From c3f9afc61ef5320d67b08ba6793375ea3c0ac192 Mon Sep 17 00:00:00 2001 From: asansal Date: Mon, 30 Jun 2025 15:06:12 +0700 Subject: [PATCH] Add date filtering to attendance queries in LogController --- fixingcheckinlate.php | 4 ++-- fixingr2late.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fixingcheckinlate.php b/fixingcheckinlate.php index 4921dfc..d5adaf8 100644 --- a/fixingcheckinlate.php +++ b/fixingcheckinlate.php @@ -66,7 +66,7 @@ class LogController $qry="select t.endtimestr,a.* 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 - 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); if($rs){ while($rw=$rs->fetch()){ @@ -88,7 +88,7 @@ class LogController } // === Update tbl_attendancelist for lateemployee $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"; $this->executeSP($qry); } diff --git a/fixingr2late.php b/fixingr2late.php index 1ac13bb..ccf9863 100644 --- a/fixingr2late.php +++ b/fixingr2late.php @@ -66,7 +66,8 @@ class LogController $qry="select t.endtimestr,a.* 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 - 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); if($rs){ while($rw=$rs->fetch()){ @@ -87,7 +88,7 @@ class LogController } } $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"; $this->executeSP($qry); return $rtn;