Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.137.186.186
Current Path : /var/www/html/oums/api/ |
| Current File : /var/www/html/oums/api/getAttendance.php |
<?php
include("sys_connect.php");
if(!isset($_GET["emplcode"]) || !isset($_GET["deptcode"])
|| $_GET["emplcode"] == "" || $_GET["deptcode"] == "" ){
echo json_encode(array("msg" => "Invalid Params", "error_code" => -1));
die();
}
$emplcode = $_GET["emplcode"];
$deptcode = $_GET["deptcode"];
// $query = "select a.fattndate, a.fdeptcode, a.femplcode, a.fattnstat,
// a.flogitime, a.flogotime
// from masdept m left join attendance a where fattndate = date(now())
// and fdeptcode = '{$deptcode}' and femplcode = '{$emplcode}'";
$query = "select m.fdeptcode, m.fdeptname, m.flogitime as flogintime, m.flogotime as flogouttime,
ifnull(a.fattndate,date_format(date(now()), '%d/%m/%Y')) as fattndate,
ifnull(a.fdeptcode,'') as fdeptcode, ifnull(a.femplcode, '') as femplcode,
ifnull(a.fattnstat,'') as fattnstat, ifnull(a.flogitime,'00:00:00') as flogitime,
ifnull(a.flogotime,'00:00:00') as flogotime
from masdept m left join attendance a on a.fdeptcode = m.fdeptcode
and fattndate = date(now()) and femplcode = '{$emplcode}'
where m.fdeptcode = '{$deptcode}'";
$myres = mysqli_query($mycon, $query);
$row = mysqli_fetch_assoc($myres);
$mycnt = mysqli_num_rows($myres);
if($mycnt == 0) {
echo json_encode(array("error_code" => -1, "msg" => "Not Logged In." ));
}
else {
echo json_encode(array("error_code" => 0, 'data'=> $row ));
}
|