-
Notifications
You must be signed in to change notification settings - Fork 3
/
dispatch_report.php
executable file
·83 lines (71 loc) · 1.9 KB
/
dispatch_report.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
<?php
require ("../settings.php");
$OUTPUT = display();
require ("../template.php");
function display()
{
extract ($_REQUEST);
$fields = array();
$fields["from_year"] = date("Y");
$fields["from_month"] = date("m");
$fields["from_day"] = "01";
$fields["to_year"] = date("Y");
$fields["to_month"] = date("m");
$fields["to_day"] = date("d");
extract ($fields, EXTR_SKIP);
$from_date = "$from_year-$from_month-$from_day";
$to_date = "$to_year-$to_month-$to_day";
$sql = "
SELECT ordno, cordno, total FROM cubit.dispatch_scans
LEFT JOIN cubit.sorders ON dispatch_scans.sordid=sorders.sordid
WHERE timestamp BETWEEN '$from_date 0:00:00' AND '$to_date 23:59:59'
AND duplicate='0'";
$dispatch_rslt = db_exec($sql) or errDie("Unable to retrieve scans.");
$report_out = "";
while ($dispatch_data = pg_fetch_array($dispatch_rslt)) {
$report_out .= "
<tr class='".bg_class()."'>
<td>$dispatch_data[ordno]</td>
<td> </td>
<td>$dispatch_data[cordno]</td>
<td>$dispatch_data[total]</td>
<td> </td>
<td> </td>
<td> </td>
</tr>";
}
if (empty($report_out)) {
$report_out .= "
<tr class='".bg_class()."'>
<td colspan='8'><li>No results found</li></td>
</tr>";
}
$OUTPUT = "
<h3>Dispatch Report</h3>
<form method='post' action='".SELF."'>
<table ".TMPL_tblDflts.">
<tr>
<th colspan='4'>Date Range</th>
</tr>
<tr class='".bg_class()."'>
<td>".mkDateSelect("from", $from_year, $from_month, $from_day)."</td>
<td> <b>To</b> </td>
<td>".mkDateSelect("to", $to_year, $to_month, $to_day)."</td>
<td><input type='submit' value='Select' /></td>
</tr>
</table>
</form>
<table ".TMPL_tblDflts.">
<tr>
<th>Order No.</th>
<th>Invoice No.</th>
<th>Customer Order No.</th>
<th>Amount</th>
<th>Date Dispatch</th>
<th>How Dispatched</th>
<th>Other Dispatch Information</th>
</tr>
$report_out
</table>";
return $OUTPUT;
}