Subversion Repositories computer_asset_manager_v1

Rev

Rev 38 | Rev 87 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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