Add ZK library classes for device interaction and user management

- Implemented Os class for retrieving OS information.
- Added Pin class for getting PIN width.
- Created Platform class for fetching platform details and version.
- Developed SerialNumber class to retrieve device serial number.
- Introduced Ssr class for SSR information retrieval.
- Implemented Time class for setting and getting device time.
- Added User class for user management including setting, getting, clearing, and removing users.
- Created Util class with various utility functions for command handling and data processing.
- Implemented Version class for fetching device version.
- Added WorkCode class for retrieving work code information.
- Set up Composer autoloading for the ZK library.
This commit is contained in:
2025-06-25 17:25:23 +07:00
commit 5bec63d9cd
39 changed files with 10171 additions and 0 deletions

107
fixingr2late.php Normal file
View File

@ -0,0 +1,107 @@
<?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(){
$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'";
$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);
}
}
}
return $rtn;
}
}
$cl = new LogController();
$rtn =$cl->index();
#if(isset($_REQUEST['isgetdata'])){
# echo "indx";
# $rtn = $cl->index();
#}
#else{
# $rtn = $cl->fn_curl();
#}
echo $rtn;