From 7f5bf9acdc76610fc7f890b2afa68f8091ff875b Mon Sep 17 00:00:00 2001 From: asansal Date: Wed, 25 Jun 2025 21:17:10 +0700 Subject: [PATCH 1/2] Remove redundant field 'lateperemployeer2' from attendance log insertion query --- getdatadevicesbylogsbydates.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/getdatadevicesbylogsbydates.php b/getdatadevicesbylogsbydates.php index 0739b27..09e6ed5 100644 --- a/getdatadevicesbylogsbydates.php +++ b/getdatadevicesbylogsbydates.php @@ -644,7 +644,7 @@ class LogController officename='".$rw['officename']."',idxdept='".$rw['idxdept']."',divisiname='".$rw['divisiname']."', serviconame='".$rw['serviconame']."',dates='".$rw['dates']."',".$attfield." islates='".$rw['islates']."',months='".$rw['months']."',years='".$rw['years']."', - shiftcode='".$rw['shiftcode']."',lateperemployee='".$rw['lateperemployee']."',lateperemployeer2='".$rw['lateperemployeer2']."', + shiftcode='".$rw['shiftcode']."',lateperemployee='".$rw['lateperemployee']."', deviceidcheckin='".$rw['deviceidcheckin']."', iby='svc',idt='".$rw['datestimes']."'"; From 5be3e83f66e94be25b84bbf9e164aed51610133b Mon Sep 17 00:00:00 2001 From: asansal Date: Wed, 25 Jun 2025 21:19:46 +0700 Subject: [PATCH 2/2] Add processing flag to attendance log queries and update status after processing --- getdatadevicesbylogs.php | 7 ++++++- getdatadevicesbylogsbydates.php | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/getdatadevicesbylogs.php b/getdatadevicesbylogs.php index f8a80aa..b131df2 100644 --- a/getdatadevicesbylogs.php +++ b/getdatadevicesbylogs.php @@ -78,7 +78,7 @@ class LogController $argv=$_SERVER['argv']; // echo $argv[1];return false; $qry="select * from tbl_attendancelogs - where cast(dates as date)=cast(now() as date) + where cast(dates as date)=cast(now() as date) and isprocess=0 order by _idx asc"; $rs=$this->selectquerySP($qry); if($rs){ @@ -88,6 +88,11 @@ class LogController $d['timestamp']=date("Y-m-d H:i:s", strtotime($rw['dates'].' '.$rw['times'])); $d['id']=$rw['fingerid']; $res=$this->fn_setattendance($d, $rw['deviceip']); + if($res){ + $qryupdate="update tbl_attendancelogs set isprocess=1,processdate=now() where _idx='".$rw['_idx']."'"; + // echo $qryupdate."\n"; + $this->executeSP($qryupdate); + } echo "End time : ".date("Y-m-d H:i:s")."\n\n"; } diff --git a/getdatadevicesbylogsbydates.php b/getdatadevicesbylogsbydates.php index 09e6ed5..47ffcd6 100644 --- a/getdatadevicesbylogsbydates.php +++ b/getdatadevicesbylogsbydates.php @@ -78,7 +78,7 @@ class LogController $argv=$_SERVER['argv']; // echo $argv[1];return false; $qry="select * from tbl_attendancelogs - where cast(dates as date)=cast('".$argv[1]."' as date) + where cast(dates as date)=cast('".$argv[1]."' as date) and isprocess=0 order by _idx asc"; $rs=$this->selectquerySP($qry); if($rs){ @@ -88,6 +88,12 @@ class LogController $d['timestamp']=date("Y-m-d H:i:s", strtotime($rw['dates'].' '.$rw['times'])); $d['id']=$rw['fingerid']; $res=$this->fn_setattendance($d, $rw['deviceip']); + if($res){ + $qryupdate="update tbl_attendancelogs set isprocess=1,processdate=now() where _idx='".$rw['_idx']."'"; + // echo $qryupdate."\n"; + $this->executeSP($qryupdate); + } + echo "End time : ".date("Y-m-d H:i:s")."\n\n"; }