Blame | Last modification | View Log | Download | RSS feed
<?php
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">
</head>
<body>
<?php include_once('../../menu.php'); ?>
<div id="content">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>
Date Range (yyyymmdd)
</td>
<td>
<input type="text" name="startDate" size='8' value=""> -
<input type="text" name="endDate" size='8' value="<?php print date('Ymd'); ?>">
</td>
</tr>
<tr>
<td>
Device
</td>
<td>
<select name='select_device' >
<option value='0'>All</option>
<?php print queryToSelect('
select distinct device.device_id,device.name
from maintenance_schedule join device on maintenance_schedule.device_id = device.device_id
where device.removed_date is null
order by device.name
' ); ?>
</select>
</td>
</tr>
<tr>
<td>
Client
</td>
<td>
<select name='select_client' >
<option value='0'>All</option>
<?php print queryToSelect('
select distinct client.client_id,client.name
from client join site on site.client_id = site.client_id
join device on device.site_id = site.site_id
join maintenance_schedule on device.device_id = maintenance_schedule.device_id
where maintenance_schedule.removed_date is null
and device.removed_date is null
and site.removed_date is null
and client.removed_date is null
' ); ?>
</select>
</td>
</tr>
<tr>
<td>
Technician
</td>
<td>
<select name='select_tech'>
<option value='0'>All</option>
<?php print queryToSelect('select login_id,email from login order by email' ); ?>
</select>
</td>
</tr>
<tr>
<td colspan='2' align="center">
<input type="submit" name="showmaintenance" value="Show Report" />
</td>
</tr>
</table>
</form>
<?php
if ( $_POST['showmaintenance'] ) {
$whereClause = array();
if ($_POST['select_client']) {
$whereClause[] = 'client.client_id = ' . $_POST['select_client'];
}
if ($_POST['startDate']) {
$whereClause[] = 'maintenance_performed.maintenance_date >= ' . $_POST['startDate'];
}
if ($_POST['endDate']) {
$whereClause[] = 'maintenance_performed.maintenance_date <= ' . $_POST['endDate'];
}
if ($_POST['select_tech']) {
$whereClause[] = 'login.login_id = ' . $_POST['select_tech'];
}
if ($_POST['select_device']) {
$whereClause[] = 'device.device_id = ' . $_POST['select_device'];
}
$sql = insertValuesIntoQuery(SQL_MAINTENANCE_REPORT,
array( 'whereClause' => ' where ' . implode(' and ', $whereClause),
'orderBy' => ' order by ' . implode( ',', array('client.name',
'device.name',
'maintenance_performed.maintenance_date',
'maintenance_task.description'
)
)
)
);
print queryToTable( $sql );
}
?>
</div>
</body>
</html>