Viewing file: graduate4.php (19.99 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include('rg_controller.php');
class Graduate4 extends Rg_controller {
/* function __construct() {
parent::__construct();
}
*/
function showGD() {
$this->output($this->config->item("rg_folder")."v_showGD");
}
function addGD() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curName',' ','trim|required|xss_clean');
$this->form_validation->set_rules('curId',' ','trim|xss_clean');
$this->form_validation->set_rules('stdTmIdAdmit',' ','trim|required|xss_clean');
$this->form_validation->set_rules('stdGraduateDate',' ','trim|required|xss_clean');
$this->form_validation->set_rules('adY',' ','trim|required|xss_clean');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf');
$this->load->model($this->config->item("rg_folder").'mo_rg_debt','dbt');
$this->load->model($this->config->item("rg_folder").'mo_rg_payment','pm');
$curId = $this->input->post('curId');
$adY = $this->input->post('adY');
$stdGraduateDate = $this->input->post('stdGraduateDate');
$this->cur->curId = $curId;
$this->contents['qu_cur'] = $this->cur->get_by_key();
$this->contents['adY'] = $adY;
$this->contents['stdGraduateDate'] = $stdGraduateDate;
$this->ac->get_by_key(TRUE);
$flagEdit_button = 0;
$i = 0;
$con_rs_std = array('stdCurId' => $curId,
'stdAdY' => $adY
);
$ord_rs_std = array('stdCode' => 'ASC');
$rs_std = $this->std->qryStd($con_rs_std, $ord_rs_std);
foreach ($rs_std->result() as $row_std) {
$flagEdit = 0;
$con_qu_rf = array('rfStdId' => $row_std->stdId);
$qu_rf = $this->rf->getSumBalance($con_qu_rf);
$con_qu_dbt = array('dbtStdId' => $row_std->stdId,
'dbtRefNo' => ''
);
$qu_dbt = $this->dbt->getSumAmt($con_qu_dbt);
$con_qu_pm = array('rfStdId' => $row_std->stdId,
'pmLateStatus' => 'Y'
);
$qu_pm = $this->pm->getSumLateFine($con_qu_pm);
if (($qu_rf != 0) || ($qu_dbt != 0) || (($this->ac->acLateFineGD == 'Y') && ($qu_pm != 0))) {
$clr = 1; // มีหนี้
} else {
$clr = 0;
}
$arr[$i]['clr'] = $clr;
if (($row_std->stdSstId == 3) && ($qu_rf == 0) && ($qu_dbt == 0) && ((($this->ac->acLateFineGD == 'Y') && ($qu_pm == 0)) || ($this->ac->acLateFineGD == 'N'))) {
$flagEdit = 1;
$flagEdit_button = 1;
}
$arr[$i]['flagEdit'] = $flagEdit;
$con_rs_std = array('stdId' => $row_std->stdId);
$arr[$i]['qu_std'] = $this->std->qryStdJoinPfCurSySstElv($con_rs_std);
$i++;
}
$this->contents['rs'] = $arr;
$this->contents['flagEdit_button'] = $flagEdit_button;
$this->output($this->config->item("rg_folder")."v_addGD");
} else
$this->showGD();
}
function processGD() {
$this->load->model($this->config->item("rg_folder").'mo_rg_studentsummary','ssm');
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$acY = $this->session->userdata('acY');
$tmId = $this->session->userdata('tmId');
$stdGraduateDate = $this->input->post('graduteDate');
$stdId = $this->input->post('stdId');
$chkSs = $this->input->post('chkSs');
for ($i = 0; $i < count($stdId); $i++) {
$maxAcY = $this->ssm->getMaxAcYByStdId($stdId[$i]);
$maxTmId = $this->ssm->getMaxTmIdByStdIdAcY($stdId[$i], $maxAcY);
$this->std->stdId = $stdId[$i];
$qu_std = $this->std->get_by_key();
if ((isset($chkSs[$i]) && $chkSs[$i] == 'Y') && $qu_std->num_rows() && ($acY == $maxAcY) && ($tmId == $maxTmId)) {
$flagCommit = true;
$this->db->trans_begin();
$this->std->stdId = $stdId[$i];
$this->std->get_by_key(TRUE);
$this->std->stdSstId = 4;
$this->std->stdGraduateY = $acY;
$this->std->stdGraduateDate = $stdGraduateDate;
$this->std->stdUpdateUsLogin = $this->session->userdata('UsLogin');
$this->std->stdUpdateDate = date('Y-m-d H:i:s');
$this->std->update();
$this->ssm->ssmStdId = $stdId[$i];
$this->ssm->ssmTmId = $tmId;
$this->ssm->ssmAcY = $acY;
$qu_ssm = $this->ssm->get_by_key();
if ($qu_ssm->num_rows()) {
$this->ssm->ssmStdId = $stdId[$i];
$this->ssm->ssmTmId = $tmId;
$this->ssm->ssmAcY = $acY;
$this->ssm->get_by_key(TRUE);
$this->ssm->ssmSstId = 4;
$this->ssm->ssmUpdateDate = date('Y-m-d H:i:s');
$this->ssm->ssmUpdateUserId = $this->session->userdata('UsLogin');
$this->ssm->update();
} else {
$this->db->trans_rollback();
}
if($this->db->trans_status() === false) {
$this->db->trans_rollback();
} else {
$this->db->trans_commit();
}
}
}
$this->showGD();
}
function showDetailsRfAndDbAndLateFine() {
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf');
$this->load->model($this->config->item("rg_folder").'mo_rg_payment','pm');
$this->load->model($this->config->item("rg_folder").'mo_rg_debt','dbt');
$stdId = $this->input->post('stdId');
$con_qu_std = array('stdId' => $stdId);
$this->contents['qu_std'] = $this->std->qryPfCurSyTm($con_qu_std);
$this->contents['acY'] = $this->session->userdata('acY');
$this->contents['tm'] = $this->session->userdata('tmId');
$con_rs_rf = array('rfStdId' => $stdId);
$rs_rf = $this->rf->qryRf($con_rs_rf,'','');
// ถ้านักศึกษามีการลงทะเบียน + มีค่าใช้จ่ายเกิดขึ้น
$i = 0;
$arr = array();
if($rs_rf->num_rows()) {
foreach($rs_rf->result() as $rowRf) {
$con_qu_pm = array('pmRfId' => $rowRf->rfId);
$qu_pm = $this->pm->qryPm($con_qu_pm,'','');
$arr[$i]['rf'] = $rowRf;
$arr[$i]['pm'] = $this->pm->qryPm($con_qu_pm,'','');
$i++;
}
}
$this->contents['arr'] = $arr;
$con_dbt = array('dbtStdId' => $stdId,
'dbtRefNo' => '');
$this->contents['dbt'] = $this->dbt->getSumAmt($con_dbt);
$this->output_detail($this->config->item("rg_folder")."v_showDetailRfAndDbAndLateFine");
}
function checkHonor() {
$this->output($this->config->item("rg_folder")."v_checkHonor");
}
function showHonor() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('curName',' ','trim|xss_clean');
$this->form_validation->set_rules('stdTmIdAdmit',' ','trim|required|xss_clean');
$this->form_validation->set_rules('adY',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->honor();
} else
$this->checkHonor();
}
function honor() {
$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->cur->curId = $this->input->post('curId');
$this->contents['qu_cur'] = $this->cur->get_by_key();
$this->contents['adY'] = $this->input->post('adY');
$con_rs_std = array('stdCurId' => $this->input->post('curId'),
'stdAdY' => $this->input->post('adY'));
$ord_rs_std = array('stdGPA' => 'DESC',
'stdTotalPoint' => 'DESC');
$this->contents['rs_std'] = $this->std->qryStdJoinPfSst($con_rs_std,$ord_rs_std);
$this->output($this->config->item("rg_folder")."v_showHonor");
}
function processHonor() {
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$adY = $this->input->post('adY');
$this->db->trans_begin();
if($this->input->post('stdId')==0) {
for($i=0; $i<=$this->input->post('cnt'); $i++) {
$this->std->stdId = $this->input->post('stdId'.$i);
$this->std->get_by_key(TRUE);
$this->std->stdHonor = $this->input->post('honor'.$i);
$this->std->stdUpdateDate = date('Y-m-d H:i:s');
$this->std->stdUpdateUsLogin = $this->session->userdata('UsLogin');
$this->std->update();
}
} else {
$this->std->stdId = $this->input->post('stdId');
$this->std->get_by_key(TRUE);
$this->std->stdHonor = '';
$this->std->stdUpdateDate = date('Y-m-d H:i:s');
$this->std->stdUpdateUsLogin = $this->session->userdata('UsLogin');
$this->std->update();
}
if($this->db->trans_status() === false)
$this->db->trans_rollback();
else
$this->db->trans_commit();
$this->honor();
}
function checkMedal() {
$this->output($this->config->item("rg_folder")."v_checkMedal");
}
function showMedal() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('curName',' ','trim|xss_clean');
$this->form_validation->set_rules('stdTmIdAdmit',' ','trim|required|xss_clean');
$this->form_validation->set_rules('adY',' ','trim|xss_clean');
if($this->form_validation->run() == true) {
$this->medal();
} else
$this->checkMedal();
}
function medal() {
$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->cur->curId = $this->input->post('curId');
$this->contents['qu_cur'] = $this->cur->get_by_key();
$this->contents['adY'] = $this->input->post('adY');
$con_rs_std = array('stdCurId' => $this->input->post('curId'),
'stdAdY' => $this->input->post('adY'));
$ord_rs_std = array('stdGPA' => 'DESC',
'stdTotalPoint' => 'DESC'
);
$this->contents['rs_std'] = $this->std->qryStdJoinPfSst($con_rs_std,$ord_rs_std);
$this->output($this->config->item("rg_folder")."v_showMedal");
}
function processMedal() {
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$adY = $this->input->post('adY');
if($this->input->post('stdId')==0) {
for($i=0; $i<=$this->input->post('cnt'); $i++) {
$this->std->stdId = $this->input->post('stdId'.$i);
$this->std->get_by_key(TRUE);
$this->std->stdMedal = $this->input->post('medal'.$i);
$this->std->stdUpdateDate = date('Y-m-d H:i:s');
$this->std->stdUpdateUsLogin = $this->session->userdata('UsLogin');
$this->std->update();
}
} else {
$this->std->stdId = $this->input->post('stdId');
$this->std->get_by_key(TRUE);
$this->std->stdMedal = '';
$this->std->stdUpdateDate = date('Y-m-d H:i:s');
$this->std->stdUpdateUsLogin = $this->session->userdata('UsLogin');
$this->std->update();
}
if($this->db->trans_status() === false)
$this->db->trans_rollback();
else
$this->db->trans_commit();
$this->medal();
}
function searchResultExamOcc() {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$con_rs_cur = array('curStatus' => 'Y');
$ord_rs_cur = array('curName' => 'ASC');
$this->contents['rs_cur'] = $this->cur->get_options($con_rs_cur,$ord_rs_cur,'','y');
$this->output($this->config->item("rg_folder")."v_searchResultExamOcc");
}
function addResultExamOcc() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('graduateY',' ','callback_checkAcY');
if($this->form_validation->run() == true) {
$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->cur->curId = $this->input->post('curId');
$this->contents['qu_cur'] = $this->cur->get_by_key();
$this->contents['graduateY'] = $this->input->post('graduateY');
$con_rs_std = array('stdCurId' => $this->input->post('curId'),
'stdGraduateY' => $this->input->post('graduateY'),
'stdSstId' => 4);
$this->contents['rs_std'] = $this->std->qryStdByCurId($con_rs_std,'','');
$this->output($this->config->item("rg_folder")."v_addResultExamOcc");
} else
$this->searchResultExamOcc();
}
function processResultExamOcc() {
$this->load->model($this->config->item("rg_folder").'mo_rg_studentdetails','sdt');
$this->db->trans_begin();
for($i=0; $i<$this->input->post('cnt'); $i++) {
$this->sdt->sdtStdId = $this->input->post('stdId'.$i);
$this->sdt->get_by_key(TRUE);
$this->sdt->sdtOccExamResult = ($this->input->post('sdtOccExamResult'.$i)=='') ? '' : $this->input->post('sdtOccExamResult'.$i);
$this->sdt->update();
}
if($this->db->trans_status() === false)
$this->db->trans_rollback();
else
$this->db->trans_commit();
$this->showResultExamOcc();
}
function showResultExamOcc() {
$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->cur->curId = $this->input->post('curId');
$this->contents['qu_cur'] = $this->cur->get_by_key();
$this->contents['graduateY'] = $this->input->post('graduateY');
$con_rs_std = array('stdCurId' => $this->input->post('curId'),
'stdGraduateY' => $this->input->post('graduateY'),
'stdSstId' => 4);
$this->contents['rs_std'] = $this->std->qryStdByCurId($con_rs_std,'','');
$this->output($this->config->item("rg_folder")."v_showResultExamOcc");
}
// ##### start ตรวจสอบรายชื่อนักศึกษาที่คาดว่าจะสำเร็จการศึกษา
function checkExpectGDSt() {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$con_rs_cur = array('curStatus' => 'Y');
$ord_rs_cur = array('curName' => 'ASC');
$this->contents['rs_cur'] = $this->cur->get_options($con_rs_cur,$ord_rs_cur,'','y');
$this->contents['acY'] = $this->session->userdata('acY');
$this->output($this->config->item("rg_folder")."v_checkExpectGDSt");
}
function showExpectGDSt() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('adY',' ','callback_checkAdY');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac');
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$curId = $this->input->post('curId');
$adY = $this->input->post('adY');
$this->cur->curId = $curId;
$this->contents['qu_cur'] = $this->cur->get_by_key();
$this->contents['adY'] = $adY;
$this->contents['qu_ac'] = $this->ac->qryAc();
$con_rs_std = array('stdCurId' => $curId,
'stdAdY' => $adY);
$ord_rs_std = array('stdCode' => 'ASC');
$this->contents['rs_std'] = $this->std->qryStdJoinPfSst($con_rs_std,$ord_rs_std,'');
$this->output($this->config->item("rg_folder")."v_showExpectGDSt");
} else {
$this->checkExpectGDSt();
}
}
// ##### end ตรวจสอบรายชื่อนักศึกษาที่คาดว่าจะสำเร็จการศึกษา
// ##### start ตรวจสอบรายชื่อผู้สำเร็จการศึกษา
function checkGDSt() {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$con_rs_cur = array('curStatus' => 'Y');
$ord_rs_cur = array('curName' => 'ASC');
$this->contents['rs_cur'] = $this->cur->get_options($con_rs_cur,$ord_rs_cur,'','y');
$this->contents['acY'] = $this->session->userdata('acY');
$this->output($this->config->item("rg_folder")."v_checkGDSt");
}
function showGDSt() {
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">','</div>');
$this->form_validation->set_rules('curId',' ','trim|required|xss_clean');
$this->form_validation->set_rules('adY',' ','callback_checkAdY');
if($this->form_validation->run() == true) {
$this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
$this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
$curId = $this->input->post('curId');
$adY = $this->input->post('adY');
$this->contents['adY'] = $adY;
$this->cur->curId = $curId;
$this->contents['qu_cur'] = $this->cur->get_by_key();
$con_rs_std = array('stdCurId' => $curId,
'stdAdY' => $adY);
$ord_rs_std = array('stdCode' => 'ASC');
$this->contents['rs_std'] = $this->std->qryStdJoinPfSst($con_rs_std,$ord_rs_std);
$this->output($this->config->item("rg_folder")."v_showGDSt");
} else {
$this->checkGDSt();
}
}
// ##### end ตรวจสอบรายชื่อผู้สำเร็จการศึกษา
// function checkExpectGDSt() {
// $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur');
//
// $con_rs_cur = array("curStatus" => "Y");
// $ord_rs_cur = array("curName" => "curName");
// $this->contents['rs_cur'] = $this->cur->get_options($con_rs_cur,$ord_rs_cur,'','y');
//
// $this->output($this->config->item("rg_folder")."v_checkExpectGDSt");
// }
//
// function processExpectGDSt() {
// $this->load->library('form_validation');
// $this->form_validation->set_error_delimiters('<div class="error">','</div>');
// $this->form_validation->set_rules('curId','ชื่อหลักสูตร','trim|required|xss_clean');
// $this->form_validation->set_rules('adY','ปีการศึกษาที่เข้า','callback_checkAcY');
//
// if($this->form_validation->run() == true) {
// $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->cur->curId = $this->input->post('curId');
// $this->contents['qu_cur'] = $this->cur->get_by_key();
//
// $this->contents['adY'] = $this->input->post('adY');
//
// $this->contents['rs_std'] = $this->std->qryStdBystdSstIdIs4($this->input->post('curId'),$this->input->post('adY'));
//
// $this->output($this->config->item("rg_folder")."v_showExpectGDSt");
// }
// else
// $this->checkExpectGDSt();
// }
// ##### start callback_function
function checkAdY($str) {
if($str=='') {
$this->form_validation->set_message('checkAdY','กรุณาป้อน%s');
return false;
} else if(strlen($str)!=4) {
$this->form_validation->set_message('checkAdY','%sจะต้องเท่ากับ 4 หลัก');
return false;
} else if($str==0) {
$this->form_validation->set_message('checkAdY','%sจะต้องมากกว่า 0');
return false;
} else {
return true;
}
}
function checkAcY($str) {
if($str=='') {
$this->form_validation->set_message('checkAcY','กรุณาป้อน%s');
return false;
} else if(strlen($str)!=4) {
$this->form_validation->set_message('checkAcY','%sจะต้องเท่ากับ 4 หลัก');
return false;
} else if($str==0) {
$this->form_validation->set_message('checkAcY','%sจะต้องมากกว่า 0');
return false;
}
if($str >= $this->input->post('adY')) {
return true;
} else {
$this->form_validation->set_message('checkAcY','%sจะต้องมากกว่าหรือเท่ากับปีการศึกษาที่เข้า');
return false;
}
} // ##### end callback_function
}
?>
|