Compare commits
	
		
			11 Commits
		
	
	
		
			f9648cd682
			...
			main
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| aa2e02beac | |||
| a74010325f | |||
| e9e2b81cf0 | |||
| ba9a8c4a4a | |||
| b3ae073d01 | |||
| 92c069d852 | |||
| c3f9afc61e | |||
| 4b1b65b38b | |||
| a90441e9fd | |||
| 5d9fe2757d | |||
| a61d246486 | 
							
								
								
									
										8
									
								
								fixingcheckinlate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										8
									
								
								fixingcheckinlate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -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()){ | ||||
| @ -87,10 +87,10 @@ 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"; | ||||
|             $qry="update tbl_attendancelist t, tbl_attendanceemployee a set t.lateperemployee=a.totallateperemp | ||||
|                   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); | ||||
|             $this->executeSP($qry); | ||||
|         } | ||||
|         return $rtn; | ||||
|     } | ||||
|  | ||||
							
								
								
									
										114
									
								
								fixingcheckinlatebydate.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										114
									
								
								fixingcheckinlatebydate.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,114 @@ | ||||
|  | ||||
| <?php | ||||
| include('zklib/ZKLib.php'); | ||||
|  | ||||
| class LogController | ||||
| { | ||||
|     // $ppHCMTT#2024 | ||||
|  | ||||
|     public function fn_getconn(){ | ||||
|         $pdo = new PDO("mysql:host=localhost;dbname=dbhcm", "apphcm", "\$ppHCMTT#2024"); | ||||
|         return $pdo; | ||||
|     } | ||||
|     public function selectquerySP($sql){ | ||||
|         // $pdo = new PDO("mysql:host=".DB_HOST_NAME.";dbname=".DB_IMS, DB_USER_NAME, DB_USER_PASS); | ||||
|         $pdo = $this->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;$i<count($d);$i++){ | ||||
|                     $rtn.=$rw[$d[$i]].","; | ||||
|                 } | ||||
|                  | ||||
|             } | ||||
|             // echo $rtn;return false; | ||||
|             $rtn=substr($rtn,0,strlen($rtn)-1); | ||||
|         } | ||||
|         return explode(",",$rtn); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public function index(){ | ||||
|         $argv=$_SERVER['argv']; | ||||
|         $rtn=false; | ||||
|         $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' and cast(a.dates as date)=cast('".$argv[1]."' as date)"; | ||||
|         $rs=$this->selectquerySP($qry); | ||||
|         if($rs){ | ||||
|             while($rw=$rs->fetch()){ | ||||
|                 $dates=date("Y-m-d", strtotime($rw['dates'])); | ||||
|                 $datestimes=date("Y-m-d H:i", strtotime($rw['datestimes'])); | ||||
|                 $time1=strtotime($dates." ".$rw['endtimestr']); | ||||
|                 $time2=strtotime($datestimes); | ||||
|                 $totaldur=0; | ||||
|                 if($time2>$time1){ | ||||
|                     $totaldur=round(($time2 - $time1) / 60,2); | ||||
|                 } | ||||
|                 echo $rw['_idx']." ".$rw['totallateperemp']." ".$totaldur."\n"; | ||||
|                 if($rw['totallateperemp']!=$totaldur){ | ||||
|                     echo $rw['_idx']." ".$rw['datestimes']." ".$rw['endtimestr']." ".$rw['totallateperemp']."=".$totaldur."\n"; | ||||
|                  | ||||
|                     $qry="update tbl_attendanceemployee set totallateperemp='$totaldur',totallateperempr2=0 where _idx='".$rw['_idx']."'"."\n"; | ||||
|                     $this->executeSP($qry); | ||||
|                 } | ||||
|             } | ||||
|             // === 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 and cast(a.dates as date)=cast('".$argv[1]."' as date)"; | ||||
|             // echo $qry."\n"; | ||||
|             $this->executeSP($qry); | ||||
|         } | ||||
|         return $rtn; | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
| $cl = new LogController(); | ||||
| $rtn =$cl->index(); | ||||
|  | ||||
| #if(isset($_REQUEST['isgetdata'])){ | ||||
| #   echo "indx"; | ||||
| #    $rtn = $cl->index(); | ||||
| #} | ||||
| #else{ | ||||
| #    $rtn = $cl->fn_curl(); | ||||
| #} | ||||
|  | ||||
| echo $rtn; | ||||
							
								
								
									
										0
									
								
								fixingcheckout.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								fixingcheckout.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								fixingcheckoutbydate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								fixingcheckoutbydate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										7
									
								
								fixingr2late.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										7
									
								
								fixingr2late.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -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()){ | ||||
| @ -86,6 +87,10 @@ 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 and cast(a.dates as date)=cast(now() as date)"; | ||||
|         // echo $qry."\n"; | ||||
|         $this->executeSP($qry); | ||||
|         return $rtn; | ||||
|     } | ||||
|  | ||||
|  | ||||
							
								
								
									
										113
									
								
								fixingr2latebydate.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								fixingr2latebydate.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,113 @@ | ||||
|  | ||||
| <?php | ||||
| include('zklib/ZKLib.php'); | ||||
|  | ||||
| class LogController | ||||
| { | ||||
|     // $ppHCMTT#2024 | ||||
|  | ||||
|     public function fn_getconn(){ | ||||
|         $pdo = new PDO("mysql:host=localhost;dbname=dbhcm", "apphcm", "\$ppHCMTT#2024"); | ||||
|         return $pdo; | ||||
|     } | ||||
|     public function selectquerySP($sql){ | ||||
|         // $pdo = new PDO("mysql:host=".DB_HOST_NAME.";dbname=".DB_IMS, DB_USER_NAME, DB_USER_PASS); | ||||
|         $pdo = $this->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;$i<count($d);$i++){ | ||||
|                     $rtn.=$rw[$d[$i]].","; | ||||
|                 } | ||||
|                  | ||||
|             } | ||||
|             // echo $rtn;return false; | ||||
|             $rtn=substr($rtn,0,strlen($rtn)-1); | ||||
|         } | ||||
|         return explode(",",$rtn); | ||||
|     } | ||||
|  | ||||
|  | ||||
|     public function index(){ | ||||
|         $argv=$_SERVER['argv']; | ||||
|         $rtn=false; | ||||
|         $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' | ||||
|                     and cast(a.dates as date)=cast('".$argv[1]."' as date)"; | ||||
|         $rs=$this->selectquerySP($qry); | ||||
|         if($rs){ | ||||
|             while($rw=$rs->fetch()){ | ||||
|                 $dates=date("Y-m-d", strtotime($rw['dates'])); | ||||
|                 $datestimes=date("Y-m-d H:i", strtotime($rw['datestimes'])); | ||||
|                 $time1=strtotime($dates." ".$rw['endtimestr']); | ||||
|                 $time2=strtotime($datestimes); | ||||
|                 $totaldur=0; | ||||
|                 if($time2>$time1){ | ||||
|                     $totaldur=round(($time2 - $time1) / 60,2); | ||||
|                 } | ||||
|                 if($rw['totallateperempr2']!=$totaldur){ | ||||
|                     echo $rw['_idx']." ".$rw['datestimes']." ".$rw['endtimestr']." ".$rw['totallateperempr2']."=".$totaldur."\n"; | ||||
|                  | ||||
|                     $qry="update tbl_attendanceemployee set totallateperemp=0,totallateperempr2='$totaldur' where _idx='".$rw['_idx']."'"; | ||||
|                     $this->executeSP($qry); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         $qry="update tbl_attendancelist t, tbl_attendanceemployee a set t.lateperemployeer2=a.totallateperempr2 | ||||
|                 where a._idx=t.idxattendance and a.totallateperempr2<>t.lateperemployeer2 and cast(a.dates as date)=cast('".$argv[1]."' as date)"; | ||||
|         // echo $qry."\n"; | ||||
|         $this->executeSP($qry); | ||||
|         return $rtn; | ||||
|     } | ||||
|  | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
| $cl = new LogController(); | ||||
| $rtn =$cl->index(); | ||||
|  | ||||
| #if(isset($_REQUEST['isgetdata'])){ | ||||
| #   echo "indx"; | ||||
| #    $rtn = $cl->index(); | ||||
| #} | ||||
| #else{ | ||||
| #    $rtn = $cl->fn_curl(); | ||||
| #} | ||||
|  | ||||
| echo $rtn; | ||||
							
								
								
									
										0
									
								
								getattsync.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								getattsync.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								getattsync2.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								getattsync2.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								getattsyncbydate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								getattsyncbydate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								getdatadevices.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								getdatadevices.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								getdatadevices2.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								getdatadevices2.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										0
									
								
								getdatadevicesbydate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										0
									
								
								getdatadevicesbydate.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
								
								
									
										10
									
								
								getdatadevicesbyip.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										10
									
								
								getdatadevicesbyip.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -82,8 +82,8 @@ class LogController | ||||
|  | ||||
|     public function index() | ||||
|     { | ||||
|         $ip = "192.168.100.76"; //$row['deviceip']; | ||||
|         $qry="select * from tbl_deviceinfo where _idx=36 and isdeleted=0 order by _idx asc"; | ||||
|         $ip = "172.16.116.5"; //$row['deviceip']; | ||||
|         $qry="select * from tbl_deviceinfo where isreprocess=1 and isdeleted=0 order by _idx asc"; | ||||
|         #echo $qry; | ||||
|         $rs=$this->selectquerySP($qry); | ||||
|         if($rs){ | ||||
| @ -107,7 +107,7 @@ class LogController | ||||
|                         $data = []; | ||||
|                         foreach ($getData as $att) { | ||||
|                             // echo date("Y-m-d", strtotime($att['timestamp'])); | ||||
|                             if (date("Y-m-d", strtotime($att['timestamp'])) == date("Y-m-d")) { | ||||
|                             if (date("Y-m-d", strtotime($att['timestamp'])) == date("Y-m-d",strtotime($rw['reprocessdate']))) { | ||||
|                                 // $data[] = [ | ||||
|                                 //     "idUser" => $att['id'], | ||||
|                                 //     "name" => isset($users[$att['id']]) ? $users[$att['id']]['name'] : $att['id'], | ||||
| @ -117,12 +117,12 @@ class LogController | ||||
|                                 //     "deviceIP" => $ip | ||||
|                                 // ]; | ||||
|                                 // echo json_encode($att)."\n"; | ||||
|                                 $res=$this->fn_setattendance($att, $ip); | ||||
|                                 // $res=$this->fn_setattendance($att, $ip); | ||||
|                                 $reslog=$this->fn_setattendancelogs($att, $ip); | ||||
|                                 $data[] = [ | ||||
|                                     "fingerid" => $att['id'], | ||||
|                                     "time" =>  date("Y-m-d H:i:s", strtotime($att['timestamp'])), | ||||
|                                     "status" => $res | ||||
|                                     "status" => $reslog | ||||
|                                 ]; | ||||
|                             } | ||||
|                         } | ||||
|  | ||||
							
								
								
									
										12
									
								
								getdatadevicesbylogs.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										12
									
								
								getdatadevicesbylogs.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -719,10 +719,22 @@ class LogController | ||||
|         $rtn=true; | ||||
|         return $rtn; | ||||
|     } | ||||
|  | ||||
|     public function fn_idxdept(){ | ||||
|         | ||||
|         $qry="update tbl_attendanceemployee a, tbl_employee e set a.idxdept = e.idxdept | ||||
|               where e._idx=a.idxemployee and a.idxdept=0"; | ||||
|         $this->executeSP($qry); | ||||
|         $qry="update tbl_attendancelist a, tbl_employee e set a.idxdept = e.idxdept | ||||
|               where e._idx=a.idxemployee and a.idxdept=0"; | ||||
|         $this->executeSP($qry); | ||||
|         return true; | ||||
|     } | ||||
| } | ||||
|  | ||||
| $cl = new LogController(); | ||||
| $rtn =$cl->index(); | ||||
| $rtn =$cl->fn_idxdept(); | ||||
|  | ||||
| #if(isset($_REQUEST['isgetdata'])){ | ||||
| #   echo "indx"; | ||||
|  | ||||
							
								
								
									
										2
									
								
								getdatadevicesbylogsbydates.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										2
									
								
								getdatadevicesbylogsbydates.php
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -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) and isprocess=0 | ||||
|               where cast(dates as date)=cast('".$argv[1]."' as date) | ||||
|               order by _idx asc"; | ||||
|         $rs=$this->selectquerySP($qry); | ||||
|         if($rs){ | ||||
|  | ||||
		Reference in New Issue
	
	Block a user