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
|
<!DOCTYPE html> <html> <head> <?php require_once '../include/head.php'; ?> <?php require_once '../include/checkuser.php'; ?> <?php require_once '../include/Nav_bar.php'; ?> <?php include_once '../include/DBConnect.php'; ?> <script> $(function() { $('#searchtype').change(function() { var searchtype = $('#searchtype').val(); $.get('attendance_add_type_ajax.php?searchtype=' + searchtype, stff); }); function stff(res) { $('#searchtype_tr').html(res); } ; $('.date-picker').datetimepicker({pickTime: false}); $('#search_form').validate(); $('.time').timepicker({'step': 15, 'timeFormat': 'H:i', 'minTime': '06:00', 'maxTime': '23:30'}); $('.staff').select2(); $('.student').select2(); }); </script> <style> .div-background { border: 1px solid #E6E6E6; border-radius: 6px 6px 6px 6px; background-color: #EEEFDE; padding-top: 10px; padding-bottom: 10px; } </style> </head> <body> <?php $selectdate = date('Y-m-d'); $today = date('Y-m-d'); if (isset($_POST['addattendance'])) { $pid = NULL; $in_time = $_POST['selecteddate'] . ' ' . $_POST['in_time'] . ':00'; $out_time = $_POST['selecteddate'] . ' ' . $_POST['out_time'] . ':00'; $insert_true = false; if (isset($_POST['student']) && $_POST['student'] != 'ALL') { $pid = $_POST['student']; $insert_true = true; } else if (isset($_POST['staff']) && $_POST['staff'] != 'ALL') { $pid = $_POST['staff']; $insert_true = true; } if ($insert_true == true) { $sth = $dbh->prepare("INSERT INTO `attendpunch`(`deviceid`, `empid`, `punchtime`) VALUES (1,?,?)"); $sth->bindParam(1, $pid); $sth->bindParam(2, $in_time); $sth->execute();
$sth = $dbh->prepare("INSERT INTO `attendpunch`(`deviceid`, `empid`, `punchtime`) VALUES (1,?,?)"); $sth->bindParam(1, $pid); $sth->bindParam(2, $out_time); $sth->execute();
echo "<script>alert('Insert data successful.')</script>"; echo("<script>location.href ='attendance_index.php';</script>"); } else { echo "<script>alert('Plz select a type for selcet a student or staff.')</script>"; } } ?> <!-- line between nav bar and content --> <div class="text-right"> <ul class="breadcrumb"> <li class="active">Add Daily Attendance</li> </ul> </div>
<div class="container-fluid div-background"> <h3>Add Daily Attendance</h3> <form id="form" class="form-inline" action="" method="POST"> <table width="1300px"> <tr> <td width="20%"> Type </td> <td> <div class="pathways-inline-block"> <select name="searchtype" id="searchtype"> <option></option> <option value="1">Staff</option> <option value="2">Student</option> </select> </div> </td> </tr> <tr style="height: 15px"></tr>
<tbody id="searchtype_tr"> <tr></tr> </tbody> <tr style="height: 15px"></tr> <tr> <td width="20%"> Day </td> <td > <div class="input-append date-picker"> <input id="end_date" class="dateISO" type="text" maxlength="200" data-format="yyyy-MM-dd" name="selecteddate" style="width:90px" value="<?= $today ?>"> <span class="add-on"> <i class="icon-calendar" data-date-icon="icon-calendar" data-time-icon="icon-time"></i> </span> </div> </td> </tr> <tr style="height: 15px"></tr> <tr> <td width="20%"> Intime </td > <td > <input type="text" class="time" name = "in_time" style = "width:45px"> </td> </tr> <tr style="height: 15px"></tr> <tr> <td width="20%"> OutTime </td> <td > <input type="text" class="time" name = "out_time" style = "width:45px"> </td> </tr> <tr style="height: 15px"></tr> </table> <div class="input-append date-picker"> <button class="btn" name="addattendance" value="addattendance" style="margin-left:30px" type="submit">Save</button> </div> </form> </div> <!-- /container --> </body> </html>
|