Viewing file: processReceiveDocAll.php (4.71 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "funct.php";
include_once "../link/function.php";
include_once "../link/functionshow.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsDocReceiveSend.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsDocuments.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oRsd = new DocReceiveSend($oC);
$oDlcd = new DocLineConfig($oC);
$oDlc = new DocLineConfig($oC);
$oRs = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oDoc2 = new Documents($oC);
if(isset($_POST)){
$flagCommit = true;
$checkflagCommit= true;
$oC->BeginTrans();
$str = $_POST['store_DrsID'];
$tmp = explode("," ,$str);
$tmp = array_reverse($tmp);
$reversed_str = join(',', $tmp);
//echo '<br>---------------------------------------<br>';
$store_DrsID_exp = explode("," ,$reversed_str);
$store_DrsID_exp_count=count($store_del_exp);
$store_DrsID_exp_count=count($store_DrsID_exp);
for($j=0; $j<$store_DrsID_exp_count;$j++){
$t_id = trim($store_DrsID_exp[$j]);
if(strlen($t_id)==0){
}else{
//echo 'Check box value ->'.$t_id;
//echo '<br>';
$oRsd->SearchByDrsIDReceiveAll($t_id);
$oRsd->GetRecord();
$oDlcd->SearchByKey($oRsd->DlcID);
$oDlcd->GetRecord();
$timesend=getNowDateTh()." ".date('H:i:s');
//-----check runningNo
if($oRsd->DtID!=15){ $insertDtID="3"; }else{ $insertDtID="15"; }
$DocTypeNo=ShowRunningDoc(3,$insertDtID,$oDlcd->deptId);
$oDP->SearchByKey($oDlcd->deptId); $oDP->GetRecord();
if($DocTypeNo=="N"){
?>
<script>alert("หน่วยงาน<? echo $oDP->deptName; ?>\nยังไม่มีการตั้งค่าการใช้งานเลขทะเบียนหนังสือภายใน \nกรุณาติดต่อผู้รับผิดชอบระบบ");</script>
<?
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
break;
}
if($DocTypeNo=="NoConfirm"){
?>
<script>alert("หน่วยงาน<? echo $oDP->deptName; ?>\nยังไม่ยืนยันการใช้งานเลขทะเบียนหนังสือภายใน \nกรุณาติดต่อผู้รับผิดชอบระบบ");</script>
<?
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
break;
}
//----set running Doc
$oRd->SearchRunningBydocGroupDtIDDept($oRsd->DocGroup,$insertDtID,$oDlcd->deptId);
$oRd->GetRecord();
$oRd->Edit();
$oRd->receiveNo=$DocTypeNo;
$checkflagCommit = $oRd->Save();
//----edit set Document
$oDoc2->SearchByKey($oRsd->DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="1";
$oDoc2->DocDateCreate=$timesend;
$oDoc2->DocUserCreate=$DlcIDlogin;
$oDoc2->DocTypeNo=$oRd->receiveNo;
$checkflagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($oRsd->DrsID);
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$checkflagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="1";
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$DocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$checkflagCommit = $oRs2->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
$searchpredocdate=splitDateForm($searchpredocdate,"/");
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php?page_id2=$page_id2&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue'>";
}
?>
|