forked from Anthonyk3801/Elderly-Care-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadminReport.php
More file actions
191 lines (177 loc) · 7.3 KB
/
adminReport.php
File metadata and controls
191 lines (177 loc) · 7.3 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
<?php
session_start();
/*if(!isset($_SESSION['level'])) header('location:home.php');
if(isset($_SESSION['level'])){
if($_SESSION['level'] != 1 || $_SESSION['level'] != 2) header('location:extras/transfer.php');
};
*/
include 'db_connection.php';
if(isset($_POST['search'])) {
$sql = "SELECT * FROM PatientChecklist
where date='$_POST[date]'";
$result = $conn->query($sql);
}
$doctorName = 0;
$attendance = 0;
$time = 0;
$caregiverName = 0;
?>
<?php //TEMPLATES
include 'templates/header.html';
switch($_SESSION['level']) {
case '1':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/admin-side-bar.html';
break;
case '2':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/supervisor-side-bar.html';
break;
case '3':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/doctor-side-bar.html';
break;
case '4':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/caregiver-side-bar.html';
break;
case '5':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/patient-side-bar.html';
break;
case '6':
include 'templates/main-nav-bar.php';
include 'templates/main-grid-content-2columns.html';
include 'templates/familyMember-side-bar.html';
break;
default:
include 'templates/alert-message-before-login.html';
include 'templates/home-nav-bar.html';
include 'templates/main-grid-content-1column.html';
}
include 'templates/main-content.html';
?>
<!-- <link rel="stylesheet" href="CSS/patientStyles.css"> -->
<head>
<link rel="stylesheet" href="CSS/adminReport.css">
</head>
<h1 class="text-center mb-5">Admin’s Report</h1>
<hr>
<div class="mt-5 mb-5 text-dark text-end">
<form action="adminReport.php" method="post">
<label for="date">Date: </label>
<input class="text-end" type="date" name="date" id="date" value=<?php if(isset($_POST['search'])) echo $_POST['date'];?>>
<button class="btn btn-sm btn-info text-light mt-0 mb-1" type="submit" name="search" id="search" value="SEARCH">Search</button>
</form>
</div>
<div class="mb-5 pb-5 text-dark text-center">
<h2 class="text-start text-info mb-4">Missed Patient Activity</h2>
<table>
<tr>
<th class="p-2">Patient Name</th>
<th class="p-2">Patient ID</th>
<th class="p-2">Doctor Name</th>
<th class="p-2">Caregiver Name</th>
<th class="p-2">Appointment Time</th>
<th class="p-2">Attendend Appointment</th>
<th class="p-2">Breakfast</th>
<th class="p-2">Morning Med</th>
<th class="p-2">Lunch</th>
<th class="p-2">Lunch Med</th>
<th class="p-2">Dinner</th>
<th class="p-2">Night Med</th>
</tr>
<?php
while($res = mysqli_fetch_array($result)) {
//Getting all of the doctor information if there is an appointment
$sql="SELECT * FROM DoctorAppointments WHERE date='$_POST[date]' AND patientID=$res[patientID]";
$result2 = $conn->query($sql);
$appoint = $result2->fetch_assoc();
$cnt = mysqli_num_rows($result2);
if ( 0===$cnt ) {
$doctorName = "No App";
$attendance = "No App";
$time = "No App";
}else {
$sql="SELECT * FROM Employee WHERE employeeID = $appoint[doctorID]";
$result3 = $conn->query($sql);
$doc = $result3->fetch_assoc();
$doctorName = $doc['fName'] . " " . $doc['lName'];
$attendance = $appoint['attendance'];
$time = $appoint['time'];
}
if($res['breakfast'] == 0 || $res['lunch'] == 0 || $res['dinner'] == 0 || $res['morningMedCheck'] == 0 ||
$res['lunchMedCheck'] == 0 || $res['nightMedCheck'] == 0 || $attendance == 0){
//Getting the patients name from their ID
$sql = "SELECT * FROM Patient WHERE patientID = $res[patientID] AND approval = 1";
$result4 = $conn->query($sql);
$patient = $result4->fetch_assoc();
$group = $patient['groupID'];
//Getting name of the caregiver
$sql = "SELECT * FROM Roster WHERE date='$_POST[date]'";
$result5 = $conn->query($sql);
$care = $result5->fetch_assoc();
if($group == 1) $caregiverName = $care['careGiver1'];
if($group == 2) $caregiverName = $care['careGiver2'];
if($group == 3) $caregiverName = $care['careGiver3'];
if($group == 4) $caregiverName = $care['careGiver4'];
$sql="SELECT * FROM Employee WHERE employeeID = $caregiverName";
$result6 = $conn->query($sql);
$care = $result6->fetch_assoc();
echo "<tr>";
echo "<td>".$patient['fName'] . " " . $patient['lName'] . "</td>";
echo "<td>".$res['patientID']."</td>";
echo "<td>".$doctorName."</td>";
echo "<td>".$care['fName'] . " " . $care['lName'] . "</td>";
echo "<td>".$time."</td>";
if($attendance == 0) {
echo "<td class='center'> X </td>";
}elseif($attendance == 1){
echo "<td class='center'> ✔ </td>";
}else{
echo "<td> No App </td>";
}
if($res['breakfast'] == 0) {
echo "<td class='center'> X </td>";
}else{
echo "<td class='center'> ✔ </td>";
}
if($res['morningMedCheck'] == 0) {
echo "<td class='center'> X </td>";
}else{
echo "<td class='center'> ✔ </td>";
}
if($res['lunch'] == 0) {
echo "<td class='center'> X </td>";
}else{
echo "<td class='center'> ✔ </td>";
}
if($res['lunchMedCheck'] == 0) {
echo "<td class='center'> X </td>";
}else{
echo "<td class='center'> ✔ </td>";
}
if($res['dinner'] == 0) {
echo "<td class='center'> X </td>";
}else{
echo "<td class='center'> ✔ </td>";
}
if($res['nightMedCheck'] == 0) {
echo "<td class='center'> X </td>";
}else{
echo "<td class='center'> ✔ </td>";
}
}
}
?>
</table>
</div>
<?php // TEMPLATES
include 'templates/end-main-content.html';
include 'templates/footer.html';
?>