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()){ $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;