forked from smuwanga/ViralLoad
/
tpl.reports.default.downloads.php
329 lines (319 loc) · 18.2 KB
/
tpl.reports.default.downloads.php
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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
<?
//security check
if(!$GLOBALS['vlDC'] || !$_SESSION["VLEMAIL"]) {
die("<font face=arial size=2>You must be logged in to view this page.</font>");
}
?>
<!--<div style="height: 250px; width: 100%; overflow: auto; padding:5px">-->
<div style="padding:5px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<? if($success) { ?>
<tr>
<td class="vl_success">
<strong>Report Created!</strong><br />
<div class="vls_grey" style="padding:5px 0px 0px 0px"><img src="/images/arrow_right.gif" border="0"> <a href="<?=vlDecrypt($pathtofile)?>" class="vls_grey">Click here to Download the Report.</a></div>
</td>
</tr>
<? } ?>
<tr>
<td valign="top" style="padding:10px 0px; border-bottom: 1px dashed #CCC">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vl_tdnoborder" width="5%"><img src="/images/download.excel.gif" width="55" height="55" alt="downloads" border="0" /></td>
<td class="vl_tdnoborder" width="95%">
<div style="padding:0px 0px 5px 2px">Cumulative Number of Samples Received</div>
<script Language="JavaScript" Type="text/javascript">
<!--
function checkFormMF(searchForm) {
if(document.pressed == ' Download Excel ') {
document.modifyForm.action ="/download/samples.received.excel/";
} else if(document.pressed == ' Download CSV ') {
document.modifyForm.action ="/download/samples.received.csv/";
}
return (true);
}
//-->
</script>
<form name="modifyForm" method="post" action="/download/samples.received.excel/" onsubmit="return checkFormMF(this)">
<table width="100%" border="0" class="nms">
<tr>
<td width="5%">From:</td>
<td width="95%"><table width="10%" border="0" cellspacing="0" cellpadding="0" class="nms">
<tr>
<td><select name="fromDay" id="fromDay" class="search">
<?
for($j=1;$j<=31;$j++) {
echo "<option value=\"".($j<10?"0$j":$j)."\">$j</option>";
}
?>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="fromMonth" id="fromMonth" class="search">
<? echo "<option value=\"".getFormattedDateMonth($datetime)."\" selected=\"selected\">".getFormattedDateMonthname($datetime)."</option>"; ?>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="fromYear" id="fromYear" class="search">
<?
for($j=getFormattedDateYear($datetime);$j>=(getCurrentYear()-10);$j--) {
echo "<option value=\"$j\">$j</option>";
}
?>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td>To:</td>
<td><table width="10%" border="0" cellspacing="0" cellpadding="0" class="nms">
<tr>
<td><select name="toDay" id="toDay" class="search">
<?
for($j=1;$j<=31;$j++) {
echo "<option value=\"".($j<10?"0$j":$j)."\" ".($j==getFormattedDateDay(getDualInfoWithAlias("last_day(now())","lastmonth"))?"selected=\"selected\"":"").">$j</option>";
}
?>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="toMonth" id="toMonth" class="search">
<? echo "<option value=\"".getFormattedDateMonth($datetime)."\" selected=\"selected\">".getFormattedDateMonthname($datetime)."</option>"; ?>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="toYear" id="toYear" class="search">
<?
for($j=(getFormattedDateYear($datetime)-5);$j<=(getCurrentYear()+50);$j++) {
echo "<option value=\"$j\"".($j==getFormattedDateYear($datetime)?" selected=\"selected\"":"").">$j</option>";
}
?>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td style="padding:0px 0px 0px 0px">
<input type="submit" name="downloadXLS" id="downloadXLS" onclick="document.pressed=this.value" value=" Download Excel " class="button" />
<input type="submit" name="downloadCSV" id="downloadCSV" onclick="document.pressed=this.value" value=" Download CSV " class="button" />
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" style="padding:10px 0px; border-bottom: 1px dashed #CCC">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vl_tdnoborder" width="5%"><img src="/images/download.excel.gif" width="55" height="55" alt="downloads" border="0" /></td>
<td class="vl_tdnoborder" width="95%">
<div style="padding:0px 0px 2px 2px">Download Facilities</div>
<div style="padding:3px 0px 5px 2px"><a href="/download/facilities.excel/">Download current list of facilities</a></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" style="padding:10px 0px; border-bottom: 1px dashed #CCC">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vl_tdnoborder" width="5%"><img src="/images/download.excel.gif" width="55" height="55" alt="downloads" border="0" /></td>
<td class="vl_tdnoborder" width="95%">
<div style="padding:3px 0px 5px 2px">
From: <input type="text" name="fro_date_tor" id="fro_date_tor" class="pick_date date_box" placeholder=" dd/mm/yyyy" maxlength="10">
To: <input type="text" name="to_date_tor" id="to_date_tor" class="pick_date date_box" placeholder=" dd/mm/yyyy " maxlength="10">
</div>
<div style="padding:3px 0px 5px 2px"><a href="#" onclick="testOR()">Test out come report</a></div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" style="padding:10px 0px<?=(getDetailedTableInfo2("vl_users_permissions","userID='".getUserID($trailSessionUser)."' and permission='reportsQC' limit 1","id")?"; border-bottom: 1px dashed #CCC":"")?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vl_tdnoborder" width="5%"><img src="/images/download.excel.gif" width="55" height="55" alt="downloads" border="0" /></td>
<td class="vl_tdnoborder" width="95%">
<div style="padding:0px 0px 5px 2px">ViralLoad Books Allocated to Facility</div>
<script Language="JavaScript" Type="text/javascript">
<!--
function checkFormBF(searchForm) {
if(document.pressed == ' Download Excel ') {
document.vlBooksForm.action ="/download/clinical.request.forms.excel/";
} else if(document.pressed == ' Download CSV ') {
document.vlBooksForm.action ="/download/samples.received.csv/";
}
return (true);
}
//-->
</script>
<form name="vlBooksForm" method="post" action="/download/clinical.request.forms.excel/" onsubmit="return checkFormBF(this)">
<table width="100%" border="0" class="nms">
<tr>
<td width="5%">From:</td>
<td width="95%"><table width="10%" border="0" cellspacing="0" cellpadding="0" class="nms">
<tr>
<td><select name="fromDay" id="fromDay" class="search">
<?
for($j=1;$j<=31;$j++) {
echo "<option value=\"".($j<10?"0$j":$j)."\">$j</option>";
}
?>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="fromMonth" id="fromMonth" class="search">
<? echo "<option value=\"".getFormattedDateMonth($datetime)."\" selected=\"selected\">".getFormattedDateMonthname($datetime)."</option>"; ?>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="fromYear" id="fromYear" class="search">
<?
for($j=getFormattedDateYear($datetime);$j>=(getCurrentYear()-10);$j--) {
echo "<option value=\"$j\">$j</option>";
}
?>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td>To:</td>
<td><table width="10%" border="0" cellspacing="0" cellpadding="0" class="nms">
<tr>
<td><select name="toDay" id="toDay" class="search">
<?
for($j=1;$j<=31;$j++) {
echo "<option value=\"".($j<10?"0$j":$j)."\" ".($j==getFormattedDateDay(getDualInfoWithAlias("last_day(now())","lastmonth"))?"selected=\"selected\"":"").">$j</option>";
}
?>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="toMonth" id="toMonth" class="search">
<? echo "<option value=\"".getFormattedDateMonth($datetime)."\" selected=\"selected\">".getFormattedDateMonthname($datetime)."</option>"; ?>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select></td>
<td style="padding:0px 0px 0px 5px"><select name="toYear" id="toYear" class="search">
<?
for($j=(getFormattedDateYear($datetime)-5);$j<=(getCurrentYear()+50);$j++) {
echo "<option value=\"$j\"".($j==getFormattedDateYear($datetime)?" selected=\"selected\"":"").">$j</option>";
}
?>
</select></td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
<td style="padding:0px 0px 0px 0px">
<input type="submit" name="downloadXLS" id="downloadXLS" onclick="document.pressed=this.value" value=" Download Excel " class="button" />
<!--<input type="submit" name="downloadCSV" id="downloadCSV" onclick="document.pressed=this.value" value=" Download CSV " class="button" />-->
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
</td>
</tr>
<? if(getDetailedTableInfo2("vl_users_permissions","userID='".getUserID($trailSessionUser)."' and permission='reportsQC' limit 1","id")) { ?>
<tr>
<td valign="top" style="padding:10px 0px">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="vl_tdnoborder" width="5%"><img src="/images/download.excel.gif" width="55" height="55" alt="downloads" border="0" /></td>
<td class="vl_tdnoborder" width="95%">
<div style="padding:0px 0px 2px 2px">Patients with multiple, and different results</div>
<div style="padding:3px 0px 5px 2px"><a href="/download/patients.multiple.results.excel/">Download list of patients with multiple, and different results</a></div>
</td>
</tr>
</table></td>
</tr>
<? } ?>
</table>
</div>
<script type="text/javascript">
function empty(e) {
switch (e) {
case "":
case 0:
case "0":
case null:
case false:
case typeof this == "undefined":
return true;
default:
return false;
}
}
function stdDate(str){
var arr=str.split("/");
if(arr.length<3){
return "";
}
return arr[2]+"-"+arr[1]+"-"+arr[0];
}
function strtotime(std_date){
var obj=new Date(std_date);
var micro_secs=obj.getTime();
return micro_secs/1000;
}
function testOR(){
var fro_date=stdDate($("#fro_date_tor").val());
var to_date=stdDate($("#to_date_tor").val());
var fro_s=strtotime(fro_date);
var to_s=strtotime(to_date);
if(empty(fro_s)||isNaN(fro_s) ||empty(to_s)||isNaN(to_s)){
alert("Please enter right dates");
return false;
}else if (fro_s>to_s){
alert("The fro date can't be after the to date");
return false;
}else{
return window.location.assign("/test_outcome_report/"+fro_s+"/"+to_s);
}
}
$(function() { $( ".pick_date" ).datepicker(); });
</script>