<?php
//include_once "../link/keyThai.php";
include_once("global0.php");

    
$GLOBALS['DBHOST'] = "localhost";
    
$GLOBALS['DBNAME_EOFFICE'] = "eopbri";                    
    
$GLOBALS['DBUSER_EOFFICE'] = "eoffice";
    
$GLOBALS['DBPASS_EOFFICE'] = "45530577";

    
$GLOBALS['DBNAME_EPERSON'] = "people";                    
    
$GLOBALS['DBUSER_EPERSON'] = "eoffice";
    
$GLOBALS['DBPASS_EPERSON'] = "45530577";
    
    
$GLOBALS['DBNAME_UMS'] = "umseo";                    
    
$GLOBALS['DBUSER_UMS'] = "eoffice";
    
$GLOBALS['DBPASS_UMS'] = "45530577";

    
    
//------------define variable
    
$GLOBALS['dateupdate']='';
    
$GLOBALS['casepbri']='';
    
$GLOBALS['PAGE_SIZE']='';
    
$GLOBALS["COLLEGEID"]='';
    
$GLOBALS["COLLEGENAME"]='';
    
$GLOBALS["COLLEGENAME2"]='';
    
$GLOBALS["FOLDERFORSEND1"]='';
    
$GLOBALS["FOLDERFORSEND2"]='';
    
$GLOBALS["FOLDERFORSEND3"]='';
    
$GLOBALS["DOCFORSIGNNAME"]='';
    
$GLOBALS['pdId']='';
    
$GLOBALS['SERVERPATH']='';
    
$GLOBALS['Output_Thai']='';
    
//--------------------------------
    
    
$GLOBALS['dateupdate'] = '2552-06-02 00-00-00';
    
$GLOBALS['casepbri'] = "0";

    include_once 
"../class/clsDepartment.php";
    include_once 
"../class/clsRunningDoc.php";
    include_once 
"../class/clsRunningTypeDoc.php";
    include_once 
"../class/clsSysConfig.php";
    include_once 
"../class/clsPerson.php"
    include_once 
"../class/clsCollegeDetail.php";


    
$oCe = new clsConnection($GLOBALS['DBHOST'], $GLOBALS['DBNAME_EOFFICE'], $GLOBALS['DBUSER_EOFFICE'], $GLOBALS['DBPASS_EOFFICE']);
    
$oDPt = new Department($oCe);
    
$oRd = new runningdoc($oCe);
    
$oRt = new runningtypedoc($oCe);
    
$oSys = new sysConfig($oCe);
    
$oPSc = new person($oC); 
    
$oCd = new collegedetail($oC);
    
    
$oSys->RSsysConfig();
    
$oSys->GetRecord();
    
    
$GLOBALS['PAGE_SIZE']=$oPSc->searchRecordPerPage($oU->userPsCode); 
    
    
//---info college
    
$GLOBALS["COLLEGEID"] = "21";
    
$GLOBALS["COLLEGENAME"] = $oSys->collegeName;
    
$GLOBALS["COLLEGENAME2"] = $oSys->collegeNameArr;
    
$GLOBALS["FOLDERFORSEND1"] =  "mispbri";
    
$GLOBALS["FOLDERFORSEND2"] =  "mistk";
    
$GLOBALS["FOLDERFORSEND3"] =  "mis";
    
$GLOBALS["DOCFORSIGNNAME"] = $oSys->docforsignname;

    
    
$GLOBALS['pdId']=$oCd->SearchpdIdpbri($GLOBALS["COLLEGEID"]);

    
$GLOBALS['path_upload_documents']="../documents/";
    
$GLOBALS['path_upload_documentsTmp']="../documentsTmp/";
    
$GLOBALS['path_upload_uploadfile']="uploadfile/";
    
$GLOBALS['path_upload_documents_TestEgif']="..documents_TestEgif/";

    
$GLOBALS['path_download_documents']="../documents/";
    
$GLOBALS['path_download_documentsTmp']="../documentsTmp/";
    
$GLOBALS['path_download_uploadfile']="uploadfile/";
    
$GLOBALS['path_download_documents_TestEgif']="..documents_TestEgif/";


//---show server path
    
$GLOBALS['SERVERPATH']="http://".$oSys->pbriHost."/mispbri/eoffice/admin/updatecollege.php";


//---check running new year    
    
$GLOBALS['Output_Thai']=$oSys->OutputThai;
    
$maxGroup=$oDPt->SearchMaxDocGroup();
    
//-----runningdoc table
    
if($oSys->SearchBysysYear()!=(date('Y')+543)){
        
$oRd->SearchBydocGroup($maxGroup);
        while(
$oRd->GetRecord()){
            
$oRd->Edit();
            
$oRd->DtID=$oRd->DtID;
            
$oRd->deptId=$oRd->deptId;
            
$oRd->receiveNoStart =1;
            
$oRd->receiveNo=0;
            
$oRd->sendNoStart =1;
            
$oRd->sendNo=0;
            
$oRd->regisNoStart =1;
            
$oRd->regisNo=0;
            
$oRd->docGroup=$oRd->docGroup;
            
$oRd->confirm=$oRd->confirm;
            
$oRd->Save();
        }
        
//--update sysYear
        
$oSys->SearchByKey();
        
$oSys->GetRecord();
        
$oSys->Edit();
        
$oSys->sysYear=(date('Y')+543);
        
$oSys->Save();
    }


    
$globals_test = @ini_get('register_globals');
    if ( isset(
$globals_test) && empty($globals_test) ) {
       
$types_to_register = array('GET''POST''COOKIE''SESSION''SERVER');
       foreach (
$types_to_register as $type) {
          
$arr = @${'_' $type};
          if (@
count($arr) > 0)
             
extract($arrEXTR_SKIP);
       }
    }
?>