Viewing file: processUpdatePerson.php (2.41 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/clsDepartment.php";
include_once "../class/clsPerson.php";
include_once "../class/clsDepartmentPE.php";
include_once "../class/clsPersonPE.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']);
$oDP = new Department($oC);
$oPS = new person($oC);
$oDPp = new departmentPE($oCc);
$oDPp2 = new departmentPE($oCc);
$oPSp = new PersonPE($oCc);
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;
if($oPSp->prefixId=="2" || $oPSp->prefixId=="3"){
$oPS->prefixId=$oPSp->prefixId;
}else{
$oPS->prefixId="1";
}
$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="";
if($oPSp->prefixId=="2" || $oPSp->prefixId=="3"){
$oPS->prefixId=$oPSp->prefixId;
}else{
$oPS->prefixId="1";
}
$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
echo "<meta http-equiv='refresh' content='0; URL=updatePerson.php?s=1'>";
?>
|