Rev 91 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
<?php
/* Revision History:
* 20161217 RWR
* Added indicator on mouseover of system if it is a DOMU or a DOM0
* showing the relationship.
*/
include_once( './maintenance_library.php' );
include_once( '../../header.php' );
?>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Daily Data - Computer Asset Management Program</title>
<link rel="stylesheet" type="text/css" href="../../camp.css">
<script src="../../siblinghide.js"></script>
</head>
<body>
<?php include_once('../../menu.php'); ?>
<div id="content">
<?php
if ( $_POST['postmaintenance'] ) {
postMaintenance();
}
if ($_POST['endDate']) {
$values = array();
$values[] = $_SESSION['where_clause'];
$values[] = 'DATEDIFF(DATE_ADD(maintenance_performed.maintenance_date, INTERVAL schedule DAY), ' . $_POST['endDate'] . ') <= 0';
$_SESSION['do_maintenance_endDate'] = $_POST['endDate'];
if ($_POST['select_client']) {
$values[] = 'client_id = ' . $_POST['select_client'];
$_SESSION['do_maintenance_select_client'] = $_POST['select_client'];
}
if ($_POST['select_tech']) {
$values['endDate'] = 'login.login_id = ' . $_POST['select_tech'];
$_SESSION['do_maintenance_select_tech'] = $_POST['select_tech'];
}
$sql = insertValuesIntoQuery(SQL_GET_OUTSTANDING_MAINTENANCE,array( 'additionalWhere' => implode(' and ', $values)));
// print '<pre>' . $sql . '</pre>';
if (! $result = queryDatabaseExtended($sql) ) {
print "No Maintenance Scheduled<br>";
} else {
$result = $result['data'];
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table border="1">
<?php
$currentSite = '';
$currentDevice = '';
for ( $row = 0; $row < count($result); $row++ ) {
$thisRow = $result[$row];
if ( $thisRow['Site'] != $currentSite) {
$currentSite = $thisRow['Site'];
print "<tr><td colspan='20' align='center'>$currentSite</td></tr>\n";
}
if ( $thisRow['Device Name'] != $currentDevice) {
$currentDevice = $thisRow['Device Name'];
if ( $thisRow['Restrictions'] ) {
$restrictions = $thisRow['Restrictions'];
//$currentDevice .= '<span class="restrictions"> - ' . $thisRow['Restrictions'] . '</span>';
} else {
$restrictions = '';
}
$notes = $thisRow['Device Notes'];
$title = $notes;
$xenRelationships = getDOMUDOM0( $thisRow['Device ID'] );
if ( $xenRelationships ) {
if ( $xenRelationships['id'] ) { // a DOMU
$title .= "<br />\n--DOMU on " . $xenRelationships['name'];
} else { // a DOM0
$title .= "<br />\n++DOM0 containing following virtuals";
foreach ( $xenRelationships as $domu ) {
$title .= "<br />\n " . $domu['name'];
}
} // if..else
} // if $xenRelationships
#$title = removeBlankLines(cleanLineReturn( $title ));
// put the stuff to convert notes to correct format,
print "<tr><td colspan='20'><table width='100%' border='1' class='sibling-hide header-table'><tr><td align='left' width='33%' class='activator'>$currentDevice</td><td width='33%' class='hidden'>$title</td><td width='33%' class='hidden'>$restrictions</td></tr></table></td></tr>\n";
}
?>
<tr>
<td valign='top' width='50' align='right'>
<INPUT type='checkbox' name='performed_<?php print $thisRow['ID']; ?>'>
</td>
<td valign='top'>
<input type='text' name='datedone_<?php print $thisRow['ID']; ?>' size="9" value="<?php print date('Ymd'); ?>">
</td>
<td>
<textarea name="notes_<?php print $thisRow['ID']; ?>" cols="20" rows="1"></textarea>
</td>
<td valign='top' title="<?php print htmlentities($thisRow['Task Notes']); ?>">
<?php print $thisRow['Task']; ?>
</td>
<td valign='top' <?php print $thisRow['Due'] < 0 ? ( $thisRow['Due'] < -30 ? "class='alert'" : "class='past-due'" ) : ''; ?>>
<?php print $thisRow['Date Due'] . ' (' . $thisRow['Due'] . ' days)'; ?>
</td>
<td valign='top'>
<select name="technician_<?php print $thisRow['ID']; ?>">
<?php print queryToSelect(getTechs(), "select " . $_SESSION['login_id'] ); ?>
</select>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="20" align="center">
<input type="submit" name="postmaintenance" value="Post Maintenance" />
</td>
</tr>
</table>
</form>
<?php
} // if results
} //if we have a valid query ?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>
Ending Date (yyyymmdd)
</td>
<td>
<input type="text" name="endDate" value="<?php print $_SESSION['do_maintenance_endDate'] ? $_SESSION['do_maintenance_endDate'] : date('Ymd', strtotime('+1 week')); ?>">
</td>
</tr>
<tr>
<td>
Client
</td>
<td>
<select name='select_client' >
<option value='0'>All</option>
<?php print queryToSelect( getClients(), $_SESSION['do_maintenance_select_client'] ); ?>
</select>
</td>
</tr>
<tr>
<td>
Technician
</td>
<td>
<select name='select_tech'>
<option value='0'>All</option>
<?php
print queryToSelect(getTechs(), $_SESSION['do_maintenance_select_tech'] );
?>
</select>
</td>
</tr>
<tr>
<td colspan='2' align="center">
<input type="submit" name="showmaintenance" value="Show Maintenance" />
</td>
</tr>
</table>
</form>
</div>
</body>
</html>