9 |
9 |
$passage = $_REQUEST["passage"];
|
10 |
10 |
$container = $_REQUEST["container"];
|
11 |
11 |
$rack = $_REQUEST["rack"];
|
|
12 |
$box = $_REQUEST["box"];
|
12 |
13 |
if ($_REQUEST["action"] == "update_storage") {
|
13 |
14 |
$where_clause = "";
|
14 |
15 |
$try_to_update = FALSE;
|
15 |
16 |
foreach ($_REQUEST as $key => $value) {
|
16 |
|
if ($value == "box_field") {
|
|
17 |
if (preg_match("/fieldy_fieldx/i", $key)) {
|
17 |
18 |
$try_to_update = TRUE;
|
18 |
19 |
$tmp_exp = explode("_", $key);
|
19 |
|
$tmp_box = $tmp_exp[2];
|
20 |
|
$tmp_field = $tmp_exp[3];
|
21 |
|
$where_clause .= "(container='$container' AND rack='$rack' AND box='$tmp_box' AND field='$tmp_field') OR ";
|
|
20 |
$tmp_field_y = $tmp_exp[2];
|
|
21 |
$tmp_field_x = $tmp_exp[3];
|
|
22 |
$where_clause .= "(container='$container' AND rack='$rack' AND box='$box' AND field_y='$tmp_field_y' AND field_x='$tmp_field_x') OR ";
|
22 |
23 |
// $output .= "<p>$tmp_box $tmp_field***********</p>";
|
23 |
24 |
}
|
24 |
25 |
}
|
25 |
26 |
$where_clause .= "0";
|
26 |
|
$qry = "SELECT * FROM cl_storage WHERE $where_clause";
|
27 |
|
// echo "<br>" . $qry . "<br>";
|
28 |
|
$result = mysql_query($qry, $connexion);
|
29 |
|
$error = FALSE;
|
30 |
|
while($tmp_passage = mysql_fetch_object($result)) {
|
31 |
|
if (isset($tmp_passage->cl_passages)) {
|
32 |
|
$error = TRUE;
|
33 |
|
echo "<H4 style='background-color: red;'><b>ERROR!</b> $tmp_passage->container $tmp_passage->rack $tmp_passage->box $tmp_passage->field is not empty.</H4>";
|
34 |
|
}
|
35 |
|
}
|
36 |
|
if ($try_to_update & $session->mode == "view") {
|
37 |
|
echo "<H4 style='background-color: red;'><b>ERROR!</b> You can't update Liquid N2 storage in view mode.</H4>";
|
38 |
|
}
|
39 |
|
if (!$error & $session->mode != "view") {
|
40 |
|
$qry = "UPDATE cl_storage SET cl_passages='$passage' WHERE $where_clause";
|
|
27 |
if ($passage == "drop") {
|
|
28 |
$qry = "UPDATE cl_storage SET cl_passages=NULL WHERE $where_clause";
|
|
29 |
$result = mysql_query($qry, $connexion);
|
|
30 |
} else {
|
|
31 |
$qry = "SELECT * FROM cl_storage WHERE $where_clause";
|
|
32 |
// echo "<br>" . $qry . "<br>";
|
41 |
33 |
$result = mysql_query($qry, $connexion);
|
|
34 |
$error = FALSE;
|
|
35 |
while($tmp_passage = mysql_fetch_object($result)) {
|
|
36 |
if (isset($tmp_passage->cl_passages)) {
|
|
37 |
$error = TRUE;
|
|
38 |
echo "<H4 style='background-color: red;'><b>ERROR!</b> $tmp_passage->container $tmp_passage->rack $tmp_passage->box $tmp_passage->field_y $tmp_passage->field_x is not empty.</H4>";
|
|
39 |
}
|
|
40 |
}
|
|
41 |
if ($try_to_update & $session->mode == "view") {
|
|
42 |
echo "<H4 style='background-color: red;'><b>ERROR!</b> You can't update Liquid N2 storage in view mode.</H4>";
|
|
43 |
}
|
|
44 |
if (!$error & $session->mode != "view") {
|
|
45 |
$qry = "UPDATE cl_storage SET cl_passages='$passage' WHERE $where_clause";
|
|
46 |
$result = mysql_query($qry, $connexion);
|
|
47 |
}
|
42 |
48 |
}
|
43 |
49 |
}
|
44 |
50 |
}
|
... | ... | |
68 |
74 |
$passage == $tmp_passage->ID ? $selected = "selected" : $selected = "";
|
69 |
75 |
$output .= "<option value='$tmp_passage->ID' $selected>$tmp_passage->name $tmp_passage->passage $tmp_passage->date_of_freezing</option>";
|
70 |
76 |
}
|
|
77 |
$output .= "<option value='drop'>drop</option>";
|
71 |
78 |
$output .= "</select><br>";
|
72 |
79 |
|
73 |
|
$output .= "In which container/rack?<br>";
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
$output .= "In which container/rack/box?<br>";
|
|
84 |
|
|
85 |
|
|
86 |
|
|
87 |
|
74 |
88 |
$output .= "Container: <select name='container' >";
|
75 |
89 |
$qry = "SELECT DISTINCT container FROM cl_storage";
|
76 |
90 |
$result = mysql_query($qry, $connexion);
|
... | ... | |
83 |
97 |
}
|
84 |
98 |
$output .= "</select><br>";
|
85 |
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
103 |
|
86 |
104 |
$output .= "Rack: <select name='rack' >";
|
87 |
105 |
$qry = "SELECT DISTINCT rack FROM cl_storage WHERE container='$container'";
|
88 |
106 |
$result = mysql_query($qry, $connexion);
|
... | ... | |
94 |
112 |
$output .= "<option value='$storage->rack' $selected>$storage->rack</option>";
|
95 |
113 |
}
|
96 |
114 |
$output .= "</select><br>";
|
|
115 |
|
|
116 |
|
97 |
117 |
|
98 |
118 |
|
99 |
|
$qry = "SELECT * FROM cl_storage, cl_passages WHERE container='$container' AND rack='$rack' AND cl_storage.cl_passages=cl_passages.ID";
|
|
119 |
$output .= "Box: <select name='box' >";
|
|
120 |
$qry = "SELECT DISTINCT box FROM cl_storage WHERE container='$container' AND rack='$rack'";
|
|
121 |
$result = mysql_query($qry, $connexion);
|
|
122 |
while($storage = mysql_fetch_object($result)) {
|
|
123 |
if (!isset($box)) {
|
|
124 |
$box = $storage->box;
|
|
125 |
}
|
|
126 |
$rack == $storage->box ? $selected = "selected" : $selected = "";
|
|
127 |
$output .= "<option value='$storage->box' $selected>$storage->box</option>";
|
|
128 |
}
|
|
129 |
$output .= "</select><br>";
|
|
130 |
|
|
131 |
$qry = "SELECT * FROM cl_storage, cl_passages WHERE container='$container' AND rack='$rack' AND box='$box' AND cl_storage.cl_passages=cl_passages.ID";
|
100 |
132 |
$result = mysql_query($qry, $connexion);
|
101 |
133 |
$content = array();
|
102 |
134 |
$content_index = array();
|
103 |
135 |
while($joint_passage = mysql_fetch_object($result)) {
|
104 |
|
$key = $joint_passage->container . $joint_passage->rack . $joint_passage->box . $joint_passage->field;
|
|
136 |
$key = $joint_passage->container . $joint_passage->rack . $joint_passage->box . $joint_passage->field_y . $joint_passage->field_x;;
|
105 |
137 |
$value = $joint_passage->name . "<br>" . $joint_passage->passage . "<br>" . $joint_passage->date_of_freezing;
|
106 |
138 |
$content[$key] = $value;
|
107 |
139 |
$content_index[$key] = $joint_passage->cl_passages ;
|
108 |
140 |
}
|
109 |
141 |
|
110 |
142 |
|
111 |
|
$rack_map = array(
|
|
143 |
$box_map = array(
|
112 |
144 |
"A" => range(1,2),
|
113 |
145 |
"B" => range(1,3),
|
114 |
146 |
"C" => range(1,4),
|
... | ... | |
124 |
156 |
|
125 |
157 |
$output .= "In which boxes/fields?<br>";
|
126 |
158 |
$output .= "<table>";
|
127 |
|
foreach ($rack_map as $box => $fields) {
|
|
159 |
foreach ($box_map as $field_y => $fields) {
|
128 |
160 |
$output .= "<tr><td >";
|
129 |
|
$output .= $box;
|
|
161 |
$output .= $field_y;
|
130 |
162 |
$output .= "</td>";
|
131 |
163 |
$output .= "<td>";
|
132 |
164 |
$output .= "<center><table ><tr>";
|
133 |
|
foreach($fields as $field) {
|
134 |
|
$key = $container . $rack . $box . $field;
|
|
165 |
foreach($fields as $field_x) {
|
|
166 |
$key = $container . $rack . $box . $field_y . $field_x;
|
135 |
167 |
isset($content[$key]) ? $color="LightGray" : $color="LightGreen";
|
136 |
168 |
@$content_index[$key] == $passage ? $color="PowderBlue": $color=$color;
|
137 |
169 |
$output .= "<td style='background-color: $color; width:80; border: 1px solid black;''>";
|
138 |
170 |
if ($session->mode != "view") {
|
139 |
|
$output .= "<input type='checkbox' name='box_field_$box" . "_$field' value='box_field'>$field</input><br>";
|
|
171 |
$output .= "<input type='checkbox' name='fieldy_fieldx_" . $field_y . "_" . $field_x . " value='on'>$field_x</input><br>";
|
140 |
172 |
} else {
|
141 |
|
$output .= "<b>$field</b><br>";
|
|
173 |
$output .= "<b>$field_x</b><br>";
|
142 |
174 |
}
|
143 |
175 |
$output .= isset($content[$key]) ? $content[$key] : "empty<br><br><br>";
|
144 |
176 |
$output .= "</td>";
|