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.129.249.240
Current Path : /var/www/html/oums/api/ |
| Current File : /var/www/html/oums/api/getEmpAttListDetDaily.php |
<?php
include("sys_connect.php");
if(!isset($_GET["emplcode"]) || !isset($_GET["month"]) || !isset($_GET["year"]) || !isset($_GET["date"])
|| $_GET["emplcode"] == "" || $_GET["month"] == "" || $_GET["year"] == "" || $_GET["date"] == "" ){
echo json_encode(array("msg" => "Invalid Params", "error_code" => -1));
die();
}
$emplcode = $_GET["emplcode"];
$month = $_GET["month"];
$year = $_GET["year"];
$date = $_GET["date"];
$deptcode = $_GET["deptcode"];
$usertype = $_GET["usertype"];
$cond = "";
if(strtoupper($usertype) == 'ADMIN') {
$cond = "and d.fdeptcode = '{$deptcode}'";
} else {
$cond = "and e.frepthead = '{$emplcode}' and e.femplcode <> '{$emplcode}'";
}
$query = "select a.fattndate, a.fdeptcode, d.fdeptshrt as fdeptname, a.femplcode,
e.femplname, a.fattnstat, a.flogitime, a.flogidiff, a.flogotime
from attendance a inner join masempl e on a.femplcode = e.femplcode
inner join masdept d on a.fdeptcode = d.fdeptcode
where year(fattndate) = '{$year}' and month(fattndate) = '{$month}'
and day(fattndate) = '{$date}' {$cond}";
$myres = mysqli_query($mycon, $query);
$mycnt = mysqli_num_rows($myres);
if($mycnt > 0) {
$res = [];
$i = 0;
while($row = mysqli_fetch_assoc($myres)){
$res[$i] = $row;
$i++;
}
echo json_encode(array("error_code" => 0, 'data' => $res ));
}
else {
echo json_encode(array("error_code" => -1, 'data'=> [], 'msg' => "Data Not found!!!" ));
}
|