-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattendance.php
155 lines (134 loc) · 6.44 KB
/
attendance.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.attendance{
padding-right: 1rem;
font-size: 14px;
}
.response-btn{
background-color: var(--bs-body-color);
color: white;
border-radius: 10px;
border: 2px solid var(--bs-body-color);
}
.response-btn:hover{
box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px;
background-color: rgb(80,100,100);
}
.error{
display: inline;
color: red;
}
</style>
<?php
$activeMenu="attendance";
include_once("includes/admin-menu.php");
require_once("includes/database.php");
if ($_SERVER['REQUEST_METHOD'] == "POST"){
$cust_id="";
foreach($_POST as $key=>$value){
$cust_id = $key;
$sUpdate = "UPDATE customer
SET no_show = ".$conn->quote($value)
."WHERE customerid = ".$conn->quote($cust_id);
echo $sUpdate;
// $UpdateResult = $conn->exec($sUpdate);
}
}
?>
<main class="content">
<div class="container-fluid p-0">
<div class="mb-3">
<h1 class="h3 d-inline align-middle">View Attendance Of Customer</h1>
</div>
<div class="card flex-fill">
<div class="card-header">
<h5 class="card-title mb-0">Attendance Sheet</h5>
</div>
<table class="table table-hover my-0">
<thead>
<tr>
<th>Customer Name</th>
<th>Appointment Date</th>
<th>Services</th>
<th>Stylist</th>
<th>Attendance</th>
</tr>
</thead>
<tbody>
<?php
$sSelect = 'SELECT customer.customerid,concat(customer.first_name," ",customer.last_name) AS Customername,concat(barber.first_name," ",barber.last_name) AS Stylist,transactions.transactionid,appointment.appointmentdate
FROM appointment,transactions,barber,customer
WHERE transactions.transactionid = appointment.transactionid
AND appointment.barberid = barber.barberid
AND transactions.customerid = customer.customerid
AND appointment.appointmentdate = CURRENT_DATE
AND TIMEDIFF(appointment.start_time,CURRENT_TIME) > 0;';
$result = $conn->query($sSelect);
$rowcount = $result->rowcount();
//$rowcount = 0;
if ($rowcount == 0){
echo "<td colspan=\"100%\" style=\"text-align: center;\"> No appointment on file </td>";
}
else{
while($row = $result->fetch()){
echo "<tr>";
$customerid = $row['customerid'];
echo "<td>".$row['Customername']."</td>";
echo "<td>".$row['appointmentdate']."</td>";
$serviceSQL=" SELECT service.name
FROM appointmentdetails,service
WHERE service.serviceid=appointmentdetails.serviceid
AND transactionid=".$row["transactionid"].";";
$serviceResults=$conn->query($serviceSQL);//USE PREPARED STATEMENTS AFTERWARDS
$services=$serviceResults->fetchall();
$string="";
for($j=0;$j<sizeof($services)-1;$j++){
$string.=$services[$j]["name"].", ";
}
$string.=$services[sizeof($services)-1]["name"];
// echo $string;
echo "<td>".$string."</td>";
echo "<td>".$row['Stylist']."</td>";
echo '<td>
<form action="attendance.php" method="post" >
<input type="radio" id="show" name="'. "$customerid" .'" value="0" >
<label for="show" class = "attendance">Present</label>
<input type="radio" id="no_show" name="'. "$customerid" .'" value="1" >
<label for="no_show" class = "attendance">Absent</label>
</td>';
echo "</tr>";
}
}
?>
<!-- <tr>
<td>Kezhilen Motean</td>
<td>2022-03-25</td>
<td>Shave,Long Cut</td>
<td>Keelan Cannoo</td>
<td>
<form action="attendance.php" method="get" >
<input type="radio" id="show" name="attendance" value="0" >
<label for="show" class = "attendance">Present</label>
<input type="radio" id="no_show" name="attendance" value="1" >
<label for="no_show" class = "attendance">Absent</label>
</td>
</tr> -->
</tbody>
</table>
<div class="btn-containers">
<input type="submit" value = "Confirm" class="btn btn-secondary" style="width: 7%; margin: 1rem; padding: 0.1rem;">
<input type="Reset" value = "Reset" class="btn btn-secondary" style="width: 7%; margin: 1rem; padding: 0.1rem;">
</div>
</form>
</div>
</main>
</div><!--end of main div-->
</div><!--end of wrapper div-->
</body>
</html>