Viewing file: processImportPerson.php (2.99 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>";
$maxdate=$oDPp->MaxDate();
$flagCommit = true;
$checkflagCommit= true;
$oC->BeginTrans();
$oDPp->RSdepartment2();
while($oDPp->GetRecord()){
$oDP->AddNew();
$oDP->deptId=$oDPp->deptId;
//echo "deptId=".$oDP->deptId."<br>";
$oDP->deptName=$oDPp->deptName;
//echo "deptName=".$oDP->deptName."<br>";
$oDP->deptDesc=$oDPp->deptDesc;
$oDP->deptCode=$oDPp->deptCode;
$oDP->deptParent=$oDPp->deptParent;
$oDP->deptYear=$oDPp->deptYear;
$oDP->deptDate=$oDPp->deptDate;
//echo "deptDate=".$oDP->deptDate."<br>";
$oDP->deptRef=$oDPp->deptRef;
$oDP->pbriId=$oDPp->pbriId;
$oDP->deptIsCenter="";
$oDP->receiveIn="Y";
$oDP->sendIn="Y";
$oDP->sendOut="Y";
$oDP->deptNo=$oDPp->deptNo;
//echo "deptNo=".$oDP->deptNo."<br>";
if($oDP->deptDate==$maxdate){
$oDP->docGroup=1;
}else{
$oDP->docGroup=0;
}
$oDP->depttypeId=$oDPp->depttypeId;
//echo "depttypeId=".$oDP->depttypeId."<br>";
$oDP->deptParentId=$oDPp->deptParentId;
//echo "deptParentId=".$oDP->deptParentId."<br>";
$oDP->deptLevel=$oDPp->deptLevel;
//echo "deptLevel=".$oDP->deptLevel."<br>";
$oDP->deptGroup=$oDPp->deptGroup;
//echo "deptGroup=".$oDP->deptGroup."<br>";
$checkflagCommit = $oDP->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
$oPSp->RSPersonf1();
while($oPSp->GetRecord()){
$oPS->AddNew();
$oPS->personId=$oPSp->personId;
//echo "e=".$oPS->personId."p=".$oPSp->personId."n=".$oPSp->fName."<br>";
$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;
$checkflagCommit = $oPS->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
echo "<meta http-equiv='refresh' content='0; URL=ImportPerson.php?s=1'>";
?>
|