forked from smuwanga/ViralLoad
/
tpl.preview.results.repeat.repeated.php
162 lines (146 loc) · 7.23 KB
/
tpl.preview.results.repeat.repeated.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
<?
//register a globals variable for security
$GLOBALS['vlDC']=true;
include "conf.php";
//get variables
$sampleID=getValidatedVariable("sampleID");
$worksheetID=getValidatedVariable("worksheetID");
$formNumber=0;
$formNumber=getDetailedTableInfo2("vl_samples","id='$sampleID' limit 1","formNumber");
$sampleReferenceNumber=0;
$sampleReferenceNumber=getDetailedTableInfo2("vl_samples","id='$sampleID' limit 1","vlSampleID");
$worksheetReferenceNumber=0;
$worksheetReferenceNumber=getDetailedTableInfo2("vl_samples_worksheetcredentials","id='$worksheetID'","worksheetReferenceNumber");
$patientID=0;
$patientID=getDetailedTableInfo2("vl_samples","id='$sampleID' limit 1","patientID");
$artNumber=0;
$artNumber=getDetailedTableInfo2("vl_patients","id='$patientID' limit 1","artNumber");
$otherID=0;
$otherID=getDetailedTableInfo2("vl_patients","id='$patientID' limit 1","otherID");
$worksheetReferenceNumber=0;
$worksheetReferenceNumber=getDetailedTableInfo2("vl_samples_worksheetcredentials","id='$worksheetID'","worksheetReferenceNumber");
$factor=0;
$factor=getDetailedTableInfo2("vl_results_multiplicationfactor","worksheetID='$worksheetID' limit 1","factor");
if(!$factor) {
$factor=1;
}
$sampleVLTestDate=0;
//$sampleVLTestDate=getDetailedTableInfo2("vl_results_abbott_runtimes","worksheetID='$worksheetID' limit 1","runCompletionTime");
$machineType=0;
if(getDetailedTableInfo2("vl_results_abbott","sampleID='$sampleReferenceNumber' and worksheetID='$worksheetID' limit 1","id")) {
$machineType="abbott";
if(!$sampleVLTestDate) {
$sampleVLTestDate=getDetailedTableInfo2("vl_results_abbott","sampleID='$sampleReferenceNumber' and worksheetID='$worksheetID' limit 1","created");
}
} elseif(getDetailedTableInfo2("vl_results_roche","SampleID='$sampleReferenceNumber' and worksheetID='$worksheetID' limit 1","id")) {
$machineType="roche";
if(!$sampleVLTestDate) {
$sampleVLTestDate=getDetailedTableInfo2("vl_results_roche","SampleID='$sampleReferenceNumber' and worksheetID='$worksheetID' limit 1","created");
}
} else {
$machineType="rejected";
}
$result=0;
$result=getVLResult($machineType,$worksheetID,$sampleReferenceNumber,$factor);
//repeated details
$scheduledOn=0;
$scheduledOn=getDetailedTableInfo2("vl_logs_samplerepeats","sampleID='$sampleID' and oldWorksheetID='$worksheetID' limit 1","created");
$repeatedOn=0;
$repeatedOn=getDetailedTableInfo2("vl_logs_samplerepeats","sampleID='$sampleID' and oldWorksheetID='$worksheetID' limit 1","repeatedOn");
$withWorksheetID=0;
$withWorksheetID=getDetailedTableInfo2("vl_logs_samplerepeats","sampleID='$sampleID' and oldWorksheetID='$worksheetID' limit 1","withWorksheetID");
$repeatedFactor=0;
$repeatedFactor=getDetailedTableInfo2("vl_results_multiplicationfactor","worksheetID='$withWorksheetID' limit 1","factor");
if(!$repeatedFactor) {
$repeatedFactor=1;
}
$repeatedResult=0;
$repeatedResult=getVLResult($machineType,$withWorksheetID,$sampleReferenceNumber,$repeatedFactor);
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table border="0" cellspacing="0" cellpadding="0" class="vl">
<tr>
<td class="tab_active">FORM: <?=getDetailedTableInfo2("vl_samples","id='$sampleID'","formNumber")?></td>
</tr>
</table></td>
</tr>
<tr>
<td style="border:1px solid #CCCCFF; padding:20px">
<table width="100%" border="0" class="vl">
<tr>
<td>
<div style="height: 280px; overflow: auto; padding:3px">
<table width="92%" border="0" class="vl">
<tr>
<td>
<fieldset style="width: 100%">
<legend><strong>PATIENT/SAMPLE RESULTS</strong></legend>
<div style="padding:5px 0px 0px 0px">
<table width="100%" border="0" class="vl">
<tr>
<td width="30%" style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">Patient ART #</td>
<td width="70%" style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6"><?=$artNumber?></td>
</tr>
<tr>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">Patient Other ID</td>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6"><?=$otherID?></td>
</tr>
<tr>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">Original Result</td>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6"><?=$result?></td>
</tr>
<tr>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">Original Factor</td>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">x<?=$factor?></td>
</tr>
<tr>
<td style="padding:4px 0px">Original Test Date</td>
<td style="padding:4px 0px"><?=getFormattedDate($sampleVLTestDate)." at ".getFormattedTimeLessS($sampleVLTestDate)?></td>
</tr>
</table>
</div>
</fieldset>
</td>
</tr>
<tr>
<td>
<fieldset style="width: 100%">
<legend><strong>REPEAT SAMPLE DETAILS</strong></legend>
<div style="padding:5px 0px 0px 0px">
<table width="100%" border="0" class="vl">
<tr>
<td width="30%" style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">Scheduled for Repeat on</td>
<td width="70%" style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6"><?=getFormattedDate($scheduledOn)." at ".getFormattedTimeLessS($scheduledOn)?></td>
</tr>
<tr>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">Repeated on</td>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6"><?=getFormattedDate($repeatedOn)." at ".getFormattedTimeLessS($repeatedOn)?></td>
</tr>
<tr>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6">Repeat Results</td>
<td style="padding:4px 0px; border-bottom: 1px dashed #dfe6e6"><?=$repeatedResult?></td>
</tr>
<tr>
<td style="padding:4px 0px">Repeat Factor</td>
<td style="padding:4px 0px">x<?=$repeatedFactor?></td>
</tr>
</table>
</div>
</fieldset>
</td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td><img src="/images/spacer.gif" width="10" height="10" /></td>
</tr>
<tr>
<td style="padding: 10px 0px 0px 0px; border-top: 1px solid #999999;"><a href="#rnd" onclick="closeMessage()" class="trailanalyticss">Close!</a></td>
</tr>
</table>
</td>
</tr>
</table>