/
manifest_rep_detail.php
365 lines (264 loc) · 11.9 KB
/
manifest_rep_detail.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
<?php
session_start();
$l_klient=$_SESSION['l_klient'];
//echo $l_klient;
$id_user=$_SESSION['id_user'];
include 'header.php';
$serwer = "localhost";
$login = "root";
$haslo = "krasnal";
$baza = "dbs3";
$tabela = "Sub_cat";
include 'menu_header.php';
include 'header_mysql.php';
include 'functions_new_weights.php'; //ne calculation functions there
include 'functions_api.php'; //including new api
$site_id;
if(isset($_SESSION['meter']))
unset($_SESSION['meter']);
function get_weight_fully_reused($site_id)
{
$sql="SELECT SUM(weight) as suma, site_id, Barcode.date,login,Ready,town,cat FROM barcode INNER JOIN test ON Barcode.id_Barcode=test.Barcode_id_Barcode
INNER JOIN user_2 ON user_2.id_user=test.user_2_id_user
INNER JOIN Item on Barcode.Item_id_item=Item.id_item
INNER JOIN item_has_cat ON Item.Item_has_Cat_id_item_cat=item_has_cat.id_item_cat
INNER JOIN site ON site.site_id=barcode.Site_site_id
INNER JOIN Origin On Origin.Origin_id=site.Origin_origin_id
WHERE (Barcode LIKE '%DBS/%/1' OR Barcode LIKE '%DBS/%/2' OR Barcode LIKE '%UNQ/%') AND Site.site_id=$site_id";
$result=query_select($sql);
$rek=mysql_fetch_array($result);
return $rek['suma'];
}
?>
<HTML>
<HEAD>
<!--<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css">-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap -->
<link href="dist/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="layout.css " type="text/css" />
<link rel="stylesheet" href="form1.css " type="text/css" />
<!--
<link rel="stylesheet" href="layout.css " type="text/css">
<link rel="stylesheet" href="form_cat.css " type="text/css">
<link href="design.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="design.css" type="text/css" />
-->
<link rel="stylesheet" type="text/css" href="csshorizontalmenu.css" />
<!-- <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> -->
<script type="text/javascript" src="csshorizontalmenu.js" >
</script>
<script type="text/javascript" src="jquery-1.10.2.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="dist/js/bootstrap.min.js"></script>
</HEAD>
<BODY >
<table border=1 width=100% height=800 bgcolor="F8F8F8" >
<tr>
<td colspan=2 width=100% height=5% align=right>
<table border="0" cellpadding="1" cellspacing="3" bgcolor="#F8F8F8">
<?php
//F8F8F8 F0F0F0 #E0E0E0
if(empty($l_klient))
{
$log='<form action="log_pro.php" method="post">
<td>Login</td><td><input type="text" name="login"></td>
<td>Password</td><td><input type="password" name="pass"></td>
<tr>
<td></td><td></td><td></td><td><input type="submit" name="Submit" value="Log In" align="right"> </td>
</tr>
</form>';
echo $log;
}
else
echo "You are Logged In as ".$l_klient;
?>
</table>
</td></tr>
<tr bgcolor="#E0E0E0">
<td colspan=2 width=100% height=15% align=center valign=center> GRR Database System 2
</td>
</tr>
<tr>
<td colspan=2 width=100% height=25px align=right bgcolor="#E0E0E0">
<?php show_menu(); ?>
</td>
</tr>
<tr>
<td colspan=2 width=100% height=90% align=left valign=top>
<?php // <p>Welcome in the System: echo $_SESSION['name1']; </p>
//LETS ADD PROCESSING FUNCTION HERE
connect_db();
$query="SELECT * From Origin ";
//this can be twofold, both distinct inner join or every site place distinctivel from origin tabel
//INNER JOIN Site ON Origin.origin_id=Site.Origin_origin_id
$result=query_select($query);
$users=array();
$names=array();
$batch_date=array();
$i=0;
while($rek = mysql_fetch_array($result,1))
{
$i++;
$users[$i]=$rek["post_code"];
$names[$i]=$rek["town"];
$origin[$i]=$rek["origin_id"];
//$batch_date[$i]=$rek["batch_date"];
// echo $users[$i].$names[$i];
}
?>
<?php if(isset($_GET['test'])) {
echo "Item with Barcode <B>".$_GET['test']."</B> added to the System ";} ?>
<center><h4>Collection Sheet Report Management</h4></center>
</BR>
</BR>
</BR>
<div style="margin: 10px;">
<form action="manifest_rep_detail.php" method="POST" >
<p><select name="site" size="1">
<?php
for($z=0;$z<=$i;$z++)
{
echo '<option value="'.$origin[$z].'">'.$names[$z].'</option>';
}
echo '</select></span>';
?>
<label for="site" >Collection Place</label>
</p>
<p><input type="text" name="date" value="" placeholder="YYYY-MM-DD"><label for="date">Day of collection</date></p>
<input type="submit" name="Generate" value="Generate" style="
background: -webkit-gradient(linear, left top, left 25, from(#FFFFFF), color-stop(4%, #EEEEEE), to(#FFFFFF));
background: -moz-linear-gradient(top, #FFFFFF, #EEEEEE 1px, #FFFFFF 25px);
box-shadow: rgba(0,0,0, 0.1) 0px 0px 2px;
-moz-box-shadow: rgba(0,0,0, 0.01) 0px 0px 2px;
-webkit-box-shadow: rgba(0,0,0, 0.01) 0px 0px 2px;
border-collapse:collapse;
">
<input type="checkbox" name="print_out" value="yes" <?php if(isset($_POST['print_out'])) echo 'checked=""'; ?> >Only Never print out before<br>
</form>
<style>
label{
margin-left: 10px;
color: #999999;
font: normal 13px/100% Verdana, Tahoma, sans-serif;
}
</style>
</div>
<?php
if(isset($_POST['Generate']))
{
echo '<p style="margin-left: 10px;">';
echo "<BR/>";
// Searching ond output results module
if(empty($_POST['date'])AND empty($_POST['site']))
{
$select_list="SELECT town,batch_date,site_ref_number,site_id,source_id, SUM(sum_weight) as sum FROM site
INNER JOIN Origin ON site.Origin_origin_id=origin.origin_id
INNER JOIN site_has_cat ON site_has_cat.Site_site_id=site.site_id
INNER JOIN source ON source.source_id=origin.Source_source_id
GROUP BY town, batch_date,site_id ORDER BY batch_date DESC;
";
}
else if(!empty($_POST['date']))
{
$dd_s=$_POST['date'];
$select_list="SELECT DISTINCT town,batch_date,site_ref_number,site_id,source_id, SUM(sum_weight) as sum FROM site
INNER JOIN Origin ON site.Origin_origin_id=origin.origin_id
INNER JOIN site_has_cat ON site_has_cat.Site_site_id=site.site_id
INNER JOIN source ON source.source_id=origin.Source_source_id WHERE batch_date='$dd_s'
GROUP BY town, batch_date,site_id ORDER BY batch_date DESC;
";
}
else if(!empty($_POST['site']))
{
$dd_t=$_POST['site'];
$select_list="SELECT DISTINCT town,batch_date,site_ref_number,site_id,source_id, SUM(sum_weight) as sum FROM site
INNER JOIN Origin ON site.Origin_origin_id=origin.origin_id
INNER JOIN site_has_cat ON site_has_cat.Site_site_id=site.site_id
INNER JOIN source ON source.source_id=origin.Source_source_id WHERE origin_id='$dd_t'
GROUP BY town, batch_date,site_id ORDER BY batch_date DESC;
";
}
if(!empty($_POST['date'])AND !empty($_POST['site']))
{
$dd_t=$_POST['site'];
$dd_s=$_POST['date'];
$select_list="SELECT DISTINCT town,batch_date,site_ref_number,site_id,source_id, SUM(sum_weight) as sum FROM site
INNER JOIN Origin ON site.Origin_origin_id=origin.origin_id
INNER JOIN site_has_cat ON site_has_cat.Site_site_id=site.site_id
INNER JOIN source ON source.source_id=origin.Source_source_id WHERE origin_id='$dd_t' AND batch_date='$dd_s'
GROUP BY town,batch_date,site_id ORDER BY batch_date DESC;
";
}
$result_list=mysql_query($select_list)or die(mysql_error());
$num_list_row= mysql_num_rows($result_list);
for($i=0;$i<$num_list_row;$i++)
{
$rek_list=mysql_fetch_array($result_list);
//echo "<form action='manifest_rep_print.php' method='POST'";
echo "<table><tr><td>".($i+1).".</td><td>Reports for: <b>";
echo $rek_list['town'];
echo "</b></td><td>on <b>";
echo $rek_list['batch_date'];
echo "</b></td><td> specified by site number: <b>";
echo $rek_list['site_ref_number'];
echo "</b></td><td> Total weight collected: <b>";
//print(intval($rek_list['sum']));
//here in this module we come with all new weights dynamicly callculated thr new standard nonstandard modul, sum weight in sub cat ignored
//this manifest_print_detail will be used as comparison to normal raport modul, for now
$site_id=$rek_list['site_id'];
$sub_cat=0;
$site_date_collection=$rek_list['batch_date'];
echo get_site_has_cat_weight($site_id, $sub_cat);
echo "KG</b></td>";
$site_id=$rek_list['site_id'];
$col=$rek_list['sum'];
//echo "<td> Status:<b> ". $re=round(get_weight_fully_reused($site_id),0)." kgs reused</b></td>";
$factor=$re/$col;
$factor=$factor*100;
$factor=round($factor,1);
// echo "<td>Factor: ".$factor."%</td>";
echo "</tr>";
echo "<tr></tr><tr></tr><tr></BR><td colspan='4'></td><td style='font-size:11px'>";
//10 cat 1.
echo "<form action='colre_report.php' method='POST'>";
$source= str_replace("H", "", $rek_list['source_id']);
$date_r=$rek_list['batch_date'];
$site_ref_num=$rek_list['site_ref_number'];
$site_id=$rek_list['site_id'];
//echo "ssd";
echo "<input type='hidden' name='site_id' value='".$site_id."'>";
echo "<input type='hidden' name='site_ref_number' value='".$site_ref_num."'>";
echo "<input type='hidden' name='date_r' value='".$date_r."'>";
echo "<input type='hidden' name='source' value='".$source."'>";
// echo "<input type='Submit' name='ten_cat' value='Generate 10 categories Sheet'>";
// echo "<input type='Submit' name='ten_cat' value='Generate 10 categories Sheet'>";
echo "</form>";
echo "</td></tr>";
//end 10 cat here second
echo "<tr><td colspan='6'></td><td style='font-size:11px'>";
//10 cat 1.
echo "<BR/>";
echo "<form action='colre_report.php' method='POST'>";
$source= str_replace("H", "", $rek_list['source_id']);
$date_r=$rek_list['batch_date'];
$site_ref_num=$rek_list['site_ref_number'];
$site_id=$rek_list['site_id'];
//echo $site_id;
//echo "ssd";
echo "<input type='hidden' name='site_id' value='".$site_id."'>";
echo "<input type='hidden' name='site_ref_number' value='".$site_ref_num."'>";
echo "<input type='hidden' name='date_r' value='".$date_r."'>";
echo "<input type='hidden' name='source' value='".$source."'>";
// echo "<input type='Submit' name='ten_cat' value='Generate 10 categories Sheet'>";
echo "<input type='Submit' name='tv_cat' value='Check Collection'>";
echo "</form></td></tr>";
echo "</table>";
}
echo " </p>";
}
?>
</td>
</table>
</BODY>
</HTML>