Viewing file: processReceiveDoc.php (26.75 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$method = (isset($method)?$method:$_POST['method']);
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsPerson.php";
include_once "../link/function.php";
include_once "../link/functionshow.php";
include_once "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocSpeedLevel.php";
include_once "../class/clsDocSecreLevel.php";
include_once "../class/clsDocattatchesTmp.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocattatches.php";
include_once "../class/clsDocReceiveSend.php";
include_once "../class/clsRunningDoc.php";
include_once "funct.php";
include_once "../class/clsDocForSign.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oDP2 = new Department($oC);
$oDP3 = new Department($oC);
$oDP4 = new Department($oC);
$oDP5 = new Department($oC);
$oPS = new person($oC);
$oPS2 = new person($oC);
$oPS3 = new person($oC);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oDlp1 = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDsl = new DocSpeedLevel($oC);
$oDcl = new DocSecretLevel($oC);
$oDtmp = new DocattatchesTmp($oC);
$oDoc = new Documents($oC);
$oDoc2 = new Documents($oC);
$oDoc3 = new Documents($oC);
$oDoc4 = new Documents($oC);
$oDatt = new Docattatches($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oRs3 = new DocReceiveSend($oC);
$oRs4 = new DocReceiveSend($oC);
$oRd = new runningdoc($oC);
$oDfs = new DocForSign($oC);
$MaxDocGroup=$oDP->SearchMaxDocGroup();
if($method=="addReceiveDoc"){
$oDoc4->SearchByKey($DocID);
$oDoc4->GetRecord();
if($oDoc4->DsID==0){ //can receive case normal
$flagCommit = true;
$oC->BeginTrans();
$timesend=getNowDateTh()." ".date('H:i:s');
//-----check runningNo
$checkerror=0;
if($DtID!=15){ $insertDtID="3"; }else{ $insertDtID="15"; }
$DocTypeNo=ShowRunningDoc(3,$insertDtID,$deptId);
$oDP->SearchByKey($deptId); $oDP->GetRecord();
if($DocTypeNo=="N"){
$checkerror++;
?>
<script>alert("หน่วยงาน<? echo $oDP->deptName; ?>\nยังไม่มีการตั้งค่าการใช้งานเลขทะเบียนหนังสือภายใน \nกรุณาติดต่อผู้รับผิดชอบระบบ");</script>
<?
echo "<meta http-equiv='refresh' content='0; URL=showReceiveDoc.php?page_id2=$page_id2&DtID=$DtID&RsID=$RsID&DocID=$DocID&DrsID=$DrsID&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchDeptPre=$searchDeptPre'>";
}
if($DocTypeNo=="NoConfirm"){
$checkerror++;
?>
<script>alert("หน่วยงาน<? echo $oDP->deptName; ?>\nยังไม่ยืนยันการใช้งานเลขทะเบียนหนังสือภายใน \nกรุณาติดต่อผู้รับผิดชอบระบบ");</script>
<?
echo "<meta http-equiv='refresh' content='0; URL=showReceiveDoc.php?page_id2=$page_id2&DtID=$DtID&RsID=$RsID&DocID=$DocID&DrsID=$DrsID&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchDeptPre=$searchDeptPre'>";
}
//----set running Doc
$oRd->SearchRunningBydocGroupDtIDDept($DocGroup,$insertDtID,$deptId);
$oRd->GetRecord();
$oRd->Edit();
$oRd->receiveNo=$DocTypeNo;
$flagCommit = $oRd->Save();
//----edit set Document
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="1";
$oDoc2->DocDateCreate=$timesend;
$oDoc2->DocUserCreate=$DlcIDlogin;
$oDoc2->DocTypeNo=$oRd->receiveNo;
if($selectforfolderstaff=='DIbHeader'){
$oDoc2->DIbHeader=$selectfolderstaff;
}else if($selectforfolderstaff=='DIbStaff'){
$oDoc2->DIbStaff=$selectfolderstaff;
}
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="1";
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$DocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin ;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs2->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
echo "<meta http-equiv='refresh' content='0; URL=regisDoc.php?DtID=$DtID&RsID=$RsID&selectdocdatevalue=3'>";
}else{
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
}
}else if($method=="addReceiveDocNoRegisReceive"){
$oDoc4->SearchByKey($DocID);
$oDoc4->GetRecord();
if($oDoc4->DsID==0){ //can receive case normal
$flagCommit = true;
$oC->BeginTrans();
$timesend=getNowDateTh()." ".date('H:i:s');
//----edit set Document
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="1";
$oDoc2->DocDateCreate=$timesend;
$oDoc2->DocUserCreate=$DlcIDlogin;
$oDoc2->DocTypeNo=$oRd->receiveNo;
if($selectforfolderstaff=='DIbHeader'){
$oDoc2->DIbHeader=$selectfolderstaff;
}else if($selectforfolderstaff=='DIbStaff'){
$oDoc2->DIbStaff=$selectfolderstaff;
}
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="1";
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo='';
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin ;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$oRs2->DrsNoRegisReceive='Y';
$flagCommit = $oRs2->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
echo "<meta http-equiv='refresh' content='0; URL=regisDoc.php?DtID=$DtID&RsID=$RsID&selectdocdatevalue=3'>";
}else{
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
}
}else if($method=="proposeAll"){
$oDoc4->SearchByKey($DocID);
$oDoc4->GetRecord();
if($oDoc4->DsID==0){ //can receive case normal
$flagCommit = true;
$oC->BeginTrans();
$timesend=getNowDateTh()." ".date('H:i:s');
//----edit set Document
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="2";
$oDoc2->DocDateCreate=$timesend;
$oDoc2->DocUserCreate=$DlcIDlogin;
$oDoc2->DocTypeNo=$oRd->receiveNo;
if($selectforfolderstaff=='DIbHeader'){
$oDoc2->DIbHeader=$selectfolderstaff;
}else if($selectforfolderstaff=='DIbStaff'){
$oDoc2->DIbStaff=$selectfolderstaff;
}
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="1";
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$DocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin ;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$oRs2->DrsNoRegisReceive='Y';
$flagCommit = $oRs2->Save();
//---------------add DocReceiveSend
$oRs3->AddNew();
$oRs3->DrsID=$oRs3->GetNextCode();
$oRs3->DocID=$DocID;
$oRs3->DlcID=$DlcIDlogin;
$oRs3->DsID=2;
$oRs3->PtID=$oRs->PtID;
$oRs3->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs3->DrsReceiveDate=$oRs->DrsSendDate;
//$oRs3->DrsReceivePersonId=$DlcPsId;
$oRs3->DrsDocDueDate=$oRs->DrsDocDueDate;
$oRs3->DrsDlcIDCreate=$DlcIDlogin;
$oRs3->DrsPsIDCreate=$personId;
$oRs3->DrsPropose=$DrsPropose;
$oRs3->DrsFromDrsID=$oRs2->DrsID;
//echo "DrsFromDrsID=".$oRs3->DrsFromDrsID;
$oRs3->DocGroup=$oRs->DocGroup;
$oRs3->AnID=$oRs->AnID;
$oRs3->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs3->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs3->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
}else{
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
}
}else if($method=="addReceiveDocByHead"){
$oDoc4->SearchByKey($DocID);
$oDoc4->GetRecord();
if($oDoc4->DsID==0){ //can receive case normal
$flagCommit = true;
$oC->BeginTrans();
$timesend=getNowDateTh()." ".date('H:i:s');
//-----check runningNo
$checkerror=0;
if($DtID!=15){ $insertDtID="3"; }else{ $insertDtID="15"; }
$DocTypeNo=ShowRunningDoc(3,$insertDtID,$deptId);
$oDP->SearchByKey($deptId); $oDP->GetRecord();
if($DocTypeNo=="N"){
$checkerror++;
?>
<script>alert("หน่วยงาน<? echo $oDP->deptName; ?>\nยังไม่มีการตั้งค่าการใช้งานเลขทะเบียนหนังสือภายใน \nกรุณาติดต่อผู้รับผิดชอบระบบ");</script>
<?
echo "<meta http-equiv='refresh' content='0; URL=showReceiveDoc.php?page_id2=$page_id2&DtID=$DtID&RsID=$RsID&DocID=$DocID&DrsID=$DrsID&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchDeptPre=$searchDeptPre'>";
}
if($DocTypeNo=="NoConfirm"){
$checkerror++;
?>
<script>alert("หน่วยงาน<? echo $oDP->deptName; ?>\nยังไม่ยืนยันการใช้งานเลขทะเบียนหนังสือภายใน \nกรุณาติดต่อผู้รับผิดชอบระบบ");</script>
<?
echo "<meta http-equiv='refresh' content='0; URL=showReceiveDoc.php?page_id2=$page_id2&DtID=$DtID&RsID=$RsID&DocID=$DocID&DrsID=$DrsID&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchDeptPre=$searchDeptPre'>";
}
//----set running Doc
$oRd->SearchRunningBydocGroupDtIDDept($DocGroup,$insertDtID,$deptId);
$oRd->GetRecord();
$oRd->Edit();
$oRd->receiveNo=$DocTypeNo;
$flagCommit = $oRd->Save();
//----edit set Document
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="2";
$oDoc2->DocDateCreate=$timesend;
$oDoc2->DocUserCreate=$DlcIDlogin;
$oDoc2->DocTypeNo=$oRd->receiveNo;
if($selectforfolderstaff=='DIbHeader'){
$oDoc2->DIbHeader=$selectfolderstaff;
}else if($selectforfolderstaff=='DIbStaff'){
$oDoc2->DIbStaff=$selectfolderstaff;
}
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="1";
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$DocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin ;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs2->Save();
//---------------add DocReceiveSend
$oRs3->AddNew();
$oRs3->DrsID=$oRs3->GetNextCode();
$oRs3->DocID=$DocID;
$oRs3->DlcID=$DlcIDlogin;
$oRs3->DsID=2;
$oRs3->PtID=$oRs->PtID;
$oRs3->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs3->DrsReceiveDate=$oRs->DrsSendDate;
//$oRs3->DrsReceivePersonId=$DlcPsId;
$oRs3->DrsDocDueDate=$oRs->DrsDocDueDate;
$oRs3->DrsDlcIDCreate=$DlcIDlogin;
$oRs3->DrsPsIDCreate=$personId;
$oRs3->DrsPropose=$DrsPropose;
$oRs3->DrsFromDrsID=$oRs2->DrsID;
//echo "DrsFromDrsID=".$oRs3->DrsFromDrsID;
$oRs3->DocGroup=$oRs->DocGroup;
$oRs3->AnID=$oRs->AnID;
$oRs3->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs3->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs3->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
}else{
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php'>";
}
}else if($method=="Noaccept"){
$oDoc4->SearchByKey($DocID);
$oDoc4->GetRecord();
if($oDoc4->DsID==0){ //can not receive case normal
$flagCommit = true;
$oC->BeginTrans();
//----edit set Document
$timesend=getNowDateTh()." ".date('H:i:s');
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="6";
$oDoc2->DocUserCreate=$DlcIDlogin;
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="6";
$oRs2->personId=$oRs->personId;
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs2->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php?page_id2=$page_id2&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchpredocdate=$searchpredocdate&searchNamePre=$searchNamePre&searchNoPre=$searchNoPre&searchDeptPre=$searchDeptPre'>";
/*
//-- เพิ่ม 2092014---//
}else if($method=="acceptAll"){
//echo "AcceptAll"." method".$_POST['method']."<br>";
//print_r($store_DrsID);
$store_DrsID = substr($store_DrsID,0,-1);
$DrsId_arr = explode("," ,$store_DrsID);
//print_r($DrsId_arr);
for($i=0;$i<count($DrsId_arr);$i++){
//echo "<br>".$i."=>".$DrsId_arr[$i];
$oRs->SearchByKey($DrsId_arr[$i]);
$oRs->GetRecord();
//echo " =====> DocID => ".$oRs->DocID;
$oDoc4->SearchByKey($DocID);
$oDoc4->GetRecord();
if($oDoc4->DsID==0){ //can not receive case normal
$flagCommit = true;
$oC->BeginTrans();
//----edit set Document
$timesend=getNowDateTh()." ".date('H:i:s');
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="1";
$oDoc2->DocUserCreate=$DlcIDlogin;
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="1";
$oRs2->personId=$oRs->personId;
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs2->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
}
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php?page_id2=$page_id2&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchpredocdate=$searchpredocdate&searchNamePre=$searchNamePre&searchNoPre=$searchNoPre&searchDeptPre=$searchDeptPre'>";
//-- End--//
*/
}else if($method=="NoacceptAll"){
//echo "method : ".$_POST['method']."<br>";
//print_r($store_DrsID);
$str = $_POST['store_DrsID'];
$tmp = explode("," ,$str);
$tmp = array_reverse($tmp);
$reversed_str = join(',', $tmp);
//echo '<br>---------------------------------------<br>';
$store_DrsID_exp = explode("," ,$reversed_str);
//print_r($store_DrsID_exp);
for($i=0;$i<count($store_DrsID_exp);$i++){
//echo "<br>".$i."=>".$store_DrsID_exp[$i];
$DrsID = $store_DrsID_exp[$i];
if($DrsID!=""){
$oRs->SearchByKey($DrsID);
$oRs->GetRecord();
//echo " =====> DocID => ".$oRs->DocID;
/*$DocID = $oRs->DocID;
echo "DocID => ".$DocID."<br>";
echo "DlcIDlogin => ".$DlcIDlogin."<br>";
echo "DrsID => ".$DrsID."<br>";
echo "personId => ".$personId."<br>";
*/
//---------------------------------------------------------
//--- NoAccept
//---------------------------------------------------------
$oDoc4->SearchByKey($oRs->DocID);
$oDoc4->GetRecord();
if($oDoc4->DsID==0){ //can not receive case normal
$flagCommit = true;
$oC->BeginTrans();
//----edit set Document
$timesend=getNowDateTh()." ".date('H:i:s');
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="6";
$oDoc2->DocUserCreate=$DlcIDlogin;
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="6";
$oRs2->personId=$oRs->personId;
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs2->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
}
}
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php?page_id2=$page_id2&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchpredocdate=$searchpredocdate&searchNamePre=$searchNamePre&searchNoPre=$searchNoPre&searchDeptPre=$searchDeptPre'>";
//-- End--//
}else if($method=="SendBack"){
$flagCommit = true;
$oC->BeginTrans();
//----edit set Document
$timesend=getNowDateTh()." ".date('H:i:s');
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
if($oDoc2->DsID=="0"){
$oDoc2->Edit();
$oDoc2->DlcID=$DlcIDlogin;
$oDoc2->DsID="7";
$oDoc2->DocUserCreate=$DlcIDlogin;
$flagCommit = $oDoc2->Save();
//-----edit set RsDoc
$oRs->SearchByKey($DrsID);
//echo "DrsID_edit=".$DrsID."<br>";
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=$timesend;
$oRs->DrsSendPersonId=$personId;
$oRs->DrsSendDlcID=$DlcIDlogin;
$flagCommit = $oRs->Save();
//$oRs3->SearchByDocIDDsID3Docgroup($oDoc2->DocPID,$MaxDocGroup);
//$oRs3->GetRecord();
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs->DocID;
$oRs2->DlcID=$DlcIDlogin;
$oRs2->DsID="7";
$oRs2->personId=$oRs->personId;
$oRs2->PtID=$oRs->PtID;
$oRs2->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$timesend;
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId=$personId;
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
$oRs2->DrsPsIDCreate=$personId;
$oRs2->DrsPropose=$DrsSend;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs->DrsID;
$oRs2->DocGroup=$oRs->DocGroup;
//echo $oRs->AnID;
$oRs2->AnID=$oRs->AnID;
$oRs2->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs->DrsendDatePost;
$oRs2->DrsSendBack=$DrsSendBack;
$oRs2->DrsSendBackDlcID=$sendbackDept;
$flagCommit = $oRs2->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php?page_id2=$page_id2&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchpredocdate=$searchpredocdate&searchNamePre=$searchNamePre&searchNoPre=$searchNoPre&searchDeptPre=$searchDeptPre'>";
}else if($method=="editdocforsign"){
$oRs2->SearchDeptSendDocforSign($DocID);
$oRs2->GetRecord();
$oRs3->SearchByKey($oRs2->DrsFromDrsID);
$oRs3->GetRecord();
$oDfs->AddNew();
$oDfs->dfID=$oDfs->GetNextCode();
$oDfs->DocID=$oRs3->DocID;
$oDfs->DlcID=$oRs2->DrsDlcIDCreate;
$oDfs->DocGroup=$oRs3->DocGroup;
$oDfs->DlcIDsign=$DlcIDlogin;
$oDfs->DeptSign=$deptId;
$oDfs->DocforsignEdit='Y';
$oDfs->DocEditComment=$noticecomment;
$oDfs->DocNoticeDate=getNowDateTh()." ".date('H:i:s');
$oDfs->psComment=$personId;
$oDfs->EditByDocID=$DocID;
$oDfs->Save();
echo "<meta http-equiv='refresh' content='0; URL=receiveDoc.php?page_id2=$page_id2&searchpredocdate=$searchpredocdate&selectpredocdatevalue=$selectpredocdatevalue&searchpredocdate=$searchpredocdate&searchNamePre=$searchNamePre&searchNoPre=$searchNoPre'>";
}
?>
|