-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathview-prescription.php
426 lines (371 loc) · 13.1 KB
/
view-prescription.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
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
<?php require_once('check_login.php');?>
<?php include('head.php');?>
<?php include('header.php');?>
<?php include('sidebar.php');?>
<?php include('connect.php');
if(isset($_GET['id']))
{
$sql ="UPDATE appointment SET delete_status='1' WHERE departmentid='$_GET[id]'";
$qsql=mysqli_query($conn,$sql);
if(mysqli_affected_rows($conn) == 1)
{
?>
<div class="popup popup--icon -success js_success-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Success
</h3>
<p>Appointment record deleted successfully.</p>
<p>
<!-- <a href="index.php"><button class="button button--success" data-for="js_success-popup"></button></a> -->
<?php echo "<script>setTimeout(\"location.href = 'view-prescription.php';\",1500);</script>"; ?>
</p>
</div>
</div>
<?php
//echo "<script>alert('Department record deleted successfully..');</script>";
//echo "<script>window.location='view-appointment.php';</script>";
}
}
if(isset($_GET['approveid']))
{
$sql ="UPDATE appointment SET status='Approved' WHERE appointmentid='$_GET[approveid]'";
$qsql=mysqli_query($conn,$sql);
if(mysqli_affected_rows($conn) == 1)
{
?>
<div class="popup popup--icon -success js_success-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Success
</h3>
<p>Appointment record Approved successfully.</p>
<p>
<!-- <a href="index.php"><button class="button button--success" data-for="js_success-popup"></button></a> -->
<?php echo "<script>setTimeout(\"location.href = 'view-prescription.php';\",1500);</script>"; ?>
</p>
</div>
</div>
<?php
//echo "<script>alert('Appointment record Approved successfully..');</script>";
//echo "<script>window.location='view-appointment.php';</script>";
}
}
?>
<?php
if(isset($_GET['delid']))
{ ?>
<div class="popup popup--icon -question js_question-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Sure
</h1>
<p>Are You Sure To Delete This Record?</p>
<p>
<a href="view-department.php?id=<?php echo $_GET['delid']; ?>" class="button button--success" data-for="js_success-popup">Yes</a>
<a href="view-department.php" class="button button--error" data-for="js_success-popup">No</a>
</p>
</div>
</div>
<?php } ?>
<div class="pcoded-content">
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-wrapper">
<div class="page-header">
<div class="row align-items-end">
<div class="col-lg-8">
<div class="page-header-title">
<div class="d-inline">
<h4>View Prescription Record</h4>
</div>
</div>
</div>
<div class="col-lg-4">
<div class="page-header-breadcrumb">
<ul class="breadcrumb-title">
<li class="breadcrumb-item">
<a href="index.php"> <i class="feather icon-home"></i> </a>
</li>
<li class="breadcrumb-item"><a>View Prescription Record</a>
</li>
<li class="breadcrumb-item"><a href="#">View Prescription Record</a>
</li>
</ul>
</div>
</div>
</div>
</div>
<div class="page-body">
<?php
$sql ="SELECT * FROM prescription where patientid='$_SESSION[patientid]'";
$qsql = mysqli_query($conn,$sql);
while($rs = mysqli_fetch_array($qsql))
{
$sqlpatient = "SELECT * FROM patient WHERE patientid='$rs[patientid]'";
$qsqlpatient = mysqli_query($conn,$sqlpatient);
$rspatient = mysqli_fetch_array($qsqlpatient);
$sqlpres ="SELECT * FROM prescription where patientid='$rs[patientid]'";
$qsqlpres = mysqli_query($conn,$sqlpres);
$rspres = mysqli_fetch_array($qsqlpres);
$sqlprescription = "SELECT * FROM prescription_records WHERE prescription_id='$rspres[prescriptionid]'";
$qsqlprescription = mysqli_query($conn,$sqlprescription);
$rsprescription = mysqli_fetch_array($qsqlprescription);
$sqldoctor = "SELECT * FROM doctor WHERE doctorid='$rs[doctorid]'";
$qsqldoctor = mysqli_query($conn,$sqldoctor);
$rsdoctor = mysqli_fetch_array($qsqldoctor);
?>
<div class="card">
<div class="card-block">
<div class="table-responsive dt-responsive">
<table id="" class="table table-striped table-bordered nowrap">
<thead>
<tr>
<th>Doctor Name</th>
<th>Patient Name</th>
<th>Prescription Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM prescription WHERE prescriptionid='$rspres[prescriptionid]'";
$qsql = mysqli_query($conn,$sql);
while($rs = mysqli_fetch_array($qsql))
{
$sqlpatient = "SELECT * FROM patient WHERE patientid='$rs[patientid]'";
$qsqlpatient = mysqli_query($conn,$sqlpatient);
$rspatient = mysqli_fetch_array($qsqlpatient);
$sqldoctor = "SELECT * FROM doctor WHERE doctorid='$rs[doctorid]'";
$qsqldoctor = mysqli_query($conn,$sqldoctor);
$rsdoctor = mysqli_fetch_array($qsqldoctor);
echo "<tr>
<td> $rsdoctor[doctorname]</td>
<td> $rspatient[patientname]</td>
<td> $rs[prescriptiondate]</td>
<td> $rs[status]</td>
</tr>";
}
?>
</tbody>
</table>
</div>
</div>
</div>
<div class="print-block">
<div class="card">
<div class="card-header">
<div class="col-sm-10">
<div class="logo" style="float:left; margin-left:5%;">
<image class="profile-img" src="uploadImage/Logo/<?php echo $logo; ?>" style="width: 100%"></image>
</div>
<div class="address" style="float:right; margin-right:5%;">
<p class="add">
<?php
$add = "SELECT * FROM manage_website";
$qadd = mysqli_query($conn,$add);
while($rs = mysqli_fetch_array($qadd))
{
echo
"<p><strong> $rs[business_name]</strong></p>
<p> $rs[business_email]</p>
<p> $rs[addr]</p>
<p> $rs[business_web]</p>";
}
?>
</p>
</div>
</div>
</div>
<hr style="width:90%; margin-left:5%; margin-right:5%;">
<div class="card-block" style="margin-left:5%; margin-right:5%;">
<div class="patient-details">
<p class="add">
<?php
if(!isset($_SESSION['patientid']))
{
$ptr = "SELECT * FROM patient WHERE patientid='$_GET[patientid]'";
$qptr = mysqli_query($conn,$ptr);
while($rs = mysqli_fetch_array($qptr))
{
echo
"<table>
<tr>
<td><strong>Patient Name:</strong></td>
<td> $rs[patientname]</td>
<td> </td>
<td> <strong>Patient Id:</strong></td>
<td> $rs[patientid]</td>
</tr>
<tr>
<td><strong>Gender:</strong></td>
<td> $rs[gender]</td>
<td> </td>
<td> <strong>Age:</strong></td>
<td> </td>
</tr>
<tr>
<td><strong>Mobile No:</strong></td>
<td> $rs[mobileno]</td>
<td> </td>
<td> <strong>Email:</strong></td>
<td> $rs[loginid]</td>
</tr>
<tr>
<td colspan='4'> </td>
</tr>";
}
}
?>
</p>
</div>
<div class="doctor-details" style="float:left;">
<?php
echo
"<p><strong>$rsdoctor[doctorname]</strong></p>
<p><h4>Prescription ( ℞ )</h4></p>";
?>
</div>
<div class="date" style="float:right;">
<?php echo "Date: " . date("d-M-Y"); ?>
</div>
<div class="table-responsive dt-responsive">
<table id="" class="table table-striped table-bordered nowrap">
<thead style="background-color: #ababab">
<tr>
<td><strong>Medicine Name</strong></td>
<td><strong>Unit</strong></td>
<td><strong>Dosage</strong></td>
<td><strong>Instructions</strong></td>
<!--
<?php # if(($_SESSION['user'] == 'doctor')){ ?>
<?php /*
if(!isset($_SESSION['patientid']))
{
?>
<td><strong>Action</strong></td>
<?php
} }
*/ ?>
-->
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM prescription_records LEFT JOIN medicine on prescription_records.medicine_name=medicine.medicineid WHERE prescription_id='$rspres[prescriptionid]'";
$qsql = mysqli_query($conn,$sql);
while($rs = mysqli_fetch_array($qsql))
{
echo "<tr>
<td> $rs[medicine_name]</td>
<td> $rs[unit]</td>
<td align='center'> $rs[dosage]</td>
<td> $rs[instruction]</td>";
/*
if(($_SESSION['user'] == 'doctor')){
if(!isset($_SESSION['patientid']))
{
echo " <td> <a href='prescriptionrecord.php?delid=$rs[prescription_record_id]&prescriptionid=$_GET[prescriptionid]'>Delete</a> </td>";
} }
*/
echo "</tr>";
}
?>
</tbody>
</table>
<br>
<div class="advice">
<h4>Lifestyle Advice</h4>
<br>
<p></p>
<p>
<?php
$sql ="SELECT * FROM lifestyle WHERE prescription_id='$rspres[prescriptionid]'";
$qsql = mysqli_query($conn,$sql);
while($rs = mysqli_fetch_array($qsql))
{
echo " Review with <strong>$rs[review_with]</strong></br></br>";
echo " Next Review is on <b>".date("d-M-Y",strtotime($rs['next_review_on']))."</b>";
echo "</br></br>";
echo " <strong>Note :</strong> $rs[message]";
}
?>
</p>
<div class="sign" style="float:right; margin-top:100px; margin-right:100px;">
<p align="center"><strong><?php echo $rsdoctor['doctorname'];?></strong></p>
<p align="center">Authorized Signature</p>
</div>
</div>
</div>
<div align="center">
<a href=""><input Class="btn btn-primary m-b-0" type="submit" name="print" id="print" value="Print" onclick="myFunction()"/></a>
</div>
</div>
<div class="ftr" style="width:100%; background:#2B66B1; padding:7px;">
<h4 style="color:#ffffff;" align="center"><strong>Polyclinic, Mysore</strong></h4>
</div>
</div>
</div>
<?php }?>
</div>
</div>
</div>
<div id="#">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include('footer.php');?>
<?php if(!empty($_SESSION['success'])) { ?>
<div class="popup popup--icon -success js_success-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Success
</h1>
<p><?php echo $_SESSION['success']; ?></p>
<p>
<?php echo "<script>setTimeout(\"location.href = 'view_user.php';\",1500);</script>"; ?>
<!-- <button class="button button--success" data-for="js_success-popup">Close</button> -->
</p>
</div>
</div>
<?php unset($_SESSION["success"]);
} ?>
<?php if(!empty($_SESSION['error'])) { ?>
<div class="popup popup--icon -error js_error-popup popup--visible">
<div class="popup__background"></div>
<div class="popup__content">
<h3 class="popup__content__title">
Error
</h1>
<p><?php echo $_SESSION['error']; ?></p>
<p>
<?php echo "<script>setTimeout(\"location.href = 'view_user.php';\",1500);</script>"; ?>
<!-- <button class="button button--error" data-for="js_error-popup">Close</button> -->
</p>
</div>
</div>
<?php unset($_SESSION["error"]); } ?>
<script>
var addButtonTrigger = function addButtonTrigger(el) {
el.addEventListener('click', function () {
var popupEl = document.querySelector('.' + el.dataset.for);
popupEl.classList.toggle('popup--visible');
});
};
Array.from(document.querySelectorAll('button[data-for]')).
forEach(addButtonTrigger);
</script>
<script>
function myFunction()
{
window.print();
}
</script>