Viewing file: funct.php (63.7 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
function ShowRunningDoc($RsID,$DtID,$deptId){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsRunningDoc.php";
include_once "../class/clsDocType.php";
include_once "../link/keyThai.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oDP2 = new Department($oC);
$oRd = new runningdoc($oC);
$oDt = new doctype($oC);
$oDt1 = new doctype($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
if($RsID=="1"){ //receiveOut
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
if($oRd->confirm=="Y"){
if($oRd->receiveNo=="0" && ($oRd->receiveNoStart!="0" && $oRd->receiveNoStart!="")){
$runningDoc=$oRd->receiveNoStart;
}else if($oRd->receiveNo!="0" && ($oRd->receiveNoStart!="0" && $oRd->receiveNoStart!="")){
$rN=$oRd->receiveNo;
$rN=$rN+1;
$runningDoc=$rN;
}else{
$runningDoc="N";
}
}else{
$runningDoc="NoConfirm";
}
return $runningDoc;
}else if($RsID=="2"){ //sendOut
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
if($oRd->confirm=="Y"){
if($oRd->sendNo=="0" && ($oRd->sendNoStart!="0" && $oRd->sendNoStart!="")){
$runningDoc=$oRd->sendNoStart;
}else if($oRd->sendNo!="0" && ($oRd->sendNoStart!="0" && $oRd->sendNoStart!="")){
$sN=$oRd->sendNo;
$sN=$sN+1;
$runningDoc=$sN;
}else{
$runningDoc="N";
}
}else{
$runningDoc="NoConfirm";
}
return $runningDoc;
}else if($RsID=="3"){ //receiveIn
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
if($oDt->DtRunAll=="N"){
$oRd->SearchRunningBydocGroupDtIDDept($maxgroup,$DtID,$deptId);
$oRd->GetRecord();
}else{
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
}
if($oRd->confirm=="Y"){
if($oRd->receiveNo=="0" && ($oRd->receiveNoStart!="0" && $oRd->receiveNoStart!="")){
$runningDoc=$oRd->receiveNoStart;
}else if($oRd->receiveNo!="0" && ($oRd->receiveNoStart!="0" && $oRd->receiveNoStart!="")){
$rN=$oRd->receiveNo;
$rN=$rN+1;
$runningDoc=$rN;
}else{
$runningDoc="N";
}
}else{
$runningDoc="NoConfirm";
}
return $runningDoc;
}else if($RsID=="4"){ //sendIn
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
if($oDt->DtRunAll=="N"){
$oRd->SearchRunningBydocGroupDtIDDept($maxgroup,$DtID,$deptId);
$oRd->GetRecord();
}else{
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
}
if($oRd->confirm=="Y"){
if($oRd->sendNo=="0" && ($oRd->sendNoStart!="0" && $oRd->sendNoStart!="")){
$runningDoc=$oRd->sendNoStart;
}else if($oRd->sendNo!="0" && ($oRd->sendNoStart!="0" && $oRd->sendNoStart!="")){
$sN=$oRd->sendNo;
$sN=$sN+1;
$runningDoc=$sN;
}else{
$runningDoc="N";
}
}else{
$runningDoc="NoConfirm";
}
return $runningDoc;
}else if($RsID=="5"){ //for regidDoc
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
if($oDt->DtRunAll=="N"){
$oRd->SearchRunningBydocGroupDtIDDept($maxgroup,$DtID,$deptId);
$oRd->GetRecord();
}else{
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
}
if($oRd->confirm=="Y"){
if($oRd->regisNo=="0" && ($oRd->regisNoStart!="0" && $oRd->regisNoStart!="")){
$runningDoc=$oRd->regisNoStart;
}else if($oRd->regisNo!="0" && ($oRd->regisNoStart!="0" && $oRd->regisNoStart!="")){
$rN=$oRd->regisNo;
$rN=$rN+1;
$runningDoc=$rN;
}else{
$runningDoc="N";
}
}else{
$runningDoc="NoConfirm";
}
return $runningDoc;
}
}
function ShowDocNo($RsID,$DtID,$deptId,$DocfCir,$useMainDocNo){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsDocType.php";
include_once "../class/clsRunningDoc.php";
include_once "../class/clsSysConfig.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oDP2 = new Department($oC);
$oDt = new doctype($oC);
$oRd = new runningdoc($oC);
$oSys = new sysConfig($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
if($RsID=="2"){ //sendOut
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
if($oRd->sendNo=="0"){
$runningDoc_=$oRd->sendNoStart;
}else{
$runningDoc_=($oRd->sendNo+1);
}
$oSys->RSsysConfig();
$oSys->GetRecord();
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
$oDP2->SearchByKey($deptId);
$oDP2->GetRecord();
if($oDP2->deptLevel!=0){
$deptId=SearchdeptIdlevel0($oDP2->deptParentId);
}
$oDP->SearchByKey($deptId);
$oDP->GetRecord();
if($oDt->sendNoPrefix!=""){
$DocNo=$oDt->sendNoPrefix;
}
if($oDt->sendNoSuffix!=""){
$DocNo=$DocNo.$oDt->sendNoSuffix;
}
if($useMainDocNo=="Y"){
$DocNo = preg_replace("/%o.%d/", "%o", $DocNo);
}
$DocNo = preg_replace("/%o/", "$oSys->sysDocNo", $DocNo);
$DocNo = preg_replace("/%d/", "$oDP->deptNo", $DocNo);
$DocNo = preg_replace("/%r/", "$runningDoc_", $DocNo);
$Y = date('Y')+543;
$DocNo = preg_replace("/%y/", "$Y", $DocNo);
if($DocfCir=="Y"){ $DocfCir_="Ç."; }
$DocNo = preg_replace("/%p/", "$DocfCir_", $DocNo);
return $DocNo;
}else if($RsID=="3"){ //receiveIn
if($DtID=="3"){
$oRd->SearchRunningBydocGroupDtIDDept($maxgroup,$DtID,$deptId);
$oRd->GetRecord();
}else{
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
}
if($oRd->receiveNo=="0"){
$runningDoc_=$oRd->receiveNoStart;
}else{
$runningDoc_=($oRd->receiveNo+1);
}
$oSys->RSsysConfig();
$oSys->GetRecord();
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
$oDP->SearchByKey($deptId);
$oDP->GetRecord();
if($oDt->sendNoPrefix!=""){
$DocNo=$oDt->sendNoPrefix;
}
if($oDt->sendNoSuffix!=""){
$DocNo=$DocNo.$oDt->sendNoSuffix;
}
$DocNo = preg_replace("/%o/", "$oSys->sysDocNo", $DocNo);
$DocNo = preg_replace("/%d/", "$oDP->deptNo", $DocNo);
$DocNo = preg_replace("/%r/", "$runningDoc_", $DocNo);
$Y = date('Y')+543;
$DocNo = preg_replace("/%y/", "$Y", $DocNo);
if($DocfCir=="Y"){ $DocfCir_="Ç."; }
$DocNo = preg_replace("/%p/", "$DocfCir_", $DocNo);
return $DocNo;
}else if($RsID=="4"){ //sendIn
if($DtID=="3"){
$oRd->SearchRunningBydocGroupDtIDDept($maxgroup,$DtID,$deptId);
$oRd->GetRecord();
}else{
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
}
if($oRd->sendNo=="0"){
$runningDoc_=$oRd->sendNoStart;
}else{
$runningDoc_=($oRd->sendNo+1);
}
$oSys->RSsysConfig();
$oSys->GetRecord();
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
$oDP->SearchByKey($deptId);
$oDP->GetRecord();
if($oDt->sendNoPrefix!=""){
$DocNo=$oDt->sendNoPrefix;
}
if($oDt->sendNoSuffix!=""){
$DocNo=$DocNo.$oDt->sendNoSuffix;
}
$DocNo = preg_replace("/%o/", "$oSys->sysDocNo", $DocNo);
$DocNo = preg_replace("/%d/", "$oDP->deptNo", $DocNo);
$DocNo = preg_replace("/%r/", "$runningDoc_", $DocNo);
$Y = date('Y')+543;
$DocNo = preg_replace("/%y/", "$Y", $DocNo);
if($DocfCir=="Y"){ $DocfCir_="Ç."; }
$DocNo = preg_replace("/%p/", "$DocfCir_", $DocNo);
return $DocNo;
}else if($RsID=="5"){ //for regisDoc
if($DtID=="3"){
$oRd->SearchRunningBydocGroupDtIDDept($maxgroup,$DtID,$deptId);
$oRd->GetRecord();
}else{
$oRd->SearchRunningBydocGroupDtID($maxgroup,$DtID);
$oRd->GetRecord();
}
if($oRd->regisNo=="0"){
$runningDoc_=$oRd->regisNoStart;
}else{
$runningDoc_=($oRd->regisNo+1);
}
$oSys->RSsysConfig();
$oSys->GetRecord();
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
$oDP2->SearchByKey($deptId);
$oDP2->GetRecord();
if($oDP2->deptLevel!=0){
$deptId=SearchdeptIdlevel0($oDP2->deptParentId);
}
$oDP->SearchByKey($deptId);
$oDP->GetRecord();
if($oDt->sendNoPrefix!=""){
$DocNo=$oDt->sendNoPrefix;
}
if($oDt->sendNoSuffix!=""){
$DocNo=$DocNo.$oDt->sendNoSuffix;
}
$DocNo = preg_replace("/%o/", "$oSys->sysDocNo", $DocNo);
$DocNo = preg_replace("/%d/", "$oDP->deptNo", $DocNo);
$DocNo = preg_replace("/%r/", "$runningDoc_", $DocNo);
$Y = date('Y')+543;
$DocNo = preg_replace("/%y/", "$Y", $DocNo);
if($DocfCir=="Y"){ $DocfCir_="Ç."; }
$DocNo = preg_replace("/%p/", "$DocfCir_", $DocNo);
return $DocNo;
}
}
function ShowEditDocNo($RsID,$DtID,$deptId,$P,$runningDoc,$useMainDocNo){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsDocType.php";
include_once "../class/clsRunningDoc.php";
include_once "../class/clsSysConfig.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oDP2 = new Department($oC);
$oDt = new doctype($oC);
$oRd = new runningdoc($oC);
$oSys = new sysConfig($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
if($RsID=="2" || $RsID=="4" || $RsID=="5"){ //sendOut
$oSys->RSsysConfig();
$oSys->GetRecord();
$oDt->SearchByKey($DtID);
$oDt->GetRecord();
$oDP2->SearchByKey($deptId);
$oDP2->GetRecord();
if($oDP2->deptLevel!=0){
$deptId=SearchdeptIdlevel0($oDP2->deptParentId);
}
$oDP->SearchByKey($deptId);
$oDP->GetRecord();
if($oDt->sendNoPrefix!=""){
$DocNo=$oDt->sendNoPrefix;
}
if($oDt->sendNoSuffix!=""){
$DocNo=$DocNo.$oDt->sendNoSuffix;
}
if($useMainDocNo=="Y"){
$DocNo = preg_replace("/%o.%d/", "%o", $DocNo);
}
$DocNo = preg_replace("/%o/", "$oSys->sysDocNo", $DocNo);
$DocNo = preg_replace("/%d/", "$oDP->deptNo", $DocNo);
$DocNo = preg_replace("/%r/", "$runningDoc", $DocNo);
$Y = date('Y')+543;
$DocNo = preg_replace("/%y/", "$Y", $DocNo);
if($P=="Y"){ $P="Ç."; }
$DocNo = preg_replace("/%p/", "$P", $DocNo);
return $DocNo;
}
}
function GetNextPsToSign($DlcID,$deptId){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq+2);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcSign=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcSign=="N"){
$nextDlcID="N";
}else{
$nextDlcID=$oDlc3->DlcID;
}
}else{
$nextDlcID=$oDlc2->DlcID;
}
return $nextDlcID;
}else{
$nextSeq=($oDlc->DlcSeq+1);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcSign=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcSign=="N"){
$nextDlcID="N";
}else{
$nextDlcID=$oDlc3->DlcID;
}
}else{
$nextDlcID=$oDlc2->DlcID;
}
return $nextDlcID;
}
}
function GetNextPrePsToSign($DlcID,$deptId){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq+2);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
$nextDlcID=$oDlc2->DlcID;
return $nextDlcID;
}else{
$nextSeq=($oDlc->DlcSeq+1);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
$nextDlcID=$oDlc2->DlcID;
return $nextDlcID;
}
}
function GetNextPsToByPass($DlcID,$deptId){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq+2);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcByPass=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcByPass=="N"){
$nextDlcID="N";
}else{
$nextDlcID="Y";
}
}else{
$nextDlcID="Y";
}
return $nextDlcID;
}else{
$nextSeq=($oDlc->DlcSeq+1);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcSign=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcByPass=="N"){
$nextDlcID="N";
}else{
$nextDlcID="Y";
}
}else{
$nextDlcID="Y";
}
return $nextDlcID;
}
}
function GetLineDoc($DocID,$DocGroup,$DsID,$DrsID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocReceiveSend.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oRs = new DocReceiveSend($oC);
$oRs->SearchByKey($DrsID);
$oRs->GetRecord();
if($oRs->DrsFromDrsID!="0"){
$line=ShowLineDoc($oRs->DrsFromDrsID,$s);
}else{
$line=$oRs->DrsID;
}
return $line;
}
function GetLineDoc2($DocGroup,$DrsID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocReceiveSend.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oRs = new DocReceiveSend($oC);
$oRs->SearchByDrsIDDocGroup($DrsID,$DocGroup);
$oRs->GetRecord();
if($oRs->DrsFromDrsID!="0"){
$line=ShowLineDoc($oRs->DrsFromDrsID,$s);
}else{
$line=$oRs->DrsID;
}
return $line;
}
function ShowLineDoc($DrsFromDrsID,$s){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocReceiveSend.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oRs = new DocReceiveSend($oC);
$oRs->SearchByKey($DrsFromDrsID);
$oRs->GetRecord();
$s=$oRs->DrsID.",".$s;
if($oRs->DrsFromDrsID!="0"){
$s=ShowLineDoc($oRs->DrsFromDrsID,$s);
}
return $s;
}
function GetNextPsAfterSign($DlcID,$deptId){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq-2);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcSend=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcSend=="N"){
$nextDlcID="N";
}else{
$nextDlcID=$oDlc3->DlcID;
}
}else{
$nextDlcID=$oDlc2->DlcID;
}
return $nextDlcID;
}else{
$nextSeq=($oDlc->DlcSeq-3);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcSend=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcSend=="N"){
$nextDlcID="N";
}else{
$nextDlcID=$oDlc3->DlcID;
}
}else{
$nextDlcID=$oDlc2->DlcID;
}
return $nextDlcID;
}
}
function ShowSendtoPs($deptId){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsDepartment.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDP = new Department($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc3->SearchDlcID11($maxgroup,$deptId);
if($oDlc3->GetRecord()==1){
$dlc_search=11;
$nextdlc_search=12;
}else{
$dlc_search=5;
$nextdlc_search=6;
}
$oDlc->SearchByDocGroupDlcID2($maxgroup,$deptId,$dlc_search);
if($oDlc->GetRecord()=="1"){
if($oDlc->DlcActive=="Y"){
$pssend=$oDlc->DlcID;
return $pssend;
}else{
$oDlc2->SearchByDocGroupDlcID($maxgroup,$deptId,$nextdlc_search);
if($oDlc2->GetRecord()=="1"){
if($oDlc2->DlcActive=="Y"){
$pssend=$oDlc2->DlcID;
return $pssend;
}else{
return "N";
}
}else{
return "N";
}
}
}else{
$oDlc2->SearchByDocGroupDlcID($maxgroup,$deptId,$nextdlc_search);
if($oDlc2->GetRecord()=="1"){
if($oDlc2->DlcActive=="Y"){
$pssend=$oDlc2->DlcID;
return $pssend;
}else{
return "N";
}
}else{
return "N";
}
}
}
function ShowSendtoPs2($deptId){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsDepartment.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDP = new Department($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByDocGroupDlcID2($maxgroup,$deptId,$dlc_search);
if($oDlc->GetRecord()=="1"){
$pssend=$oDlc->DlcID;
return $pssend;
}
}
function GetUpPsSend($DlcID,$deptId){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq-2);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcSend=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcSend=="N"){
$nextDlcID="N";
}else{
$nextDlcID=$oDlc3->DlcID;
}
}else{
$nextDlcID=$oDlc2->DlcID;
}
return $nextDlcID;
}else{
$nextSeq=($oDlc->DlcSeq-3);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
if($oDlc2->DlcSend=="N"){
$oDlc3->SearchByNextDlcID(($nextSeq+1),$maxgroup,$oDlc->deptId); $oDlc3->GetRecord();
if($oDlc3->DlcSend=="N"){
$nextDlcID="N";
}else{
$nextDlcID=$oDlc3->DlcID;
}
}else{
$nextDlcID=$oDlc2->DlcID;
}
return $nextDlcID;
}
}
function GetUpPrePsSend($DlcID,$deptId){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq-2);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
$nextDlcID=$oDlc2->DlcID;
return $nextDlcID;
}else{
$nextSeq=($oDlc->DlcSeq-3);
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
$nextDlcID=$oDlc2->DlcID;
return $nextDlcID;
}
}
function GetParentDoc($DocID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocuments.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDoc = new Documents($oC);
$oDoc->SearchByKey($DocID);
$oDoc->GetRecord();
if($oDoc->DocPID!=0){
$a=GetParentDoc($oDoc->DocPID);
}else{
$a=$oDoc->DocID;
return $a;
}
return $oDoc->DocPID;
}
function UpdatereadDoc($DrsID,$DocID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocReceiveSend.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oRs->SearchByKey($DrsID);
$oRs->GetRecord();
$oRs->Edit();
$oRs->DrsID=$oRs->DrsID;
$oRs->DocID=$oRs->DocID;
$oRs->DlcID=$oRs->DlcID;
$oRs->DsID=4;
$oRs->personId=$oRs->personId;
$oRs->PtID=$oRs->PtID;
$oRs->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs->DrsReceiveDate=$oRs->DrsReceiveDate;
$oRs->DrsReceivePersonId=$oRs->DrsReceivePersonId;
$oRs->DrsSendDate=$oRs->DrsSendDate;
$oRs->DrsSendPersonId=$oRs->DrsSendPersonId;
$oRs->DrsSendDlcID=$oRs->DrsSendDlcID;
$oRs->DrsDocDueDate=$oRs->DrsDocDueDate;
$oRs->DrsDlcIDCreate=$oRs->DrsDlcIDCreate;
$oRs->DrsPsIDCreate=$oRs->DrsPsIDCreate;
$oRs->DrsPropose=$oRs->DrsPropose;
$oRs->DrsSign=$oRs->DrsSign;
$oRs->DrsFromDrsID=$oRs->DrsFromDrsID;
$oRs->DocGroup=$oRs->DocGroup;
$oRs->DrsflagRead=$oRs->DrsflagRead;
$oRs->DrsByPass=$oRs->DrsByPass;
$oRs->DrsSend=$oRs->DrsSend;
$oRs->DrsSendToPs=$oRs->DrsSendToPs;
$oRs->DrsDelete=$oRs->DrsDelete;
$oRs->DrsMainPs=$oRs->DrsMainPs;
$oRs->AnID=$oRs->AnID;
$oRs->DrsDocReceiveDate=$oRs->DrsDocReceiveDate;
$oRs->DocRefAnsDate=$oRs->DocRefAnsDate;
$oRs->DrsSendDocNew=$oRs->DrsSendDocNew;
$oRs->DrsInboxID=$oRs->DrsInboxID;
$oRs->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs->DrsendDatePost=$oRs->DrsendDatePost;
$oRs->DrsSendBack=$oRs->DrsSendBack;
$oRs->DrsSendBackDlcID=$oRs->DrsSendBackDlcID;
$oRs->DrsfSendBack=$oRs->DrsfSendBack;
$oRs->Save();
?>
<script>
window.opener.location.href="showEntryDoc.php?DocID=<? echo $DocID; ?>&DrsID=<? echo $DrsID; ?>";
</script>
<?
}
function searchDocSendToPs($DocID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocReceiveSend.php";
include_once "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsPerson.php";
include_once "../class/clsDepartment.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oDlc = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oPS = new person($oC);
$oDP = new Department($oC);
$oRs->SearchByDocIDStatus3($DocID);
if($oRs->GetRecord()==1){
$oRs1->SearchByDrsFromDrsID($oRs->DrsID);
while($oRs1->GetRecord()){
$oDlc->SearchByKey($oRs1->DlcID); $oDlc->GetRecord();
$oDP->SearchByKey($oDlc->deptId); $oDP->GetRecord();
$oPS->SearchByKey($oRs1->DrsReceivePersonId); $oPS->GetRecord();
if($oRs1->DrsReceivePersonId!='0'){
echo "- ".GetPrefix($oPS->prefixId).$oPS->fName." ".$oPS->lName;
}else{
echo "ÊÒúÃóÂèÍÂ";
}
if($oRs1->DrsSendToPs=="Y"){
echo " [Ê觴èǹ]";
}
echo "<br>";
if($oRs1->personId==0){
//echo " ".$oDlp->DlpName."<br>";
echo " ".$oDP->deptName."<br>";
}
}
}
}
function checkCountDoc($DocID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocattatches.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDatt = new Docattatches($oC);
$count=0;
$oDatt->SearchByDocID($DocID);
while($oDatt->GetRecord()){
$count++;
}
return $count;
}
function ff($personId){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocReceiveSend.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDepartment.php";
include_once "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oRs = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oDoc = new Documents($oC);
$oDoc2 = new Documents($oC);
$oDP = new Department($oC);
$oDlp = new docLinePosition($oC);
$oDlp2 = new docLinePosition($oC);
$oDlp3 = new docLinePosition($oC);
$oDlp4 = new docLinePosition($oC);
$oDlc = new docLineConfig($oC);
$oDlc1 = new docLineConfig($oC);
$oDlc2 = new docLineConfig($oC);
$oDlc3 = new docLineConfig($oC);
$oDlp1 = new docLinePosition($oC);
$Maxgroup=$oDP->SearchMaxDocGroup();
//108---------------------------------------¼Ùéãªé·ÑèÇä»
$i=0;
$countdoc=0;
$oRs2->SearchBypersonIdDocGroupDsID0($personId,$Maxgroup);
while($oRs2->GetRecord()){
$oDoc2->SearchByKey($oRs2->DocID);
$oDoc2->GetRecord();
$i++;
}
$countdoc=$countdoc+$i;
if($i!="0"){
}
//107---------------------------------------à¨éÒ˹éÒ·ÕèÊÒúÃó
$oDlp->SearchByGpID(107);
while($oDlp->GetRecord()){
$oDlc->SearchByPsPositionDlpID($personId,$oDlp->DlpID,$Maxgroup);
while($oDlc->GetRecord()){
$oDlp1->SearchByKey($oDlc->DlpID);
$oDlp1->GetRecord();
$oDP->SearchByKey($oDlc->deptId);
$oDP->GetRecord();
$oDlc2->SearchByKey($oDlc->DlcID); $oDlc2->GetRecord();
$oDlp1->SearchByKey($oDlc->DlpID); $oDlp1->GetRecord();
if($oDlp1->DlpPID!="0"){
$DlcPS2=$oDlc2->DlcID;
}else{
$DlcPS2=$oDlc3->SearchDlc2($oDlc->DlcSeq,$oDlp1->DlpPID,$oDlc->deptId);
}
$oDoc->SearchByDlcIDDocGroupPSDlcID2DsID0($oDlc2->DlcID,$Maxgroup,$DlcPS2);
$i=0;
while($oDoc->GetRecord()){
$oRs->SearchByDocGroupDocIDStatus0($Maxgroup,$oDoc->DocID);
if($oRs->GetRecord()=="1"){
$i++;
}
}
$countdoc=$countdoc+$i;
if($i!="0"){
}
}
}
//110---------------------------------------ËÑÇ˹éÒÊÒúÃó
$oDlp2->SearchByGpID(110);
while($oDlp2->GetRecord()){
$oDlc2->SearchByPsPositionDlpID($personId,$oDlp2->DlpID,$Maxgroup);
while($oDlc2->GetRecord()){
$oDlp1->SearchByKey($oDlc2->DlpID);
$oDlp1->GetRecord();
$oDP->SearchByKey($oDlc2->deptId);
$oDP->GetRecord();
$oDlc->SearchByKey($oDlc2->DlcID); $oDlc->GetRecord();
$oDlp1->SearchByKey($oDlc->DlpID); $oDlp1->GetRecord();
if($oDlp1->DlpPID!="0"){
$DlcPS2=$oDlc2->DlcID;
}else{
$DlcPS2=$oDlc2->SearchDlc2($oDlc->DlcSeq,$oDlp1->DlpPID,$oDlc->deptId);
}
$oDoc->SearchByDocGroupDsID2($Maxgroup);
$i=0;
while($oDoc->GetRecord()){
$oRs->SearchByDocGroupDocIDDlcIDDrsReceiveDlcID2Status2($Maxgroup,$oDoc->DocID,$oDlc2->DlcID,$DlcPS2);
if($oRs->GetRecord()=="1"){
$i++;
}
}
$countdoc=$countdoc+$i;
if($i!="0"){
}
}
}
//111---------------------------------------ËÑÇ˹éÒ˹èǧҹ
$oDlp2->SearchByGpID(111);
while($oDlp2->GetRecord()){
$oDlc2->SearchByPsPositionDlpID($personId,$oDlp2->DlpID,$Maxgroup);
while($oDlc2->GetRecord()){
$oDlp1->SearchByKey($oDlc2->DlpID);
$oDlp1->GetRecord();
$oDP->SearchByKey($oDlc2->deptId);
$oDP->GetRecord();
$oDlc->SearchByKey($oDlc2->DlcID); $oDlc->GetRecord();
$oDlp1->SearchByKey($oDlc->DlpID); $oDlp1->GetRecord();
if($oDlp1->DlpPID!="0"){
$DlcPS2=$oDlc2->DlcID;
}else{
$DlcPS2=$oDlc2->SearchDlc2($oDlc->DlcSeq,$oDlp1->DlpPID,$oDlc->deptId);
}
$oDoc->SearchByDocGroupDsID2($Maxgroup);
$i=0;
while($oDoc->GetRecord()){
$oRs->SearchByDocGroupDocIDDlcIDDrsReceiveDlcID2Status2($Maxgroup,$oDoc->DocID,$oDlc2->DlcID,$DlcPS2);
if($oRs->GetRecord()=="1"){
$i++;
}
}
$countdoc=$countdoc+$i;
if($i!="0"){
}
}
}
//112---------------------------------------¼ÙéÍӹǡÒÃ
$oDlp2->SearchByGpID(112);
while($oDlp2->GetRecord()){
$oDlc2->SearchByPsPositionDlpID($personId,$oDlp2->DlpID,$Maxgroup);
while($oDlc2->GetRecord()){
$oDlp1->SearchByKey($oDlc2->DlpID);
$oDlp1->GetRecord();
$oDP->SearchByKey($oDlc2->deptId);
$oDP->GetRecord();
$oDlc->SearchByKey($oDlc2->DlcID); $oDlc->GetRecord();
$oDlp1->SearchByKey($oDlc->DlpID); $oDlp1->GetRecord();
if($oDlp1->DlpPID!="0"){
$DlcPS2=$oDlc2->DlcID;
}else{
$DlcPS2=$oDlc2->SearchDlc2($oDlc->DlcSeq,$oDlp1->DlpPID,$oDlc->deptId);
}
$oDoc->SearchByDocGroupDsID2($Maxgroup);
$i=0;
while($oDoc->GetRecord()){
$oRs->SearchByDocGroupDocIDDlcIDDrsReceiveDlcID2Status2($Maxgroup,$oDoc->DocID,$oDlc2->DlcID,$DlcPS2);
if($oRs->GetRecord()=="1"){
$i++;
}
}
$countdoc=$countdoc+$i;
if($i!="0"){
}
}
}
//115---------------------------------------Ãͧ¼ÙéÍӹǡÒÃ
$oDlp2->SearchByGpID(115);
while($oDlp2->GetRecord()){
$oDlc2->SearchByPsPositionDlpID($personId,$oDlp2->DlpID,$Maxgroup);
while($oDlc2->GetRecord()){
$oDlp1->SearchByKey($oDlc2->DlpID);
$oDlp1->GetRecord();
$oDP->SearchByKey($oDlc2->deptId);
$oDP->GetRecord();
$oDlc->SearchByKey($oDlc2->DlcID); $oDlc->GetRecord();
$oDlp1->SearchByKey($oDlc->DlpID); $oDlp1->GetRecord();
if($oDlp1->DlpPID!="0"){
$DlcPS2=$oDlc2->DlcID;
}else{
$DlcPS2=$oDlc2->SearchDlc2($oDlc->DlcSeq,$oDlp1->DlpPID,$oDlc->deptId);
}
$oDoc->SearchByDocGroupDsID2($Maxgroup);
$i=0;
while($oDoc->GetRecord()){
$oRs->SearchByDocGroupDocIDDlcIDDrsReceiveDlcID2Status2($Maxgroup,$oDoc->DocID,$oDlc2->DlcID,$DlcPS2);
if($oRs->GetRecord()=="1"){
$i++;
}
}
$countdoc=$countdoc+$i;
if($i!="0"){
}
}
}
// if($countdoc==0){ echo ' '; }else{ echo $countdoc; }
return $countdoc;
}
function searchDeptDlcID($DlcID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocLineConfig.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oDlc = new docLineConfig($oC);
$oDlc->SearchByKey($DlcID);
$oDlc->GetRecord();
$oDP->SearchByKey($oDlc->deptId);
$oDP->GetRecord();
return $oDP->deptName;
}
function updateAnIDdocumentDocPID0($DocID,$AnID){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocReceiveSend.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDoc = new Documents($oC);
$oRs = new DocReceiveSend($oC);
$oDoc->SearchByDocPIDAnIDnot0($DocID);
while($oDoc->GetRecord()){
$oDoc->SearchByKey($DocID);
$oDoc->GetRecord();
$oDoc->Edit();
$oDoc->DocID=$oDoc->DocID;
$oDoc->DocPID=$oDoc->DocPID;
$oDoc->DlcID=$oDoc->DlcID;
$oDoc->PtID=$oDoc->PtID;
$oDoc->DtID=$oDoc->DtID;
$oDoc->DslID=$oDoc->DslID;
$oDoc->DclID=$oDoc->DclID;
$oDoc->DsID=$oDoc->DsID;
$oDoc->RsID=$oDoc->RsID;
$oDoc->DocDateCreate=$oDoc->DocDateCreate;
$oDoc->DocUserCreate=$oDoc->DocUserCreate;
$oDoc->DocTypeNo=$oDoc->DocTypeNo;
$oDoc->DocDate=$oDoc->DocDate;
$oDoc->DocNo=$oDoc->DocNo;
$oDoc->DocSubject=$oDoc->DocSubject;
$oDoc->DocFrom=$oDoc->DocFrom;
$oDoc->DocTo=$oDoc->DocTo;
$oDoc->DocShortDesc=$oDoc->DocShortDesc;
$oDoc->DocSpeedLevelDueDate=$oDoc->DocSpeedLevelDueDate;
$oDoc->DocStart=$oDoc->DocStart;
$oDoc->DocFinish=$oDoc->DocFinish;
$oDoc->DocGroup=$oDoc->DocGroup;
$oDoc->DocRef=$oDoc->DocRef;
$oDoc->DocCircular=$oDoc->DocCircular;
$oDoc->DocfCir=$oDoc->DocfCir;
$oDoc->DocOther=$oDoc->DocOther;
$oDoc->CertificatePs=$oDoc->CertificatePs;
$oDoc->fDelete=$oDoc->fDelete;
$oDoc->endDoc=$oDoc->endDoc;
$oDoc->sendToPs=$oDoc->sendToPs;
$oDoc->AnID=$AnID;
$oDoc->DocRefAns=$oDoc->DocRefAns;
$oDoc->DocRefAnsID=$oDoc->DocRefAnsID;
$oDoc->DocstartDatePost=$oDoc->DocstartDatePost;
$oDoc->DocendDatePost=$oDoc->DocendDatePost;
$oDoc->DocMainPost=$oDoc->DocMainPost;
$oDoc->DocGetPost=$oDoc->DocGetPost;
$oDoc->DocShowInOut=$oDoc->DocShowInOut;
$oDoc->DocDateGetPost=$oDoc->DocDateGetPost;
$oDoc->Save();
$oRs->SearchByDocIDAnID($DocID);
while($oRs->GetRecord()){
$oRs->Edit();
$oRs->DrsID=$oRs->DrsID;
$oRs->DocID=$oRs->DocID;
$oRs->DlcID=$oRs->DlcID;
$oRs->DsID=$oRs->DsID;
$oRs->personId=$oRs->personId;
$oRs->PtID=$oRs->PtID;
$oRs->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs->DrsReceiveDate=$oRs->DrsReceiveDate;
$oRs->DrsReceivePersonId=$oRs->DrsReceivePersonId;
$oRs->DrsSendDate=$oRs->DrsSendDate;
$oRs->DrsSendPersonId=$oRs->DrsSendPersonId;
$oRs->DrsSendDlcID=$oRs->DrsSendDlcID;
$oRs->DrsDocDueDate=$oRs->DrsDocDueDate;
$oRs->DrsDlcIDCreate=$oRs->DrsDlcIDCreate;
$oRs->DrsPsIDCreate=$oRs->DrsPsIDCreate;
$oRs->DrsPropose=$oRs->DrsPropose;
$oRs->DrsSign=$oRs->DrsSign;
$oRs->DrsFromDrsID=$oRs->DrsFromDrsID;
$oRs->DocGroup=$oRs->DocGroup;
$oRs->DrsflagRead=$oRs->DrsflagRead;
$oRs->DrsByPass=$oRs->DrsByPass;
$oRs->DrsSend=$oRs->DrsSend;
$oRs->DrsSendToPs=$oRs->DrsSendToPs;
$oRs->DrsDelete=$oRs->DrsDelete;
$oRs->DrsMainPs=$oRs->DrsMainPs;
$oRs->AnID=$AnID;
$oRs->DrsDocReceiveDate=$oRs->DrsDocReceiveDate;
$oRs->DocRefAnsDate=$oRs->DocRefAnsDate;
$oRs->DrsSendDocNew=$oRs->DrsSendDocNew;
$oRs->DrsInboxID=$oRs->DrsInboxID;
$oRs->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs->DrsendDatePost=$oRs->DrsendDatePost;
$oRs->DrsSendBack=$oRs->DrsSendBack;
$oRs->DrsSendBackDlcID=$oRs->DrsSendBackDlcID;
$oRs->DrsfSendBack=$oRs->DrsfSendBack;
$oRs->Save();
}
}
}
function searchnextpssend($pssend,$deptId){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsDepartment.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDP = new Department($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
// echo '---------------ss'.$oDlc->DlpID;
$oDlc->SearchByKey($pssend);
$oDlc->GetRecord();
if($oDlc->DlpID=="5"){
$nextDlpID="6";
}else if($oDlc->DlpID=="6"){
$nextDlpID="5";
}else if($oDlc->DlpID=="11"){
$nextDlpID="12";
}else if($oDlc->DlpID=="12"){
$nextDlpID="11";
}else if($oDlc->DlpID=="15"){
$nextDlpID="16";
}else if($oDlc->DlpID=="16"){
$nextDlpID="15";
}else if($oDlc->DlpID=="18"){
$nextDlpID="19";
}else if($oDlc->DlpID=="19"){
$nextDlpID="18";
}else if($oDlc->DlpID=="28"){
$nextDlpID="29";
}else if($oDlc->DlpID=="29"){
$nextDlpID="28";
}else if($oDlc->DlpID=="30"){
$nextDlpID="31";
}else if($oDlc->DlpID=="32"){ $nextDlpID="33"; }else if($oDlc->DlpID=="33"){ $nextDlpID="32"; }else if($oDlc->DlpID=="34"){ $nextDlpID="35"; }else if($oDlc->DlpID=="35"){ $nextDlpID="34"; }else if($oDlc->DlpID=="36"){ $nextDlpID="37"; }else if($oDlc->DlpID=="37"){ $nextDlpID="36"; }else if($oDlc->DlpID=="38"){ $nextDlpID="39"; }else if($oDlc->DlpID=="39"){ $nextDlpID="38"; }
$oDlc2->SearchDlcIDDlpID($nextDlpID,$deptId);
$oDlc2->GetRecord();
return $oDlc2->DlcID;
}
function showsteplinedoc($searchDoc,$tab){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocReceiveSend.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsDocLinePosition.php";
include_once "../class/clsPerson.php";
include_once "../class/clsDepartment.php";
include_once "../link/function.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDoc = new Documents($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$oRs3 = new DocReceiveSend($oC);
$oRs4 = new DocReceiveSend($oC);
$oDlc = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oPS = new person($oC);
$oDlc1 = new DocLineConfig($oC);
$oDlp1 = new docLinePosition($oC);
$oPS1 = new person($oC);
$oPS2 = new person($oC);
$oDP = new Department($oC);
$oDP1 = new Department($oC);
if($tab!=""){
$tab=" ".$tab;
}else{
$tab=" ";
}
?>
<table border="0" align="center" width="98%" >
<?
$oRs->SearchByDocIDDsID3($searchDoc);
if($oRs->GetRecord()=="1"){
$oDlc->SearchByKey($oRs->DlcID);
$oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID);
$oDlp->GetRecord();
$oPS->SearchByKey($oDlc->personId);
$oPS->GetRecord();
echo "<tr><td>";
if($tab==" "){
echo "<img src=\"../picture/reg.png\" alt=\"\" border=\"0\" >"; //$oRs->DocID;
echo " <strong>".$oDlp->DlpName." ".$oDP->SearchDeptName($oDlc->deptId)." </strong> <font color=\"#000099\">".GetPrefix($oPS->prefixId).$oPS->fName." ".$oPS->lName."</font> ";
list($DocD,$DocT) = split(' ',$oRs->DrsSendDate);
if($oRs->DrsSendDate!="0000-00-00 00:00:00"){ echo "[Çѹ·ÕèÊè§:: ".abbreDate2($DocD,'/')." ".a2th($DocT)."]"; } echo "<br>";
}
$oRs2->SearchByDrsFromDrsIDcaseps($oRs->DrsID);
while($oRs2->GetRecord()){
$oPS2->SearchByKey($oRs2->personId);
$oPS2->GetRecord();
echo $tab."<img src=\"../picture/linesub.gif\" alt=\"\" border=\"0\" ><font color=\"#000099\">"; //$oRs2->personId;
echo " ".GetPrefix($oPS2->prefixId).$oPS2->fName." ".$oPS2->lName."</font> ";
if($oRs2->DsID=="4" && $oRs2->DrsDocReceiveDate=="0000-00-00 00:00:00"){
echo "[à»Ô´Ë¹Ñ§Ê×ÍáÅéÇ]";
}else if($oRs2->DsID=="5" && $oRs2->DrsDocReceiveDate=="0000-00-00 00:00:00"){
echo "[à»Ô´á¿éÁ˹ѧÊ×ÍáÅéÇ]";
}else if($oRs2->DsID=="5" && $oRs2->DrsDocReceiveDate!="0000-00-00 00:00:00"){
list($DocD2,$DocT2) = split(' ',$oRs2->DrsDocReceiveDate);
echo "[Çѹ·ÕèŧÃѺ:: ".abbreDate2($DocD2,'/')." ".a2th($DocT2)."]";
}
if($oRs2->DrsDelete=='Y'){ echo '[ź˹ѧÊ×ÍáÅéÇ]'; }
if($oRs2->DsID=="7" && $oRs2->DrsDocReceiveDate!="0000-00-00 00:00:00"){
list($DocD2,$DocT2) = split(' ',$oRs2->DrsDocReceiveDate);
echo "[Çѹ·Õèá¨é§¡ÒÃÊ觼Դ:: ".abbreDate2($DocD2,'/')." ".a2th($DocT2)."]";
}
echo "<br>";
}
$oRs1->SearchByDrsFromDrsIDcasedept($oRs->DrsID);
while($oRs1->GetRecord()){
$oDlc1->SearchByKey($oRs1->DlcID);
$oDlc1->GetRecord();
$oDlp1->SearchByKey($oDlc1->DlpID);
$oDlp1->GetRecord();
$oPS1->SearchByKey($oRs1->DrsReceivePersonId);
$oPS1->GetRecord();
echo $tab."<img src=\"../picture/linesub.gif\" alt=\"\" border=\"0\" ><img src=\"../picture/reg.png\" alt=\"\" border=\"0\" ><strong>"; //echo $oRs1->DocID;
echo " ".$oDlp1->DlpName." ".$oDP1->SearchDeptName($oDlc1->deptId)."</strong>";
if($oRs1->DrsReceivePersonId!='0'){
echo " <strong>::</strong> <font color=\"#000099\">".GetPrefix($oPS1->prefixId).$oPS1->fName." ".$oPS1->lName."</font> ";
}
$oRs3->SearchByDrsFromDrsID($oRs1->DrsID);
$oRs3->GetRecord();
if($oRs3->DsID=="1" || $oRs3->DsID=="6" || $oRs3->DsID=="7"){
list($DocD1,$DocT1) = split(' ',$oRs3->DrsReceiveDate);
echo "["; if($oRs3->DsID=="1"){ echo "Çѹ·ÕèŧÃѺ"; }else if($oRs3->DsID=="6"){ echo "Çѹ·ÕèäÁèŧÃѺ"; }else if($oRs3->DsID=="7"){ echo "Çѹ·Õèá¨é§¡ÒÃÊ觼Դ"; } echo ":: ".abbreDate2($DocD1,'/')." ".a2th($DocT1)."]";
}
$oRs4->SearchByDocIDDsID3($oRs1->DocID);
if($oRs4->GetRecord()=="1"){
if($oRs4->DrsSendDate!="0000-00-00 00:00:00"){
list($DocD3,$DocT3) = split(' ',$oRs4->DrsSendDate);
echo "[Çѹ·ÕèÊè§:: ".abbreDate2($DocD3,'/')." ".a2th($DocT3)."]";
}
}
echo "<br>";
showsteplinedoc($oRs1->DocID,$tab);
}
echo "</td></tr>";
}
?>
</table>
<?
}
function searchDepRef($deptId,$str){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDepartment.php";
include_once "../link/function.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP = new Department($oC);
$oDP1 = new Department($oC);
if($str==""){ $str="<select name=selectPositionDeptID><option value=0>- àÅ×Í¡½èÒ -</option>"; }
$oDP->SearchByKey($deptId);
$oDP->GetRecord();
$oDP1->searchMaxDate($oDP->deptDate); $oDP1->GetRecord();
$str=$str."<option value=".$oDP->deptId.">".$oDP->deptName." [".abbreDate2($oDP->deptDate,'/')." - ".abbreDate2($oDP1->deptDate,'/')."]</option>";
if($oDP->deptRef!="0"){
searchDepRef($oDP->deptRef,$str);
}else{
echo $str=$str."</select>";
}
}
function UpdateDocSign($DlcID){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocReceiveSend.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq+1);
}else{
$nextSeq=($oDlc->DlcSeq-1);
}
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
$DlcID2=$oDlc2->DlcID;
//echo "[".$DlcID."---".$DlcID2;
$oRs->SearchPreDocSign($DlcID,$DlcID2,$maxgroup);
while($oRs->GetRecord()){
$flagCommit = true;
$oC->BeginTrans();
//---edit sign
$oRs->Edit();
$oRs->DrsID=$oRs->DrsID;
//echo "DrsID----".$oRs->DrsID."<br>";
$oRs->DocID=$oRs->DocID;
$oRs->DlcID=$DlcID;
//echo "DlcID----".$oRs->DlcID."<br>";
$oRs->DsID=$oRs->DsID;
$oRs->personId=$oRs->personId;
$oRs->PtID=$oRs->PtID;
$oRs->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs->DrsReceiveDate=$oRs->DrsReceiveDate;
$oRs->DrsReceivePersonId=$oDlc->personId;
//echo "DrsReceivePersonId----".$oRs->DrsReceivePersonId."<br>";
$oRs->DrsSendDate=$oRs->DrsSendDate;
$oRs->DrsSendPersonId=$oRs->DrsSendPersonId;
$oRs->DrsSendDlcID=$oRs->DrsSendDlcID;
$oRs->DrsDocDueDate=$oRs->DrsDocDueDate;
$oRs->DrsDlcIDCreate=$oRs->DrsDlcIDCreate;
$oRs->DrsPsIDCreate=$oRs->DrsPsIDCreate;
$oRs->DrsPropose=$oRs->DrsPropose;
$oRs->DrsSign=$oRs->DrsSign;
$oRs->DrsFromDrsID=$oRs->DrsFromDrsID;
$oRs->DocGroup=$oRs->DocGroup;
$oRs->DrsflagRead=$oRs->DrsflagRead;
$oRs->DrsByPass=$oRs->DrsByPass;
$oRs->DrsSend=$oRs->DrsSend;
$oRs->DrsSendToPs=$oRs->DrsSendToPs;
$oRs->DrsDelete=$oRs->DrsDelete;
$oRs->DrsMainPs=$oRs->DrsMainPs;
$oRs->AnID=$oRs->AnID;
$oRs->DrsDocReceiveDate=$oRs->DrsDocReceiveDate;
$oRs->DocRefAnsDate=$oRs->DocRefAnsDate;
$oRs->DrsSendDocNew=$oRs->DrsSendDocNew;
$oRs->DrsInboxID=$oRs->DrsInboxID;
$oRs->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs->DrsendDatePost=$oRs->DrsendDatePost;
$oRs->DrsSendBack=$oRs->DrsSendBack;
$oRs->DrsSendBackDlcID=$oRs->DrsSendBackDlcID;
$oRs->DrsfSendBack=$oRs->DrsfSendBack;
$flagCommit = $oRs->Save();
//--edit propose
$oRs1->SearchByKey($oRs->DrsFromDrsID);
$oRs1->GetRecord();
$oRs1->Edit();
$oRs1->DrsID=$oRs1->DrsID;
//echo "DrsID----".$oRs1->DrsID."<br>";
$oRs1->DocID=$oRs1->DocID;
$oRs1->DlcID=$oRs1->DlcID;
$oRs1->DsID=$oRs1->DsID;
$oRs1->personId=$oRs1->personId;
$oRs1->PtID=$oRs1->PtID;
$oRs1->DrsDocTypeNo=$oRs1->DrsDocTypeNo;
$oRs1->DrsReceiveDate=$oRs1->DrsReceiveDate;
$oRs1->DrsReceivePersonId=$oRs1->DrsReceivePersonId;
$oRs1->DrsSendDate=$oRs1->DrsSendDate;
$oRs1->DrsSendPersonId=$oDlc->personId;
//echo "DrsSendPersonId----".$oRs1->DrsSendPersonId."<br>";
$oRs1->DrsSendDlcID=$DlcID;
//echo "DrsSendDlcID----".$oRs1->DrsSendDlcID."<br>";
$oRs1->DrsDocDueDate=$oRs1->DrsDocDueDate;
$oRs1->DrsDlcIDCreate=$oRs1->DrsDlcIDCreate;
$oRs1->DrsPsIDCreate=$oRs1->DrsPsIDCreate;
$oRs1->DrsPropose=$oRs1->DrsPropose;
$oRs1->DrsSign=$oRs1->DrsSign;
$oRs1->DrsFromDrsID=$oRs1->DrsFromDrsID;
$oRs1->DocGroup=$oRs1->DocGroup;
$oRs1->DrsflagRead=$oRs1->DrsflagRead;
$oRs1->DrsByPass=$oRs1->DrsByPass;
$oRs1->DrsSend=$oRs1->DrsSend;
$oRs1->DrsSendToPs=$oRs1->DrsSendToPs;
$oRs1->DrsDelete=$oRs1->DrsDelete;
$oRs1->DrsMainPs=$oRs1->DrsMainPs;
$oRs1->AnID=$oRs1->AnID;
$oRs1->DrsDocReceiveDate=$oRs1->DrsDocReceiveDate;
$oRs1->DocRefAnsDate=$oRs1->DocRefAnsDate;
$oRs1->DrsSendDocNew=$oRs1->DrsSendDocNew;
$oRs1->DrsInboxID=$oRs1->DrsInboxID;
$oRs1->DrsstartDatePost=$oRs1->DrsstartDatePost;
$oRs1->DrsendDatePost=$oRs1->DrsendDatePost;
$oRs1->DrsSendBack=$oRs1->DrsSendBack;
$oRs1->DrsSendBackDlcID=$oRs1->DrsSendBackDlcID;
$oRs1->DrsfSendBack=$oRs1->DrsfSendBack;
$flagCommit = $oRs1->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
}
function UpdateDocSend($DlcID){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocReceiveSend.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);
$oPS = new person($oC);
$oUG = new umgroup($oCu);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq+1);
}else{
$nextSeq=($oDlc->DlcSeq-1);
}
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
$DlcID2=$oDlc2->DlcID;
$oRs->SearchPreDocSend($DlcID,$DlcID2,$maxgroup);
while($oRs->GetRecord()){
$flagCommit = true;
$oC->BeginTrans();
//---edit send
$oRs->Edit();
$oRs->DrsID=$oRs->DrsID;
//echo "DrsID----".$oRs->DrsID."<br>";
$oRs->DocID=$oRs->DocID;
$oRs->DlcID=$DlcID;
//echo "DlcID----".$oRs->DlcID."<br>";
$oRs->DsID=$oRs->DsID;
$oRs->personId=$oRs->personId;
$oRs->PtID=$oRs->PtID;
$oRs->DrsDocTypeNo=$oRs->DrsDocTypeNo;
$oRs->DrsReceiveDate=$oRs->DrsReceiveDate;
$oRs->DrsReceivePersonId=$oDlc->personId;
//echo "DrsReceivePersonId----".$oRs->DrsReceivePersonId."<br>";
$oRs->DrsSendDate=$oRs->DrsSendDate;
$oRs->DrsSendPersonId=$oRs->DrsSendPersonId;
$oRs->DrsSendDlcID=$oRs->DrsSendDlcID;
$oRs->DrsDocDueDate=$oRs->DrsDocDueDate;
$oRs->DrsDlcIDCreate=$oRs->DrsDlcIDCreate;
$oRs->DrsPsIDCreate=$oRs->DrsPsIDCreate;
$oRs->DrsPropose=$oRs->DrsPropose;
$oRs->DrsSign=$oRs->DrsSign;
$oRs->DrsFromDrsID=$oRs->DrsFromDrsID;
$oRs->DocGroup=$oRs->DocGroup;
$oRs->DrsflagRead=$oRs->DrsflagRead;
$oRs->DrsByPass=$oRs->DrsByPass;
$oRs->DrsSend=$oRs->DrsSend;
$oRs->DrsSendToPs=$oRs->DrsSendToPs;
$oRs->DrsDelete=$oRs->DrsDelete;
$oRs->DrsMainPs=$oRs->DrsMainPs;
$oRs->AnID=$oRs->AnID;
$oRs->DrsDocReceiveDate=$oRs->DrsDocReceiveDate;
$oRs->DocRefAnsDate=$oRs->DocRefAnsDate;
$oRs->DrsSendDocNew=$oRs->DrsSendDocNew;
$oRs->DrsInboxID=$oRs->DrsInboxID;
$oRs->DrsstartDatePost=$oRs->DrsstartDatePost;
$oRs->DrsendDatePost=$oRs->DrsendDatePost;
$oRs->DrsSendBack=$oRs->DrsSendBack;
$oRs->DrsSendBackDlcID=$oRs->DrsSendBackDlcID;
$oRs->DrsfSendBack=$oRs->DrsfSendBack;
$flagCommit = $oRs->Save();
//--edit sign
$oRs1->SearchByKey($oRs->DrsFromDrsID);
$oRs1->GetRecord();
$oRs1->Edit();
$oRs1->DrsID=$oRs1->DrsID;
//echo "DrsID----".$oRs1->DrsID."<br>";
$oRs1->DocID=$oRs1->DocID;
$oRs1->DlcID=$oRs1->DlcID;
$oRs1->DsID=$oRs1->DsID;
$oRs1->personId=$oRs1->personId;
$oRs1->PtID=$oRs1->PtID;
$oRs1->DrsDocTypeNo=$oRs1->DrsDocTypeNo;
$oRs1->DrsReceiveDate=$oRs1->DrsReceiveDate;
$oRs1->DrsReceivePersonId=$oRs1->DrsReceivePersonId;
$oRs1->DrsSendDate=$oRs1->DrsSendDate;
$oRs1->DrsSendPersonId=$oDlc->personId;
//echo "DrsSendPersonId----".$oRs1->DrsSendPersonId."<br>";
$oRs1->DrsSendDlcID=$DlcID;
//echo "DrsSendDlcID----".$oRs1->DrsSendDlcID."<br>";
$oRs1->DrsDocDueDate=$oRs1->DrsDocDueDate;
$oRs1->DrsDlcIDCreate=$oRs1->DrsDlcIDCreate;
$oRs1->DrsPsIDCreate=$oRs1->DrsPsIDCreate;
$oRs1->DrsPropose=$oRs1->DrsPropose;
$oRs1->DrsSign=$oRs1->DrsSign;
$oRs1->DrsFromDrsID=$oRs1->DrsFromDrsID;
$oRs1->DocGroup=$oRs1->DocGroup;
$oRs1->DrsflagRead=$oRs1->DrsflagRead;
$oRs1->DrsByPass=$oRs1->DrsByPass;
$oRs1->DrsSend=$oRs1->DrsSend;
$oRs1->DrsSendToPs=$oRs1->DrsSendToPs;
$oRs1->DrsDelete=$oRs1->DrsDelete;
$oRs1->DrsMainPs=$oRs1->DrsMainPs;
$oRs1->AnID=$oRs1->AnID;
$oRs1->DrsDocReceiveDate=$oRs1->DrsDocReceiveDate;
$oRs1->DocRefAnsDate=$oRs1->DocRefAnsDate;
$oRs1->DrsSendDocNew=$oRs1->DrsSendDocNew;
$oRs1->DrsInboxID=$oRs1->DrsInboxID;
$oRs1->DrsstartDatePost=$oRs1->DrsstartDatePost;
$oRs1->DrsendDatePost=$oRs1->DrsendDatePost;
$oRs1->DrsSendBack=$oRs1->DrsSendBack;
$oRs1->DrsSendBackDlcID=$oRs1->DrsSendBackDlcID;
$oRs1->DrsfSendBack=$oRs1->DrsfSendBack;
$flagCommit = $oRs1->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
}
function UpdateDocReceive($DlcID){
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 "../class/clsDocLinePosition.php";
include_once "../class/clsDocLineConfig.php";
include_once "../class/clsReceiveSendType.php";
include_once "../class/clsDocType.php";
include_once "../class/clsDocuments.php";
include_once "../class/clsDocReceiveSend.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);
$oPS = new person($oC);
$oDlc = new DocLineConfig($oC);
$oDlc2 = new DocLineConfig($oC);
$oDlc3 = new DocLineConfig($oC);
$oDlp = new docLinePosition($oC);
$oRSt = new receiveSendType($oC);
$oDt = new doctype($oC);
$oDoc = new Documents($oC);
$oRs = new DocReceiveSend($oC);
$oRs1 = new DocReceiveSend($oC);
$oRs2 = new DocReceiveSend($oC);
$maxgroup=$oDP->SearchMaxDocGroup();
$oDlc->SearchByKey($DlcID); $oDlc->GetRecord();
$oDlp->SearchByKey($oDlc->DlpID); $oDlp->GetRecord();
if($oDlp->DlpPID=="0"){
$nextSeq=($oDlc->DlcSeq+1);
}else{
$nextSeq=($oDlc->DlcSeq-1);
}
$oDlc2->SearchByNextDlcID($nextSeq,$maxgroup,$oDlc->deptId); $oDlc2->GetRecord();
$DlcID2=$oDlc2->DlcID;
$oDoc->SearchByDlcIDDocGroupDlcID2DsID0DrsSendDate($DlcID,$DlcID2,$maxgroup);
while($oDoc->GetRecord()){
$flagCommit = true;
$oC->BeginTrans();
$oDoc->Edit();
$oDoc->DocID=$oDoc->DocID;
//echo "DocID=".$oDoc->DocID."<br>";
$oDoc->DocPID=$oDoc->DocPID;
//echo "DocPID=".$oDoc->DocPID."<br>";
$oDoc->DlcID=$DlcID;
//echo "DlcID=".$oDoc->DlcID."<br>";
$oDoc->PtID=$oDoc->PtID;
$oDoc->DtID=$oDoc->DtID;
$oDoc->DslID=$oDoc->DslID;
$oDoc->DclID=$oDoc->DclID;
$oDoc->DsID=$oDoc->DsID;
$oDoc->RsID=$oDoc->RsID;
$oDoc->DocDateCreate=$oDoc->DocDateCreate;
$oDoc->DocUserCreate=$DlcID;
//echo "DocUserCreate=".$oDoc->DocUserCreate."<br>";
$oDoc->DocTypeNo=$oDoc->DocTypeNo;
$oDoc->DocDate=$oDoc->DocDate;
$oDoc->DocNo=$oDoc->DocNo;
$oDoc->DocSubject=$oDoc->DocSubject;
$oDoc->DocFrom=$oDoc->DocFrom;
$oDoc->DocTo=$oDoc->DocTo;
$oDoc->DocShortDesc=$oDoc->DocShortDesc;
$oDoc->DocSpeedLevelDueDate=$oDoc->DocSpeedLevelDueDate;
$oDoc->DocStart=$oDoc->DocStart;
$oDoc->DocFinish=$oDoc->DocFinish;
$oDoc->DocGroup=$oDoc->DocGroup;
$oDoc->DocRef=$oDoc->DocRef;
$oDoc->DocCircular=$oDoc->DocCircular;
$oDoc->DocfCir=$oDoc->DocfCir;
$oDoc->DocOther=$oDoc->DocOther;
$oDoc->CertificatePs=$oDoc->CertificatePs;
$oDoc->fDelete=$oDoc->fDelete;
$oDoc->endDoc=$oDoc->endDoc;
$oDoc->sendToPs=$oDoc->sendToPs;
$oDoc->AnID=$oDoc->AnID;
$oDoc->DocRefAns=$oDoc->DocRefAns;
$oDoc->DocRefAnsID=$oDoc->DocRefAnsID;
$oDoc->DocstartDatePost=$oDoc->DocstartDatePost;
$oDoc->DocendDatePost=$oDoc->DocendDatePost;
$oDoc->DocMainPost=$oDoc->DocMainPost;
$oDoc->DocGetPost=$oDoc->DocGetPost;
$oDoc->DocShowInOut=$oDoc->DocShowInOut;
$oDoc->DocDateGetPost=$oDoc->DocDateGetPost;
$oDoc->useMainDocNo=$oDoc->useMainDocNo;
$flagCommit = $oDoc->Save();
$oRs2->SearchPreDocReceive($DlcID,$DlcID2,$maxgroup,$oDoc->DocID);
$oRs2->GetRecord();
$oRs2->Edit();
$oRs2->DrsID=$oRs2->DrsID;
//echo "DrsID=".$oRs2->DrsID."<br>";
$oRs2->DocID=$oRs2->DocID;
//echo "DocID=".$oRs2->DocID."<br>";
$oRs2->DlcID=$DlcID;
//echo "DlcID=".$oRs2->DlcID."<br>";
$oRs2->DsID=$oRs2->DsID;
$oRs2->personId=$oRs2->personId;
$oRs2->PtID=$oRs2->PtID;
$oRs2->DrsDocTypeNo=$oRs2->DrsDocTypeNo;
$oRs2->DrsReceiveDate=$oRs2->DrsReceiveDate;
$oRs2->DrsReceivePersonId=$oDlc->personId;
//echo "DrsReceivePersonId=".$oRs2->DrsReceivePersonId."<br>";
$oRs2->DrsSendDate=$oRs2->DrsSendDate;
$oRs2->DrsSendPersonId=$oRs2->DrsSendPersonId;
$oRs2->DrsSendDlcID=$oRs2->DrsSendDlcID;
$oRs2->DrsDocDueDate=$oRs2->DrsDocDueDate;
//echo "speedDate2=".$speedDate."<br>";
$oRs2->DrsDlcIDCreate=$oRs2->DrsDlcIDCreate;
$oRs2->DrsPsIDCreate=$oRs2->DrsPsIDCreate;
$oRs2->DrsPropose=$oRs2->DrsPropose;
$oRs2->DrsSign=$oRs2->DrsSign;
$oRs2->DrsFromDrsID=$oRs2->DrsFromDrsID;
$oRs2->DocGroup=$oRs2->DocGroup;
$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=$oRs2->AnID;
$oRs2->DrsDocReceiveDate=$oRs2->DrsDocReceiveDate;
$oRs2->DocRefAnsDate=$oRs2->DocRefAnsDate;
$oRs2->DrsSendDocNew=$oRs2->DrsSendDocNew;
$oRs2->DrsInboxID=$oRs2->DrsInboxID;
$oRs2->DrsstartDatePost=$oRs2->DrsstartDatePost;
$oRs2->DrsendDatePost=$oRs2->DrsendDatePost;
$oRs2->DrsSendBack=$oRs2->DrsSendBack;
$oRs2->DrsSendBackDlcID=$oRs2->DrsSendBackDlcID;
$oRs2->DrsfSendBack=$oRs2->DrsfSendBack;
$flagCommit = $oRs2->Save();
if($flagCommit)
$oC->CommitTrans();
else
$oC->RollbackTrans();
}
}
function SearchdeptIdlevel0($deptId){
include_once("../../class/clsConnection.php");
include_once("../../class/clsDB.php");
include_once "../global.php";
include_once "../class/clsDepartment.php";
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDP3 = new Department($oC);
$oDP3->SearchByKey($deptId);
$oDP3->GetRecord();
if($oDP3->deptLevel!=0){
return SearchdeptIdlevel0($oDP3->deptParentId);
}else{
return $oDP3->deptId;
}
}
?>
|