-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathreports.php
More file actions
228 lines (204 loc) · 8 KB
/
Copy pathreports.php
File metadata and controls
228 lines (204 loc) · 8 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?php
session_start();
if (!isset($_SESSION['user_id']) || $_SESSION['org_type'] !== 'restaurant') {
header("Location: index.html");
exit;
}
require 'db_connection.php';
// Query to fetch total donations and other metrics
$sql_total_donations = "SELECT COUNT(*) AS total_donations, SUM(quantity) AS total_quantity FROM food_donations WHERE restaurant_id = ?";
$stmt = $conn->prepare($sql_total_donations);
$stmt->bind_param("i", $_SESSION['user_id']);
$stmt->execute();
$result = $stmt->get_result();
$data = $result->fetch_assoc();
// Query for weekly donation statistics
$sql_weekly_donations = "SELECT WEEK(donation_date) AS week, SUM(quantity) AS weekly_quantity FROM food_donations WHERE restaurant_id = ? GROUP BY WEEK(donation_date) ORDER BY WEEK(donation_date) DESC LIMIT 4"; // Last 4 weeks
$stmt_weekly = $conn->prepare($sql_weekly_donations);
$stmt_weekly->bind_param("i", $_SESSION['user_id']);
$stmt_weekly->execute();
$weekly_result = $stmt_weekly->get_result();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Restaurant Donation Report</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="icon" href="Screenshot 2024-11-23 154406.png" type="image/x-icon" />
<link rel="stylesheet" href="css/style.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<style>
/* Add background image to the body */
body {
background-image: url('img/IMG1.webp');
background-size: cover;
background-position: center;
background-repeat: no-repeat;
color: white;
}
/* Optional: Add a background overlay with blur */
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
filter: blur(5px);
z-index: -1;
}
/* Table Styling */
.table-responsive {
margin-top: 30px;
}
/* Make table text white */
.table th, .table td {
text-align: center;
color: white;
}
.table-striped tbody tr:nth-child(odd) {
background-color: rgba(0, 0, 0, 0.5);
}
/* Styling for Claim button */
.claim-btn {
background-color: #007bff;
color: white;
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.claim-btn:hover {
background-color: #0056b3;
}
/* Navbar Styling */
.navbar {
background-color: rgba(0, 0, 0, 0.7);
}
.navbar-brand, .nav-link {
color: white !important;
}
.navbar-brand:hover, .nav-link:hover {
color: #ff5722 !important;
}
/* Footer Styling */
footer {
background-color: rgba(0, 0, 0, 0.7);
color: white;
padding: 20px 0;
margin-top: 50px;
}
footer .social a {
margin: 0 10px;
color: white;
font-size: 24px;
text-decoration: none;
}
footer .social a:hover {
color: #ff5722;
}
</style>
</head>
<body>
<!-- Background overlay -->
<div class="overlay"></div>
<!-- Navbar -->
<header>
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<a class="navbar-brand" href="restaurant_dashboard.php">PlatePromise</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="restaurant_dashboard.php">Dashboard</a>
</li>
<li class="nav-item">
<a class="nav-link" href="donations.php">Manage Donations</a>
</li>
<li class="nav-item">
<a class="nav-link" href="reports.php">Reports</a>
</li>
<li class="nav-item">
<a class="nav-link" href="logout.php">Logout</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<!-- Main Content -->
<div class="container mt-5">
<h1 class="text-center mb-4">Donation Report</h1>
<!-- Total Donations -->
<div class="row mb-4">
<div class="col-md-6">
<h4>Total Donations:</h4>
<p><?php echo htmlspecialchars($data['total_donations']); ?> donations made</p>
</div>
<div class="col-md-6">
<h4>Total Quantity Donated:</h4>
<p><?php echo htmlspecialchars($data['total_quantity']); ?> units of food donated</p>
</div>
</div>
<!-- Weekly Donations -->
<h4>Weekly Donations</h4>
<div class="table-responsive">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Week</th>
<th>Quantity Donated</th>
</tr>
</thead>
<tbody>
<?php while ($week_data = $weekly_result->fetch_assoc()) { ?>
<tr>
<td>Week <?php echo htmlspecialchars($week_data['week']); ?></td>
<td><?php echo htmlspecialchars($week_data['weekly_quantity']); ?> units</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
<!-- Footer -->
<footer>
<div class="container">
<div class="row">
<div class="col-lg-4">
<h4>PlatePromise Restaurant</h4>
<p>Address: 3, Near IT Park, Mahatma Gandhi Road, Bengaluru 560001</p>
<p>Contact No: <a href="tel:+91 986593359">+91 986593359</a></p>
<p>Email: <a href="mailto:[email protected]">[email protected]</a></p>
</div>
<div class="col-lg-4">
<h4>Important Links</h4>
<ul>
<li><a href="restaurant_dashboard.php">Dashboard</a></li>
<li><a href="donations.php">Manage Donations</a></li>
<li><a href="reports.php">Reports</a></li>
<li><a href="contact.php">Contact Us</a></li>
</ul>
</div>
<div class="col-lg-4">
<h4>Follow Us</h4>
<div class="social">
<a href="#"><i class="fa fa-facebook"></i></a>
<a href="#"><i class="fa fa-instagram"></i></a>
<a href="#"><i class="fa fa-twitter"></i></a>
</div>
</div>
</div>
</div>
</footer>
</body>
</html>