| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)pathways.org.hk/MIS20140127/old20140407/Attendance/ |
Upload File : |
<!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>