-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathindex.php
More file actions
185 lines (167 loc) · 7.97 KB
/
index.php
File metadata and controls
185 lines (167 loc) · 7.97 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
<?php
// error_reporting(0);
include 'db/config.php';
function x_week_range($scdate) {
$ts = strtotime($scdate);
$start = (date('w', $ts) == 0) ? $ts : strtotime('last sunday', $ts);
return array(date('Y-m-d', $start),
date('Y-m-d', strtotime('next saturday', $start)));
}
function sumRamtValues($values) {
$sum = 0;
foreach ($values as $value) {
// Remove unwanted characters from the value
$cleanedValue = preg_replace("/[^0-9.]/", "", $value);
// Convert the cleaned value to a float and add it to the sum
$sum += floatval($cleanedValue);
}
return $sum;
}
$date = date('Y-m-d');
list($start_date, $end_date) = x_week_range($date);
$query = "SELECT tzone, COUNT(*) AS count FROM std_info GROUP BY tzone";
$result1 = mysqli_query($conn, $query);
$countSum = 0;
// Calculate the sum of count values
while ($row = mysqli_fetch_assoc($result1)) {
$count = $row['count'];
$countSum += $count;
}
$percentageComposition = array();
$query = "SELECT tzone, COUNT(*) AS count FROM std_info GROUP BY tzone";
$result1 = mysqli_query($conn, $query);
// Calculate the percentage composition
while ($row = mysqli_fetch_assoc($result1)) {
$tzone = $row['tzone'];
$count = $row['count'];
$percentage = ($count / $countSum ) * 100;
$dataPoints[] = array("label" => $tzone, "y" => $percentage);
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="css/style.css">
<link href="https://unpkg.com/boxicons@2.0.7/css/boxicons.min.css" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="img/favicon.png">
<title>Dashboard</title>
<script>
window.onload = function() {
var chart = new CanvasJS.Chart("chartContainer", {
animationEnabled: true,
title: {
text: "Number of students timezone wise"
},
data: [{
type: "pie",
yValueFormatString: "#,##0.00\"%\"",
indexLabel: "{label} ({y})",
dataPoints: <?php echo json_encode($dataPoints, JSON_NUMERIC_CHECK); ?>
}]
});
chart.render();
}
</script>
</head>
<body>
<div class="home">
<div class="wrapper">
<div class="menu">
<h2><i class='bx bxs-dashboard'></i> DASHBOARD</h2>
<ul class="menu-adjust">
<li class="active"><a href="index.php"><i class='bx bx-home' ></i> Home</a></li>
<li><a href="students/student.php"><i class='bx bxs-group' ></i> Students</a></li>
<li class="sch-menu">
<a href="report/session.php"><i class='bx bxs-report'></i> Reports <i class='bx bx-chevron-right' ></i></a>
<ul class="sub-sch">
<li><a style="font-size: 18px;" href="report/session.php"> Session</a> </li>
<li><a style="font-size: 18px;" href="report/progress.php"> Progress</a> </li>
</ul>
</li>
<li class="sch-menu">
<a href="schedule/daily.php"><i class='bx bx-calendar'></i> Schedule <i class='bx bx-chevron-right' ></i></a>
<ul class="sub-sch">
<li><a style="font-size: 18px;" href="schedule/daily.php"> Daily</a> </li>
<li><a style="font-size: 18px;" href="schedule/weekly.php"> Weekly</a> </li>
</ul>
</li>
<li class="sch-menu">
<a href="payment/history.php"><i class='bx bx-money'></i> Billing <i class='bx bx-chevron-right' ></i></a>
<ul class="sub-sch">
<li><a style="font-size: 18px;" href="payment/new.php"> Add new</a> </li>
<li><a style="font-size: 18px;" href="payment/history.php"> History</a> </li>
</ul>
</li>
<li><a href="https://app.ziteboard.com/" target="_blank"><i class='bx bx-chalkboard' ></i> Ziteboard</a></li>
<li><a href="https://google.com" target="_blank"><i class='bx bxl-google' ></i>oogle</a></li>
</ul>
</div>
<div class="main-content">
<div class="header">
<h4>HOME</h4>
</div>
<div class="content-card">
<div class="overview-boxes">
<div class="box">
<div class="right-side">
<div class="box-topic">Records</div>
<div class="number"><?php $sql="SELECT COUNT(1) FROM std_info"; $result = mysqli_query($conn, $sql); $row=mysqli_fetch_array($result); echo $row['0']; ?></div>
<div class="brief">
<span class="text">Total number of students</span>
</div>
</div>
<i class='bx bx-user ico' ></i>
</div>
<div class="box">
<div class="right-side">
<div class="box-topic">Today's session</div>
<div class="number"><?php $sql="SELECT COUNT(1) FROM schedule WHERE scdate='$date'"; $result = mysqli_query($conn, $sql); $row=mysqli_fetch_array($result); echo $row['0']; ?></div>
<div class="brief">
<span class="text">Number of sessions today</span>
</div>
</div>
<i class='bx bxs-book-open ico three' ></i>
</div>
<div class="box">
<div class="right-side">
<div class="box-topic">Unpaid bills</div>
<div class="number"><?php $sql = "SELECT COUNT(DISTINCT bid) AS total FROM bill WHERE complete = '0'"; $result = mysqli_query($conn, $sql); $row=mysqli_fetch_array($result); echo $row['0']; ?></div>
<div class="brief">
<span class="text">Number of pending bills</span>
</div>
</div>
<i class='bx bx-error ico five'></i>
</div>
<div class="box">
<div class="right-side">
<div class="box-topic">Income</div>
<div class="number"><?php
$sql="SELECT bid, ramt FROM bill GROUP BY bid;";
$result = mysqli_query($conn, $sql);
if ($result){
$ramtValues = array();
while ($row = mysqli_fetch_array($result)) {
$ramtValues[] = $row['ramt'];
}
}
echo sumRamtValues($ramtValues). " $";
?></div>
<div class="brief">
<span class="text">Total amount of money earned</span>
</div>
</div>
<i class='bx bx-wallet-alt ico four' ></i>
</div>
</div>
<!-- <div id="chartContainer" style="height: 370px; width: 100%;"></div> -->
<!-- uncomment if you need the chart for statics -->
</div>
</div>
</div>
</div>
<script src="https://cdn.canvasjs.com/canvasjs.min.js"></script>
</body>
</html>