Viewing file:      rpt_regis.php (31.62 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 include('rg_controller.php');
 class Rpt_regis extends Rg_controller {
 //    function __construct() {
 //        parent::__construct();
 //    }
 
     //Rep106-----------------------------------------------------------------------------
     public function searchRptRis106() {
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
         $this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
         $tm = $this->tm;
         $tmOrder = array('tmId' => 'ASC');
         $ord_rs_sy  = array('syId'        => '');
 
         $this->contents['rs_tm'] = $tm->get_options('',$tmOrder,'','');
         $this->contents['rs_sy']  = $this->sy->get_options('',$ord_rs_sy,'','N');
 
         $this->contents['tmId'] = $this->session->userdata('tmId');
         $this->contents['acY'] = $this->session->userdata('acY');
 
         $this->output($this->config->item("rg_folder")."v_searchRptRis106");
     }
     
     function cur_popup($id=0) {  //popup course and year searchRptRis106
         $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
         $this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
         $this->contents['qu_cur'] = $this->cur->get_by_key($id);
         $this->contents['rs_std'] = $this->std->qryByGenStatusGroupCurIdAndAdY('Y');
         
         $this->output_detail($this->config->item("rg_folder")."v_curAndAdYTable");
     }
     
     public function showRptRis106() {
         $this->load->library('form_validation');
         $this->form_validation->set_error_delimiters('<div class="error">','</div>');
         $this->form_validation->set_rules('curId', ' ', 'trim|required|callback_checkselect');//รหัสหลักสูตร
         $this->form_validation->set_rules('curName', ' ', '');//ชื่อหลักสูตร
         $this->form_validation->set_rules('adY', ' ', 'trim|integer|callback_checkAdY|xss_clean');//ปีการศึกษาที่เข้า
         $this->form_validation->set_rules('acY', ' ', 'trim|integer|callback_checkAcY|xss_clean');//ปีการศึกษา
         $this->form_validation->set_rules('tmId', ' ', 'callback_checkselect');//ภาคการศึกษา
         $this->form_validation->set_rules('studentYear',' ','callback_checkselect');//ชั้นปี
 
         if($this->form_validation->run() == true) {
                 $curId = $this->input->post('curId');
                 $curName = $this->input->post('curName');
                 $adY = $this->input->post('adY');
                 $acY = $this->input->post('acY');
                 $tmId = $this->input->post('tmId');
                 $studentYear = $this->input->post('studentYear');
 
                 $tmIdAdmit = $this->input->post('tmIdAdmit');
                 $syId = $this->input->post('syId');
 
                 $this->contents['curId'] = $curId;
                 $this->contents['curName'] = $curName;
                 $this->contents['adY'] = $adY;
                 $this->contents['acY'] = $acY;
                 $this->contents['tmId'] = $tmId;
                 $this->contents['studentYear'] = $studentYear;
                 $this->contents['tmIdAdmit'] = $tmIdAdmit;
                 $this->contents['syId'] = $syId;
                 
                 $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
                 $this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
                 $this->load->model($this->config->item("rg_folder").'mo_rg_prefix','pre');
                 $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','reg');
                 $this->load->model($this->config->item("rg_folder").'mo_rg_payment','pay');
 
                 $cur = $this->cur;
                 $std = $this->std;
                 $pre = $this->pre;
                 $reg = $this->reg;
                 $pay = $this->pay;
 
                 $curCon = array('curId' => $curId);
                 $this->contents['qu_cur'] = $cur->qryCur($curCon,'','');
 
                 $stdCon = array('stdCurId' => $curId , 'stdAdY' => $adY);
                 $stdOrder = array('stdCode' => '');
                 $this->contents['rs_std'] = $std->qryStdJoinPf($stdCon,$stdOrder,'');
 
                 $this->contents['reg'] = $reg;
                 $this->contents['pay'] = $pay;
 
                 $this->output($this->config->item("rg_folder")."v_rptRis106");
         } else {  
             $this->searchRptRis106(); 
         }
     }
 
     public function printRepRis106($stdId,$acY,$studentYear,$tmId,$curId) {
             $this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
             $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','reg');
             $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rgd');
             $this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf');
             $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf');
             $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
             $this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
             $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
 
             $std = $this->std;
             $reg = $this->reg;
             $rgd = $this->rgd;
             $cmf = $this->cmf;
             $cf = $this->cf;
             $crf = $this->crf;
             $sd = $this->sd;
             $cur = $this->cur;
 
             $stdCon = array('stdId' => $stdId);
             $this->contents['qu_std'] = $std->qryStdJoinPfCurGen($stdCon,'','');
 
             $regCon = array('rfStdId' => $stdId , 'rfAcY' => $acY , 'rfTmId' => $tmId);
 
             $this->contents['qu_reg'] = $reg->qryRf($regCon,'','');
 
             $this->contents['rs_rgd'] = $rgd->getRegistDetailsByStdIdAcYTmId($stdId, $acY, $tmId);
 
             $cmfCon = array('cmfStdId' => $stdId, 'cmfAcY' => $acY , 'cmfTmId' => $tmId);
             $this->contents['rs_cmf'] = $cmf->qryCmfJoinFee($cmfCon,'','');
 
             $cfCon = array('cfStdId' => $stdId, 'cfAcY' => $acY , 'cfTmId' => $tmId);
             $this->contents['rs_cf'] = $cf->qryCfJoinFee($cfCon,'','');
 
             $curCon = array('curId' => $curId);
             $this->contents['qu_cur'] = $cur->qryCur($curCon,'','');
 
             $this->contents['stdId'] = $stdId;
             $this->contents['acY'] = $acY;
             $this->contents['tmId'] = $tmId;
             $this->contents['studentYear'] = $studentYear;
             
             $crfCon = array('crfStdId' => $stdId , 'crfAcY' => $acY , 'crfTmId' => $tmId);
             $this->contents['sumLcFee'] = $crf->GetSumcrfLecFeeAmtCourseFee($crfCon,'');
             $this->contents['sumLbFee'] = $crf->GetSumcrfLabFeeAmtCourseFee($crfCon,'');
 
             $rgdCon = array('rdStdId' => $stdId , 'rdAcY' => $acY , 'rdTmId' => $tmId);
             $this->contents['sumRdCredit1'] = $rgd->getSumCr1($rgdCon,'');
             $this->contents['sumRdCredit2'] = $rgd->getSumCr2($rgdCon,'');
             $this->contents['sumRdCreditAttempt'] = $rgd->getCreditAttempt($rgdCon,'');
             
             $this->contents['sumKssFee'] = $crf->GetSumcrfKssFeeAmtCourseFee($crfCon,'','');
             
             $regCon = array('rfStdId' => $stdId , 'rfAcY' => $acY , 'rfSyId' => $studentYear , 'rfTmId' => $tmId);
             $this->contents['sumTotalAmt'] = $reg->getSumTotalAmt($regCon,'');
 
             $sdCon = array('sdAcY' => $acY , 'sdTmId' => $tmId);
             $this->contents['qu_sd'] = $sd->qrySd($sdCon,'','');
 
             $this->output_detail($this->config->item("rg_folder")."v_rptRis106popup");
     }
 
     public function printRepRis106PDF($stdId='', $acY='' ,$studentYear='', $tmId='', $curId='') {
         $this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
         $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','reg');
         $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rgd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf');
         $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf');
         $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
         $this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
 
         $std = $this->std;
         $reg = $this->reg;
         $rgd = $this->rgd;
         $cmf = $this->cmf;
         $cf = $this->cf;
         $crf = $this->crf;
         $sd = $this->sd;
         $cur = $this->cur;
 
         $stdId = $this->input->post('stdId') ? $this->input->post('stdId') : $stdId;
         $acY = $this->input->post('acY') ? $this->input->post('acY') : $acY;
         $studentYear = $this->input->post('syId') ? $this->input->post('syId') : $studentYear;
         $tmId = $this->input->post('tmId') ? $this->input->post('tmId') : $tmId;
         $curId = $this->input->post('curId') ? $this->input->post('curId') : $curId;
 
         $stdCon = array('stdId' => $stdId);
         $this->contents['qu_std'] = $std->qryStdJoinPfCurGen($stdCon);
 
         $regCon = array('rfStdId' => $stdId , 'rfAcY' => $acY , 'rfTmId' => $tmId);
         $this->contents['qu_reg'] = $reg->qryRf($regCon);
 
         $this->contents['rs_rgd'] = $rgd->getRegistDetailsByStdIdAcYTmId($stdId, $acY, $tmId);
 
         $cmfCon = array('cmfStdId' => $stdId, 'cmfAcY' => $acY , 'cmfTmId' => $tmId);
         $this->contents['rs_cmf'] = $cmf->qryCmfJoinFee($cmfCon,'','');
 
         $cfCon = array('cfStdId' => $stdId, 'cfAcY' => $acY , 'cfTmId' => $tmId);
         $this->contents['rs_cf'] = $cf->qryCfJoinFee($cfCon,'','');
 
 
         $this->contents['stdId'] = $stdId;
         $this->contents['acY'] = $acY;
         $this->contents['tmId'] = $tmId;
         $this->contents['studentYear'] = $studentYear;
 
         $curCon = array('curId' => $curId);
         $this->contents['qu_cur'] = $cur->qryCur($curCon,'','');
 
         $crfCon = array('crfStdId' => $stdId , 'crfAcY' => $acY , 'crfTmId' => $tmId);
         $this->contents['sumLcFee'] = $crf->GetSumcrfLecFeeAmtCourseFee($crfCon,'');
         $this->contents['sumLbFee'] = $crf->GetSumcrfLabFeeAmtCourseFee($crfCon,'');
 
         $rgdCon = array('rdStdId' => $stdId , 'rdAcY' => $acY , 'rdTmId' => $tmId);
         $this->contents['sumRdCredit1'] = $rgd->getSumCr1($rgdCon,'');
         $this->contents['sumRdCredit2'] = $rgd->getSumCr2($rgdCon,'');
         $this->contents['sumRdCreditAttempt'] = $rgd->getCreditAttempt($rgdCon,'');
         
         $this->contents['sumKssFee'] = $crf->GetSumcrfKssFeeAmtCourseFee($crfCon,'','');
         
         $regCon = array('rfStdId' => $stdId , 'rfAcY' => $acY , 'rfSyId' => $studentYear , 'rfTmId' => $tmId);
         $this->contents['sumTotalAmt'] = $reg->getSumTotalAmt($regCon,'');
 
         $sdCon = array('sdAcY' => $acY , 'sdTmId' => $tmId);
         $this->contents['qu_sd'] = $sd->qrySd($sdCon,'','');
 
         $this->output_detail($this->config->item("rg_folder")."v_rptRis106PDF");
     }
 
     //Rep109-----------------------------------------------------------------------------
     public function searchRptRis109() {
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
         $tm = $this->tm;
         $ord_rs_tm  = array('tmId' => '');
         $this->contents['rs_tm']  = $tm->get_options('',$ord_rs_tm,'','N');
         $this->contents['tmId'] = $this->session->userdata('tmId');
         $this->contents['acY'] = $this->session->userdata('acY');
                 
         $this->output($this->config->item("rg_folder")."v_searchRptRis109");
     }
 
     public function showRptRis109() {
         $this->load->library('form_validation');
         $this->form_validation->set_error_delimiters('<div class="error">','</div>');
         $this->form_validation->set_rules('acY', ' ', 'trim|integer|callback_checkAdY|xss_clean');
         $this->form_validation->set_rules('tmId', ' ', 'callback_checkselect');
         $this->form_validation->set_rules('courseCode', ' ', 'trim|required|xss_clean');
         $this->form_validation->set_rules('section', ' ', 'trim|required|integer|xss_clean');
 
         if($this->form_validation->run() == true) {
                 $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
                 $this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','cof');
                 $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
                 $this->load->model($this->config->item("rg_folder").'mo_rg_timetable','ttb');
                 $co = $this->co;
                 $cof = $this->cof;
                 $cur = $this->cur;
                 $ttb = $this->ttb;
 
                 $acY = $this->input->post('acY');
                 $tmId = $this->input->post('tmId');
                 $courseCode = $this->input->post('courseCode');
                 $section = $this->input->post('section');
 
                 $this->contents['acY'] = $acY;
                 $this->contents['tmId'] = $tmId;
                 $this->contents['courseCode'] = $courseCode;
                 $this->contents['section'] = $section;
 
                 $this->contents['rs_co'] = $co->qryCoANDCrsByCourseCodeAndAcYAndTmIdAndSec($courseCode,$acY,$tmId,$section);
                 $this->contents['cof'] = $cof;
                 $this->contents['ttb'] = $ttb;
                 $this->contents['cur'] = $cur;
 
             $this->output($this->config->item("rg_folder")."v_rptRis109");
         
         }else{  $this->searchRptRis109(); }
     }
 
     public function RptRis109($coId,$acY,$tmId,$coCurId,$ep) {
         $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
         $this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_examschedule','es');
         $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
         
         $this->contents['acY'] = $acY;
         $this->contents['tmId'] = $tmId;
         $this->contents['coCurId'] = $coCurId;
 
         $this->contents['qu_co'] = $this->co->qryForRis109($coId);
         $this->contents['prd'] = $this->prd;
         $this->contents['es'] = $this->es;
         $rdCon = array('rdCoId' => $coId);
         $rdOrd = array('stdCode' => 'ASC');
         $this->contents['rs_rd'] = $this->rd->qrySstOfStd($rdCon, $rdOrd);
         if($ep=='E')
             $this->output_detail($this->config->item("rg_folder")."v_rptRis109Excel");
         else
             $this->output_detail($this->config->item("rg_folder")."v_rptRis109PDF");
     }
 
     //Rep110-----------------------------------------------------------------------------
     public function searchRptRis110() {
         //$this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
         //$this->contents['rs_tm'] = $this->tm->qryOrderId();    
         //$this->contents['qu_tm'] = $this->tm->get_by_key($this->session->userdata('tmId'));    
         
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
         $tm = $this->tm;
         $tmOrder = array('tmId' => '');
         $this->contents['rs_tm'] = $tm->get_options('',$tmOrder,'','');
 
         $this->contents['tmId'] = $this->session->userdata('tmId');
         $this->contents['acY'] = $this->session->userdata('acY');
                 
         $this->output($this->config->item("rg_folder")."v_searchRptRis110");
     }
 
     public function showRptRis110() {
         $this->load->library('form_validation');
         $this->form_validation->set_error_delimiters('<div class="error">','</div>');
         $this->form_validation->set_rules('acY', ' ', 'trim|integer|callback_checkAdY|xss_clean');
         $this->form_validation->set_rules('courseCode', ' ', 'trim|required|xss_clean');
         $this->form_validation->set_rules('section', ' ', 'trim|integer|callback_checkselect|xss_clean');
 
         if($this->form_validation->run() == true) {
                 $this->contents['acY'] = $this->input->post('acY');
                 $this->contents['tmId'] = $this->input->post('tmId');
                 $this->contents['courseCode'] = $this->input->post('courseCode');
                 $this->contents['section'] = $this->input->post('section');
                 
                 $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
                 $this->contents['rs_co'] = $this->co->qryCoANDCrsByCourseCodeAndAcYAndTmIdAndSec($this->input->post('courseCode'),$this->input->post('acY'),$this->input->post('tmId'),$this->input->post('section')); 
 
                 $this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','ocof');
                 $this->contents['cof'] = &$this->ocof;
 
                 $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','ocur');
                 $this->contents['cur'] = &$this->ocur;
 
                 $this->load->model($this->config->item("rg_folder").'mo_rg_timetable','ott');
                 $this->contents['tt'] = &$this->ott;
 
             $this->output($this->config->item("rg_folder")."v_rptRis110");
         
         }else{  $this->searchRptRis110(); }
     }
 
     public function RptRis110($coId,$acY,$tmId,$coCurId) {
         $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
         $this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_examschedule','es');
         $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_grade','gd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','cof');
         $this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
 
         $this->contents['acY'] = $acY;
         $this->contents['tmId'] = $tmId;
         $this->contents['coCurId'] = $coCurId;
         $this->contents['co'] = $this->co;
         $this->contents['cof'] = $this->cof;
         $this->contents['sy'] = $this->sy;
         $this->contents['tm'] = $this->tm;
 
         $this->contents['qu_co'] = $this->co->qryForRis110($coId);
 
         $this->contents['prd'] = $this->prd;
         $this->contents['es'] = $this->es;
 
         $rdCon = array('rdCoId' => $coId);
         $rdOrd = array('stdCode' => 'ASC');
         $this->contents['rs_rd'] = $this->rd->qrySstOfStd($rdCon, $rdOrd);
 
         $this->contents['rs_gd'] = $this->gd->qryGtpId($this->contents['qu_co']->row()->crsGtpId);
 
         $this->output_detail($this->config->item("rg_folder")."v_rptRis110Excel");
     }
 
     //Rep116-----------------------------------------------------------------------------
     public function searchRptRis116() {
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
         $tm = $this->tm;
         $tmOrder = array('tmId' => '');
         $this->contents['rs_tm'] = $tm->get_options('',$tmOrder,'','');
         $this->contents['tmId'] = $this->session->userdata('tmId');
         $this->contents['acY'] = $this->session->userdata('acY');
         $this->output($this->config->item("rg_folder")."v_searchRptRis116");
     }
 
     public function showRptRis116() {
         $this->load->library('form_validation');
         $this->form_validation->set_error_delimiters('<div class="error">','</div>');
         $this->form_validation->set_rules('acY', ' ', 'trim|integer|callback_checkAdY|xss_clean');
         $this->form_validation->set_rules('tmId', ' ', 'callback_checkselect');
 
         if($this->form_validation->run() == true) {
             $this->contents['acY'] = $this->input->post('acY');
             $this->contents['tmId'] = $this->input->post('tmId');
             
             $this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
             $sd_cond = array('sdAcY' =>$this->contents['acY'], 'sdTmId' => $this->contents['tmId'] );
             $this->contents['qu_sd'] = $this->sd->qrySd($sd_cond,"","");
 
             $this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
             $prd_order = array('prdId' => '');
             $this->contents['rs_prd'] = $this->prd->qryPrd("",$prd_order,""); 
 
             $this->load->model($this->config->item("rg_folder").'mo_rg_day','dy');
             $dy_order = array('dyId' => '');
             $this->contents['rs_dy'] = $this->dy->qryDy("",$dy_order,"");         
             
             $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
             $this->contents['co'] = $this->co;    
 
             $this->load->model($this->config->item("rg_folder").'mo_rg_timetable','tt');
             $this->contents['tt'] = $this->tt;
                             
             $this->output_detail($this->config->item("rg_folder")."v_rptRis116");
         
         }else{  $this->searchRptRis116(); }
     }
 
 
     //Rep117-----------------------------------------------------------------------------
     public function searchRptRis117() {        
         $this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
 
         $ord_rs_sy  = array('syId'        => '');        
         $this->contents['rs_sy']  = $this->sy->get_options('',$ord_rs_sy,'','---เลือกชั้นปี---');
         $ord_rs_tm  = array('tmId'        => '');
         $this->contents['rs_tm']  = $this->tm->get_options('',$ord_rs_tm,'',FALSE);
         $this->contents['tmId'] = $this->session->userdata('tmId');
         $this->contents['acY'] = $this->session->userdata('acY');
         $this->output($this->config->item("rg_folder")."v_searchRptRis117");
     }
     
     public function showRptRis117() {
         $this->load->library('form_validation');
         $this->form_validation->set_error_delimiters('<div class="error">','</div>');
         $this->form_validation->set_rules('curId', ' ', 'callback_checkselect');
         $this->form_validation->set_rules('curName', ' ', ' ');
         $this->form_validation->set_rules('adY', ' ', 'trim|integer|callback_checkAdY|xss_clean');
         $this->form_validation->set_rules('syId',' ','callback_checkselect');
 
         if($this->form_validation->run() == true) {
             $this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd');
             $this->load->model($this->config->item("rg_folder").'mo_rg_period','prd');
             $this->load->model($this->config->item("rg_folder").'mo_rg_day','dy');
             $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
             $this->load->model($this->config->item("rg_folder").'mo_rg_timetable','tt');
 
             $this->sd->sdAcY = $this->contents['acadYear'] = $this->input->post('acadYear');
             $this->sd->sdTmId = $this->contents['tmId'] = $this->input->post('tmId');
             $this->contents['syId'] = $this->input->post('syId');
             $this->contents['curName'] = $this->input->post('curName');
             $this->contents['curId'] = $this->input->post('curId');
                         
             $this->contents['qu_sd'] = $this->sd->get_by_key();
 
             $ord_prd = array('prdId' => 'ASC');
             $this->contents['rs_prd'] = $this->prd->qryPrd("",$ord_prd);
 
             $ord_dy = array('dyId' => 'ASC');
             $this->contents['rs_dy'] = $this->dy->qryDy("",$ord_dy);
 
             $this->contents['co'] =  $this->co;
             $this->contents['tt'] =  $this->tt;
 
             $this->output_detail($this->config->item("rg_folder")."v_rptRis117");
             
         }else{  $this->searchRptRis117(); }
     }
 
 
     //Rep133-----------------------------------------------------------------------------
     public function searchRptRis133() {
         
         $this->output($this->config->item("rg_folder")."v_searchRptRis133");
     }
     
     public function showRptRis133() {
         $this->load->library('form_validation');
         $this->form_validation->set_error_delimiters('<div class="error">','</div>');
         $this->form_validation->set_rules('curName', ' ', 'trim|xss_clean');
         $this->form_validation->set_rules('curId', ' ', 'trim|required|callback_checkselect|xss_clean');
         $this->form_validation->set_rules('adY', ' ', 'trim|integer|callback_checkAdY|xss_clean');
 
         if($this->form_validation->run() == true) {
             $this->load->model($this->config->item("rg_folder").'mo_rg_realstudyplan','rsp');
             $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumstructure','cs');
             $this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy');
             $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
             $this->load->model($this->config->item("rg_folder").'mo_rg_condition','cd');
             $this->load->model($this->config->item("rg_folder").'mo_rg_course','crs');
 
             $this->contents['curName'] = $this->input->post('curName');
             $this->contents['curId'] = $this->input->post('curId');
             $this->contents['adY'] = $this->input->post('adY');
     
             $this->contents['rsp'] = $this->rsp;
             $this->contents['cs'] = $this->cs;
             $this->contents['studyyear'] = $this->sy;
             $this->contents['term'] = $this->tm;
             $this->contents['condition'] = $this->cd;
             $this->contents['course'] = $this->crs;
     
             $this->output_detail($this->config->item("rg_folder")."v_rptRis133");
         
         }else{  
             $this->searchRptRis133(); 
         }
     }
 
 
     public function curAndAdmitYAndGenStatusIsYTable() {
 
         return;
     }
 
 
     public function searchRptRis305() {
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
 
         $this->contents['rs_tm'] = $this->tm->get_options('','','',FALSE);
         $this->contents['tmId'] = $this->session->userdata('tmId');
         $this->contents['acY'] = $this->session->userdata('acY');
         $this->output($this->config->item("rg_folder")."v_searchRptRis305");
     }
 
 
     public function rptRis305PDF() {
         $this->load->library('form_validation');
         $this->form_validation->set_error_delimiters('<div class="error">','</div>');
         $this->form_validation->set_rules('levelName', ' ', 'trim|xss_clean');
         $this->form_validation->set_rules('divisorType', ' ', 'trim|xss_clean');
         $this->form_validation->set_rules('acY', ' ', 'trim|integer|callback_checkAdY|xss_clean');
         $this->form_validation->set_rules('tmId', ' ', 'trim|xss_clean');
 
         if($this->form_validation->run() == true) {
             $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
             /* กำหนดตัวหารหน่วยกิต */
             if($this->input->post('levelName')=='B' && $this->input->post('divisorType')=='S') {
                 $divisor = 18;
                 $sLevelId = 11;
                 $eLevelId = 11;
             }
             else if($this->input->post('levelName')=='B' && $this->input->post('divisorType')=='Y') {
                 $divisor = 36;
                 $sLevelId = 11;
                 $eLevelId = 11;
             }
             else if($this->input->post('levelName')=='C' && $this->input->post('divisorType')=='S') {
                 $divisor = 19;
                 $sLevelId = 1;
                 $eLevelId = 10;
             }
             else if($this->input->post('levelName')=='C' && $this->input->post('divisorType')=='Y') {
                 $divisor = 38;
                 $sLevelId = 1;
                 $eLevelId = 10;
             }
 
             $this->contents['divisor'] = $divisor;
             $this->contents['sLevelId'] = $sLevelId;
             $this->contents['eLevelId'] = $eLevelId;
             
 
             $rs_cur = $this->cur->qryCurForFTESJoinCurElvGen($sLevelId, $eLevelId,$this->input->post('acY'));
 
             $this->contents['arr'] = $arr = array();
             $i = 1;
             if($rs_cur->num_rows()) {
                 foreach($rs_cur->result() as $row) {
                     $arr[$i]['curId']     = $row->curId;
                     $arr[$i]['curName'] = $row->curName;
                     $arr[$i]['genId']     = $row->genId;
                     $arr[$i]['genNo']     = $row->genNo;
 
                     if($this->input->post('divisorType') == 'S') {
                         $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
                         $con_sumCredit1 = array('coCurId'    => $row->curId,
                                                 'coAcY'        => $this->input->post('acY'),
                                                 'coTmId'    => $this->input->post('tmId'),
                                                 'stdAdY'    => $row->stdAdY);
                         $sumCredit1 = $this->rd->getSumCreditAttempt($con_sumCredit1,'','');
                          
                         $con_sumCredit2 = array('coAcY'        => $this->input->post('acY'),
                                                 'coTmId'    => $this->input->post('tmId'),
                                                 'cofCurId'    => $row->curId,
                                                 'stdAdY'    => $row->stdAdY);
                         $sumCredit2 = $this->rd->getSumCreditAttemptCurIsNULL($con_sumCredit2,'','');
 
                         $sum = $sumCredit1+$sumCredit2;
                         $FTES = $sum / $divisor;
                         
                         $arr[$i]['SCH']  = $sum;
                         $arr[$i]['FTES'] = $FTES;
 
                         $this->contents['arr'] = $arr;
                         
                     } else if($this->input->post('divisorType') == 'Y') {
                         $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
                         $con_sumCredit1 = array('coCurId'    => $row->curId,
                                                 'coAcY'        => $this->input->post('acY'),
                                                 'stdAdY'    => $row->stdAdY);
                         $sumCredit1 = $this->rd->getSumCreditAttempt($con_sumCredit1,'','');
                          
                         $con_sumCredit2 = array('coAcY'        => $this->input->post('acY'),
                                                 'cofCurId'    => $row->curId,
                                                 'stdAdY'    => $row->stdAdY);
                         $sumCredit2 = $this->rd->getSumCreditAttemptCurIsNULL($con_sumCredit2,'','');
 
                         $sum = $sumCredit1+$sumCredit2;
                         $FTES = $sum / $divisor;
                         
                         $arr[$i]['SCH']  = $sum;
                         $arr[$i]['FTES'] = $FTES;
 
                         $this->contents['arr'] = $arr;
                     }
 
                     $i++;
                 }
             }
             $this->contents['acY'] = $this->input->post('acY');
             $this->contents['tmId'] = $this->input->post('tmId');
             $this->contents['divisorType'] = $this->input->post('divisorType');
 
             $this->output_pdf($this->config->item("rg_folder")."v_rptRis305");
         } else {
             $this->searchRptRis305();
         }
     }
 
     /* ##### รายงานรายชื่อนักศึกษาแยกตามรายวิชา #####*/
     public function searchRptRis999() {
         $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
         $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
 
         $this->contents['acY'] = ($this->input->post('acY')) ? $this->input->post('acY') : $this->session->userdata('acY');    
         $this->contents['tmId'] = ($this->input->post('tmId')) ? $this->input->post('tmId') : $this->session->userdata('tmId');        
         $arr = array();
 
         if($this->input->post('btnSearch')){ 
             $this->load->library('form_validation');
             $this->form_validation->set_error_delimiters('<div class="error">','</div>');
             $this->form_validation->set_rules('acY', ' ', 'trim|integer|callback_checkAdY|xss_clean');
             $this->form_validation->set_rules('tmId', ' ', 'callback_checkselect');
             $this->form_validation->set_rules('crsCode', ' ', 'trim|required|xss_clean');
             $this->form_validation->set_rules('crsSection', ' ', 'trim|required|integer|xss_clean');
 
             if($this->form_validation->run() == true) {
                 $con_qu_co = array('coAcY'        => $this->input->post('acY'),
                                    'coTmId'        => $this->input->post('tmId'),
                                    'crsCode'    => '%'.$this->input->post('crsCode').'%',
                                    'coSection'    => $this->input->post('crsSection'));
                 $rs_gco = $this->co->qryCoJoinCrs($con_qu_co,'','');
 
                 $arr = array();
                 foreach($rs_gco->result() as $gco) {
                     $arr[$gco->crsId] = array('coId' => $gco->coId,
                                               'crsCode' => $gco->crsCode,
                                               'coCrsId' => $gco->crsId,
                                               'crsName' => $gco->crsName);
 
                     $cond1 = array('crsId' => $gco->crsId,
                                    'coAcY' => $this->input->post('acY'),
                                    'coTmId' => $this->input->post('tmId'),
                                    'coSection' => $this->input->post('crsSection'));
                     $rs_gcur = $this->co->qryCoJoinCrsCur($cond1);    
                     $i = 1;
                     foreach($rs_gcur->result() as $gcur) {
                         $this->load->model($this->config->item("rg_folder").'mo_rg_timetable','tt');
 
                         $rs_prs = $this->tt->qryTeacher($gcur->coId);
                         $row_rs_prs = $rs_prs->row();
 
                         $arr[$gco->crsId]['cur'.$i] = array('curId' => $gcur->curId,
                                                             'curName' => $gcur->curName,
                                                             'coSection' => $gcur->coSection,
                                                             'prsName' => $row_rs_prs->prsName);
                         $i++;
                     }
                 }
             }
         }
             
         $this->contents['arr'] = $arr;
         $this->contents['rs_tm'] = $this->tm->get_options('','','',FALSE);
         
         $this->output($this->config->item("rg_folder")."v_showRptRis999");
     }
 
     public function rptRis999PDF($acY, $tmId, $coId) {
         $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co');
         $this->load->model($this->config->item("rg_folder").'mo_rg_course','c');
         $this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','cof');
         $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
         $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_grade','grd');
         $this->load->model($this->config->item("rg_folder").'mo_rg_person','prs');
 
         $this->co->coId = $coId;
         $this->co->get_by_key(TRUE);
         $this->contents['qu_co'] = $this->co;
 
         $this->c->crsId = $this->co->coCrsId;
         $this->c->get_by_key(TRUE);
         $this->contents['qu_c'] = $this->c;
 
         if($this->co->coCurId) {
             $this->cur->curId = $this->co->coCurId;
             $this->cur->get_by_key(TRUE);
             $this->contents['pgNames'] = $this->cur->curName;
             $curElvId = $this->cur->curElvId;
         } else {
             $cond = array('cofCoId' => $coId);
             $rs_cof = $this->cof->qryCofJoinCur($cond);
             $k = 1;
             $pgNames = '';
             $curElvId = '';
             foreach($rs_cof->result() as $row) {
                 $this->cur->curId = $row->cofCurId;
                 $this->cur->get_by_key(TRUE);
 
                 if($k == 0) {
                     $pgNames = $row->curName;
                 } else {
                     $pgNames .= ', '.$row->curName;
                 }
                 $curElvId = $row->curElvId;
                 $k++;
             }
             $this->contents['pgNames'] = $pgNames;
         }
 
         $this->contents['acY'] = $acY;
         $this->contents['tmId'] = $tmId;
         $this->contents['coId'] = $coId;
 
         $this->contents['rs_rd'] = $this->rd->RSEnrollItemByClIdAndStudying($coId);
         $this->contents['rd'] = $this->rd;
         $cond2 = array('prsId' => $this->co->coPrsId);
         $this->contents['qu_prs'] = $this->prs->qryPrsJoinPPC($cond2);
 
         $this->output_pdf($this->config->item("rg_folder")."v_rptRis999");
     }
 
 
     public function ris999() {
 
         return;
     }
     /* ##### รายงานรายชื่อนักศึกษาแยกตามรายวิชา #####*/
     
 }
 ?>
  |