Viewing file: processSendDocSR.php (13.23 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php set_time_limit(0); 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"; include_once "../class/clsCollegeDetail.php"; include_once "../class/clsSendReceive.php"; include_once "programTSR.php"; include_once "../class/clsCorrespondenceletter_Department.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); $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); $oDoc3 = new Documents($oC); $oDoc4 = new Documents($oC); $oDoc5 = new Documents($oC); $oDatt = new Docattatches($oC); $oDatt2 = 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); $oRs8 = new DocReceiveSend($oC); $oRd = new runningdoc($oC); $oStmp=new DocSendToPsTmp($oC); $oPSd = new psdept($oC); $oCd = new collegedetail($oC); $oTsr = new sendreceive($oC); $oTsr2 = new sendreceive($oC); $oTsre = new sendreceive($oC); $oCdld = new correspondenceletter_department($oC);
$MaxDocGroup=$oDP->SearchMaxDocGroup(); if($method=="addsend"){
$DocIDParent=GetParentDoc($DocID); $oDoc2->SearchByKey($DocID); $oDoc2->GetRecord(); $oRs4->SearchByKey($DrsID); $oRs4->GetRecord(); if($oRs4->DsID=='3' && $oRs4->DrsSendDate=='0000-00-00 00:00:00'){ //can send case normal $flagCommit = true; $checkflagCommit= true; $oC->BeginTrans(); $oRs4->Edit(); $oRs4->DlcID=$DlcIDlogin; $oRs4->DrsReceivePersonId=$personId; $oRs4->Save(); $oRs8->SearchPreDocSignforDlpID0_Update2($DlcIDlogin,$personId,$oRs4->DrsFromDrsID); //----------Get documents and chksum $i=0; $oDatt->SearchByDocID($DocIDParent); while($oDatt->GetRecord()){ $tsr_doc_url.=$docpath.$oDatt->DaUpFileName; $tsr_doc_url.=','; $tsr_docname.=$oDatt->DaFileName; $tsr_docname.=','; //echo 'before chksum='.$docpath.$oDatt->DaUpFileName.'<br>'; $chksum_doc.=md5_file($docpath.$oDatt->DaUpFileName); $chksum_doc.=','; $tsr_statusDocAtt.='N'; //--NNN NNNNN $i++; } $timesend=getNowDateTh()." ".date('H:i:s'); $checkupdate=0; $checkupdate2=0; $oCd->RScollegeSR2($GLOBALS["COLLEGEID"]); //$numRow = $oCd->NumRow(); $ndex = 1; while($oCd->GetRecord()){ if($collegeSR[$oCd->collegeID]!=""){ $oTsr->AddNew(); //echo '<br><br>-------------insert TSR '.$oCd->collegeName.'['.$oCd->collegeID.']----------------<br>'; $oTsr->tsr_fr_node=$GLOBALS["COLLEGEID"]; //echo '<b>tsr_fr_node=</b>'.$oTsr->tsr_fr_node=$GLOBALS["COLLEGEID"]; $oTsr->tsr_fr_node_date=$timesend; //echo '<br><b>tsr_fr_node_date=</b>'.$oTsr->tsr_fr_node_date=$timesend; $oTsr->tsr_to_node=$oCd->collegeID; //echo '<br><b>tsr_to_node=</b>'.$oTsr->tsr_to_node=$oCd->collegeID; $oTsr->tsr_docid=$DocID; //echo '<br><b>tsr_docid=</b>'.$oTsr->tsr_docid=$DocID; $oTsr->tsr_doc_url=$tsr_doc_url; //echo '<br><b>tsr_doc_url=</b>'.$oTsr->tsr_doc_url=$tsr_doc_url; $oTsr->tsr_doc_chksum=$chksum_doc; //echo '<br><b>tsr_doc_chksum=</b>'.$oTsr->tsr_doc_chksum=$chksum_doc; $oTsr->tsr_status='s1'; //echo '<br><b>tsr_status=</b>'.$oTsr->tsr_status='s1'; $oTsr->tsr_docgroup=$oDoc2->DocGroup; //echo '<br><b>tsr_docgroup=</b>'.$oTsr->tsr_docgroup=$oDoc2->DocGroup; $oTsr->tsr_DrsID=$DrsID; //echo '<br><b>tsr_DrsID=</b>'.$oTsr->tsr_DrsID=$DrsID; $oTsr->tsr_DocSubject=th2a($oDoc2->DocSubject); //echo '<br><b>tsr_DocSubject=</b>'.$oTsr->tsr_DocSubject=th2a($oDoc2->DocSubject); $oTsr->tsr_DocNo=th2a($oDoc2->DocNo); //echo '<br><b>tsr_DocNo=</b>'.$oTsr->tsr_DocNo=th2a($oDoc2->DocNo); $oTsr->tsr_DocDate=$oDoc2->DocDate; //echo '<br><b>tsr_DocDate=</b>'.$oTsr->tsr_DocDate=$oDoc2->DocDate; $oTsr->tsr_DocFrom=th2a($oDoc2->DocFrom); //echo '<br><b>tsr_DocFrom=</b>'.$oTsr->tsr_DocFrom=th2a($oDoc2->DocFrom); $oTsr->tsr_DocTo=th2a($oDoc2->DocTo); //echo '<br><b>tsr_DocTo=</b>'.$oTsr->tsr_DocTo=th2a($oDoc2->DocTo); $oTsr->tsr_DocRef=th2a($oDoc2->DocRef); //echo '<br><b>tsr_DocRef=</b>'.$oTsr->tsr_DocRef=th2a($oDoc2->DocRef); $oTsr->tsr_DocOther=th2a($oDoc2->DocOther); //echo '<br><b>tsr_DocOther=</b>'.$oTsr->tsr_DocOther=th2a($oDoc2->DocOther); $oTsr->tsr_DslID=$oDoc2->DslID; //echo '<br><b>tsr_DslID=</b>'.$oTsr->tsr_DslID=$oDoc2->DslID; $oTsr->tsr_DclID=$oDoc2->DclID; //echo '<br><b>tsr_DclID=</b>'.$oTsr->tsr_DclID=$oDoc2->DclID; $oTsr->tsr_DocShortDesc=th2a($oDoc2->DocShortDesc); //echo '<br><b>tsr_DocShortDesc=</b>'.$oTsr->tsr_DocShortDesc=th2a($oDoc2->DocShortDesc); $oTsr->tsr_PtID=$PtID; //echo '<br><b>tsr_PtID=</b>'.$oTsr->tsr_PtID=$PtID; $oTsr->tsr_DlcID=$DlcIDlogin; //echo '<br><b>tsr_DlcID=</b>'.$oTsr->tsr_DlcID=$DlcIDlogin; $oTsr->tsr_personId=$personId; //echo '<br><b>tsr_personId=</b>'.$oTsr->tsr_personId=$personId; $oTsr->tsr_DtID=$oDoc2->DtID; //echo '<br><b>tsr_DtID=</b>'.$oTsr->tsr_DtID=$oDoc2->DtID; $oTsr->tsr_docname=$tsr_docname; //echo '<br><b>tsr_docname=</b>'.$oTsr->tsr_docname=$tsr_docname; if($checkDocSpeedDate=='Y'){ $oTsr->tsr_DrsDocDueDate=splitDateForm($DocSpeedLevelDueDate,"/"); //echo '<br><b>tsr_DrsDocDueDate=</b>'.$oTsr->tsr_DrsDocDueDate=splitDateForm($DocSpeedLevelDueDate,"/"); } $oTsr->tsr_statusDocAtt=$tsr_statusDocAtt; //echo '<br><b>tsr_statusDocAtt=</b>'.$oTsr->tsr_statusDocAtt=$tsr_statusDocAtt; $oTsr->tsr_DocTelOwner=$oDoc2->DocTelOwner; $oTsr->tsr_DocSendReal=$oDoc2->DocSendReal; $oTsr->tsr_DocDeptOwner=$oDoc2->DocDeptOwner; $oTsr->tsr_DocFaxOwner=$oDoc2->DocFaxOwner; $oTsr->tsr_DocCopySend=$oDoc2->DocCopySend; $oTsr->tsr_DocContactE=$oDoc2->DocContactE; $oTsr->tsr_CountDoc=$i; $checkflagCommit = $oTsr->Save(); if(!$checkflagCommit){ $flagCommit=$checkflagCommit; } $oTsre->SearchBytsr_docid_tsr_to_node_tsr_fr_node_date2($DocID,$oCd->collegeID,$timesend); $oTsre->GetRecord(); $realpath = sendTor1($oTsre->tsr_id); //echo "<br> REAL PATH:".$realpath."<br><br>"; $areal[$oTsre->tsr_id] = $realpath; //print_r($areal).'<br>'; $checkupdate++; } } //while CollegeDetail $oCdld->RScorrespondenceletter_department_Y(); while($oCdld->GetRecord()){ if($deptTHeGIF[$oCdld->dm_ID]!=""){ $areal['THeGIF-'.$oCdld->dm_ID] = 'http://'.$GLOBALS["HOST_NAME"].$GLOBALS["FOLDERFORSEND1"].'/eoffice/admin/THeGIF_soap_LetterOutboundRequest.php?DocID='.$DocID.'&DlcIDlogin='.$DlcIDlogin.'&sendDepartment='.$deptTHeGIF[$oCdld->dm_ID]; $checkupdate++; } }
//---------------curl stuff for recieve some from anywhere/ $curlHandle = curl_multi_init(); if($curlHandle){ $i = 1; //echo "Yes I am handle".$curlHandle."<br>"; foreach($areal as $key => $value){ //echo "Key:$key; Value: $value<br>"; $curl[$key] = addHandle($curlHandle,$value); $i++; }//end foreach //echo "After add<br>"; ExecHandle($curlHandle); //This is the adventage of multi curl instead of dumb filegetcontent // echo "After Execute<br>"; foreach($curl as $key => $value){ $output[$key] = curl_multi_getcontent($value); curl_multi_remove_handle($curlHandle,$value); } curl_multi_close($curlHandle);
foreach($output as $id => $answer){ $mystring = $id; $findme = 'THeGIF-'; $pos = strpos($mystring, $findme); //echo "id:$id; answer: $answer<br>"; if($answer == 'mr'){ if($pos==false){ $oTsr2->SearchByKey($id); $oTsr2->GetRecord(); //echo "<br>-------------update status = s2--------------<br>"; $oTsr2->Edit(); //echo '<b>tsr_status=</b>';$oTsr->tsr_status='s2'; $oTsr2->tsr_status='s2'; //echo '<br>'; $checkflagCommit = $oTsr2->Save(); if(!$checkflagCommit){ $flagCommit=$checkflagCommit; } } }else{ echo 'äÁèÍѾഷ mr'; } } }else{ echo "Cannot use multi curl<br>"; } //-------------curl stuff
if($checkupdate!="0"){ //------------------update RSdoc status=3 //echo '<br>-------------update RSdoc status=3----------------<br>'; $oRs->SearchByKey($DrsID); //echo "DrsID_edit=".$DrsID."<br>"; $oRs->GetRecord(); $oRs->Edit(); $oRs->PtID=$PtID; $oRs->DrsSendDate=$timesend; //echo "DrsSendDate=".$oRs->DrsSendDate."<br>"; if($checkDocSpeedDate=="Y"){ $speedDate=splitDateForm($DocSpeedLevelDueDate,"/"); }else{ $speedDate=$DrsDocDueDate; } $oRs->DrsDocDueDate=$speedDate; $oRs->AnID=$AnID; $checkflagCommit = $oRs->Save(); if(!$checkflagCommit){ $flagCommit=$checkflagCommit; } } //checkupdate!=0 if($checkupdate!="0"){ //------------------echo "update RSdoc status=3<br>"; //echo '<br>-------------update document status=3----------------<br>'; $oDoc3->SearchByKey($DocID); $oDoc3->GetRecord(); $oDoc3->Edit(); $oDoc3->PtID=$PtID; if($checkDocSpeedDate=="Y"){ $speedDate=splitDateForm($DocSpeedLevelDueDate,"/"); }else{ $speedDate=$oDoc3->DocSpeedLevelDueDate; } $oDoc3->DocSpeedLevelDueDate=$speedDate; //echo "DocSpeedLevelDueDate=".$oDoc3->DocSpeedLevelDueDate."<br>"; $oDoc3->AnID=$AnID; //echo "AnID=".$oDoc3->AnID."<br>"; $DocstartDatePost=$oDoc3->DocstartDatePost; $DocendDatePost=$oDoc3->DocendDatePost; $oDoc3->DocstartDatePost=$DocstartDatePost; $oDoc3->DocendDatePost=$DocendDatePost; $checkflagCommit = $oDoc3->Save(); if(!$checkflagCommit){ $flagCommit=$checkflagCommit; } } if($flagCommit) $oC->CommitTrans(); else $oC->RollbackTrans();
if($cansend=="Y"){ //echo "<meta http-equiv='refresh' content='0; URL=signDoc.php'>"; ?> <script language="JavaScript"> parent.location.href ="signDoc.php?searchpredocdate=<? echo $searchpredocdate; ?>&selectpredocdatevalue=<? echo $selectpredocdatevalue;?>&folderstaff2=<? echo $folderstaff2; ?>&forfolderstaff2=<? echo $forfolderstaff2;?>"; </script> <? }else{ //echo "<meta http-equiv='refresh' content='0; URL=sendDoc.php'>"; ?> <script language="JavaScript"> parent.location.href ="sendDoc.php?page_id2=<? echo $page_id2;?>&searchpredocdate=<? echo $searchpredocdate; ?>&selectpredocdatevalue=<? echo $selectpredocdatevalue;?>&searchNamePre=<? echo $searchNamePre; ?>&searchNoPre=<? echo $searchNoPre; ?>&selectpreDtID=<? echo $selectpreDtID;?>&folderstaff2=<? echo $folderstaff2; ?>&forfolderstaff2=<? echo $forfolderstaff2;?>"; </script> <? }
}else{ //case normal ?> <script language="JavaScript"> parent.location.href ="sendDoc.php?page_id2=<? echo $page_id2;?>&searchpredocdate=<? echo $searchpredocdate; ?>&selectpredocdatevalue=<? echo $selectpredocdatevalue;?>&searchNamePre=<? echo $searchNamePre; ?>&searchNoPre=<? echo $searchNoPre; ?>&selectpreDtID=<? echo $selectpreDtID;?>&folderstaff2=<? echo $folderstaff2; ?>&forfolderstaff2=<? echo $forfolderstaff2;?>"; </script> <? } } ?>
|