forked from timschofield/webERP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaintenanceUserSchedule.php
84 lines (66 loc) · 2.45 KB
/
MaintenanceUserSchedule.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
<?php
include('includes/session.php');
$Title = _('My Maintenance Jobs');
$Title = _('Fixed Assets Maintenance Schedule');
$ViewTopic = 'FixedAssets';
$BookMark = 'AssetMaintenance';
include('includes/header.php');
echo '<p class="page_title_text"><img src="'.$RootPath.'/css/'.$Theme.'/images/group_add.png" title="' . _('Search') . '" alt="" />' . ' ' . $Title . '</p><br />';
if (isset($_GET['Complete'])) {
$Result = DB_query("UPDATE fixedassettasks
SET lastcompleted = CURRENT_DATE
WHERE taskid='" . $_GET['TaskID'] . "'");
}
$SQL="SELECT taskid,
fixedassettasks.assetid,
description,
taskdescription,
frequencydays,
lastcompleted,
ADDDATE(lastcompleted,frequencydays) AS duedate,
userresponsible,
realname,
manager
FROM fixedassettasks
INNER JOIN fixedassets
ON fixedassettasks.assetid=fixedassets.assetid
INNER JOIN www_users
ON fixedassettasks.userresponsible=www_users.userid
WHERE userresponsible='" . $_SESSION['UserID'] . "'
OR manager = '" . $_SESSION['UserID'] . "'
ORDER BY ADDDATE(lastcompleted,frequencydays) DESC";
$ErrMsg = _('The maintenance schedule cannot be retrieved because');
$Result=DB_query($SQL,$ErrMsg);
echo '<table class="selection">
<tr>
<th>' . _('Task ID') . '</th>
<th>' . _('Asset') . '</th>
<th>' . _('Description') . '</th>
<th>' . _('Last Completed') . '</th>
<th>' . _('Due By') . '</th>
<th>' . _('Person') . '</th>
<th>' . _('Manager') . '</th>
<th>' . _('Now Complete') . '</th>
</tr>';
while ($MyRow=DB_fetch_array($Result)) {
if ($MyRow['manager']!=''){
$ManagerResult = DB_query("SELECT realname FROM www_users WHERE userid='" . $MyRow['manager'] . "'");
$ManagerRow = DB_fetch_array($ManagerResult);
$ManagerName = $ManagerRow['realname'];
} else {
$ManagerName = _('No Manager Set');
}
echo '<tr>
<td>' . $MyRow['taskid'] . '</td>
<td>' . $MyRow['description'] . '</td>
<td>' . $MyRow['taskdescription'] . '</td>
<td>' . ConvertSQLDate($MyRow['lastcompleted']) . '</td>
<td>' . ConvertSQLDate($MyRow['duedate']) . '</td>
<td>' . $MyRow['realname'] . '</td>
<td>' . $ManagerName . '</td>
<td><a href="'.$RootPath.'/MaintenanceUserSchedule.php?Complete=Yes&TaskID=' . $MyRow['taskid'] .'" onclick="return confirm(\'' . _('Are you sure you wish to mark this maintenance task as completed?') . '\');">' . _('Mark Completed') . '</a></td>
</tr>';
}
echo '</table><br /><br />';
include('includes/footer.php');
?>