!c99Shell v. 1.0 pre-release build #16!

Software: Apache/2.2.3 (CentOS). PHP/5.1.6 

uname -a: Linux mx-ll-110-164-51-230.static.3bb.co.th 2.6.18-194.el5PAE #1 SMP Fri Apr 2 15:37:44
EDT 2010 i686
 

uid=48(apache) gid=48(apache) groups=48(apache) 

Safe-mode: OFF (not secure)

/var/www/html/manage/teacher/   drwxr-xr-x
Free 52.82 GB of 127.8 GB (41.33%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     funct.php (82.14 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
function ShowRunningDoc($RsID,$DtID,$deptId){
include_once(
"../clas/clsConnection.php");
include_once(
"../clas/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";
include_once 
"getPrefix.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->SearchRunningBydocGroupDtIDfunct($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->SearchRunningBydocGroupDtIDfunct($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->SearchRunningBydocGroupDtIDfunctDept($maxgroup,$DtID,$deptId);
                    
$oRd->GetRecord();
            }else{
                    
$oRd->SearchRunningBydocGroupDtIDfunct($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->SearchRunningBydocGroupDtIDfunctDept($maxgroup,$DtID,$deptId);
                    
$oRd->GetRecord();
            }else{
                    
$oRd->SearchRunningBydocGroupDtIDfunct($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->SearchRunningBydocGroupDtIDfunctDept($maxgroup,$DtID,$deptId);
                    
$oRd->GetRecord();
            }else{
                    
$oRd->SearchRunningBydocGroupDtIDfunct($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(
"../clas/clsConnection.php");
include_once(
"../clas/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";
include_once 
"getPrefix.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->SearchRunningBydocGroupDtIDfunct($maxgroup,$DtID);
            
$oRd->GetRecord();
    
            if(
$oRd->sendNo=="0"){
                
$runningDoc_=$oRd->sendNoStart;
            }else{
                
$runningDoc_=($oRd->sendNo+1);
            }
            
$oSysDocNo=$oSys->SearchByKeyName('sysDocNo');
            
            
$oDt->SearchByKey($DtID);
            
$oDt->GetRecord();            
            
            
$oDP2->SearchByShowDocNo($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/""$oSysDocNo"$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->SearchRunningBydocGroupDtIDfunctDept($maxgroup,$DtID,$deptId);
                    
$oRd->GetRecord();
            }else{
                    
$oRd->SearchRunningBydocGroupDtIDfunct($maxgroup,$DtID);
                    
$oRd->GetRecord();
            }
                    if(
$oRd->receiveNo=="0"){
                        
$runningDoc_=$oRd->receiveNoStart;
                    }else{
                        
$runningDoc_=($oRd->receiveNo+1);
                    }
                    
$oSysDocNo=$oSys->SearchByKeyName('sysDocNo');
            
                    
$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/""$oSysDocNo"$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->SearchRunningBydocGroupDtIDfunctDept($maxgroup,$DtID,$deptId);
                    
$oRd->GetRecord();
            }else{
                    
$oRd->SearchRunningBydocGroupDtIDfunct($maxgroup,$DtID);
                    
$oRd->GetRecord();
            }

                if(
$oRd->sendNo=="0"){
                    
$runningDoc_=$oRd->sendNoStart;
                }else{
                    
$runningDoc_=($oRd->sendNo+1);
                }
                
$oSysDocNo=$oSys->SearchByKeyName('sysDocNo');
        
                
$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/""$oSysDocNo"$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->SearchRunningBydocGroupDtIDfunctDept($maxgroup,$DtID,$deptId);
                    
$oRd->GetRecord();
            }else{
                    
$oRd->SearchRunningBydocGroupDtIDfunct($maxgroup,$DtID);
                    
$oRd->GetRecord();
            }
                if(
$oRd->regisNo=="0"){
                    
$runningDoc_=$oRd->regisNoStart;
                }else{
                    
$runningDoc_=($oRd->regisNo+1);
                }
                
$oSysDocNo=$oSys->SearchByKeyName('sysDocNo');
        
                
$oDt->SearchByKey($DtID);
                
$oDt->GetRecord();

                
$oDP2->SearchByShowDocNo($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/""$oSysDocNo"$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(
"../clas/clsConnection.php");
include_once(
"../clas/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";
include_once 
"getPrefix.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(
$RsID!='4'){
                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(
"../clas/clsConnection.php");
include_once(
"../clas/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 
"getPrefix.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(
"../clas/clsConnection.php");
include_once(
"../clas/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 
"getPrefix.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(
"../clas/clsConnection.php");
include_once(
"../clas/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 
"getPrefix.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(
"../clas/clsConnection.php");
include_once(
"../clas/clsDB.php");
include_once 
"global.php";
include_once 
"./class/clsDocReceiveSend.php";
include_once 
"getPrefix.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(
"../clas/clsConnection.php");
include_once(
"../clas/clsDB.php");
include_once 
"global.php";
include_once 
"./class/clsDocReceiveSend.php";
include_once 
"getPrefix.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(
"../clas/clsConnection.php");
include_once(
"../clas/clsDB.php");
include_once 
"global.php";
include_once 
"./class/clsDocReceiveSend.php";
include_once 
"getPrefix.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(
"../clas/clsConnection.php");
include_once(
"../clas/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 
"getPrefix.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(
"../clas/clsConnection.php");
include_once(
"../clas/clsDB.php");
include_once 
"global.php";
include_once 
"./class/clsDocLineConfig.php";
include_once 
"./class/clsDepartment.php";
include_once 
"getPrefix.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";
include_once 
"getPrefix.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";
include_once 
"getPrefix.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";
include_once 
"getPrefix.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";
    include_once 
"getPrefix.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";
include_once 
"getPrefix.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";
include_once 
"getPrefix.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 
"-&nbsp;".GetPrefix($oPS->prefixId).$oPS->fName."&nbsp;".$oPS->lName;
            }else{
                echo 
"สารบรรณย่อย";
            }
            if(
$oRs1->DrsSendToPs=="Y"){
                echo 
"&nbsp;[ส่งด่วน]";
            }
            echo 
"<br>"
            if(
$oRs1->personId==0){
                
//echo "&nbsp;&nbsp;".$oDlp->DlpName."<br>";
                
echo "&nbsp;&nbsp;".$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";
    include_once 
"getPrefix.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";
    include_once 
"getPrefix.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";
    include_once 
"getPrefix.php";
    
    
$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
    
$oDP = new Department($oC);
    
$oDlc = new docLineConfig($oC);

    return 
$oDP->SearchDeptName($oDlc->SearchByKeyName($DlcID,'deptId'));
}
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";
include_once 
"getPrefix.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";
include_once 
"getPrefix.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";
include_once 
"getPrefix.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="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$tab;
}else{
$tab="&nbsp;&nbsp;";
}
?>
<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=="&nbsp;&nbsp;"){                            
echo 
"<img src=\"../picture/reg.png\" alt=\"\"  border=\"0\" >"//$oRs->DocID;
echo "&nbsp;<strong>".$oDlp->DlpName."&nbsp;".$oDP->SearchDeptName($oDlc->deptId)."&nbsp;</strong>&nbsp;<font color=\"#000099\">".GetPrefix($oPS->prefixId).$oPS->fName."&nbsp;".$oPS->lName."</font>&nbsp;";
list(
$DocD,$DocT) = split(' ',$oRs->DrsSendDate); 
if(
$oRs->DrsSendDate!="0000-00-00 00:00:00"){  echo "[วันที่ส่ง::&nbsp;".abbreDate2($DocD,'/')."&nbsp;".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 "&nbsp;".GetPrefix($oPS2->prefixId).$oPS2->fName."&nbsp;".$oPS2->lName."</font>&nbsp;";
            if(
$oRs2->DrsMainPs=='Y'){
                echo 
"[ผู้รับผิดชอบหลัก]";
            }            
            if(
$oRs2->DrsSendToPs=='Y'){
                
$oDP->SearchByKey($oPS2->deptId);
                
$oDP->GetRecord();
                echo 
"<font color=\"#FF0000\">(".$oDP->deptName." : ส่งด่วน)</font>";
            }
            if(
$oRs2->DrsSendDocNew!="0000-00-00 00:00:00"){
                list(
$DocD2,$DocT2) = split(' ',$oRs2->DrsSendDocNew); 
                echo 
"[ส่งเพิ่มเติม ".abbreDate2($DocD2,'/')."&nbsp;".a2th($DocT2)."]";
            }
            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 
"[วันที่รับทราบ::&nbsp;".abbreDate2($DocD2,'/')."&nbsp;".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 
"[วันที่แจ้งการส่งผิด::&nbsp;".abbreDate2($DocD2,'/')."&nbsp;".a2th($DocT2)."]";
            }
            
            if(
$oRs2->DrsMainPs=='Y'){
                    list(
$DocD3,$DocT3) = split(' ',$oRs2->DrsDocDueDate); 
                    if(
$oRs2->DocRefAnsDate!="0000-00-00 00:00:00"){ 
                                list(
$DocD2,$DocT2) = split(' ',$oRs2->DocRefAnsDate); 
                                if(
$DocD2>$oRs2->DrsDocDueDate){  
                                        
$resultshow='หลังเวลากำหนด '.abbreDate2($DocD2,'/')."&nbsp;".a2th($DocT2);
                                }else if(
$DocD2==$oRs2->DrsDocDueDate){ 
                                        
$resultshow='ตามเวลากำหนด '.abbreDate2($DocD2,'/')."&nbsp;".a2th($DocT2);
                                }else{  
                                        
$resultshow='ก่อนเวลากำหนด '.abbreDate2($DocD2,'/')."&nbsp;".a2th($DocT2);
                                }
                    }else{    
                                
$resultshow="ยังไม่ดำเนินการ";
                    } 
                    echo 
"<br>".$tab."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#330000><strong>ระยะเวลาดำเนินการ ::</strong></font>  ".abbreDate2($DocD3,'/')."&nbsp;".a2th($DocT3);
                    echo 
"<br>".$tab."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color=#330000><strong>สถานะการดำเนินงาน ::</strong></font>  ".$resultshow;
            }
            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 "&nbsp;".$oDlp1->DlpName."&nbsp;".$oDP1->SearchDeptName($oDlc1->deptId)."</strong>";
            if(
$oRs1->DrsReceivePersonId!='0'){
                echo 
"&nbsp;<strong>::</strong>&nbsp;<font color=\"#000099\">".GetPrefix($oPS1->prefixId).$oPS1->fName."&nbsp;".$oPS1->lName."</font>&nbsp;";
                
            }
            
$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 "::&nbsp;".abbreDate2($DocD1,'/')."&nbsp;".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 
"[วันที่ส่ง::&nbsp;".abbreDate2($DocD3,'/')."&nbsp;".a2th($DocT3)."]";
                }
            }
            
            echo 
"<br>";
            
showsteplinedoc($oRs1->DocID,$tab);
    }
    
    
    
    
    
    
echo 
"</td></tr>";    
}
?>
</table>
<?
}
function 
searchDepRef($deptId){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsDepartment.php";
include_once 
"../link/function.php";
include_once 
"getPrefix.php";
include_once 
"../class/clsdeptref.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);

$oDP = new Department($oC);
$oDP1 = new Department($oC);
$oDr= new deptref($oC);
$oDr2= new deptref($oC);


$oDP->SearchByKey($deptId);
$oDP->GetRecord();
    
    
$oDP1->searchMaxDate($oDP->deptDate);  $oDP1->GetRecord(); 
    echo 
$str="<option value=".$oDP->deptId.">".$oDP->deptName."&nbsp;&nbsp;[".abbreDate2($oDP->deptDate,'/')."&nbsp;-&nbsp;".abbreDate2($oDP1->deptDate,'/')."]</option>";
    
$checkcountdeptref=$oDr2->searchcountBydeptId($oDP->deptId);
                        
    if(
$checkcountdeptref!="0"){  
                                
$oDr->searchBydeptId($oDP->deptId);
                                while(
$oDr->GetRecord()){
                                        
searchDepRef($oDr->deptrefId);  
                                }
    }
}
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";
include_once 
"getPrefix.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);
$oRs2 = 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;

    
$numcount=0;
    if(
$oDlp->DlpPID=="0"){
        
$numcount=$oRs2->SearchCountPreDocSign($DlcID,$DlcID2,$maxgroup);
    }else{
        
$numcount=$oRs2->SearchCountPreDocSignforDlpID0($DlcID,$DlcID2,$maxgroup);
    }
    if(
$numcount>0){

            if(
$oDlp->DlpPID=="0"){
                
$oRs->SearchPreDocSign($DlcID,$DlcID2,$maxgroup);
            }else{
                
$oRs->SearchPreDocSignforDlpID0($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";
include_once 
"getPrefix.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);
$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;

    
$numcount=0;
    
$numcount=$oRs2->SearchCountPreDocSend($DlcID,$DlcID2,$maxgroup);
    if(
$numcount>0){
    
    
$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";
include_once 
"getPrefix.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);
$oDoc2 = 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;

    
$numcount=0;
    
$numcount=$oDoc2->SearchCountDocReceive($DlcID,$DlcID2,$maxgroup);
    if(
$numcount>0){


    
$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";
include_once 
"getPrefix.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;
}
}
function 
GetDrsReadDoc($DocID){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsDocuments.php";
include_once 
"../class/clsDocattatches.php";
include_once 
"getPrefix.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);

$oDoc3 = new Documents($oC);
$oDatt2 = new Docattatches($oC);

                    
$oDoc3->SearchByKey($DocID);
                    
$oDoc3->GetRecord();
                    
//---set DrsReadDoc
                    
if($oDoc3->DocPID=="0" || $oDoc3->DocPID==""){  $searchDocRead=$oDoc3->DocID; }else{ $searchDocRead=$oDoc3->DocPID; }
                    
$countdocread=$oDatt2->CountDocByDocID($searchDocRead);
                    
                    for(
$i=1;$i<=$countdocread;$i++){
                        
$writeReadDoc=$writeReadDoc.'0';
                    } 
return 
$writeReadDoc;
}
function 
GetStatusReadDoc($DrsReadDoc,$DaSeq){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsDocuments.php";
include_once 
"../class/clsDocattatches.php";
include_once 
"getPrefix.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);

$oDoc3 = new Documents($oC);
$oDatt2 = new Docattatches($oC);

                    
$string $DrsReadDoc;
return 
$string{$DaSeq-1};

}
function 
showsteplinedoc2($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";
include_once 
"getPrefix.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);
$oRs5 = 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="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;".$tab;
}else{
        
$tab="&nbsp;&nbsp;";
}
$oDoc->SearchByKey($searchDoc); $oDoc->GetRecord(); 

?>
<table border="0" align="center" width="98%" >
<?

echo '</td></tr>';
$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=="&nbsp;&nbsp;"){                            
                echo 
"<img src=\"../picture/reg.png\" alt=\"\"  border=\"0\" >"
                echo 
"&nbsp;<strong>".$oDlp->DlpName."&nbsp;".$oDP->SearchDeptName($oDlc->deptId)."&nbsp;::</strong>&nbsp;<font color=\"#000099\">".GetPrefix($oPS->prefixId).$oPS->fName."&nbsp;".$oPS->lName."</font>&nbsp;";
                list(
$DocD,$DocT) = split(' ',$oRs->DrsSendDate); 
                echo 
'<br>';
                
showSignSendDoc($oRs->DocID);
        }
        
$i=0;
        
$oRs2->SearchByDrsFromDrsIDcaseps($oRs->DrsID);
        
$countrowps=$oRs2->NumRow();
        while(
$oRs2->GetRecord()){
                
$oPS2->SearchByKey($oRs2->personId);    
                
$oPS2->GetRecord();
                if(
$i==0){
                    echo 
$tab."<img src=\"../picture/linesub.gif\" alt=\"\"  border=\"0\" >";
                }else{
                    echo 
',';
                }
                echo 
"<font color=\"#000099\">"
                echo 
"&nbsp;".GetPrefix($oPS2->prefixId).$oPS2->fName."&nbsp;".$oPS2->lName."</font>&nbsp;";
                
$i++;
                if(
$i==$countrowps){
                    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 "&nbsp;".$oDlp1->DlpName."&nbsp;".$oDP1->SearchDeptName($oDlc1->deptId)."</strong>";
                if(
$oRs1->DrsReceivePersonId!='0'){
                    echo 
"&nbsp;<strong>::</strong>&nbsp;<font color=\"#000099\">".GetPrefix($oPS1->prefixId).$oPS1->fName."&nbsp;".$oPS1->lName."</font>&nbsp;";
                    
                }
            
                
showSignSendDoc($oRs1->DocID);


            
showsteplinedoc2($oRs1->DocID,$tab);
        }
echo 
"</td></tr>";

}

?>
</table>
<?
}
function 
showSignSendDoc($searchDoc){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../link/functionshow.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";
include_once 
"getPrefix.php";
include_once 
"../class/clsDocWSign.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);
$oRs5 = new DocReceiveSend($oC);
$oRs6 = new DocReceiveSend($oC);
$oDlc = new DocLineConfig($oC);
$oDlc5 = 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);
$oDws = new docwsign($oC);

                    echo 
'<table width="80%" border="0" align=center  cellpadding=0 cellspacing=0  ><tr><td>';
                    
                    
$i=0;
                    
$oRs5->SearchByDocID($searchDoc);
                    while(
$oRs5->GetRecord()){
                            echo 
'<table width="100%" border="0" align=center  cellpadding=0 cellspacing=0 bordercolor=#DADADA style=border-collapse:collapse>';
                            
$oDoc->SearchByKey($searchDoc); $oDoc->GetRecord(); 
                            list(
$DocD,$DocT) = split(' ',$oDoc->DocDateCreate);
                            if(
$oRs5->DsID=="1"){  
                                        echo 
'<tr><td  height=22 bgcolor=#F0F8FF><strong><font color=#336600>ข้อมูลการลงรับ</font></strong></td></tr>';
                                        echo 
'<tr><td bgcolor=#F0F8FF>&nbsp;&nbsp;<font color=#FF6600>ลงรับวันที่</font> '.abbreDate2($DocD,'/')."&nbsp;".a2th($DocT);   echo '&nbsp;&nbsp;<font color=#FF6600>เลขทะเบียน'.ShowNameRSDoc2($oDoc->RsID).'</font> : '.a2th($oDoc->DocTypeNo).'</td></tr><br>';}
                            if(
$oRs5->DsID=="6"){
                                    echo 
'<tr><td height=22 bgcolor=#F0F8FF><strong><font color=#336600>ข้อมูลไม่ลงทะเบียนรับ</font></strong></td></tr>'
                                    list(
$DocD,$DocT) = split(' ',$oRs5->DrsReceiveDate );
                                    echo 
'<tr><td bgcolor=#F0F8FF>&nbsp;&nbsp;<font color=#FF6600>ไม่ลงรับวันที่</font> '.abbreDate2($DocD,'/')."&nbsp;".a2th($DocT);  echo '<br>';
                            }
                            if(
$oRs5->DsID=="7"){
                                    echo 
'<tr><td height=22 bgcolor=#F0F8FF><strong><font color=#336600>ข้อมูลแจ้งการส่งผิด</font></strong></td></tr>'
                                    list(
$DocD,$DocT) = split(' ',$oRs5->DrsReceiveDate );
                                    echo 
'<tr><td bgcolor=#F0F8FF>&nbsp;&nbsp;<font color=#FF6600>แจ้งส่งผิดวันที่</font> '.abbreDate2($DocD,'/')."&nbsp;".a2th($DocT);  echo '<br>';
                                    echo 
'<tr><td bgcolor=#F0F8FF>&nbsp;&nbsp;<font color=#FF6600>คำชี้แจง แจ้งการส่งผิด ::  </font> '.$oRs5->DrsSendBack;  echo '<br>';
                            }
                            if(
$oRs5->DsID=="2"){ 
                                       echo 
'<tr><td height=22 bgcolor=#FFFAE8><strong><font color=#336600>ข้อมูลเสนอลงนาม</font></strong></td></tr>'
                                       echo 
'<tr><td bgcolor=#FFFAE8>&nbsp;&nbsp;<font color=#FF6600>บันทึกต่อเนื่อง</font> '.nl2br($oRs5->DrsPropose).'<br>';  
                                       
$oPS->SearchByKey($oRs5->DrsPsIDCreate); $oPS->GetRecord();   
                                       echo 
'&nbsp;&nbsp;'.GetPrefix($oPS->prefixId).$oPS->fName."&nbsp;".$oPS->lName."&nbsp;";                         
                                          
$oDlc5->SearchByKey($oRs5->DrsDlcIDCreate);  $oDlc5->GetRecord();    
                                          
$oDlp->SearchByKey($oDlc5->DlpID);  $oDlp->GetRecord();            
                                          echo 
"(".ShowNamePosition($oDlp->DlpID,$oDlp->DlpName,$oDP->SearchDeptName($oDlc5->deptId)).")&nbsp;";  
                                        list(
$DocD,$DocT) = split(' ',$oRs5->DrsReceiveDate );
                                        echo 
abbreDate2($DocD,'/')."&nbsp;".a2th($DocT); 
                                        echo 
'</td></tr><br>';  
                            }
                            if(
$oRs5->DrsWSign=='Y'){
                                            
$oDws->SearchByDrsIDDocID($oRs5->DrsID,$oRs5->DocID);
                                            
$oDws->GetRecord();
                                     echo 
'<tr><td>&nbsp;</td></tr>';
                                     echo 
'<tr><td height=22 bgcolor=#FFFAE8><strong><font color=#336600>ข้อมูลรอเสนอผอก./หน.</font></strong></td></tr>'
                                     echo 
'<tr><td bgcolor=#FFFAE8>&nbsp;&nbsp;<font color=#FF6600>บันทึกต่อเนื่อง</font> '.nl2br($oDws->DocSign).'<br>';  
                                      
$oPS->SearchByKey($oDws->personId); $oPS->GetRecord();   
                                      echo 
'&nbsp;&nbsp;'.GetPrefix($oPS->prefixId).$oPS->fName."&nbsp;".$oPS->lName."&nbsp;";  
                                      
$oDlc5->SearchByKey($oDws->DlcID);  $oDlc5->GetRecord();    
                                      
$oDlp->SearchByKey($oDlc5->DlpID);  $oDlp->GetRecord();            
                                     echo 
"(".ShowNamePosition($oDlp->DlpID,$oDlp->DlpName,$oDP->SearchDeptName($oDlc5->deptId)).")&nbsp;";  
                                        list(
$DocD,$DocT) = split(' ',$oDws->signDateTime);
                                        echo 
abbreDate2($DocD,'/')."&nbsp;".a2th($DocT); 
                                        echo 
'</td></tr><br>';  
                            }
                            
$oRs6->SearchByKey($oRs5->DrsFromDrsID);
                            
$oRs6->GetRecord();
                            
                             if(
$oRs5->DsID=="3" && $oRs6->DrsByPass!='Y'){ 
                                      echo 
'<tr><td height=22 bgcolor=#E4F0F9><strong><font color=#336600>ข้อมูลลงนาม</font></strong></td></tr>';  
                                     echo 
'<tr><td bgcolor=#E4F0F9>&nbsp;&nbsp;<font color=#FF6600>บันทึกต่อเนื่อง</font> '.nl2br($oRs5->DrsSign).'<br>';  
                                      
$oPS->SearchByKey($oRs5->DrsPsIDCreate); $oPS->GetRecord();   
                                      echo 
'&nbsp;&nbsp;'.GetPrefix($oPS->prefixId).$oPS->fName."&nbsp;".$oPS->lName."&nbsp;";     
                                     
$oDlc5->SearchByKey($oRs5->DrsDlcIDCreate);  $oDlc5->GetRecord();    
                                     
$oDlp->SearchByKey($oDlc5->DlpID);  $oDlp->GetRecord();
                                    echo 
"(".ShowNamePosition($oDlp->DlpID,$oDlp->DlpName,$oDP->SearchDeptName($oDlc5->deptId)).")&nbsp;"
                                    list(
$DocD,$DocT) = split(' ',$oRs5->DrsReceiveDate );
                                    echo 
abbreDate2($DocD,'/')."&nbsp;".a2th($DocT); 
                                    echo 
'</td></tr><br>';
                             }
                            echo 
'</table>';
               }
                    echo 
'</td></tr></table>';
                    
}
function 
SearchSendAll($DlpId){
//if($DlpId==1 || $DlpId==2 || $DlpId==3 || $DlpId==4){
    
return "All";
//}
}
function 
SearchSendAll_receive($DlpId){
if(
$DlpId==|| $DlpId==2){
    return 
"All";
}
}
function 
showDeptForSend($deptId,$iselect,$DlcdeptId,$searchDoc){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsDepartment.php";
include_once 
"../class/clsDocReceiveSend.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDPt = new Department($oC);
$oDPt2 = new Department($oC);
$oRs9 = new DocReceiveSend($oC);
//$iselect++;
global $iselect;
global 
$mydept;
global 
$pssend;
                        
$oDPt->SearchByKey($deptId);
                        
$oDPt->GetRecord();
                        
                        
$pssend=ShowSendtoPs2($deptId); 
                        
                        echo 
"<tr><td>&nbsp;&nbsp;";
                        echo 
"<input name=deptPs[".$deptId."]  id=select1[".$iselect."] type=checkbox  value=\"".$pssend."\"";
                        if(
$pssend==''){ echo " disabled "; }
                        echo 
">";
                        if(
$DlcdeptId==$deptId){   $mydept=$iselect; }
                        
                        
$tab="&nbsp;";
                        if(
$oDPt->deptLevel%!= 0){  $stylefont="<b>";  $stylefont2="</b>"; }
                        for(
$i=1;$i<=$oDPt->deptLevel;$i++){
                            
$tab.="&nbsp;&nbsp;&nbsp;&nbsp;";
                        }
                        
$nextpssend=searchnextpssend($pssend,$oDPt->deptId);  $oRs9->searchHaveSendDoc($pssend,$nextpssend,$searchDoc); if($oRs9->GetRecord()==1){ $showimg="<img src=\"../picture/yes.gif\"  border=\"0\"  alt=\"หมายถึงหน่วยงานย่อยหรือบุคลากรผู้นั้น เคยได้รับหนังสือนี้แล้ว\">"; }         
                        echo 
$showimg.$tab.$stylefont.$oDPt->deptName.$stylefont2;
                        echo 
"</td></tr>";
                        
                        
                        
                        
                        
$oDPt2->RSmenuByDeptParent2($oDPt->deptId);
                        while(
$oDPt2->GetRecord()){
                            
$iselect++;
                            
showDeptForSend($oDPt2->deptId,$iselect,$DlcdeptId,$searchDoc);
                            
                        }
    

}
function 
showDeptForSendDocNew($deptId,$DlcdeptId,$searchDoc){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsDepartment.php";
include_once 
"../class/clsDocReceiveSend.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oDPt = new Department($oC);
$oDPt2 = new Department($oC);
$oRs9 = new DocReceiveSend($oC);

global 
$pssend;
//global $nextpssend;
                        
$oDPt->SearchByKey($deptId);
                        
$oDPt->GetRecord();
                        
                        
$pssend=ShowSendtoPs2($deptId); 
                        echo 
"<tr><td>&nbsp;&nbsp;";
                        
                        echo 
"<input name=deptPs[".$deptId."]   type=checkbox  value=\"".$pssend."\"";
                        if(
$pssend==''){ echo " disabled "; }
                        echo 
">";
                        
                        
$nextpssend=searchnextpssend($pssend,$oDPt->deptId);   
                        if(
$nextpssend!=""){ 
                                
$oRs9->searchHaveSendDoc($pssend,$nextpssend,$searchDoc); 
                                if(
$oRs9->GetRecord()==1){ 
                                        echo 
"<img src=\"../picture/yes.gif\"  border=\"0\"  alt=\"หมายถึงหน่วยงานย่อยหรือบุคลากรผู้นั้น เคยได้รับหนังสือนี้แล้ว\">"
                                } 
                        }
                        
                        
$tab="&nbsp;";
                        if(
$oDPt->deptLevel%!= 0){  $stylefont="<b>";  $stylefont2="</b>"; }
                        for(
$i=1;$i<=$oDPt->deptLevel;$i++){
                            
$tab.="&nbsp;&nbsp;&nbsp;&nbsp;";
                        }    
                        echo 
$tab.$stylefont.$oDPt->deptName.$stylefont2;
                        echo 
"</td></tr>";
                        
                        
$oDPt2->RSmenuByDeptParent2($oDPt->deptId);
                        while(
$oDPt2->GetRecord()){
                            
showDeptForSendDocNew($oDPt2->deptId,$DlcdeptId,$searchDoc);
                            
                        }
    

}
function 
searchDocPath($cId){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsCollegeDetail.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oCD = new collegedetail($oC);

$oCD->SearchByKey($cId);
$oCD->GetRecord();

//---show documents path
    
return "http://".$oCD->collegeHost.$GLOBALS["ROOT_URL"]."eoffice/documents/";

}
function 
searchcollegeAbbr($cId){
include_once(
"../../class/clsConnection.php");
include_once(
"../../class/clsDB.php");
include_once 
"../global.php";
include_once 
"../class/clsCollegeDetail.php";

$oC = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
$oCD = new collegedetail($oC);

$oCD->SearchByKey($cId);
$oCD->GetRecord();
    
return 
$oCD->collegeAbbr;

}
?>

:: Command execute ::

Enter:
 
Select:
 

:: Shadow's tricks :D ::

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

:: Preddy's tricks :D ::

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c999shell v. 1.0 pre-release build #16 Modded by Shadow & Preddy | RootShell Security Group | r57 c99 shell | Generation time: 0.0251 ]--