-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-details.php
More file actions
465 lines (377 loc) · 13.9 KB
/
test-details.php
File metadata and controls
465 lines (377 loc) · 13.9 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
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
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<?php session_start();
//DB conncetion
include_once('includes/config.php');
error_reporting(0);
//validating Session
if (strlen($_SESSION['aid']==0)) {
header('location:logout.php');
} else{
//Code for Assign to
if (isset($_POST['submit'])) {
$testid=intval($_GET['tid']);
$ato=$_POST['assignto'];
$assignto=explode("-",$ato);
$aname=$assignto[0];
$pid=$assignto[1];
$status='Assigned';
$assigntime = date( 'd-m-Y h:i:s A', time ());
$query=mysqli_query($con,"update tbltestrecord set ReportStatus='$status',AssigntoName='$aname',AssignedtoEmpId='$pid',AssignedTime='$assigntime' where id='$testid'");
echo '<script>alert("Assigned to Phlebotomist successfully.")</script>';
echo "<script>window.location.href='assigned-test.php'</script>";
}
//Code for Take Action
if (isset($_POST['takeaction'])) {
$orderid=intval($_GET['oid']);
$status=$_POST['status'];
$remark=$_POST['remark'];
$rby=$_SESSION['aid'];
//For delivered Status
if($status=='Delivered'):
$uploadtime = date( 'd-m-Y h:i:s A', time ());
//For checking the image type
$reportfile=$_FILES["report"]["name"];
// get the image extension
$extension = substr($reportfile,strlen($reportfile)-4,strlen($reportfile));
// allowed extensions
$allowed_extensions = array(".doc",".pdf",".PDF");
// Validation for allowed extensions .in_array() function searches an array for a specific value.
if(!in_array($extension,$allowed_extensions))
{
echo "<script>alert('Invalid format. Only doc / pdf format allowed');</script>";
}
else
{
//rename the image file
$newreportfile=md5($reportfile).time().$extension;
// Code for move image into directory
move_uploaded_file($_FILES["report"]["tmp_name"],"reportfiles/".$newreportfile);
$query=mysqli_query($con,"insert into tblreporttracking(OrderNumber,Status,Remark,RemarkBy) values('$orderid','$status','$remark','$rby')");
$query2=mysqli_query($con,"update tbltestrecord set ReportStatus='$status',FinalReport='$newreportfile',ReportUploadTime='$uploadtime' where OrderNumber='$orderid'");
echo '<script>alert("Status updated successfully")</script>';
echo "<script>window.location.href='all-test.php'</script>";
}
// For other status
else:
$query=mysqli_query($con,"insert into tblreporttracking(OrderNumber,Status,Remark,RemarkBy) values('$orderid','$status','$remark','$rby')");
$query2=mysqli_query($con,"update tbltestrecord set ReportStatus='$status' where OrderNumber='$orderid'");
echo '<script>alert("Status updated successfully")</script>';
echo "<script>window.location.href='all-test.php'</script>";
endif;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Covid-19 Testing Management System | Test Details</title>
<!-- Custom fonts for this template-->
<link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link
href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i"
rel="stylesheet">
<!-- Custom styles for this template-->
<link href="css/sb-admin-2.min.css" rel="stylesheet">
<style type="text/css">
label{
font-size:16px;
font-weight:bold;
color:#000;
}
</style>
</head>
<body id="page-top">
<!-- Page Wrapper -->
<div id="wrapper">
<?php include_once('includes/sidebar.php');?>
<!-- Content Wrapper -->
<div id="content-wrapper" class="d-flex flex-column">
<!-- Main Content -->
<div id="content">
<!-- Topbar -->
<?php include_once('includes/topbar.php');?>
<!-- End of Topbar -->
<!-- Begin Page Content -->
<div class="container-fluid">
<!-- Page Heading -->
<h1 class="h3 mb-4 text-gray-800">Test Details# <?php echo intval($_GET['oid']);?></h1>
<div class="row">
<?php
$testid=intval($_GET['tid']);
$query=mysqli_query($con,"select * from tbltestrecord
join tblpatients on tblpatients.MobileNumber=tbltestrecord.PatientMobileNumber
where tbltestrecord.id='$testid'");
while($row=mysqli_fetch_array($query)){
?>
<!-- personal information --->
<div class="col-lg-6">
<!-- Basic Card Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Personal Information</h6>
</div>
<div class="card-body">
<table class="table table-bordered" width="100%" cellspacing="0">
<tr>
<th>Full Name</th>
<td><?php echo $row['FullName'];?></td>
</tr>
<tr>
<th>Mobile Number</th>
<td><?php echo $row['MobileNumber'];?></td>
</tr>
<tr>
<th>DOB (Date of Birth)</th>
<td><?php echo $row['DateOfBirth'];?></td>
</tr>
<tr>
<th>Govt Issued Id</th>
<td><?php echo $row['GovtIssuedId'];?></td>
</tr>
<tr>
<th>Govt Issued Id No</th>
<td><?php echo $row['GovtIssuedIdNo'];?></td>
</tr>
<tr>
<th>Full Address</th>
<td><?php echo $row['FullAddress'];?></td>
</tr>
<tr>
<th>State</th>
<td><?php echo $row['State'];?></td>
</tr>
<tr>
<th>Profile Reg Date</th>
<td><?php echo $row['RegistrationDate'];?></td>
</tr>
</table>
</div>
</div>
</div>
<!-- Test Information --->
<div class="col-lg-6">
<!-- Basic Card Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Test Information</h6>
</div>
<div class="card-body">
<table class="table table-bordered" width="100%" cellspacing="0">
<tr>
<th>Order Number</th>
<td><?php echo $row['OrderNumber'];?></td>
</tr>
<tr>
<th>Test Type</th>
<td><?php echo $row['TestType'];?></td>
</tr>
<tr>
<th>Time Slot</th>
<td><?php echo $row['TestTimeSlot'];?></td>
</tr>
<tr>
<th>Report Status</th>
<td><?php if($row['ReportStatus']==''):
echo "Not Processed yet";
else:
echo $row['ReportStatus'];
endif;
?></td>
</tr>
<?php if($row['AssignedtoEmpId']!=''):?>
<tr>
<th>Assign To</th>
<td><?php echo $row['AssigntoName'];?>-(<?php echo $row['AssignedtoEmpId'];?>)</td>
</tr>
<tr>
<th>Assigned Date</th>
<td><?php echo $row['AssignedTime'];?></td>
</tr>
<?php endif;?>
<?php if($row['FinalReport']!=''):?>
<tr>
<th>Report</th>
<td><a href="reportfiles/<?php echo $row['FinalReport'];?>" target="_blank">Download</a></td>
</tr>
<tr>
<th>Report Delivered Time</th>
<td><?php echo $row['ReportUploadTime'];?></td>
</tr>
<?php endif;?>
</table>
<?php if($row['AssignedtoEmpId']==''):
?>
<div class="form-group">
<button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#assignto">Assign To</button>
</div>
<?php else:
$rstatus=$row['ReportStatus'];
if($rstatus=='Assigned' || $rstatus=='On the Way for Collection' || $rstatus=='Sample Collected' || $rstatus=='Sent to Lab'):?>
<button type="button" class="btn btn-info btn-sm" data-toggle="modal" data-target="#takeaction">Take Action</button>
<?php
endif;
endif;?>
</div>
</div>
</div>
</div>
<?php } ?>
<!-- Test Tracking History --->
<?php
$orderid=intval($_GET['oid']);
$ret=mysqli_query($con,"select * from tblreporttracking
join tbladmin on tbladmin.ID=tblreporttracking.RemarkBy
where tblreporttracking.OrderNumber='$orderid'");
$num=mysqli_num_rows($ret);
?>
<div class="row">
<div class="col-lg-12">
<!-- Basic Card Example -->
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary" align="center">Test Tracking History</h6>
</div>
<div class="card-body">
<?php if($num>0){
?>
<table class="table table-bordered" width="100%" cellspacing="0">
<tr>
<th>Remark</th>
<th>Status</th>
<th>Remark Date</th>
<th>Remark By</th>
<?php while($result=mysqli_fetch_array($ret)){?>
</tr>
<tr>
<td><?php echo $result['Remark'];?></td>
<td><?php echo $result['Status'];?></td>
<td><?php echo $result['PostingTime'];?></td>
<td><?php echo $result['AdminName'];?></td>
</tr>
<?php } // End while loop?>
</table>
<?php
//end if
} else { ?>
<h4 align="center" style="color:red"> No Tracking history found </h4>
<?php } ?>
</div>
</div>
</div>
</div>
</form>
</div>
<!-- /.container-fluid -->
</div>
<!-- End of Main Content -->
<?php include_once('includes/footer.php');?>
</div>
<!-- End of Content Wrapper -->
</div>
<!-- End of Page Wrapper -->
<?php include_once('includes/footer2.php');?>
<!-- Assign Modal -->
<div id="assignto" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 align="left">Assign to</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form method="post">
<p> <select class="form-control" name="assignto" required="true">
<option value="">Select Phlebotomist</option>
<?php $sql=mysqli_query($con,"select FullName,EmpID from tblphlebotomist");
while ($result=mysqli_fetch_array($sql)) {
?>
<option value="<?php echo $result['FullName']."-".$result['EmpID'];?>"><?php echo $result['FullName'];?>-(<?php echo $result['EmpID'];?>)</option>
<?php } ?>
</select></p>
<p>
<input type="submit" class="btn btn-primary btn-user btn-block" name="submit" id="submit"> </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<!-- Take Action Modal -->
<div id="takeaction" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<h4 align="left">Take Action</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<form method="post" enctype="multipart/form-data" >
<p> <select class="form-control" name="status" id="status" required="true">
<option value="">Select Action</option>
<?php
$query1=mysqli_query($con,"select ReportStatus from tbltestrecord where OrderNumber='$orderid'");
while($result=mysqli_fetch_array($query1)):
$reportstatus=$result['ReportStatus'];
endwhile;
?>
<?php if($reportstatus=='Assigned'):?>
<option value="On the Way for Collection">On the Way for Collection</option>
<option value="Sample Collected">Sample Collected</option>
<option value="Sent to Lab">Sent to Lab</option>
<option value="Delivered">Delivered</option>
<?php elseif($reportstatus=='On the Way for Collection'):?>
<option value="Sample Collected">Sample Collected</option>
<option value="Sent to Lab">Sent to Lab</option>
<option value="Delivered">Delivered</option>
<?php elseif($reportstatus=='Sample Collected'):?>
<option value="Sent to Lab">Sent to Lab</option>
<option value="Delivered">Delivered</option>
<?php elseif($reportstatus=='Sent to Lab'):?>
<option value="Delivered">Delivered</option>
<?php endif;?>
</select></p>
<p id='reportfile'> Report <span style="color:red; font-size:12px;">(Doc and PDF formate allowed)</span> <input type="file" name="report" id="report"></p>
<p>
<textarea name="remark" class="form-control" required="true" placeholder="Remark (Max 500 Characters)" maxlength="500" rows="5"></textarea> </p>
<p>
<input type="submit" class="btn btn-primary btn-user btn-block" name="takeaction" id="submit"> </p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</form>
</div>
</div>
</div>
<!-- Bootstrap core JavaScript-->
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- Core plugin JavaScript-->
<script src="vendor/jquery-easing/jquery.easing.min.js"></script>
<!-- Custom scripts for all pages-->
<script src="js/sb-admin-2.min.js"></script>
<script type="text/javascript">
//For report file
$('#reportfile').hide();
$(document).ready(function(){
$('#status').change(function(){
if($('#status').val()=='Delivered')
{
$('#reportfile').show();
jQuery("#report").prop('required',true);
}
else{
$('#reportfile').hide();
}
})})
</script>
</body>
</html>
<?php } ?>