Viewing file: processSendDocNew.php (34.56 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 "../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/clspsdept.php";
include_once "../class/clsDocSendtoPsTmp.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);
$oDPt = new Department($oC);
$oDPt2 = new Department($oC);
$oDPt3 = new Department($oC);
$oDPt4 = new Department($oC);
$oPS = new person($oC);
$oPS2 = new person($oC);
$oPS3 = new person($oC);
$oPS4 = 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);
$oDatt = new Docattatches($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oRs3 = new DocReceiveSend($oC);
$oRs4 = new DocReceiveSend($oC);
$oRs5 = new DocReceiveSend($oC);
$oRd = new runningdoc($oC);
$oStmp=new DocSendToPsTmp($oC);
$oPSd = new psdept($oC);
$MaxDocGroup=$oDP->SearchMaxDocGroup();
if($method=="AddSendNew"){
$flagCommit = true;
$checkflagCommit= true;
$oC->BeginTrans();
$DocIDParent=GetParentDoc($DocID);
//echo "DocID=".$DocID."<br>";
//echo "DocIDParent=".$DocIDParent."<br>";
$oDoc2->SearchByKey($DocID);
$oDoc2->GetRecord();
$oRs4->SearchByKey($DrsID);
$oRs4->GetRecord();
$timesend=getNowDateTh()." ".date('H:i:s');
$checkupdate=0;
$checkupdate2=0;
//-----------------send to Dept----------------------------------
$oDPt->SearchByKey($deptId);
$oDPt->GetRecord();
//---send to deptParentId=0------------------------
if($oDPt->deptParentId==0){
$oDPt2->RSmenuByDeptParent2($oDPt->deptParentId);
while($oDPt2->GetRecord()){
if($deptPs[$oDPt2->deptId]!=""){
//echo "send to deptParentId=0 =".$oDPt2->deptName." pssend=".$deptPs[$oDPt2->deptId]." <br>";
//--------------add documents
$oDoc->AddNew();
$oDoc->DocID=$oDoc->GetNextCode();
//echo "DocID=".$oDoc->DocID."<br>";
$oDoc->DocPID=$DocIDParent;
//echo "DocPID=".$oDoc->DocPID."<br>";
$oDoc->DlcID=$deptPs[$oDPt2->deptId];
//echo "DlcID=".$oDoc->DlcID."<br>";
$oDoc->PtID=$oDoc2->PtID;
//echo "PtID=".$oDoc->PtID."<br>";
$oDoc->DtID=$oDoc2->DtID;
$oDoc->DslID=$oDoc2->DslID;
$oDoc->DclID=$oDoc2->DclID;
$oDoc->DsID="0";
$oDoc->RsID="3"; //sendin
$oDoc->DocDateCreate=$timesend;
$DocDateCreate=$oDoc->DocDateCreate;
$oDoc->DocUserCreate=$deptPssend[$oDPt2->deptId];
//echo "DocUserCreate=".$oDoc->DocUserCreate."<br>";
//$DocTypeNo=ShowRunningDoc($oDoc->RsID,$oDoc->DtID,$oDP2->deptId);
$oDoc->DocTypeNo=$oDoc->DocTypeNo;
//echo "DocTypeNo=".$DocTypeNo."<br>";
$oDoc->DocDate=$oDoc2->DocDate;
$oDoc->DocNo=$oDoc2->DocNo;
$oDoc->DocSubject=$oDoc2->DocSubject;
$oDoc->DocFrom=$oDoc2->DocFrom;
$oDoc->DocTo=$oDoc2->DocTo;
$oDoc->DocShortDesc=$oDoc2->DocShortDesc;
$oDoc->DocSpeedLevelDueDate=$oDoc2->DocSpeedLevelDueDate;
//echo "speedDate=".$oDoc->DocSpeedLevelDueDate."<br>";
$oDoc->DocStart=$oDoc2->DocStart;
$oDoc->DocFinish=$oDoc2->DocFinish;
$oDoc->DocGroup=$oDoc2->DocGroup;
$oDoc->DocRef=$oDoc2->DocRef;
$oDoc->DocCircular=$oDoc2->DocCircular;
$oDoc->DocfCir=$oDoc2->DocfCir;
$oDoc->DocOther=$oDoc2->DocOther;
$oDoc->CertificatePs=$oDoc2->CertificatePs;
$oDoc->fDelete=$oDoc2->fDelete;
$oDoc->endDoc=$oDoc->endDoc;
$oDoc->sendToPs=$oDoc2->sendToPs;
$oDoc->AnID=$oDoc2->AnID;
$oDoc->DocRefAns=$oDoc2->DocRefAns;
$oDoc->DocRefAnsID=$oDoc2->DocRefAnsID;
$oDoc->DocstartDatePost=$oDoc2->DocstartDatePost;
$oDoc->DocendDatePost=$oDoc2->DocendDatePost;
$oDoc->DocMainPost=$oDoc->DocMainPost;
$oDoc->DocGetPost=$oDoc->DocGetPost;
$oDoc->DocShowInOut=$oDoc2->DocShowInOut;
$oDoc->DocDateGetPost=$oDoc->DocDateGetPost;
$oDoc->useMainDocNo=$oDoc2->useMainDocNo;
$oDoc->DocforSign=$oDoc2->DocforSign;
$checkflagCommit = $oDoc->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
//echo "end<br>";
$checkupdate++;
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oDoc->DocID;
//echo "DocID=".$oRs2->DocID."<br>";
$oRs2->DlcID=$deptPs[$oDPt2->deptId];
//echo "DlcID=".$oRs2->DlcID."<br>";
$oRs2->DsID="0";
$oRs2->personId=$oRs2->personId;
//echo "personId=".$oRs2->personId."<br>";
$oRs2->PtID=$oDoc->PtID;
//echo "PtID=".$oRs2->PtID."<br>";
$oRs2->DrsDocTypeNo=$oRs2->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$oRs4->DrsSendDate;
//echo "DrsReceiveDate=".$oRs2->DrsReceiveDate."<br>";
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId='';
//echo "DrsReceivePersonId=".$oRs2->DrsReceivePersonId."<br>";
$oRs2->DrsSendDate=$oRs2->DrsSendDate;
$oRs2->DrsSendPersonId=$oRs2->DrsSendPersonId;
$oRs2->DrsSendDlcID=$oRs2->DrsSendDlcID;
$oRs2->DrsDocDueDate=$oDoc->DocSpeedLevelDueDate;
//echo "DrsDocDueDate=".$oRs2->DrsDocDueDate."<br>";
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
//echo "DrsDlcIDCreate=".$oRs2->DrsDlcIDCreate."<br>";
$oRs2->DrsPsIDCreate=$personId;
//echo "DrsPsIDCreate=".$oRs2->DrsPsIDCreate."<br>";
$oRs2->DrsPropose=$oRs4->DrsSign;
//echo "DrsPropose=".$oRs2->DrsPropose."<br>";
$oRs2->DrsSign=$oRs2->DrsSign;
//echo "DrsSign=".$oRs2->DrsSign."<br>";
$oRs2->DrsFromDrsID=$oRs4->DrsID;
//echo "DrsFromDrsID=".$oRs2->DrsFromDrsID."<br>";
$oRs2->DocGroup=$oRs4->DocGroup;
//echo "DocGroup=".$oRs2->DocGroup."<br>";
$oRs2->DrsflagRead=$oRs2->DrsflagRead;
$oRs2->DrsByPass=$oRs2->DrsByPass;
$oRs2->DrsSend=$oRs2->DrsSend;
$oRs2->DrsSendToPs=$oRs2->DrsSendToPs;
$oRs2->DrsDelete=$oRs2->DrsDelete;
$oRs2->DrsMainPs=$oRs2->DrsMainPs;
$oRs2->AnID=$oRs4->AnID;
//echo "AnID=".$oRs2->AnID."<br>";
$oRs2->DrsDocReceiveDate=$oRs2->DrsDocReceiveDate;
$oRs2->DocRefAnsDate=$oRs2->DocRefAnsDate;
$oRs2->DrsSendDocNew=$timesend;
//echo "DrsSendDocNew=".$oRs2->DrsSendDocNew."<br>";
$oRs2->DrsInboxID=$oRs2->DrsInboxID;
$oRs2->DrsstartDatePost=$oRs4->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs4->DrsendDatePost;
$checkflagCommit = $oRs2->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
}
//-----send to child deptId
$oDPt4->RSmenuByDeptParent2($oDPt->deptId);
while($oDPt4->GetRecord()){
if($deptPs[$oDPt4->deptId]!=""){
//echo "send to child deptId =".$oDPt4->deptName." pssend=".$deptPs[$oDPt4->deptId]." <br>";
//--------------add documents
$oDoc->AddNew();
$oDoc->DocID=$oDoc->GetNextCode();
//echo "DocID=".$oDoc->DocID."<br>";
$oDoc->DocPID=$DocIDParent;
//echo "DocPID=".$oDoc->DocPID."<br>";
$oDoc->DlcID=$deptPs[$oDPt4->deptId];
//echo "DlcID=".$oDoc->DlcID."<br>";
$oDoc->PtID=$oDoc2->PtID;
//echo "PtID=".$oDoc->PtID."<br>";
$oDoc->DtID=$oDoc2->DtID;
$oDoc->DslID=$oDoc2->DslID;
$oDoc->DclID=$oDoc2->DclID;
$oDoc->DsID="0";
$oDoc->RsID="3"; //sendin
$oDoc->DocDateCreate=$timesend;
$DocDateCreate=$oDoc->DocDateCreate;
$oDoc->DocUserCreate=$deptPssend[$oDPt4->deptId];
//echo "DocUserCreate=".$oDoc->DocUserCreate."<br>";
//$DocTypeNo=ShowRunningDoc($oDoc->RsID,$oDoc->DtID,$oDP2->deptId);
$oDoc->DocTypeNo=$oDoc->DocTypeNo;
//echo "DocTypeNo=".$DocTypeNo."<br>";
$oDoc->DocDate=$oDoc2->DocDate;
$oDoc->DocNo=$oDoc2->DocNo;
$oDoc->DocSubject=$oDoc2->DocSubject;
$oDoc->DocFrom=$oDoc2->DocFrom;
$oDoc->DocTo=$oDoc2->DocTo;
$oDoc->DocShortDesc=$oDoc2->DocShortDesc;
$oDoc->DocSpeedLevelDueDate=$oDoc2->DocSpeedLevelDueDate;
//echo "speedDate=".$oDoc->DocSpeedLevelDueDate."<br>";
$oDoc->DocStart=$oDoc2->DocStart;
$oDoc->DocFinish=$oDoc2->DocFinish;
$oDoc->DocGroup=$oDoc2->DocGroup;
$oDoc->DocRef=$oDoc2->DocRef;
$oDoc->DocCircular=$oDoc2->DocCircular;
$oDoc->DocfCir=$oDoc2->DocfCir;
$oDoc->DocOther=$oDoc2->DocOther;
$oDoc->CertificatePs=$oDoc2->CertificatePs;
$oDoc->fDelete=$oDoc2->fDelete;
$oDoc->endDoc=$oDoc->endDoc;
$oDoc->sendToPs=$oDoc2->sendToPs;
$oDoc->AnID=$oDoc2->AnID;
$oDoc->DocRefAns=$oDoc2->DocRefAns;
$oDoc->DocRefAnsID=$oDoc2->DocRefAnsID;
$oDoc->DocstartDatePost=$oDoc2->DocstartDatePost;
$oDoc->DocendDatePost=$oDoc2->DocendDatePost;
$oDoc->DocMainPost=$oDoc->DocMainPost;
$oDoc->DocGetPost=$oDoc->DocGetPost;
$oDoc->DocShowInOut=$oDoc2->DocShowInOut;
$oDoc->DocDateGetPost=$oDoc->DocDateGetPost;
$oDoc->useMainDocNo=$oDoc2->useMainDocNo;
$oDoc->DocforSign=$oDoc2->DocforSign;
$checkflagCommit = $oDoc->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
//echo "end<br>";
$checkupdate++;
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oDoc->DocID;
//echo "DocID=".$oRs2->DocID."<br>";
$oRs2->DlcID=$deptPs[$oDPt4->deptId];
//echo "DlcID=".$oRs2->DlcID."<br>";
$oRs2->DsID="0";
$oRs2->personId=$oRs2->personId;
//echo "personId=".$oRs2->personId."<br>";
$oRs2->PtID=$oDoc->PtID;
//echo "PtID=".$oRs2->PtID."<br>";
$oRs2->DrsDocTypeNo=$oRs2->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$oRs4->DrsSendDate;
//echo "DrsReceiveDate=".$oRs2->DrsReceiveDate."<br>";
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId='';
//echo "DrsReceivePersonId=".$oRs2->DrsReceivePersonId."<br>";
$oRs2->DrsSendDate=$oRs2->DrsSendDate;
$oRs2->DrsSendPersonId=$oRs2->DrsSendPersonId;
$oRs2->DrsSendDlcID=$oRs2->DrsSendDlcID;
$oRs2->DrsDocDueDate=$oDoc->DocSpeedLevelDueDate;
//echo "DrsDocDueDate=".$oRs2->DrsDocDueDate."<br>";
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
//echo "DrsDlcIDCreate=".$oRs2->DrsDlcIDCreate."<br>";
$oRs2->DrsPsIDCreate=$personId;
//echo "DrsPsIDCreate=".$oRs2->DrsPsIDCreate."<br>";
$oRs2->DrsPropose=$oRs4->DrsSign;
//echo "DrsPropose=".$oRs2->DrsPropose."<br>";
$oRs2->DrsSign=$oRs2->DrsSign;
//echo "DrsSign=".$oRs2->DrsSign."<br>";
$oRs2->DrsFromDrsID=$oRs4->DrsID;
//echo "DrsFromDrsID=".$oRs2->DrsFromDrsID."<br>";
$oRs2->DocGroup=$oRs4->DocGroup;
//echo "DocGroup=".$oRs2->DocGroup."<br>";
$oRs2->DrsflagRead=$oRs2->DrsflagRead;
$oRs2->DrsByPass=$oRs2->DrsByPass;
$oRs2->DrsSend=$oRs2->DrsSend;
$oRs2->DrsSendToPs=$oRs2->DrsSendToPs;
$oRs2->DrsDelete=$oRs2->DrsDelete;
$oRs2->DrsMainPs=$oRs2->DrsMainPs;
$oRs2->AnID=$oRs4->AnID;
//echo "AnID=".$oRs2->AnID."<br>";
$oRs2->DrsDocReceiveDate=$oRs2->DrsDocReceiveDate;
$oRs2->DocRefAnsDate=$oRs2->DocRefAnsDate;
$oRs2->DrsSendDocNew=$timesend;
//echo "DrsSendDocNew=".$oRs2->DrsSendDocNew."<br>";
$oRs2->DrsInboxID=$oRs2->DrsInboxID;
$oRs2->DrsstartDatePost=$oRs4->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs4->DrsendDatePost;
$checkflagCommit = $oRs2->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
}
}else{ //-----------have deptparent
//------send to parent dept----------------------
$oDPt2->SearchByKey($oDPt->deptParentId);
$oDPt2->GetRecord();
if($deptPs[$oDPt2->deptId]!=""){
//echo "send to parent dept =".$oDPt2->deptName." pssend=".$deptPs[$oDPt2->deptId]." <br>";
//--------------add documents
$oDoc->AddNew();
$oDoc->DocID=$oDoc->GetNextCode();
//echo "DocID=".$oDoc->DocID."<br>";
$oDoc->DocPID=$DocIDParent;
//echo "DocPID=".$oDoc->DocPID."<br>";
$oDoc->DlcID=$deptPs[$oDPt2->deptId];
//echo "DlcID=".$oDoc->DlcID."<br>";
$oDoc->PtID=$oDoc2->PtID;
//echo "PtID=".$oDoc->PtID."<br>";
$oDoc->DtID=$oDoc2->DtID;
$oDoc->DslID=$oDoc2->DslID;
$oDoc->DclID=$oDoc2->DclID;
$oDoc->DsID="0";
$oDoc->RsID="3"; //sendin
$oDoc->DocDateCreate=$timesend;
$DocDateCreate=$oDoc->DocDateCreate;
$oDoc->DocUserCreate=$deptPssend[$oDPt2->deptId];
//echo "DocUserCreate=".$oDoc->DocUserCreate."<br>";
//$DocTypeNo=ShowRunningDoc($oDoc->RsID,$oDoc->DtID,$oDP2->deptId);
$oDoc->DocTypeNo=$oDoc->DocTypeNo;
//echo "DocTypeNo=".$DocTypeNo."<br>";
$oDoc->DocDate=$oDoc2->DocDate;
$oDoc->DocNo=$oDoc2->DocNo;
$oDoc->DocSubject=$oDoc2->DocSubject;
$oDoc->DocFrom=$oDoc2->DocFrom;
$oDoc->DocTo=$oDoc2->DocTo;
$oDoc->DocShortDesc=$oDoc2->DocShortDesc;
$oDoc->DocSpeedLevelDueDate=$oDoc2->DocSpeedLevelDueDate;
//echo "speedDate=".$oDoc->DocSpeedLevelDueDate."<br>";
$oDoc->DocStart=$oDoc2->DocStart;
$oDoc->DocFinish=$oDoc2->DocFinish;
$oDoc->DocGroup=$oDoc2->DocGroup;
$oDoc->DocRef=$oDoc2->DocRef;
$oDoc->DocCircular=$oDoc2->DocCircular;
$oDoc->DocfCir=$oDoc2->DocfCir;
$oDoc->DocOther=$oDoc2->DocOther;
$oDoc->CertificatePs=$oDoc2->CertificatePs;
$oDoc->fDelete=$oDoc2->fDelete;
$oDoc->endDoc=$oDoc->endDoc;
$oDoc->sendToPs=$oDoc2->sendToPs;
$oDoc->AnID=$oDoc2->AnID;
$oDoc->DocRefAns=$oDoc2->DocRefAns;
$oDoc->DocRefAnsID=$oDoc2->DocRefAnsID;
$oDoc->DocstartDatePost=$oDoc2->DocstartDatePost;
$oDoc->DocendDatePost=$oDoc2->DocendDatePost;
$oDoc->DocMainPost=$oDoc->DocMainPost;
$oDoc->DocGetPost=$oDoc->DocGetPost;
$oDoc->DocShowInOut=$oDoc2->DocShowInOut;
$oDoc->DocDateGetPost=$oDoc->DocDateGetPost;
$oDoc->useMainDocNo=$oDoc2->useMainDocNo;
$oDoc->DocforSign=$oDoc2->DocforSign;
$checkflagCommit = $oDoc->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
//echo "end<br>";
$checkupdate++;
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oDoc->DocID;
//echo "DocID=".$oRs2->DocID."<br>";
$oRs2->DlcID=$deptPs[$oDPt2->deptId];
//echo "DlcID=".$oRs2->DlcID."<br>";
$oRs2->DsID="0";
$oRs2->personId=$oRs2->personId;
//echo "personId=".$oRs2->personId."<br>";
$oRs2->PtID=$oDoc->PtID;
//echo "PtID=".$oRs2->PtID."<br>";
$oRs2->DrsDocTypeNo=$oRs2->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$oRs4->DrsSendDate;
//echo "DrsReceiveDate=".$oRs2->DrsReceiveDate."<br>";
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId='';
//echo "DrsReceivePersonId=".$oRs2->DrsReceivePersonId."<br>";
$oRs2->DrsSendDate=$oRs2->DrsSendDate;
$oRs2->DrsSendPersonId=$oRs2->DrsSendPersonId;
$oRs2->DrsSendDlcID=$oRs2->DrsSendDlcID;
$oRs2->DrsDocDueDate=$oDoc->DocSpeedLevelDueDate;
//echo "DrsDocDueDate=".$oRs2->DrsDocDueDate."<br>";
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
//echo "DrsDlcIDCreate=".$oRs2->DrsDlcIDCreate."<br>";
$oRs2->DrsPsIDCreate=$personId;
//echo "DrsPsIDCreate=".$oRs2->DrsPsIDCreate."<br>";
$oRs2->DrsPropose=$oRs4->DrsSign;
//echo "DrsPropose=".$oRs2->DrsPropose."<br>";
$oRs2->DrsSign=$oRs2->DrsSign;
//echo "DrsSign=".$oRs2->DrsSign."<br>";
$oRs2->DrsFromDrsID=$oRs4->DrsID;
//echo "DrsFromDrsID=".$oRs2->DrsFromDrsID."<br>";
$oRs2->DocGroup=$oRs4->DocGroup;
//echo "DocGroup=".$oRs2->DocGroup."<br>";
$oRs2->DrsflagRead=$oRs2->DrsflagRead;
$oRs2->DrsByPass=$oRs2->DrsByPass;
$oRs2->DrsSend=$oRs2->DrsSend;
$oRs2->DrsSendToPs=$oRs2->DrsSendToPs;
$oRs2->DrsDelete=$oRs2->DrsDelete;
$oRs2->DrsMainPs=$oRs2->DrsMainPs;
$oRs2->AnID=$oRs4->AnID;
//echo "AnID=".$oRs2->AnID."<br>";
$oRs2->DrsDocReceiveDate=$oRs2->DrsDocReceiveDate;
$oRs2->DocRefAnsDate=$oRs2->DocRefAnsDate;
$oRs2->DrsSendDocNew=$timesend;
//echo "DrsSendDocNew=".$oRs2->DrsSendDocNew."<br>";
$oRs2->DrsInboxID=$oRs2->DrsInboxID;
$oRs2->DrsstartDatePost=$oRs4->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs4->DrsendDatePost;
$checkflagCommit = $oRs2->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
//------send to balance dept----------------------
$oDPt3->RSmenuByDeptParent2($oDPt2->deptId);
while($oDPt3->GetRecord()){
if($deptPs[$oDPt3->deptId]!=""){
//echo "send to balance dept =".$oDPt3->deptName." pssend=".$deptPs[$oDPt3->deptId]." <br>";
//--------------add documents
$oDoc->AddNew();
$oDoc->DocID=$oDoc->GetNextCode();
//echo "DocID=".$oDoc->DocID."<br>";
$oDoc->DocPID=$DocIDParent;
//echo "DocPID=".$oDoc->DocPID."<br>";
$oDoc->DlcID=$deptPs[$oDPt3->deptId];
//echo "DlcID=".$oDoc->DlcID."<br>";
$oDoc->PtID=$oDoc2->PtID;
//echo "PtID=".$oDoc->PtID."<br>";
$oDoc->DtID=$oDoc2->DtID;
$oDoc->DslID=$oDoc2->DslID;
$oDoc->DclID=$oDoc2->DclID;
$oDoc->DsID="0";
$oDoc->RsID="3"; //sendin
$oDoc->DocDateCreate=$timesend;
$DocDateCreate=$oDoc->DocDateCreate;
$oDoc->DocUserCreate=$deptPssend[$oDPt3->deptId];
//echo "DocUserCreate=".$oDoc->DocUserCreate."<br>";
//$DocTypeNo=ShowRunningDoc($oDoc->RsID,$oDoc->DtID,$oDP2->deptId);
$oDoc->DocTypeNo=$oDoc->DocTypeNo;
//echo "DocTypeNo=".$DocTypeNo."<br>";
$oDoc->DocDate=$oDoc2->DocDate;
$oDoc->DocNo=$oDoc2->DocNo;
$oDoc->DocSubject=$oDoc2->DocSubject;
$oDoc->DocFrom=$oDoc2->DocFrom;
$oDoc->DocTo=$oDoc2->DocTo;
$oDoc->DocShortDesc=$oDoc2->DocShortDesc;
$oDoc->DocSpeedLevelDueDate=$oDoc2->DocSpeedLevelDueDate;
//echo "speedDate=".$oDoc->DocSpeedLevelDueDate."<br>";
$oDoc->DocStart=$oDoc2->DocStart;
$oDoc->DocFinish=$oDoc2->DocFinish;
$oDoc->DocGroup=$oDoc2->DocGroup;
$oDoc->DocRef=$oDoc2->DocRef;
$oDoc->DocCircular=$oDoc2->DocCircular;
$oDoc->DocfCir=$oDoc2->DocfCir;
$oDoc->DocOther=$oDoc2->DocOther;
$oDoc->CertificatePs=$oDoc2->CertificatePs;
$oDoc->fDelete=$oDoc2->fDelete;
$oDoc->endDoc=$oDoc->endDoc;
$oDoc->sendToPs=$oDoc2->sendToPs;
$oDoc->AnID=$oDoc2->AnID;
$oDoc->DocRefAns=$oDoc2->DocRefAns;
$oDoc->DocRefAnsID=$oDoc2->DocRefAnsID;
$oDoc->DocstartDatePost=$oDoc2->DocstartDatePost;
$oDoc->DocendDatePost=$oDoc2->DocendDatePost;
$oDoc->DocMainPost=$oDoc->DocMainPost;
$oDoc->DocGetPost=$oDoc->DocGetPost;
$oDoc->DocShowInOut=$oDoc2->DocShowInOut;
$oDoc->DocDateGetPost=$oDoc->DocDateGetPost;
$oDoc->useMainDocNo=$oDoc2->useMainDocNo;
$oDoc->DocforSign=$oDoc2->DocforSign;
$checkflagCommit = $oDoc->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
//echo "end<br>";
$checkupdate++;
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oDoc->DocID;
//echo "DocID=".$oRs2->DocID."<br>";
$oRs2->DlcID=$deptPs[$oDPt3->deptId];
//echo "DlcID=".$oRs2->DlcID."<br>";
$oRs2->DsID="0";
$oRs2->personId=$oRs2->personId;
//echo "personId=".$oRs2->personId."<br>";
$oRs2->PtID=$oDoc->PtID;
//echo "PtID=".$oRs2->PtID."<br>";
$oRs2->DrsDocTypeNo=$oRs2->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$oRs4->DrsSendDate;
//echo "DrsReceiveDate=".$oRs2->DrsReceiveDate."<br>";
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId='';
//echo "DrsReceivePersonId=".$oRs2->DrsReceivePersonId."<br>";
$oRs2->DrsSendDate=$oRs2->DrsSendDate;
$oRs2->DrsSendPersonId=$oRs2->DrsSendPersonId;
$oRs2->DrsSendDlcID=$oRs2->DrsSendDlcID;
$oRs2->DrsDocDueDate=$oDoc->DocSpeedLevelDueDate;
//echo "DrsDocDueDate=".$oRs2->DrsDocDueDate."<br>";
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
//echo "DrsDlcIDCreate=".$oRs2->DrsDlcIDCreate."<br>";
$oRs2->DrsPsIDCreate=$personId;
//echo "DrsPsIDCreate=".$oRs2->DrsPsIDCreate."<br>";
$oRs2->DrsPropose=$oRs4->DrsSign;
//echo "DrsPropose=".$oRs2->DrsPropose."<br>";
$oRs2->DrsSign=$oRs2->DrsSign;
//echo "DrsSign=".$oRs2->DrsSign."<br>";
$oRs2->DrsFromDrsID=$oRs4->DrsID;
//echo "DrsFromDrsID=".$oRs2->DrsFromDrsID."<br>";
$oRs2->DocGroup=$oRs4->DocGroup;
//echo "DocGroup=".$oRs2->DocGroup."<br>";
$oRs2->DrsflagRead=$oRs2->DrsflagRead;
$oRs2->DrsByPass=$oRs2->DrsByPass;
$oRs2->DrsSend=$oRs2->DrsSend;
$oRs2->DrsSendToPs=$oRs2->DrsSendToPs;
$oRs2->DrsDelete=$oRs2->DrsDelete;
$oRs2->DrsMainPs=$oRs2->DrsMainPs;
$oRs2->AnID=$oRs4->AnID;
//echo "AnID=".$oRs2->AnID."<br>";
$oRs2->DrsDocReceiveDate=$oRs2->DrsDocReceiveDate;
$oRs2->DocRefAnsDate=$oRs2->DocRefAnsDate;
$oRs2->DrsSendDocNew=$timesend;
//echo "DrsSendDocNew=".$oRs2->DrsSendDocNew."<br>";
$oRs2->DrsInboxID=$oRs2->DrsInboxID;
$oRs2->DrsstartDatePost=$oRs4->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs4->DrsendDatePost;
$checkflagCommit = $oRs2->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
//-----send to child deptId
if($oDPt3->deptId==$oDPt->deptId){
$oDPt4->RSmenuByDeptParent2($oDPt3->deptId);
while($oDPt4->GetRecord()){
if($deptPs[$oDPt4->deptId]!=""){
//echo "send to child deptId =".$oDPt4->deptName." pssend=".$deptPs[$oDPt4->deptId]." <br>";
//--------------add documents
$oDoc->AddNew();
$oDoc->DocID=$oDoc->GetNextCode();
//echo "DocID=".$oDoc->DocID."<br>";
$oDoc->DocPID=$DocIDParent;
//echo "DocPID=".$oDoc->DocPID."<br>";
$oDoc->DlcID=$deptPs[$oDPt4->deptId];
//echo "DlcID=".$oDoc->DlcID."<br>";
$oDoc->PtID=$oDoc2->PtID;
//echo "PtID=".$oDoc->PtID."<br>";
$oDoc->DtID=$oDoc2->DtID;
$oDoc->DslID=$oDoc2->DslID;
$oDoc->DclID=$oDoc2->DclID;
$oDoc->DsID="0";
$oDoc->RsID="3"; //sendin
$oDoc->DocDateCreate=$timesend;
$DocDateCreate=$oDoc->DocDateCreate;
$oDoc->DocUserCreate=$deptPssend[$oDPt4->deptId];
//echo "DocUserCreate=".$oDoc->DocUserCreate."<br>";
//$DocTypeNo=ShowRunningDoc($oDoc->RsID,$oDoc->DtID,$oDP2->deptId);
$oDoc->DocTypeNo=$oDoc->DocTypeNo;
//echo "DocTypeNo=".$DocTypeNo."<br>";
$oDoc->DocDate=$oDoc2->DocDate;
$oDoc->DocNo=$oDoc2->DocNo;
$oDoc->DocSubject=$oDoc2->DocSubject;
$oDoc->DocFrom=$oDoc2->DocFrom;
$oDoc->DocTo=$oDoc2->DocTo;
$oDoc->DocShortDesc=$oDoc2->DocShortDesc;
$oDoc->DocSpeedLevelDueDate=$oDoc2->DocSpeedLevelDueDate;
//echo "speedDate=".$oDoc->DocSpeedLevelDueDate."<br>";
$oDoc->DocStart=$oDoc2->DocStart;
$oDoc->DocFinish=$oDoc2->DocFinish;
$oDoc->DocGroup=$oDoc2->DocGroup;
$oDoc->DocRef=$oDoc2->DocRef;
$oDoc->DocCircular=$oDoc2->DocCircular;
$oDoc->DocfCir=$oDoc2->DocfCir;
$oDoc->DocOther=$oDoc2->DocOther;
$oDoc->CertificatePs=$oDoc2->CertificatePs;
$oDoc->fDelete=$oDoc2->fDelete;
$oDoc->endDoc=$oDoc->endDoc;
$oDoc->sendToPs=$oDoc2->sendToPs;
$oDoc->AnID=$oDoc2->AnID;
$oDoc->DocRefAns=$oDoc2->DocRefAns;
$oDoc->DocRefAnsID=$oDoc2->DocRefAnsID;
$oDoc->DocstartDatePost=$oDoc2->DocstartDatePost;
$oDoc->DocendDatePost=$oDoc2->DocendDatePost;
$oDoc->DocMainPost=$oDoc->DocMainPost;
$oDoc->DocGetPost=$oDoc->DocGetPost;
$oDoc->DocShowInOut=$oDoc2->DocShowInOut;
$oDoc->DocDateGetPost=$oDoc->DocDateGetPost;
$oDoc->useMainDocNo=$oDoc2->useMainDocNo;
$oDoc->DocforSign=$oDoc2->DocforSign;
$checkflagCommit = $oDoc->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
//echo "end<br>";
$checkupdate++;
$oRs2->AddNew();
$oRs2->DrsID=$oRs2->GetNextCode();
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oDoc->DocID;
//echo "DocID=".$oRs2->DocID."<br>";
$oRs2->DlcID=$deptPs[$oDPt4->deptId];
//echo "DlcID=".$oRs2->DlcID."<br>";
$oRs2->DsID="0";
$oRs2->personId=$oRs2->personId;
//echo "personId=".$oRs2->personId."<br>";
$oRs2->PtID=$oDoc->PtID;
//echo "PtID=".$oRs2->PtID."<br>";
$oRs2->DrsDocTypeNo=$oRs2->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$oRs4->DrsSendDate;
//echo "DrsReceiveDate=".$oRs2->DrsReceiveDate."<br>";
$oDlc->SearchByKey($oDoc->DlcID); $oDlc->GetRecord();
$oRs2->DrsReceivePersonId='';
//echo "DrsReceivePersonId=".$oRs2->DrsReceivePersonId."<br>";
$oRs2->DrsSendDate=$oRs2->DrsSendDate;
$oRs2->DrsSendPersonId=$oRs2->DrsSendPersonId;
$oRs2->DrsSendDlcID=$oRs2->DrsSendDlcID;
$oRs2->DrsDocDueDate=$oDoc->DocSpeedLevelDueDate;
//echo "DrsDocDueDate=".$oRs2->DrsDocDueDate."<br>";
$oRs2->DrsDlcIDCreate=$DlcIDlogin;
//echo "DrsDlcIDCreate=".$oRs2->DrsDlcIDCreate."<br>";
$oRs2->DrsPsIDCreate=$personId;
//echo "DrsPsIDCreate=".$oRs2->DrsPsIDCreate."<br>";
$oRs2->DrsPropose=$oRs4->DrsSign;
//echo "DrsPropose=".$oRs2->DrsPropose."<br>";
$oRs2->DrsSign=$oRs2->DrsSign;
//echo "DrsSign=".$oRs2->DrsSign."<br>";
$oRs2->DrsFromDrsID=$oRs4->DrsID;
//echo "DrsFromDrsID=".$oRs2->DrsFromDrsID."<br>";
$oRs2->DocGroup=$oRs4->DocGroup;
//echo "DocGroup=".$oRs2->DocGroup."<br>";
$oRs2->DrsflagRead=$oRs2->DrsflagRead;
$oRs2->DrsByPass=$oRs2->DrsByPass;
$oRs2->DrsSend=$oRs2->DrsSend;
$oRs2->DrsSendToPs=$oRs2->DrsSendToPs;
$oRs2->DrsDelete=$oRs2->DrsDelete;
$oRs2->DrsMainPs=$oRs2->DrsMainPs;
$oRs2->AnID=$oRs4->AnID;
//echo "AnID=".$oRs2->AnID."<br>";
$oRs2->DrsDocReceiveDate=$oRs2->DrsDocReceiveDate;
$oRs2->DocRefAnsDate=$oRs2->DocRefAnsDate;
$oRs2->DrsSendDocNew=$timesend;
//echo "DrsSendDocNew=".$oRs2->DrsSendDocNew."<br>";
$oRs2->DrsInboxID=$oRs2->DrsInboxID;
$oRs2->DrsstartDatePost=$oRs4->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs4->DrsendDatePost;
$checkflagCommit = $oRs2->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
}
}
}
}
}
//-----------------send to person in dept----------------------------------
$oPS2->SearchByDeptId($deptId);
while($oPS2->GetRecord()){
if($Ps[$oPS2->personId]!="" || $mainPsselect==$oPS2->personId){
//echo "addnew send to person in dept<br>";
$oRs1->AddNew();
$oRs1->DrsID=$oRs1->GetNextCode();
$oRs1->DocID=$DocID;
$oRs1->DlcID="0";
$oRs1->DsID=0;
$oRs1->personId=$oPS2->personId;
//echo "send All ps=".$oRs1->personId."<br>";
$oRs1->PtID=$oRs4->PtID;
$oRs1->DrsDocTypeNo=$oRs4->DrsDocTypeNo;
//echo "DrsDocTypeNo=".$oRs1->DrsDocTypeNo."<br>";
$oRs1->DrsReceiveDate=$oRs4->DrsSendDate;
//echo "DrsReceiveDate=".$oRs1->DrsReceiveDate."<br>";
$oRs1->DrsReceivePersonId=$oPS2->personId;
//echo "DrsReceivePersonId=".$oRs1->DrsReceivePersonId."<br>";
$oRs1->DrsSendDate=$oRs1->DrsSendDate;
$oRs1->DrsSendPersonId=$oRs1->DrsSendPersonId;
$oRs1->DrsSendDlcID=$oRs1->DrsSendDlcID;
$oRs1->DrsDocDueDate=$oDoc->DocSpeedLevelDueDate;
//echo "DrsDocDueDate=".$oRs1->DrsDocDueDate."<br>";
$oRs1->DrsDlcIDCreate=$DlcIDlogin;
//echo "DrsDlcIDCreate=".$oRs1->DrsDlcIDCreate."<br>";
$oRs1->DrsPsIDCreate=$personId;
//echo "DrsPsIDCreate=".$oRs1->DrsPsIDCreate."<br>";
$oRs1->DrsPropose=$oRs4->DrsSign;
//echo "DrsPropose=".$oRs1->DrsPropose."<br>";
$oRs1->DrsSign=$oRs1->DrsSign;
$oRs1->DrsFromDrsID=$oRs4->DrsID;
//echo "DrsFromDrsID=".$oRs1->DrsFromDrsID."<br>";
$oRs1->DocGroup=$oRs4->DocGroup;
$oRs1->DrsflagRead=$oRs1->DrsflagRead;
$oRs1->DrsByPass=$oRs1->DrsByPass;
$oRs1->DrsSend=$oRs1->DrsSend;
$oRs1->DrsSendToPs=$oRs1->DrsSendToPs;
$oRs1->DrsDelete=$oRs1->DrsDelete;
if($mainPsselect==$oPS2->personId){ $DrsMainPs="Y"; }else{ $DrsMainPs=""; }
$oRs1->DrsMainPs=$DrsMainPs;
//echo "DrsMainPs=".$DrsMainPs."<br>";
$oRs1->AnID=$oRs4->AnID;
//echo "AnID=".$AnID."<br>";
$oRs1->DrsDocReceiveDate=$oRs1->DrsDocReceiveDate;
$oRs1->DocRefAnsDate=$oRs1->DocRefAnsDate;
$oRs1->DrsSendDocNew=$timesend;
$oRs1->DrsInboxID=$oRs1->DrsInboxID;
$oRs1->DrsstartDatePost=$oRs4->DrsstartDatePost;
$oRs1->DrsendDatePost=$oRs4->DrsendDatePost;
$DrsReadDoc=GetDrsReadDoc($DocID);
$oRs1->DrsReadDoc=$DrsReadDoc;
$checkflagCommit = $oRs1->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
$checkupdate2++;
}
}
//-----------------send to person psdept----------------------------------
$oPSd->SearchBydeptId($deptId);
while($oPSd->GetRecord()){
if($Ps[$oPSd->personId]!="" || $mainPsselect==$oPSd->personId){
//echo "addnew send to person in dept<br>";
$oRs1->AddNew();
$oRs1->DrsID=$oRs1->GetNextCode();
$oRs1->DocID=$DocID;
$oRs1->DlcID="0";
$oRs1->DsID=0;
$oRs1->personId=$oPSd->personId;
//echo "send All ps=".$oRs1->personId."<br>";
$oRs1->PtID=$oRs4->PtID;
$oRs1->DrsDocTypeNo=$oRs4->DrsDocTypeNo;
//echo "DrsDocTypeNo=".$oRs1->DrsDocTypeNo."<br>";
$oRs1->DrsReceiveDate=$oRs4->DrsSendDate;
//echo "DrsReceiveDate=".$oRs1->DrsReceiveDate."<br>";
$oRs1->DrsReceivePersonId=$oPSd->personId;
//echo "DrsReceivePersonId=".$oRs1->DrsReceivePersonId."<br>";
$oRs1->DrsSendDate=$oRs1->DrsSendDate;
$oRs1->DrsSendPersonId=$oRs1->DrsSendPersonId;
$oRs1->DrsSendDlcID=$oRs1->DrsSendDlcID;
$oRs1->DrsDocDueDate=$oDoc->DocSpeedLevelDueDate;
//echo "DrsDocDueDate=".$oRs1->DrsDocDueDate."<br>";
$oRs1->DrsDlcIDCreate=$DlcIDlogin;
//echo "DrsDlcIDCreate=".$oRs1->DrsDlcIDCreate."<br>";
$oRs1->DrsPsIDCreate=$personId;
//echo "DrsPsIDCreate=".$oRs1->DrsPsIDCreate."<br>";
$oRs1->DrsPropose=$oRs4->DrsSign;
//echo "DrsPropose=".$oRs1->DrsPropose."<br>";
$oRs1->DrsSign=$oRs1->DrsSign;
$oRs1->DrsFromDrsID=$oRs4->DrsID;
//echo "DrsFromDrsID=".$oRs1->DrsFromDrsID."<br>";
$oRs1->DocGroup=$oRs4->DocGroup;
$oRs1->DrsflagRead=$oRs1->DrsflagRead;
$oRs1->DrsByPass=$oRs1->DrsByPass;
$oRs1->DrsSend=$oRs1->DrsSend;
$oRs1->DrsSendToPs=$oRs1->DrsSendToPs;
$oRs1->DrsDelete=$oRs1->DrsDelete;
if($mainPsselect==$oPSd->personId){ $DrsMainPs="Y"; }else{ $DrsMainPs=""; }
$oRs1->DrsMainPs=$DrsMainPs;
//echo "DrsMainPs=".$DrsMainPs."<br>";
$oRs1->AnID=$oRs4->AnID;
//echo "AnID=".$AnID."<br>";
$oRs1->DrsDocReceiveDate=$oRs1->DrsDocReceiveDate;
$oRs1->DocRefAnsDate=$oRs1->DocRefAnsDate;
$oRs1->DrsSendDocNew=$timesend;
$oRs1->DrsInboxID=$oRs1->DrsInboxID;
$oRs1->DrsstartDatePost=$oRs4->DrsstartDatePost;
$oRs1->DrsendDatePost=$oRs4->DrsendDatePost;
$DrsReadDoc=GetDrsReadDoc($DocID);
$oRs1->DrsReadDoc=$DrsReadDoc;
$checkflagCommit = $oRs1->Save();
if(!$checkflagCommit){ $flagCommit=$checkflagCommit; }
$checkupdate2++;
}
}
$oStmp->SearchByDrsID($DrsID);
while($oStmp->GetRecord()){
$oStmp->Delete();
}
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
if($sendback!="1"){
echo "<meta http-equiv='refresh' content='0; URL=sendDoc.php?flagshow=$flagshow&monthe=$monthe&searchYear=$searchYear'>";
}else{
echo "<meta http-equiv='refresh' content='0; URL=docSendBack.php?flagshow=$flagshow&monthe=$monthe&searchYear=$searchYear'>";
}
}
?>
|