-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewappointment.php
172 lines (158 loc) · 5.07 KB
/
viewappointment.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
<?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>View Appointments</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>Appointment Date & Time</td>
<td>Department</td>
<td>Doctor</td>
<td>Reason</td>
<td>Status</td>
<td>Action</td>
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM appointment WHERE (status !='')";
if(isset($_SESSION[patientid]))
{
$sql = $sql . " AND patientid='$_SESSION[patientid]'";
}
$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> " . date("d-M-Y",strtotime($rs[appointmentdate])) . " " . date("H:i A",strtotime($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-sm btn-raised g-bg-cyan'>Approve</a><hr>";
}
echo " <a href='viewappointment.php?delid=$rs[appointmentid]' class='btn btn-sm btn-raised g-bg-blush2'>Delete</a>";
}
else
{
echo "<a href='patientreport.php?patientid=$rs[patientid]&appointmentid=$rs[appointmentid]'class='btn btn-sm btn-raised g-bg-blush3'>View Report</a>";
}
echo "</center></td></tr>";
}
?>
</tbody>
</table>
</section>
</div>
</div>
<?php
include("adformfooter.php");
?>
<div class="container-fluid">
<div class="block-header">
<h2>View Appointment records</h2>
</div>
<div class="card">
<section class="container">
<table class="table table-bordered table-striped table-hover js-basic-example dataTable">
<thead>
<tr>
<th>Patient detail</th>
<th>Appointment Date & Time</th>
<th>Department</th>
<th>Doctor</th>
<th>Reason</th>
<th>Status</th>
<th><div align="center">Action</div></th>
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM appointment WHERE (status !='')";
if(isset($_SESSION[patientid]))
{
$sql = $sql . " AND patientid='$_SESSION[patientid]'";
}
$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> " . date("d-M-Y",strtotime($rs[appointmentdate])) . " " . date("H:i A",strtotime($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]'>Approve</a><hr>";
}
echo " <a href='viewappointment.php?delid=$rs[appointmentid]'>Delete</a>";
}
else
{
echo "<a href='patientreport.php?patientid=$rs[patientid]&appointmentid=$rs[appointmentid]'>View Report</a>";
}
echo "</center></td></tr>";
}
?>
</tbody>
</table>
</section>
</div>
</div>
<?php
include("adformfooter.php");
?>