<?php
require_once(__DIR__."/../includes/sysinit.php");
include("attendance.php");

$_attendance = new Attendance; //new class instance
$_attendance->hddnAttendanceId		= $_POST['hddnAttendanceId']	?? 0;
$_attendance->selUserCode			= $_POST['selUserCode']			?? 0;
$_attendance->edtAttendanceIn		= $_POST['edtAttendanceIn']		?? '';
$_attendance->edtAttendanceOut		= $_POST['edtAttendanceOut']	?? '';
$_attendance->edtAttendanceInLat	= $_POST['edtAttendanceInLat']	?? '';
$_attendance->edtAttendanceInLng	= $_POST['edtAttendanceInLng']	?? '';
$_attendance->edtAttendanceOutLat	= $_POST['edtAttendanceOutLat']	?? '';
$_attendance->edtAttendanceOutLng	= $_POST['edtAttendanceOutLng'] ?? '';
$_attendance->edtAttendanceInIp		= $_POST['edtAttendanceInIp']	?? '';
$_attendance->edtAttendanceOutIp	= $_POST['edtAttendanceOutIp']	?? '';

if ($_POST['action']=='0') $_attendance->addAttendance();
if ($_POST['action']=='1') $_attendance->updateAttendance();
if ($_POST['action']=='2') $_attendance->viewAttendance();
if ($_POST['action']=='3') $_attendance->editAttendance();
if ($_POST['action']=='4') $_attendance->deleteAttendance();
if ($_POST['action']=='5') $_attendance->checkIn();
if ($_POST['action']=='6') $_attendance->checkOut();
unset($_attendance);
