Subversion Repositories computer_asset_manager_v1

Rev

Details | 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
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
16
    <table>
17
       <tr>
18
          <td>
19
             Date Range (yyyymmdd)
20
          </td>
21
          <td>
22
             <input type="text" name="startDate" size='8' value=""> -
23
             <input type="text" name="endDate" size='8' value="<?php print date('Ymd'); ?>">
24
          </td>
25
       </tr>
26
       <tr>
27
          <td>
28
             Device
29
          </td>
30
          <td>
31
             <select name='select_device' >
32
                <option value='0'>All</option>
33
                <?php print queryToSelect('
34
                     select distinct device.device_id,device.name 
35
                     from maintenance_schedule join device on maintenance_schedule.device_id = device.device_id 
36
                     where device.removed_date is null
37
                     order by device.name
38
                                     ' ); ?>
39
             </select>
40
          </td>
41
       </tr>
42
       <tr>
43
          <td>
44
             Client
45
          </td>
46
          <td>
47
             <select name='select_client' >
48
                <option value='0'>All</option>
49
                <?php print queryToSelect('
50
                     select distinct client.client_id,client.name 
51
                     from client join site on site.client_id = site.client_id 
52
                        join device on device.site_id = site.site_id 
53
                        join maintenance_schedule on device.device_id = maintenance_schedule.device_id
54
                     where maintenance_schedule.removed_date is null 
55
                           and device.removed_date is null 
56
                           and site.removed_date is null 
57
                           and client.removed_date is null
58
                ' ); ?>
59
             </select>
60
          </td>
61
       </tr>
62
       <tr>
63
          <td>
64
             Technician
65
          </td>
66
          <td>
67
             <select name='select_tech'>
68
                <option value='0'>All</option>
69
                   <?php print queryToSelect('select login_id,email from login order by email' ); ?>
70
             </select>
71
          </td>
72
       </tr>
73
 
74
       <tr>
75
          <td colspan='2' align="center">
76
             <input type="submit" name="showmaintenance" value="Show Report" />
77
          </td>
78
       </tr>
79
    </table>
80
 
81
  </form>
82
  <?php
83
     if ( $_POST['showmaintenance'] ) {
84
         $whereClause = array();
85
         if ($_POST['select_client']) {
86
            $whereClause[] = 'client.client_id = ' . $_POST['select_client'];
87
         }
88
         if ($_POST['startDate']) {
89
            $whereClause[] = 'maintenance_performed.maintenance_date >= ' . $_POST['startDate'];
90
         }
91
         if ($_POST['endDate']) {
92
            $whereClause[] = 'maintenance_performed.maintenance_date <= ' . $_POST['endDate'];
93
         }
94
         if ($_POST['select_tech']) {
95
            $whereClause[] = 'login.login_id = ' . $_POST['select_tech'];
96
         }
97
         if ($_POST['select_device']) {
98
            $whereClause[] = 'device.device_id = ' . $_POST['select_device'];
99
         }
100
         $sql = insertValuesIntoQuery(SQL_MAINTENANCE_REPORT,
101
                                       array( 'whereClause' => ' where ' . implode(' and ', $whereClause),
102
                                             'orderBy' => ' order by ' . implode( ',', array('client.name', 
103
                                                                                             'device.name', 
104
                                                                                             'maintenance_performed.maintenance_date', 
105
                                                                                             'maintenance_task.description' 
106
                                                                                             ) 
107
                                                                                 )
108
                                             )
109
                                       );
110
         print queryToTable( $sql );
111
     }
112
  ?>   
113
</div>
114
 
115
</body>
116
</html>
117