From 9315a92fcebaec94841f87173775a2bd66573559 Mon Sep 17 00:00:00 2001 From: asansal Date: Fri, 27 Jun 2025 08:02:42 +0700 Subject: [PATCH] Implement LogController for attendance checkout processing and update duration calculations --- fixingcheckoutbydate.php | 113 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 fixingcheckoutbydate.php diff --git a/fixingcheckoutbydate.php b/fixingcheckoutbydate.php new file mode 100644 index 0000000..35f005f --- /dev/null +++ b/fixingcheckoutbydate.php @@ -0,0 +1,113 @@ + +fn_getconn(); //new PDO("mysql:host=localhost;dbname=dbhcm", "apphcm", "\$pp"); + $q = $pdo->query($sql); + $q->setFetchMode(PDO::FETCH_ASSOC); + return $q; + } + + public function executeSP($qry){ + $rtn=false; + $pdo = $this->fn_getconn(); + $statement = $pdo->prepare($qry); + if($statement->execute()){ + $rtn=true; + } + return $rtn; + } + + public function fn_getfieldvalue($fieldname,$qry){ + $rs=$this->selectquerySP($qry); + $rtn=""; + if($rs){ + // $rw=$rs->fetch(); + // $rtn=$rw[$fieldname]; + while($rw=$rs->fetch()){ + $rtn=$rw[$fieldname]; + } + } + return $rtn; + } + + public function fn_getfieldsvalues($fieldname,$qry){ + $rs=$this->selectquerySP($qry); + $rtn=""; + if($rs){ + // $rw=$rs->fetch(); + // $rtn=$rw[$fieldname]; + while($rw=$rs->fetch()){ + $d=explode(",",$fieldname); + for($i=0;$iselectquerySP($qry); + if($rs){ + while($rw=$rs->fetch()){ + $idxdept=$rw['idxdept']; + if($idxdept==33||$idxdept==34||$idxdept==30||$idxdept==31||$idxdept==22){ + $qry="update tbl_attendancelist + set duration=SEC_TO_TIME(TIMESTAMPDIFF(SECOND,checkin,checkout)) + where _idx='".$rw["_idx"]."'"; + } + else{ + $qry="update tbl_attendancelist + set duration=SEC_TO_TIME(TIMESTAMPDIFF(SECOND,checkin,R1)+TIMESTAMPDIFF(SECOND,R2,checkout)) + where _idx='".$rw["_idx"]."'"; + } + echo $qry."\n"; + $this->executeSP($qry); + + } + } + return true; + } + + + +} + +$cl = new LogController(); +$rtn =$cl->index(); + +#if(isset($_REQUEST['isgetdata'])){ +# echo "indx"; +# $rtn = $cl->index(); +#} +#else{ +# $rtn = $cl->fn_curl(); +#} + +echo $rtn;