Subversion Repositories computer_asset_manager_v1

Rev

Rev 87 | Rev 91 | 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();
87 rodolico 26
         $values[] = $_SESSION['where_clause'];
1 rodolico 27
         $values[] = 'DATEDIFF(DATE_ADD(maintenance_performed.maintenance_date, INTERVAL schedule DAY), ' . $_POST['endDate'] . ') <= 0';
28
         $_SESSION['do_maintenance_endDate'] = $_POST['endDate'];
29
         if ($_POST['select_client']) {
88 rodolico 30
            $values[] = 'client_id = ' . $_POST['select_client'];
1 rodolico 31
            $_SESSION['do_maintenance_select_client'] = $_POST['select_client'];
32
         }
33
         if ($_POST['select_tech']) {
34
            $values['endDate'] = 'login.login_id = ' . $_POST['select_tech'];
35
            $_SESSION['do_maintenance_select_tech'] = $_POST['select_tech'];
36
         }
37
         $sql = insertValuesIntoQuery(SQL_GET_OUTSTANDING_MAINTENANCE,array( 'additionalWhere' => implode(' and ', $values)));
38
         // print '<pre>' . $sql . '</pre>';
39
         if (! $result = queryDatabaseExtended($sql) ) {
40
            print "No Maintenance Scheduled<br>";
41
         } else {
42
         $result = $result['data'];
43
   ?>
44
      <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
45
      <table border="1">
46
         <?php
47
            $currentSite = '';
48
            $currentDevice = '';
49
            for ( $row = 0; $row < count($result); $row++ ) {
50
               $thisRow = $result[$row];
51
               if ( $thisRow['Site'] != $currentSite) {
52
                  $currentSite = $thisRow['Site'];
53
                  print "<tr><td colspan='20' align='center'>$currentSite</td></tr>\n";
54
               }
55
               if ( $thisRow['Device Name'] != $currentDevice) {
56
                  $currentDevice = $thisRow['Device Name'];
37 rodolico 57
                  if ( $thisRow['Restrictions'] ) {
58
                     $currentDevice .= '<span class="restrictions"> - ' . $thisRow['Restrictions'] . '</span>';
59
                  }
1 rodolico 60
                  $notes = $thisRow['Device Notes'];
38 rodolico 61
                  $title = $notes;
62
                  $xenRelationships = getDOMUDOM0( $thisRow['Device ID'] );
63
                  if ( $xenRelationships ) {
64
                     if ( $xenRelationships['id'] ) { // a DOMU
65
                        $title .= "<br />\n--DOMU on " . $xenRelationships['name'];
66
                     } else { // a DOM0
67
                        $title .= "<br />\n++DOM0 containing following virtuals";
68
                        foreach ( $xenRelationships as $domu ) {
69
                           $title .= "<br />\n&nbsp;&nbsp;&nbsp;&nbsp;" . $domu['name'];
70
                        }
71
                     } // if..else
72
                  } // if $xenRelationships
73
                  $title = removeBlankLines(cleanLineReturn( $title ));
74
 
1 rodolico 75
                  // put the stuff to convert notes to correct format, &#10;&#13; &#10;&#13;
38 rodolico 76
                  print "<tr><td colspan='20' align='left' title='$title'>$currentDevice</td></tr>\n";
1 rodolico 77
               }
78
               ?>
79
               <tr>
80
                  <td valign='top' width='50' align='right'>
81
                     <INPUT type='checkbox' name='performed_<?php print $thisRow['ID']; ?>'>
82
                  </td>
83
                  <td valign='top'>
84
                     <input type='text' name='datedone_<?php print $thisRow['ID']; ?>' size="9" value="<?php print date('Ymd'); ?>">
85
                  </td>
86
                  <td>
87
                     <textarea name="notes_<?php print $thisRow['ID']; ?>" cols="20" rows="1"></textarea>
88
                  </td>
89
                  <td valign='top' title="<?php print htmlentities($thisRow['Task Notes']); ?>">
90
                     <?php print $thisRow['Task']; ?>
91
                  </td>
92
                  <td valign='top'>
93
                     <?php print $thisRow['Date Due'] . ' (' . $thisRow['Due'] . ' days)'; ?>
94
                  </td>
95
                  <td valign='top'>
96
                     <select name="technician_<?php print $thisRow['ID']; ?>">
85 rodolico 97
                     <?php print queryToSelect(getTechs(), "select " . $_SESSION['login_id'] ); ?>
1 rodolico 98
                     </select>
99
                  </td>
100
               </tr>
101
         <?php
102
            }
103
         ?>   
104
         <tr>
105
            <td colspan="20" align="center">
106
               <input type="submit" name="postmaintenance" value="Post Maintenance" />
107
            </td>
108
         </tr>
109
      </table>
110
      </form>
111
  <?php 
112
        } // if results
113
     } //if we have a valid query ?>
114
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
115
    <table>
116
       <tr>
117
          <td>
118
             Ending Date (yyyymmdd)
119
          </td>
120
          <td>
121
             <input type="text" name="endDate" value="<?php print $_SESSION['do_maintenance_endDate'] ? $_SESSION['do_maintenance_endDate'] : date('Ymd', strtotime('+1 week')); ?>">
122
          </td>
123
       </tr>
124
       <tr>
125
          <td>
126
             Client
127
          </td>
128
          <td>
129
             <select name='select_client' >
130
                <option value='0'>All</option>
85 rodolico 131
                <?php print queryToSelect( getClients(), $_SESSION['do_maintenance_select_client'] ); ?>
1 rodolico 132
             </select>
133
          </td>
134
       </tr>
135
       <tr>
136
          <td>
137
             Technician
138
          </td>
139
          <td>
140
             <select name='select_tech'>
141
                <option value='0'>All</option>
142
                   <?php 
85 rodolico 143
                      print queryToSelect(getTechs(), $_SESSION['do_maintenance_select_tech'] ); 
1 rodolico 144
                   ?>
145
             </select>
146
          </td>
147
       </tr>
148
       <tr>
149
          <td colspan='2' align="center">
150
             <input type="submit" name="showmaintenance" value="Show Maintenance" />
151
          </td>
152
       </tr>
153
    </table>
154
 
155
  </form>
156
</div>
157
 
158
</body>
159
</html>
160