Viewing file: processUpdatePerson.php (3.91 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";
$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);
echo "<br><br><div align=center><strong>--- ระบบกำลังปรับปรุงข้อมูลบุคลากร กรุณารอสักครู่ ---</strong></div>";
$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;
//echo "เจอ=update=".$oPS->fName."".$oPS->lName."fstatus=".$oPS->fStatus."hireId=".$oPS->hireId."<br>";
$oPS->Save();
}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;
// echo "ไม่เจอ=เพิ่มใหม่=".$oPS->fName."".$oPS->lName."fstatus=".$oPS->fStatus."hireId=".$oPS->hireId."<br>";
$oPS->Save();
}
} //
} //loop all ps
$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'>";
?>
|