-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbyDates.php
More file actions
240 lines (231 loc) · 6.72 KB
/
Copy pathbyDates.php
File metadata and controls
240 lines (231 loc) · 6.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<?php
include_once 'header.php';
if($_SESSION['id'] == 'ok'){
?>
<?php
if ($_POST['startDate'] && $_POST['endDate']) {
$startDate = ($_POST['startDate']);
$endDate = ($_POST['endDate']);
$query = "SELECT *, DATE_FORMAT(created, '%m/%d/%y') AS created FROM it_data WHERE created BETWEEN '".$startDate."' AND '".$endDate."' ORDER BY id DESC LIMIT 500";
$result = mysql_query($query);
$count = mysql_num_rows($result);
if ($count > 0){ // If it ran OK, display the records.
?>
<meta http-equiv="refresh" content="300" />
<script>
$(function()
{
$('#yahoo a').tooltip({
track: true,
delay: 0,
showURL: false,
showBody: " - ",
fade: 250
});
});
</script>
<style>
#tooltip {
position: absolute;
z-index: 3000;
border: 1px solid #111;
background-color: #eee;
padding: 5px;
opacity: 0.85;
}
#tooltip h3, #tooltip div { margin: 0; }
</style>
<div data-role="page" class="type-interior">
<div data-role="header" data-theme="a">
<h1>WarriorDesk</h1>
<a href="#" data-icon="home" data-iconpos="notext" data-direction="reverse" onclick="javascript:location.href='index.php'">Home</a>
</div><!-- /header -->
<br />
<div data-role="content" class="mybg">
<b>Total Work Orders: <?php if ($count > 499) {?> ><?php print $count; } else { print $count; }?><br /></b>
<br />
<?php
if ($rs = mysql_fetch_array($result, MYSQL_ASSOC))
{
?>
<table class="footable" data-filter="#filter">
<thead>
<tr>
<th data-class="expand">
Priority
</th>
<th data-hide="phone, tablet" data-type="numeric">
Date
</th>
<th>
From
</th>
<th data-hide="phone, tablet">
Building
</th>
<th>
Problem
</th>
<th data-hide="phone">
Technician
</th>
<th data-hide="phone, tablet">
Status
</th>
<th data-hide="phone, tablet" data-sort-ignore="true">
Edit
</th>
</tr>
</thead>
<tbody>
<?php
do
{
$id = $rs['id'];
$created = $rs['created'];
$createdNumeric = strtotime($created);
$requestedbyL = $rs['requestedby'];
if (strlen($requestedbyL) > 10)
{
$requestedby = substr($requestedbyL, 0, 10) . "...";
} else {
$requestedby = $requestedbyL;
}
$building = $rs['building'];
$technician = $rs['assignedto'];
if ($technician == '') {
$technician = 'Unassigned';
}
$problems = $rs['problem'];
if (strlen($problems) > 30)
{
$problem = substr($problems, 0, 30) . "...";
} else {
$problem = $problems;
}
$priorityNumber = $rs['priority'];
switch ($priorityNumber) {
case 1:
$priority = "<span style='color: #A80000; background-color: #F78181;'>Alert</span>";
break;
case 2:
$priority = "<span style='color: #000000; background-color: #F7FE2E'>High</span>";
break;
case 3:
$priority = "<span style='color: #0B610B; background-color: #CEF6CE'>Normal</span>";
break;
case 4:
$priority = "<span style='color: #000000; background-color: #CECEF6'>Low</span>";
break;
}
$statusL = $rs['status'];
if (strlen($statusL) > 10)
{
$status = substr($statusL, 0, 10) . "...";
} else {
$status = $statusL;
}
echo '<tr><td>'.$priority.'</td>';
echo '<td data-value="'.$createdNumeric.'">'.$created.'</td>';
echo '<td><span id="yahoo" title="'.$requestedbyL.'">'.$requestedby.'</td>';
echo '<td>'.$building.'</td>';
echo '<td><span id="yahoo" title="'.$problems.'">'.$problem.'</span></td>';
echo '<td>'.$technician.'</td>';
echo '<td><span id="yahoo" title="'.$statusL.'">'.$status.'</td>';
echo '<td><a href="edit.php?id='.$id.'">Edit Record</a></td></tr>';
} while ($rs = mysql_fetch_array($result));
?>
</tbody>
</table>
<span data-mini="true">
<br />
<hr />
<br />
</span>
<?php
if($_SESSION['id'] == 'ok'){
?>
<table align="center">
<tr>
<td>
<a href="new.php" data-theme="a" data-role="button" data-ajax="false" data-mini="true">Submit Work Order</a>
</td>
<td>
<a href="completed.php" data-theme="a" data-role="button" data-ajax="false" data-mini="true">Recently Completed</a>
</td>
</tr>
<tr>
<td>
<a href="search.php" data-theme="a" data-role="button" data-ajax="false" data-mini="true">Search Workorders</a>
</td>
<td>
<a href="/tech/index.php" data-theme="a" data-role="button" data-ajax="false" data-mini="true">Back to Tech Home</a>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<a href="logout.php" data-theme="a" data-role="button" data-ajax="false" data-mini="true">Logout</a>
</td>
</tr>
</table>
<?php
} else {
?>
<table align="center">
<tr>
<td>
<a href="new.php" data-theme="a" data-role="button" data-ajax="false" data-mini="true">Submit Work Order</a>
</td>
<td>
<a href="mobilelogin.php" data-theme="a" data-role="button" data-ajax="false" data-mini="true">Log In</a>
</td>
</tr>
</table>
<?php
}
?>
</div>
<?php
} else {
print 'Sorry, no results found for your search of ' . $query . '. Please try again.<br />';
}
} else {
print '<div data-role="dialog"><div data-role="header" data-theme="a">
<h1>Error</h1>
<a href="#" data-icon="home" data-iconpos="notext" data-direction="reverse" onclick="javascript:location.href="index.php"">Home</a>
</div><!-- /header --> <div data-role="content">Sorry, there were no workorders entered between those dates.</div></div>';
}
} else {
?>
<div data-role="page" class="type-interior mybg">
<div data-role="header" data-theme="a">
<h1>View By Date Range</h1>
<a href="#" data-icon="home" data-iconpos="notext" data-direction="reverse" onclick="javascript:location.href='index.php'">Home</a>
</div><!-- /header -->
<br />
<div data-role="content">
<form method="post" onSubmit="byDates.php">
<label for="basic"><b>Select a Start Date: </b></label>
<input type="date" id="datepicker" name="startDate"/>
<label for="basic"><b>Select an End Date: </b></label>
<input type="date" id="datepicker" name="endDate"/>
<input type="submit" value="Submit" data-inline="true"/>
<a href="/tech/index.php"><input type="button" value="Cancel" data-inline="true" data-theme="e"/></a>
</form>
<?php
}
} else {
?>
<label for="basic">You're Not Logged in!</label>
<form action="mobilelogin.php" method="get">
<input type="hidden" name="adding" value="yes" />
<a href="mobilelogin.php" data-inline="true" data-role="button">Login</a>
</form>
<?php
}
?>
</div>
<?php
include_once 'footer.php';
include_once 'common/end.inc.php';
?>