-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.php
96 lines (92 loc) · 2.47 KB
/
report.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
<!DOCTYPE html>
<html>
<head>
<title>Patient Report</title>
</head>
<style>
#report_table, th, td {
border: 1px solid black;
text-align: center;
}
#all_table {
position: absolute;
top: 20%;
left: 22%;
vertical-align: middle;
float: left;
border-collapse: separate;
border-spacing: 30px;
}
div#back {
position: absolute;
top: 80%;
left: 80%;
}
</style>
<body>
<!-- <h2>Patient Report: <?php //echo date("Y-m-d") ?></h2> -->
<div style = 'text-align: center;'>
<h2>Patient Report: 2021-3-20</h2>
</div>
<?php
$con = new mysqli('localhost','root','mysql','test');
if (!$con) {die('Cannot connect' .mysqli_connect_error());}
$get_report = mysqli_query($con, "select Fname, Lname, AptResult, Manufacture, Date from appointments left join patient on "
. "(appointments.patientid = patient.patientid) left join doses on "
. "(appointments.doseid = doses.doseid) order by AptResult, Date Asc");
$vaccinated = array();
$reserved = array();
$waitlist = array();
while ($report = $get_report->fetch_array()) {
if ($report['AptResult'] == 'reserved') {
if ($report['Date'] < '2021-03-20') {
array_push($vaccinated, $report);
} else {
array_push($reserved, $report);
}
} else {
array_push($waitlist, $report);
}
}
$patient_report = array($vaccinated, $reserved, $waitlist);
echo "<table id = 'all_table'> <tr>";
for ($i = 0; $i < 3; $i++) {
echo "<td>";
$section = $patient_report[$i];
if ($i == 0) {
echo "<h3>Vaccinated Patient</h3>";
$col = "<th>Name</th> <th>Brand</th> <th>Date</th>";
} else if ($i == 1) {
echo "<h3>Reserved Patient</h3>";
$col = "<th>Name</th> <th>Brand</th> <th>Date</th>";
} else {
echo "<h3>Waitlisted Patient</h3>";
$col = "<th>Name</th>";
}
if (count($section) != 0) {
echo "<table id = 'report_table'>";
echo "<tr> " . $col . " </tr>";
for ($j = 0; $j < count($section); $j++) {
$r = $section[$j];
if ($i < 2) {
echo "<tr><td>" . $r['Fname'] . " " . $r['Lname'] . "</td><td>" . $r['Manufacture'] . "</td><td>" . $r['Date'] . "</td></tr>";
} else {
echo "<tr><td>" . $r['Fname'] . " " . $r['Lname'] . "</td><tr>";
}
}
echo "</table> <br>";
} else {
echo "No Patient in this report<br>";
}
echo "</td>";
}
echo "</tr></table>";
?>
<br>
<div id = "back">
<form method = "get" action = "signup.php">
<input type = "submit" value = "Back"></br>
</form>
</div>
</body>
</html>