Viewing file: mobliedetailSign.php (4.45 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
$fn = (! isset($_REQUEST['fn'])? "" : $_REQUEST['fn']);
if($fn=='signDocAction'){ //ลงนาม
//echo "POST";
$personId = $_POST['personId'];
$DLCID = $_POST['DLCID'];
$DrsID = $_POST['DrsID'];
$DocID = $_POST['DocID'];
$DrsSign = $_POST['DrsSign'];
$DrsSign = iconv('UTF-8', 'TIS-620',$DrsSign);
//echo $personId." | ".$DLCID." | ".$DrsID." | ".$DocID." | ".$DrsSign;
//die;
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/clsDocLineConfig.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocReceiveSendMobile.php";
include_once "../class/clsDocForSign.php";
$oDlc = new DocLineConfig($oC);
$oDoc = new Documents($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oRs3 = new DocReceiveSend($oC);
$oDfs = new DocForSign($oC);
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
//-----------------------------------------------------------
$oDoc->SearchByKey($DocID); $oDoc->GetRecord();
$oDlc->SearchByKey($DLCID); $oDlc->GetRecord();
$DlcPs=GetUpPrePsSend($DLCID,$oDlc->deptId);
if($oDoc->DtID==15){
$DocForSign=1;
}
$cansend="N"; //ไม่ส่งหนังสือเอง
$DlcIDlogin = $DLCID;
//$DrsSign = str_replace("|"," ",$DrsSign);
//$DrsSign = iconv('UTF-8', 'TIS-620',$DrsSign);
//echo $DrsSign;die;
//-----------------------------------------------------------
$flagCommit = true;
$oC->BeginTrans();
$oDoc->SearchByKey($DocID);
if($oDoc->GetRecord()=="1"){
$oDoc->Edit();
$oDoc->DsID="3";
$flagCommit = $oDoc->Save();
}
$oRs->SearchByKey($DrsID);
$oRs->GetRecord();
$oRs->Edit();
$oRs->DlcID=$DlcIDlogin;
$oRs->DrsReceivePersonId=$personId;
$oRs->DrsSendDate=getNowDateTh()." ".date('H:i:s');
//echo "DrsSendDate=".$oRs->DrsSendDate;
if($cansend!="Y"){
//$oRs->DrsSendPersonId=$DlcPsId;
$oRs->DrsSendPersonId='';
}else if($cansend=="Y"){
$oRs->DrsSendPersonId=$personId;
}
//echo "DrsSendPersonId=".$oRs->DrsSendPersonId;
if($cansend!="Y"){
$oRs->DrsSendDlcID=$DlcPs;
}else if($cansend=="Y"){
$oRs->DrsSendDlcID=$DlcIDlogin;
}
//echo "DrsSendDlcID=".$oRs->DrsSendDlcID;
$oRs->fn=1;//Mobile
$oRs->DrsSign=$DrsSign;
$oRs->Save();
$oRs2->SearchPreDocSignforDlpID0_Update2($DlcIDlogin,$personId,$oRs->DrsFromDrsID);
//---------------add DocReceiveSend
$oRs1->AddNew();
$oRs1->DrsID=$oRs1->GetNextCode();
$oRs1->DocID=$DocID;
if($cansend!="Y"){
$oRs1->DlcID=$DlcPs;
}else if($cansend=="Y"){
$oRs1->DlcID=$DlcIDlogin;
}
$oRs1->DsID=3;
$oRs1->PtID=$oRs->PtID;
$oRs1->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs1->DrsReceiveDate=$oRs->DrsSendDate;
//$oRs1->DrsReceivePersonId=$DlcPsId;
$oRs1->DrsReceivePersonId='';
$oRs1->DrsDocDueDate=$oRs->DrsDocDueDate;
$oRs1->DrsDlcIDCreate=$DlcIDlogin;
$oRs1->DrsPsIDCreate=$personId;
$oRs1->DrsPropose=$oRs->DrsPropose;
$oRs1->DrsSign=$DrsSign;
$oRs->fn=1;//Mobile
$oRs1->DrsFromDrsID=$oRs->DrsID;
//echo "DrsFromDrsID=".$oRs1->DrsFromDrsID;
$oRs1->DocGroup=$oRs->DocGroup;
if($cansend!="Y"){
$oRs1->DrsSend=$oRs1->DrsSend;
}else if($cansend=="Y"){
$oRs1->DrsSend="Y";
}
$oRs1->AnID=$oRs->AnID;
$oRs1->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs1->DrsendDatePost=$oRs->DrsendDatePost;
$flagCommit = $oRs1->Save();
if($DocForSign==1 && $DocPID!="0"){
$oDlc->SearchByKey($DlcIDlogin); $oDlc->GetRecord();
$oRs2->SearchDeptSendDocforSign($oDoc->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=$oDlc->deptId;
$oDfs->Save();
//echo $oRs8->DrsID.'--'.$oRs8->DrsDlcIDCreate.'--'.$oRs8->DrsPsIDCreate.'-'.$oRs8->DrsFromDrsID;
}
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
//echo "Success signDocAction";
}
?>
<html>
<head>
<meta charset="utf-8">
</head>
<body>ลงนามเรียบร้อยแล้ว
</body>
</html>
|