Add date filtering to attendance queries in LogController

This commit is contained in:
2025-06-30 15:06:12 +07:00
parent a90441e9fd
commit c3f9afc61e
2 changed files with 5 additions and 4 deletions

View File

@ -66,7 +66,7 @@ class LogController
$qry="select t.endtimestr,a.* $qry="select t.endtimestr,a.*
from tbl_employee e inner join tbl_attendanceemployee a on e._idx=a.idxemployee from tbl_employee e inner join tbl_attendanceemployee a on e._idx=a.idxemployee
inner join tbl_attendancethreshold t on e.idxdept=t.idxdept and t.attendancename=a.attendancename and a.shiftcode=t.shiftcode inner join tbl_attendancethreshold t on e.idxdept=t.idxdept and t.attendancename=a.attendancename and a.shiftcode=t.shiftcode
where a.isdeleted=0 and t.isdeleted=0 and e.isdeleted=0 and t.attendancename='IN'"; where a.isdeleted=0 and t.isdeleted=0 and e.isdeleted=0 and t.attendancename='IN' and cast(a.dates as date)=cast(now() as date)";
$rs=$this->selectquerySP($qry); $rs=$this->selectquerySP($qry);
if($rs){ if($rs){
while($rw=$rs->fetch()){ while($rw=$rs->fetch()){
@ -88,7 +88,7 @@ class LogController
} }
// === Update tbl_attendancelist for lateemployee // === Update tbl_attendancelist for lateemployee
$qry="update tbl_attendancelist t, tbl_attendanceemployee a set t.lateperemployee=a.totallateperemp $qry="update tbl_attendancelist t, tbl_attendanceemployee a set t.lateperemployee=a.totallateperemp
where a._idx=t.idxattendance and a.totallateperemp<>t.lateperemployee"; where a._idx=t.idxattendance and a.totallateperemp<>t.lateperemployee and cast(a.dates as date)=cast(now() as date)";
// echo $qry."\n"; // echo $qry."\n";
$this->executeSP($qry); $this->executeSP($qry);
} }

View File

@ -66,7 +66,8 @@ class LogController
$qry="select t.endtimestr,a.* $qry="select t.endtimestr,a.*
from tbl_employee e inner join tbl_attendanceemployee a on e._idx=a.idxemployee from tbl_employee e inner join tbl_attendanceemployee a on e._idx=a.idxemployee
inner join tbl_attendancethreshold t on e.idxdept=t.idxdept and t.attendancename=a.attendancename and a.shiftcode=t.shiftcode inner join tbl_attendancethreshold t on e.idxdept=t.idxdept and t.attendancename=a.attendancename and a.shiftcode=t.shiftcode
where a.isdeleted=0 and t.isdeleted=0 and e.isdeleted=0 and a.attendancename='R2'"; where a.isdeleted=0 and t.isdeleted=0 and e.isdeleted=0 and a.attendancename='R2'
and cast(a.dates as date)=cast(now() as date)";
$rs=$this->selectquerySP($qry); $rs=$this->selectquerySP($qry);
if($rs){ if($rs){
while($rw=$rs->fetch()){ while($rw=$rs->fetch()){
@ -87,7 +88,7 @@ class LogController
} }
} }
$qry="update tbl_attendancelist t, tbl_attendanceemployee a set t.lateperemployeer2=a.totallateperempr2 $qry="update tbl_attendancelist t, tbl_attendanceemployee a set t.lateperemployeer2=a.totallateperempr2
where a._idx=t.idxattendance and a.totallateperempr2<>t.lateperemployeer2"; where a._idx=t.idxattendance and a.totallateperempr2<>t.lateperemployeer2 and cast(a.dates as date)=cast(now() as date)";
// echo $qry."\n"; // echo $qry."\n";
$this->executeSP($qry); $this->executeSP($qry);
return $rtn; return $rtn;