-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewappointmentapproved.php
102 lines (94 loc) · 2.95 KB
/
viewappointmentapproved.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
<?php
include("adformheader.php");
include("dbconnection.php");
if(isset($_GET['delid']))
{
$sql ="DELETE FROM appointment WHERE appointmentid='$_GET[delid]'";
$qsql=mysqli_query($con,$sql);
if(mysqli_affected_rows($con) == 1)
{
echo "<script>alert('appointment record deleted successfully..');</script>";
}
}
if(isset($_GET['approveid']))
{
$sql ="UPDATE appointment SET status='Approved' WHERE appointmentid='$_GET[approveid]'";
$qsql=mysqli_query($con,$sql);
if(mysqli_affected_rows($con) == 1)
{
echo "<script>alert('Appointment record Approved successfully..');</script>";
}
}
?>
<div class="container-fluid">
<div class="block-header">
<h2 class="text-center">View Appointments - Approved</h2>
</div>
<div class="card">
<section class="container">
<table class="table table-bordered table-striped table-hover js-basic-example dataTable">
<thead>
<tr>
<td>Patient Detail</td>
<td>Date & Time</td>
<td>Department</td>
<td>Doctor</td>
<td>Appointment Reason</td>
<td>Status</td>
<td><div align="center">Action</div></td>
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM appointment WHERE (status='Approved' OR status='Active')";
if(isset($_SESSION['patientid']))
{
$sql = $sql . " AND patientid='$_SESSION[patientid]'";
}
if(isset($_SESSION['doctorid']))
{
$sql = $sql . " AND doctorid='$_SESSION[doctorid]'";
}
$qsql = mysqli_query($con,$sql);
while($rs = mysqli_fetch_array($qsql))
{
$sqlpat = "SELECT * FROM patient WHERE patientid='$rs[patientid]'";
$qsqlpat = mysqli_query($con,$sqlpat);
$rspat = mysqli_fetch_array($qsqlpat);
$sqldept = "SELECT * FROM department WHERE departmentid='$rs[departmentid]'";
$qsqldept = mysqli_query($con,$sqldept);
$rsdept = mysqli_fetch_array($qsqldept);
$sqldoc= "SELECT * FROM doctor WHERE doctorid='$rs[doctorid]'";
$qsqldoc = mysqli_query($con,$sqldoc);
$rsdoc = mysqli_fetch_array($qsqldoc);
echo "<tr>
<td> $rspat[patientname]<br> $rspat[mobileno]</td>
<td> $rs[appointmentdate] $rs[appointmenttime]</td>
<td> $rsdept[departmentname]</td>
<td> $rsdoc[doctorname]</td>
<td> $rs[app_reason]</td>
<td> $rs[status]</td>
<td><div align='center'>";
if($rs['status'] != "Approved")
{
if(!(isset($_SESSION['patientid'])))
{
echo "<a href='appointmentapproval.php?editid=$rs[appointmentid]' class='btn btn-raised g-bg-cyan>Approve</a><hr>";
}
echo " <a href='viewappointment.php?delid=$rs[appointmentid]' class='btn btn-raised g-bg-blush2'>Delete</a>";
}
else
{
echo "<a href='patientreport.php?patientid=$rs[patientid]&appointmentid=$rs[appointmentid]' class='btn btn-raised bg-cyan'>View Report</a>";
}
echo "</center></td></tr>";
}
?>
</tbody>
</table>
</section>
</div>
</div>
<?php
include("adformfooter.php");
?>