/
service_dates.php
executable file
·57 lines (46 loc) · 1.23 KB
/
service_dates.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
<?php
require ("../settings.php");
$OUTPUT = display();
require ("../template.php");
function display()
{
extract ($_REQUEST);
$sql = "SELECT * FROM cubit.assets ORDER BY des ASC";
$asset_rslt = db_exec($sql) or errDie("Unable to retrieve assets.");
$service_out = "";
while ($asset_data = pg_fetch_array($asset_rslt)) {
if (!isOurs($asset_data["id"])) {
continue;
}
// Retrieve the service date
$sql = "SELECT svdate, des FROM cubit.asset_svdates
WHERE asset_id='$asset_data[id]'";
$svdate_rslt = db_exec($sql) or errDie("Unable to retrieve service date.");
list($svdate, $des) = pg_fetch_array($svdate_rslt);
$service_out .= "
<tr class='".bg_class()."'>
<td>".getSerial($asset_data["id"])."</td>
<td>$asset_data[des]</td>
<td>$svdate</td>
<td>$des</td>
</tr>";
}
if (empty($service_out)) {
$service_out = "<tr class='".bg_class()."'>
<td colspan='3'><li>No results found.</li></td>
</tr>";
}
$OUTPUT = "<center>
<h3>Plant Service Dates</h3>
<table ".TMPL_tblDflts.">
<tr>
<th>Serial</th>
<th>Description</th>
<th>Service Date</th>
<th>Service Description</th>
</tr>
$service_out
</table>
</center>";
return $OUTPUT;
}