-
Notifications
You must be signed in to change notification settings - Fork 1
/
report_copy.php
131 lines (113 loc) · 4.4 KB
/
report_copy.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
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript">
google.charts.load("current", {packages:['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
["Element", "Density", { role: "style" } ],
["", 0, ""],
// ["bb", 2, "blue"],
// ["Gold", 19.30, "blue"],
// ["Platinum", 21.45, "blue"]
// ]);
<?php
$color = "blue";
$conn = mysqli_connect("localhost", "root", "", "vaccineregistration");
$query = "SELECT center_district_name, count(*) AS counter FROM bookedSlots GROUP BY center_district_name";
$result = mysqli_query($conn, $query) or die(mysql_error());
// Print out result
if(mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_array($result)) {
// echo gettype($row['center_district_name'])." ".gettype((int)$row['counter'])."<br>";
echo "['".$row['center_district_name']."', '".(int)$row['counter']."', '".$color."'],";
// echo "There are ". $row['counter'] ." ". $row['center_district_name'] ." slots";
// echo "<br />";
}
}
?>
]);
var view = new google.visualization.DataView(data);
view.setColumns([0, 1,
{ calc: "stringify",
sourceColumn: 1,
type: "string",
role: "annotation" },
2]);
var options = {
// title: "Density of Precious Metals, in g/cm^3",
width: 600,
height: 400,
bar: {groupWidth: "95%"},
legend: { position: "none" },
};
var chart = new google.visualization.ColumnChart(document.getElementById("columnchart_values"));
chart.draw(view, options);
}
</script>
</head>
<body>
<!-- Registrations Today -->
<?php
$conn = mysqli_connect("localhost", "root", "", "vaccineregistration");
$date = date("Y-m-d", strtotime('+1 day'));
$sql = "SELECT COUNT(*) as total FROM bookedSlots WHERE vaccine_date='$date' ";
$result = mysqli_query($conn, $sql);
$data = mysqli_fetch_array($result);
echo "Registrations Today: ".$data['total'];
//Vaccinations Taken Today
$date = date("Y-m-d");
$sql = "SELECT COUNT(*) as total FROM bookedSlots WHERE vaccine_date='$date' ";
$result = mysqli_query($conn, $sql);
$data = mysqli_fetch_array($result);
echo "<br>Vaccination Today: ".$data['total'];
?>
<!-- Partially and FuLLY Vaccinated today -->
<?php
$conn = mysqli_connect("localhost", "root", "", "vaccineregistration");
$sql = " SELECT name, COUNT(ID) as total FROM bookedSlots GROUP BY account_name, name";
$result = mysqli_query($conn, $sql);
$parital_vaccinated = 0;
$fully_vaccinated = 0;
while($row = mysqli_fetch_array($result)) {
if($row['total'] == 1) {
$parital_vaccinated = $parital_vaccinated + 1;
} else {
$fully_vaccinated = $fully_vaccinated + 1;
}
}
echo "<br>Partiallly Vaccinated: ".$parital_vaccinated."<br>";
echo "Fully Vaccinated: ".$fully_vaccinated."<br>";
?>
<!-- Total Registrations(Month) -->
<?php
$conn = mysqli_connect("localhost", "root", "", "vaccineregistration");
$sql = "SELECT count(ID) as cnt, MONTH(vaccine_date) as mnt FROM bookedSlots
GROUP BY MONTH(vaccine_date)";
$result = mysqli_query($conn, $sql);
while($row = mysqli_fetch_array($result)) {
echo "<br> ".$row['cnt']. " ".$row['mnt'];
}
?>
<!-- Vaccination by District -->
<?php
$conn = mysqli_connect("localhost", "root", "", "vaccineregistration");
$query = "SELECT center_district_name, count(*) AS counter FROM bookedSlots GROUP BY center_district_name";
$result = mysqli_query($conn, $query) or die(mysql_error());
echo "<br>";
// Print out result
while($row = mysqli_fetch_array($result)) {
echo "There are ". $row['counter'] ." ". $row['center_district_name'] ." slots";
echo "<br />";
}
?>
<!-- No of doses vs date -->
<div>
<iframe src="report2.php" height="400" width="600" title="Iframe Example" style="margin-left: 700px; margin-top: -50px;"></iframe>
</div>
<!-- Doses Vs district -->
<div id="columnchart_values" style="width: 900px; height: 300px; float:left;"></div>
</body>
</html>