Subversion Repositories computer_asset_manager_v1

Rev

Rev 1 | Rev 38 | Go to most recent revision | Details | Compare with Previous | 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'];
37 rodolico 51
                  if ( $thisRow['Restrictions'] ) {
52
                     $currentDevice .= '<span class="restrictions"> - ' . $thisRow['Restrictions'] . '</span>';
53
                  }
1 rodolico 54
                  $notes = $thisRow['Device Notes'];
55
                  // put the stuff to convert notes to correct format, &#10;&#13; &#10;&#13;
56
                  print "<tr><td colspan='20' align='left' title='$notes'>$currentDevice</td></tr>\n";
57
               }
58
               ?>
59
               <tr>
60
                  <td valign='top' width='50' align='right'>
61
                     <INPUT type='checkbox' name='performed_<?php print $thisRow['ID']; ?>'>
62
                  </td>
63
                  <td valign='top'>
64
                     <input type='text' name='datedone_<?php print $thisRow['ID']; ?>' size="9" value="<?php print date('Ymd'); ?>">
65
                  </td>
66
                  <td>
67
                     <textarea name="notes_<?php print $thisRow['ID']; ?>" cols="20" rows="1"></textarea>
68
                  </td>
69
                  <td valign='top' title="<?php print htmlentities($thisRow['Task Notes']); ?>">
70
                     <?php print $thisRow['Task']; ?>
71
                  </td>
72
                  <td valign='top'>
73
                     <?php print $thisRow['Date Due'] . ' (' . $thisRow['Due'] . ' days)'; ?>
74
                  </td>
75
                  <td valign='top'>
76
                     <select name="technician_<?php print $thisRow['ID']; ?>">
77
                     <?php print queryToSelect('select login_id,email from login order by email', "select " . $_SESSION['login_id'] ); ?>
78
                     </select>
79
                  </td>
80
               </tr>
81
         <?php
82
            }
83
         ?>   
84
         <tr>
85
            <td colspan="20" align="center">
86
               <input type="submit" name="postmaintenance" value="Post Maintenance" />
87
            </td>
88
         </tr>
89
      </table>
90
      </form>
91
  <?php 
92
        } // if results
93
     } //if we have a valid query ?>
94
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
95
    <table>
96
       <tr>
97
          <td>
98
             Ending Date (yyyymmdd)
99
          </td>
100
          <td>
101
             <input type="text" name="endDate" value="<?php print $_SESSION['do_maintenance_endDate'] ? $_SESSION['do_maintenance_endDate'] : date('Ymd', strtotime('+1 week')); ?>">
102
          </td>
103
       </tr>
104
       <tr>
105
          <td>
106
             Client
107
          </td>
108
          <td>
109
             <select name='select_client' >
110
                <option value='0'>All</option>
111
                <?php print queryToSelect('
112
                     select distinct client.client_id,client.name 
113
                     from client join site on site.client_id = site.client_id 
114
                        join device on device.site_id = site.site_id 
115
                        join maintenance_schedule on device.device_id = maintenance_schedule.device_id
116
                     where maintenance_schedule.removed_date is null 
117
                           and device.removed_date is null 
118
                           and site.removed_date is null 
119
                           and client.removed_date is null
120
                ', $_SESSION['do_maintenance_select_client'] ); ?>
121
             </select>
122
          </td>
123
       </tr>
124
       <tr>
125
          <td>
126
             Technician
127
          </td>
128
          <td>
129
             <select name='select_tech'>
130
                <option value='0'>All</option>
131
                   <?php 
132
                      print queryToSelect('select login_id,email from login order by email', $_SESSION['do_maintenance_select_tech'] ); 
133
                   ?>
134
             </select>
135
          </td>
136
       </tr>
137
       <tr>
138
          <td colspan='2' align="center">
139
             <input type="submit" name="showmaintenance" value="Show Maintenance" />
140
          </td>
141
       </tr>
142
    </table>
143
 
144
  </form>
145
</div>
146
 
147
</body>
148
</html>
149