-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.php
372 lines (334 loc) · 9.97 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<?php require_once('check_login.php');?>
<?php include('head.php');?>
<?php include('header.php');?>
<?php include('sidebar.php');?>
<?php include('connect.php');?>
<?php
include('connect.php');
$sql = "select * from admin where id = '".$_SESSION["id"]."'";
$result=$conn->query($sql);
$row1=mysqli_fetch_array($result);
?>
<div class="pcoded-content">
<div class="pcoded-inner-content">
<div class="main-body">
<div class="page-wrapper full-calender">
<div class="page-body">
<div class="row">
<?php
$sql_manage = "select * from manage_website";
$result_manage = $conn->query($sql_manage);
$row_manage = mysqli_fetch_array($result_manage);
?>
<?php if($_SESSION['user'] == 'admin'){ ?>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-green update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white">
<?php
$sql = "SELECT * FROM patient WHERE status='Active' and delete_status='0'";
$qsql = mysqli_query($conn,$sql);
echo mysqli_num_rows($qsql);
?>
</h4>
<h6 class="text-white m-b-0">Total Patient</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-2" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-pink update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white">
<?php
$sql = "SELECT * FROM doctor WHERE status='Active' and delete_status='0'";
$qsql = mysqli_query($conn,$sql);
echo mysqli_num_rows($qsql);
?>
</h4>
<h6 class="text-white m-b-0">Total Doctor</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-3" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-lite-green update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white">
<?php
$sql = "SELECT * FROM admin WHERE delete_status='0'";
$qsql = mysqli_query($conn,$sql);
echo mysqli_num_rows($qsql);
?>
</h4>
<h6 class="text-white m-b-0">Performing Admin
</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-4" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-yellow update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white"> ₹.
<?php
$sql = "SELECT sum(bill_amount) as total FROM `billing_records` ";
$qsql = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_assoc($qsql))
{
echo $row['total'];
}
?>
</h4>
<h6 class="text-white m-b-0">Clinic Earning</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-1" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<?php }else if($_SESSION['user'] == 'doctor'){ ?>
<div class="row col-sm-12"><h3>Welcome <?php echo ''.$_SESSION['fname']; ?></h3><br><br></div>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-green update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white">
<?php
$sql = "SELECT * FROM appointment WHERE `doctorid`=1 AND appointmentdate=' ".date("Y-m-d")."' and delete_status='0'";
$qsql = mysqli_query($conn,$sql);
echo mysqli_num_rows($qsql);
?>
</h4>
<h6 class="text-white m-b-0">New Appoiment</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-2" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-pink update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white">
<?php
$sql = "SELECT * FROM patient WHERE status='Active' and delete_status='0'";
$qsql = mysqli_query($conn,$sql);
echo mysqli_num_rows($qsql);
?>
</h4>
<h6 class="text-white m-b-0">Number of Patient</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-3" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-lite-green update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white">
<?php
$sql = "SELECT * FROM appointment WHERE status='Active' AND `doctorid`=1 AND appointmentdate=' ".date("Y-m-d")."' and delete_status='0'" ;
$qsql = mysqli_query($conn,$sql);
echo mysqli_num_rows($qsql);
?>
</h4>
<h6 class="text-white m-b-0">Today's Appoinment
</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-4" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6">
<div class="card bg-c-yellow update-card">
<div class="card-block">
<div class="row align-items-end">
<div class="col-8">
<h4 class="text-white">₹.
<?php
$sql = "SELECT sum(bill_amount) as total FROM `billing_records` WHERE `bill_type` = 'Consultancy Charge'" ;
$qsql = mysqli_query($conn,$sql);
while ($row = mysqli_fetch_assoc($qsql))
{
echo $row['total'];
}
?>
</h4>
<h6 class="text-white m-b-0">Total Earning Earning</h6>
</div>
<div class="col-4 text-right">
<canvas id="update-chart-1" height="50"></canvas>
</div>
</div>
</div>
</div>
</div>
<?php }else if($_SESSION['user'] == 'patient'){
$sqlpatient = "SELECT * FROM patient WHERE patientid='$_SESSION[patientid]' ";
$qsqlpatient = mysqli_query($conn,$sqlpatient);
$rspatient = mysqli_fetch_array($qsqlpatient);
$sqlpatientappointment = "SELECT * FROM appointment WHERE patientid='$_SESSION[patientid]' ";
$qsqlpatientappointment = mysqli_query($conn,$sqlpatientappointment);
$rspatientappointment = mysqli_fetch_array($qsqlpatientappointment);
?>
<div class="row col-lg-12"><h3><b>Dashboard</b></h3></div>
<div class="row col-lg-12">Welcome to Polyclinic<br><br></div>
<div class="card row col-lg-12">
<div class="card-block">
<!-- Row start -->
<div class="row">
<div class="col-lg-12">
<div class="sub-title"><h2>Welcome <?php echo ''.$_SESSION['fname']; ?> !!</h2></div>
<!-- Nav tabs -->
<ul class="nav nav-tabs md-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#home3" role="tab">Registration History</a>
<div class="slide"></div>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#profile3" role="tab">Appointment</a>
<div class="slide"></div>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content card-block">
<div class="tab-pane active" id="home3" role="tabpanel">
<p class="m-0"><b>Registration History</b>
<h3>You are with us from <?php echo $rspatient['admissiondate']; ?>
<?php echo $rspatient['admissiontime']; ?></h3></p>
</div>
<div class="tab-pane" id="profile3" role="tabpanel">
<p class="m-0">
<b>Appointment</b>
<?php
if(mysqli_num_rows($qsqlpatientappointment) == 0)
{
?>
<h3>Appointment records not found.. </h3>
<?php
}
else
{
?>
<h3>Last Appointment taken on - <?php echo $rspatientappointment['appointmentdate']; ?>
<?php echo $rspatientappointment['appointmenttime']; ?> </h3>
<?php
}
?>
</p>
</div>
</div>
</div>
</div>
<!-- Row end -->
</div>
</div>
<?php } ?>
</div>
<?php if($_SESSION['user'] == 'admin'){ ?>
<div class="card">
<div class="card-header">
<h2>Appointments</h2>
</div>
<div class="card-block">
<div class="table-responsive dt-responsive">
<table id="dom-jqry" class="table table-striped table-bordered nowrap">
<thead>
<tr>
<th>Patient detail</th>
<th>Appointment Date & Time</th>
<th>Department</th>
<th>Doctor</th>
<th>Reason</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<?php
$sql ="SELECT * FROM appointment WHERE (status !='') and delete_status='0'";
if(isset($_SESSION['patientid']))
{
$sql = $sql . " AND patientid='$_SESSION[patientid]'";
}
$qsql = mysqli_query($conn,$sql);
while($rs = mysqli_fetch_array($qsql))
{
$sqlpat = "SELECT * FROM patient WHERE patientid='$rs[patientid]' and delete_status='0'";
$qsqlpat = mysqli_query($conn,$sqlpat);
$rspat = mysqli_fetch_array($qsqlpat);
$sqldept = "SELECT * FROM department WHERE departmentid='$rs[departmentid]' and delete_status='0'";
$qsqldept = mysqli_query($conn,$sqldept);
$rsdept = mysqli_fetch_array($qsqldept);
$sqldoc= "SELECT * FROM doctor WHERE doctorid='$rs[doctorid]' and delete_status='0'";
$qsqldoc = mysqli_query($conn,$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></tr>";
}
?>
</tbody>
<tfoot>
<tr>
<th>Patient detail</th>
<th>Appointment Date & Time</th>
<th>Department</th>
<th>Doctor</th>
<th>Reason</th>
<th>Status</th>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include('footer.php');?>