Subversion Repositories computer_asset_manager_v1

Rev

Rev 37 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 rodolico 1
<?php 
2
   include_once( './maintenance_library.php' );
3
   include_once( '../../header.php' ); 
4
?>
5
<?xml version="1.0" encoding="utf-8"?>
6
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
7
<html xmlns="http://www.w3.org/1999/xhtml">
8
<head>
9
  <title>Daily Data - Computer Asset Management Program</title>
10
  <link rel="stylesheet" type="text/css" href="../../camp.css">
11
</head>
12
<body>
13
<?php include_once('../../menu.php'); ?>
14
<div id="content">
15
  <?php 
16
     if ( $_POST['postmaintenance'] ) {
17
        postMaintenance();
18
     }
19
     if ($_POST['endDate']) { 
20
         $values = array();
21
         $values[] = 'DATEDIFF(DATE_ADD(maintenance_performed.maintenance_date, INTERVAL schedule DAY), ' . $_POST['endDate'] . ') <= 0';
22
         $_SESSION['do_maintenance_endDate'] = $_POST['endDate'];
23
         if ($_POST['select_client']) {
24
            $values[] = 'client.client_id = ' . $_POST['select_client'];
25
            $_SESSION['do_maintenance_select_client'] = $_POST['select_client'];
26
         }
27
         if ($_POST['select_tech']) {
28
            $values['endDate'] = 'login.login_id = ' . $_POST['select_tech'];
29
            $_SESSION['do_maintenance_select_tech'] = $_POST['select_tech'];
30
         }
31
         $sql = insertValuesIntoQuery(SQL_GET_OUTSTANDING_MAINTENANCE,array( 'additionalWhere' => implode(' and ', $values)));
32
         // print '<pre>' . $sql . '</pre>';
33
         if (! $result = queryDatabaseExtended($sql) ) {
34
            print "No Maintenance Scheduled<br>";
35
         } else {
36
         $result = $result['data'];
37
   ?>
38
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
39
      <table border="1">
40
         <?php
41
            $currentSite = '';
42
            $currentDevice = '';
43
            for ( $row = 0; $row < count($result); $row++ ) {
44
               $thisRow = $result[$row];
45
               if ( $thisRow['Site'] != $currentSite) {
46
                  $currentSite = $thisRow['Site'];
47
                  print "<tr><td colspan='20' align='center'>$currentSite</td></tr>\n";
48
               }
49
               if ( $thisRow['Device Name'] != $currentDevice) {
50
                  $currentDevice = $thisRow['Device Name'];
51
                  $notes = $thisRow['Device Notes'];
52
                  // put the stuff to convert notes to correct format, &#10;&#13; &#10;&#13;
53
                  print "<tr><td colspan='20' align='left' title='$notes'>$currentDevice</td></tr>\n";
54
               }
55
               ?>
56
               <tr>
57
                  <td valign='top' width='50' align='right'>
58
                     <INPUT type='checkbox' name='performed_<?php print $thisRow['ID']; ?>'>
59
                  </td>
60
                  <td valign='top'>
61
                     <input type='text' name='datedone_<?php print $thisRow['ID']; ?>' size="9" value="<?php print date('Ymd'); ?>">
62
                  </td>
63
                  <td>
64
                     <textarea name="notes_<?php print $thisRow['ID']; ?>" cols="20" rows="1"></textarea>
65
                  </td>
66
                  <td valign='top' title="<?php print htmlentities($thisRow['Task Notes']); ?>">
67
                     <?php print $thisRow['Task']; ?>
68
                  </td>
69
                  <td valign='top'>
70
                     <?php print $thisRow['Date Due'] . ' (' . $thisRow['Due'] . ' days)'; ?>
71
                  </td>
72
                  <td valign='top'>
73
                     <select name="technician_<?php print $thisRow['ID']; ?>">
74
                     <?php print queryToSelect('select login_id,email from login order by email', "select " . $_SESSION['login_id'] ); ?>
75
                     </select>
76
                  </td>
77
               </tr>
78
         <?php
79
            }
80
         ?>   
81
         <tr>
82
            <td colspan="20" align="center">
83
               <input type="submit" name="postmaintenance" value="Post Maintenance" />
84
            </td>
85
         </tr>
86
      </table>
87
      </form>
88
  <?php 
89
        } // if results
90
     } //if we have a valid query ?>
91
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
92
    <table>
93
       <tr>
94
          <td>
95
             Ending Date (yyyymmdd)
96
          </td>
97
          <td>
98
             <input type="text" name="endDate" value="<?php print $_SESSION['do_maintenance_endDate'] ? $_SESSION['do_maintenance_endDate'] : date('Ymd', strtotime('+1 week')); ?>">
99
          </td>
100
       </tr>
101
       <tr>
102
          <td>
103
             Client
104
          </td>
105
          <td>
106
             <select name='select_client' >
107
                <option value='0'>All</option>
108
                <?php print queryToSelect('
109
                     select distinct client.client_id,client.name 
110
                     from client join site on site.client_id = site.client_id 
111
                        join device on device.site_id = site.site_id 
112
                        join maintenance_schedule on device.device_id = maintenance_schedule.device_id
113
                     where maintenance_schedule.removed_date is null 
114
                           and device.removed_date is null 
115
                           and site.removed_date is null 
116
                           and client.removed_date is null
117
                ', $_SESSION['do_maintenance_select_client'] ); ?>
118
             </select>
119
          </td>
120
       </tr>
121
       <tr>
122
          <td>
123
             Technician
124
          </td>
125
          <td>
126
             <select name='select_tech'>
127
                <option value='0'>All</option>
128
                   <?php 
129
                      print queryToSelect('select login_id,email from login order by email', $_SESSION['do_maintenance_select_tech'] ); 
130
                   ?>
131
             </select>
132
          </td>
133
       </tr>
134
       <tr>
135
          <td colspan='2' align="center">
136
             <input type="submit" name="showmaintenance" value="Show Maintenance" />
137
          </td>
138
       </tr>
139
    </table>
140
 
141
  </form>
142
</div>
143
 
144
</body>
145
</html>
146