-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreports.php
More file actions
executable file
·112 lines (105 loc) · 4.25 KB
/
Copy pathreports.php
File metadata and controls
executable file
·112 lines (105 loc) · 4.25 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
<?php
include './includes/toppart.php';
$bookingListSql = "SELECT * FROM bookings";
$summaryQueries = [
"bookingSummarySql" => "SELECT COUNT(*) FROM bookings",
"earningSummarySql" => "SELECT SUM(amount) FROM checkout",
"expenditureSummarySql" => "SELECT SUM(exp_amount) FROM expenditure",
"staffsSql" => "SELECT COUNT(*) FROM staff"
];
$resultArray = ["bookingSummarySql" => 0, "earningSummarySql" => 0, "expenditureSummarySql" => 0, "staffsSql" => 0];
foreach ($summaryQueries as $key => $query) {
if ($result = $conn->query($query)) {
$row = $result->fetch_assoc();
$resultArray[$key] = reset($row);
} else {
echo 'Error:' . $conn->error . ".<br>";
}
}
$result = $conn->query($bookingListSql);
$bookingsArr = [];
$i = 0;
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
$bookingsArr[] = $row;
}
}
?>
<div class="body-container">
<div id="sidebar-space" class="sidebar-space"></div>
<div class="container">
<div class="summary">
<h3>Lifetime Reports</h3>
<div class="summary-container">
<div class="box report-box" style="margin-left: 0;">
<div class="result">
<p><?php echo $resultArray["bookingSummarySql"] ?></p>
<p>Total Bookings</p>
</div>
<div class="icon-container">
<i class="fa-brands fa-font-awesome fa-2xl" style="color: var(--primary)"></i>
</div>
</div>
<div class="box report-box">
<div class="result">
<p><?php echo $resultArray["earningSummarySql"] == null ? '0' : $resultArray["earningSummarySql"] ?>
</p>
<p>Total Earning</p>
</div>
<div class="icon-container">
<i class="fa-solid fa-money-bills fa-2xl" style="color: var(--primary)"></i>
</div>
</div>
<div class="box report-box">
<div class="result">
<p><?php echo $resultArray["expenditureSummarySql"] == null ? '0' : $resultArray["expenditureSummarySql"] ?>
</p>
<p>Total Expenditure</p>
</div>
<div class="icon-container">
<i class="fa-solid fa-file-invoice-dollar fa-2xl" style="color: var(--primary)"></i>
</div>
</div>
<div class="box report-box" style="margin-right: 0;">
<div class="result">
<p><?php echo $resultArray["staffsSql"] ?></p>
<p>Total Staffs</p>
</div>
<div class="icon-container">
<i class="fa-solid fa-users fa-2xl" style="color:var(--primary)"></i>
</div>
</div>
</div>
</div>
<section class="page-container show-page">
<?php include './pages/_reports-pages/bookings.php'?>
</section>
<section class="page-container">
<?php include './pages/_reports-pages/earnings.php'?>
</section>
<section class="page-container">
<?php include './pages/_reports-pages/expenditure.php'?>
</section>
<section class="page-container">
<?php include './pages/_reports-pages/staff.php'?>
</section>
</div>
</div>
</main>
</body>
<script>
let pages = document.getElementsByClassName('box');
let container = Array.from(document.getElementsByClassName('page-container'));
for (let i = 0; i < pages.length; i++) {
pages[i].addEventListener('click', () => {
if (container[i].classList.contains('show-page'))
container[i].classList.add('show-page');
else{
container[i].classList.toggle('show-page');
const value = i;
container.filter((x,i) => i !== value).map(x => x.classList.remove('show-page'));
}
});
}
</script>
</html>