Viewing file: processUpdatePerson.php (6.21 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include_once "template.php"; include_once "../link/function.php"; include_once "../class/clsTable.php"; include_once "../class/clsPerson.php"; include_once "../class/clsPersonPE.php"; include_once "../class/clsDepartment.php"; include_once "../class/clsDepartmentPE.php"; include_once "../class/clspsdept.php"; $oCc = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EPERSON'], $GLOBALS['DBUSER_EPERSON'], $GLOBALS['DBPASS_EPERSON']); $oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oPS = new person($oC); $oPSp = new PersonPE($oCc); $oDPp = new departmentPE($oCc); $oDP = new Department($oC); $oPSd = new psdept($oC); echo "<br><br><div align=center><strong>--- ระบบกำลังปรับปรุงข้อมูลบุคลากร กรุณารอสักครู่ ---</strong></div>";
if($casepbri==1){ //--------------------update คนเดิมที่อยู่ในระบบสารบรรณ $oPS->RSperson2(); while($oPS->GetRecord()){ $oPSp->SearchByKey($oPS->personId); if($oPSp->GetRecord()=="1"){ //เจอ //echo 'กรณีมีข้อมูลในระบบบุคลากรกลาง='.$oPSp->personId.'--'.$oPSp->fName.'--'.$oPSp->lName.'--'.$oPSp->dpId.'<br>'; $oPS->Edit(); $oPS->deptId=$oPSp->deptId; $oPS->workGpId=$oPS->workGpId; $oPS->prefixId=$oPSp->prefixId; $oPS->fName=$oPSp->fName; $oPS->lName=$oPSp->lName; if($oPSp->dpId!=$pdId){ $oPS->fStatus=0; //ไม่อยู่ที่หน่วยงานนี้แล้ว }else{ $oPS->fStatus=$oPSp->fStatus; } $oPS->adminId=$oPSp->adminId; $oPS->fRetire=$oPSp->fRetire; $oPS->hireId=$oPSp->hireId; $oPS->recordPerPage=$oPS->recordPerPage; $oPS->Save(); }else{ //echo 'กรณีไม่มีข้อมูลในระบบบุคลากรกลาง='.$oPSp->personId.'--'.$oPSp->fName.'--'.$oPSp->lName.'<br>'; } }
//--------------------กรณีมีคนใหม่ในระบบบุคลากรกลาง แต่ไม่มีในระบบสารบรรณ $oPSp->RSAllpersonpbri($pdId); while($oPSp->GetRecord()){ $oPS->SearchByKey($oPSp->personId); if($oPS->GetRecord()!="1"){ //เจอ //echo 'กรณีมีคนใหม่ในระบบบุคลากรกลาง แต่ไม่มีในระบบสารบรรณ='.$oPSp->personId.'--'.$oPSp->fName.'--'.$oPSp->lName.'--'.$oPSp->dpId.'<br>'; $oPS->AddNew(); $oPS->personId=$oPSp->personId; $oPS->deptId=$oPSp->deptId; $oPS->workGpId=""; $oPS->prefixId=$oPSp->prefixId; $oPS->fName=$oPSp->fName; $oPS->lName=$oPSp->lName; $oPS->fStatus=$oPSp->fStatus; $oPS->adminId=$oPSp->adminId; $oPS->fRetire=$oPSp->fRetire; $oPS->hireId=$oPSp->hireId; $oPS->recordPerPage='10'; $oPS->Save(); } }
}else{ //case other not in pbri $oPSp->RSAllperson(); while($oPSp->GetRecord()){ $oPS->SearchByKey($oPSp->personId); if($oPS->GetRecord()=="1"){ //เจอ //echo "workGpId==".$oPS->workGpId; $oPS->Edit(); $oPS->personId=$oPSp->personId; $oPS->deptId=$oPSp->deptId; $oPS->workGpId=$oPS->workGpId; $oPS->prefixId=$oPSp->prefixId; $oPS->fName=$oPSp->fName; $oPS->lName=$oPSp->lName; $oPS->fStatus=$oPSp->fStatus; $oPS->adminId=$oPSp->adminId; $oPS->fRetire=$oPSp->fRetire; $oPS->hireId=$oPSp->hireId; $oPS->recordPerPage=$oPS->recordPerPage; //echo "เจอ=update=".$oPS->fName."".$oPS->lName."fstatus=".$oPS->fStatus."hireId=".$oPS->hireId."<br>"; $oPS->Save(); $countPSd=0; $countPSd=$oPSd->SearchCountBypersonIddeptId($oPS->personId,$oPS->deptId,$oDP->SearchMaxDocGroup()); if($countPSd!=0){ $oPSd->DeleteBypersonIddeptId($oPS->personId,$oPS->deptId,$oDP->SearchMaxDocGroup()); } }else{ //ไม่เจอ if($oPSp->fStatus=="1" && $oPSp->fRetire=="0"){ $oPS->AddNew(); $oPS->personId=$oPSp->personId; $oPS->deptId=$oPSp->deptId; $oPS->workGpId=""; $oPS->prefixId=$oPSp->prefixId; $oPS->fName=$oPSp->fName; $oPS->lName=$oPSp->lName; $oPS->fStatus=$oPSp->fStatus; $oPS->adminId=$oPSp->adminId; $oPS->fRetire=$oPSp->fRetire; $oPS->hireId=$oPSp->hireId; $oPS->recordPerPage='10'; // echo "ไม่เจอ=เพิ่มใหม่=".$oPS->fName."".$oPS->lName."fstatus=".$oPS->fStatus."hireId=".$oPS->hireId."<br>"; $oPS->Save(); } } // } //loop all ps
}
if($casepbri==1){ $oDPp->SearchDeptByMaxdeptDatepbri($pdId); }else{ $oDPp->SearchDeptByMaxdeptDate(); } while($oDPp->GetRecord()){ $oDP->SearchByKey($oDPp->deptId); $oDP->GetRecord(); $oDP->Edit(); $oDP->deptId=$oDP->deptId; //echo "deptId=".$oDP->deptId."<br>"; $oDP->deptName=$oDPp->deptName; //echo "deptName=".$oDP->deptName."<br>"; $oDP->deptDesc=$oDPp->deptDesc; //echo "deptDesc=".$oDP->deptDesc."<br>"; $oDP->deptCode=$oDP->deptCode; //echo "deptCode=".$oDP->deptCode."<br>"; $oDP->deptParent=$oDP->deptParent; //echo "deptParent=".$oDP->deptParent."<br>"; $oDP->deptYear=$oDP->deptYear; //echo "deptYear=".$oDP->deptYear."<br>"; $oDP->deptDate=$oDP->deptDate; //echo "deptDate=".$oDP->deptDate."<br>"; $oDP->deptRef=$oDP->deptRef; //echo "deptRef=".$oDP->deptRef."<br>"; $oDP->pbriId=$oDP->pbriId; //echo "pbriId=".$oDP->pbriId."<br>"; $oDP->receiveIn=$oDP->receiveIn; //echo "receiveIn=".$oDP->receiveIn."<br>"; $oDP->sendIn=$oDP->sendIn; //echo "sendIn=".$oDP->sendIn."<br>"; $oDP->sendOut=$oDP->sendOut; //echo "sendOut=".$oDP->sendOut."<br>"; $oDP->deptIsCenter=$oDP->deptIsCenter; $oDP->docGroup=$oDP->docGroup; //echo "docGroup=".$oDP->docGroup."<br>"; $oDP->deptNo=$oDP->deptNo; //echo "deptNo=".$oDP->deptNo."<br>"; $oDP->depttypeId=$oDPp->depttypeId; //echo "depttypeId=".$oDP->depttypeId."<br>"; $oDP->deptParentId=$oDP->deptParentId; //echo "deptParentId=".$oDP->deptParentId."<br>"; $oDP->deptLevel=$oDP->deptLevel; //echo "deptLevel=".$oDP->deptLevel."<br>"; $oDP->deptGroup=$oDP->deptGroup; //echo "deptGroup=".$oDP->deptGroup."<br>"; //echo "-------------------------------------------<br>"; $oDP->Save(); }
echo "<meta http-equiv='refresh' content='0; URL=updatePerson.php?s=1'>"; ?>
|