Viewing file: regis.php (84.04 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include('rg_controller.php'); class Regis extends Rg_controller { // function __construct() { // parent::__construct(); // }
// ##### start ลงทะเบียนเรียนรายกลุ่ม/ชั้นปี function showRegisCur() { $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_curriculum','cur'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg'); $this->load->model($this->config->item("rg_folder").'mo_rg_realstudyplan','rsp'); $this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
/* หาชั้นปี */ $rs_sy = $this->sy->qrySy(); $this->contents['rs_sy'] = $rs_sy;
/* หาภาคการศึกษา */ $rs_tm = $this->tm->qryTm(); $this->contents['rs_tm'] = $rs_tm;
$i = 0; $arr = array(); /* หาหลักสูตรที่สถานะการใช้เป็น Y โดยเรียงตามชื่อหลักสูตร จาก ก ไป ฮ */ $con_rs_cur = array('curStatus' => 'Y'); $ord_rs_cur = array('curName' => 'ASC'); $rs_cur = $this->cur->qryCur($con_rs_cur, $ord_rs_cur); if ($rs_cur->num_rows()) { foreach ($rs_cur->result() as $row_cur) { $arr[$i]['level'] = 0; $arr[$i]['name'] = $row_cur->curName;
$i++;
$rs_std = $this->std->qryStdByCurIdGroupAdY($row_cur->curId); if ($rs_std->num_rows()) { foreach ($rs_std->result() as $row_std) { foreach ($rs_sy->result() as $row_sy) { foreach ($rs_tm->result() as $row_tm) { $acY = $row_std->stdAdY + $row_sy->syId - 1;
$con_rs_rsp = array('rspCurId' => $row_cur->curId, 'rspAdY' => $row_std->stdAdY, 'rspSyId' => $row_sy->syId, 'rspTmId' => $row_tm->tmId ); $rs_rsp = $this->rsp->qryRsp($con_rs_rsp);
if ($rs_rsp->num_rows()) { $con_rs_rg = array('rgAcY' => $acY, 'rgTmId' => $row_tm->tmId, 'rgSyId' => $row_sy->syId, 'rgCurId' => $row_cur->curId, 'stdAdY' => $row_std->stdAdY ); $rs_rg = $this->rg->qryRgJoinStd($con_rs_rg);
/* กำหนดสถานะการแสดงรูปการลงทะเบียน 0 คือ ยังไม่มีการกำหนดโปรแกรมการเรียนจริง และลงทะเบียนเรียน 1 คือ กำหนดโปรแกรมการเรียนจริงแล้ว 2 คือ ลงทะเบียนเรียนจริงแล้ว */
if ($rs_rg->num_rows()) { $link = 2; } else { $link = 1; } } else { $link = 0; }
$arr[$i]['level'] = 1; $arr[$i]['name'] = $row_std->stdAdY; $arr[$i]['url'][] = "{'curId':$row_cur->curId,'adY':$row_std->stdAdY,'acY':$acY,'syId':$row_sy->syId,'tmId':$row_tm->tmId}"; $arr[$i]['link'][] = $link; } // end foreach tm } // end foreach sy
$i++; } // end foreach std } // end if std } // end foreach cur } // end if cur
$this->contents['rs'] = $arr;
$this->output($this->config->item("rg_folder")."v_showRegisCurriculum"); }
/* ตัวแปรที่ส่งมา - $key คือ รหัสหลักสูตร - $rowAcY->stdAdY คือ ปีที่เข้า - $acY คือ ปีการศึกษาที่ต้องการลงทะเบียน - $sy คือ ชั้นปี - $tm คือ เทอม */ function addRegisCur() { $this->load->model($this->config->item("rg_folder").'mo_rg_curriculum','cur'); $this->load->model($this->config->item("rg_folder").'mo_rg_realstudyplan','rsp'); $this->load->model($this->config->item("rg_folder").'mo_rg_studyyear','sy'); $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
$curId = $this->input->post('curId'); $adY = $this->input->post('adY'); $acY = $this->input->post('acY'); $syId = $this->input->post('syId'); $tmId = $this->input->post('tmId');
$this->cur->curId = $curId; $this->contents['qu_cur'] = $this->cur->get_by_key();
$this->sy->syId = $syId; $this->contents['qu_sy'] = $this->sy->get_by_key();
$this->tm->tmId = $tmId; $this->contents['qu_tm'] = $this->tm->get_by_key();
$this->contents['adY'] = $adY; $this->contents['acY'] = $acY; $this->contents['syId'] = $syId; $this->contents['tmId'] = $tmId;
$con_rs_rsp = array('rspCurId' => $curId, 'rspAdY' => $adY, 'rspSyId' => $syId, 'rspTmId' => $tmId ); $ord_rs_rsp = array('crsCode' => 'ASC', 'crsName' => 'ASC' ); //$this->contents['rs_rsp'] = $this->rsp->qryRspJoinCoCrs($con_rs_rsp, $ord_rs_rsp);// หารายวิชา $this->contents['rs_rsp'] = $this->rsp->qryRspJoinCoCrsGroupCrsId($con_rs_rsp);
$this->output($this->config->item("rg_folder")."v_addRegisCurriculum"); }
function processRegisCur() { $this->load->model($this->config->item("rg_folder").'mo_rg_realstudyplan','rsp'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefeetp','crft'); $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg'); $this->load->model($this->config->item("rg_folder").'mo_rg_courseopen','co'); $this->load->model($this->config->item("rg_folder").'mo_rg_course','crs'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_courseopenfor','cof'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf');
$curId = $this->input->post('curId'); $adY = $this->input->post('adY'); $acY = $this->input->post('acY'); $syId = $this->input->post('syId'); $tmId = $this->input->post('tmId');
/* ปีการศึกษาที่เริ่มคิดค่าหน่วยกิตแบบเหมาจ่าย */ $reviseY = $this->config->item('reviseY'); //2552;
// ************************************************** Start Check ************************************************** $con_rs_rsp = array('rspCurId' => $curId, 'rspAdY' => $adY, 'rspSyId' => $syId, 'rspTmId' => $tmId ); $rs_rsp = $this->rsp->qryRspJoinCoCrs($con_rs_rsp); foreach ($rs_rsp->result() as $row_rsp) { if ($row_rsp->crsStatus == 'Y') { $msg = "ไม่สามารถลงทะเบียนเรียนรายกลุ่ม/ชั้นปีได้<br />ต้องกลับไปแก้ไขโปรแกรมการเรียนจริงก่อน "; //$msg .= "<span class=\"hand\" onClick=\"sendPost('hidform', {'curId':".$curId.",'syId':".$syId.",'tmId':".$tmId.",'adY':".$adY."}, '".site_url($this->config->item("rg_folder")."preregis/addRealStudyPlan")."')\">คลิกที่นี่</span>";
$this->session->set_flashdata('msg', $msg); redirect($this->config->item("rg_folder")."msg/err_msg"); } }
// Not found CourseFeeTP // ทำเฉพาะ นศ. ปีเข้า < 2552 if ($adY < $reviseY) { $this->crft->crftCurId = $curId; $this->crft->crftAcY = $acY; $this->crft->crftAdY = ($acY < $reviseY) ? 0 : $adY; $this->crft->crftSyId = ($acY < $reviseY) ? 0 : $syId; $this->crft->crftTmId = $tmId; $qu_crft = $this->crft->get_by_key();
if (!$qu_crft->num_rows()) { $msg = "ไม่สามารถลงทะเบียนเรียนรายกลุ่ม/ชั้นปีได้<br />ต้องกลับไปบันทึกข้อมูลค่าใช้จ่ายประเภทค่าหน่วยกิตก่อน"; /*$msg = "ไม่สามารถลงทะเบียนเรียนรายกลุ่ม/ชั้นปีได้<br/> ต้องกลับไปบันทึกข้อมูลค่าใช้จ่ายประเภทค่าหน่วยกิตก่อน"; */ //$msg .= "<span class=\"hand\" onClick=\"sendPost('hidform', {'curId':".$curId.",'acY':".$acY.",'tmId':".$tmId."}, '".site_url($this->config->item("rg_folder")."preregis/addCourseFeeTP")."')\">คลิกที่นี่</span>";
$this->session->set_flashdata('msg', $msg); redirect($this->config->item('rg_folder')."msg/err_msg"); } } // ************************************************** End Check **************************************************
set_time_limit(0); $flagCommit = true; $this->db->trans_begin();
$rs_std = $this->std->qryStdByCurIdAdYSyIdSstIdStr($curId, $adY, $syId, 1); foreach ($rs_std->result() as $row_std) { $con_qu_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId ); $rgSeq = $this->rg->getNextSeq($con_qu_rg);
// Insert Regist $this->rg->rgStdId = $row_std->stdId; $this->rg->rgTmId = $tmId; $this->rg->rgAcY = $acY; $this->rg->rgSeq = $rgSeq; $this->rg->rgSubmitType = 'B'; $this->rg->rgStatus = 'N'; $this->rg->rgCurId = $curId; $this->rg->rgSyId = $syId; $this->rg->rgCreateDate = date('Y-m-d H:i:s'); $this->rg->rgCreateUserId = $this->session->userdata('UsLogin'); $this->rg->rgUpdateDate = date('Y-m-d H:i:s'); $this->rg->rgUpdateUserId = $this->session->userdata('UsLogin'); $this->rg->insert();
// Insert RegistDetails $con_rs_rsp = array('rspCurId' => $curId, 'rspAdY' => $adY, 'rspSyId' => $syId, 'rspTmId' => $tmId ); $rs_rsp = $this->rsp->qryRsp($con_rs_rsp); foreach ($rs_rsp->result() as $row_rsp) { $this->co->coId = $row_rsp->rspCoId; $qu_co = $this->co->get_by_key(); $row_co1 = $qu_co->row();
$flag = 0; $i = 0; while (($flag == 0) && ($i < $row_co1->coSectionClass)) { $tmpClId = $row_rsp->rspCoId + $i;
$qu_co = $this->co->qryCoByStdIdCoIdEmpty($row_std->stdId, $tmpClId); if ($qu_co->num_rows()) { $row_co2 = $qu_co->row();
$this->crs->crsId = $row_co2->coCrsId; $qu_crs = $this->crs->get_by_key(); $row_crs = $qu_crs->row();
$this->rd->rdAcY = $acY; $this->rd->rdStdId = $row_std->stdId; $this->rd->rdTmId = $tmId; $this->rd->rdCoId = $row_rsp->rspCoId + $i; $this->rd->rdSeq = $rgSeq; $this->rd->rdCreditAttempt = $row_crs->crsCreditTotal; $this->rd->rdSection = $row_co2->coSection; $this->rd->rdGrade = ''; $this->rd->rdDocNo = ''; $this->rd->rdCredit1 = $row_crs->crsCredit1; $this->rd->rdCredit2 = $row_crs->crsCredit2; $this->rd->rdNoCalGPA = $row_rsp->rspNoCalGPA; $this->rd->rdAllowPr = 'N'; $this->rd->rdCdId1 = $row_rsp->rspCdId1; $this->rd->rdCdId2 = $row_rsp->rspCdId2; $this->rd->rdUpdateDate = date('Y-m-d H:i:s'); $this->rd->rdUpdateUserId = $this->session->userdata('UsLogin'); $this->rd->insert();
// Update ClassOpenFor if (is_null($row_co2->coCurId)) { $this->cof->cofCoId = $tmpClId; $this->cof->cofCurId = $curId; $this->cof->get_by_key(TRUE); $this->cof->cofNumEnroll += 1; $this->cof->update(); }
// Update Class $this->co->coId = $row_co2->coId; $this->co->get_by_key(TRUE); $this->co->coNumSeatReg += 1; $this->co->update();
$flag = 1; } // end if co $i++; } // end while } // end foreach rsp
// Insert EnrollFee $con_rs_rf = array('rfStdId' => $row_std->stdId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $rs_rf = $this->rf->qryRf($con_rs_rf);
// Not found if ($rs_rf->num_rows() == 0) { // Insert EnrollFee $this->rf->rfId = ''; $this->rf->rfAcY = $acY; $this->rf->rfTotalAmt = 0; $this->rf->rfBalance = 0; $this->rf->rfRefNo = $acY.$tmId.$rgSeq.$row_std->stdCode; $this->rf->rfStdId = $row_std->stdId; $this->rf->rfSyId = $syId; $this->rf->rfTmId = $tmId; $this->rf->rfCurId = $curId; $this->rf->rfCreateDate = date('Y-m-d H:i:s'); $this->rf->rfCreateUserId = $this->session->userdata('UsLogin'); $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $this->rf->insert();
$rfId = $this->rf->last_insert_id(); } else { $rfId = $rs_rf->row()->rfId; }
$this->rf->rfId = $rfId; $this->rf->get_by_key(TRUE); if ($row_std->stdAdY >= $reviseY) { $this->rf->rfTotalAmt = $this->calFee2552($row_std->stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId, $row_std->stdAdY); } else { $this->rf->rfTotalAmt = $this->calFee($row_std->stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId); }
$this->rf->rfBalance = $this->rf->rfTotalAmt; $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $this->rf->update(); } // end foreach std
if ($this->db->trans_status() === false) { $this->db->trans_rollback(); $flgmsg = "ลงทะเบียนไม่สำเร็จ"; } else { $this->db->trans_commit(); $flgmsg = "ลงทะเบียนสำเร็จ"; }
set_time_limit(30);
$this->session->set_flashdata('success_msg', $flgmsg); redirect($this->config->item("rg_folder")."regis/showRegisCur"); }
function calFee($stdId, $acY, $syId, $tmId, $curId, $etId) { $this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf'); $this->load->model($this->config->item("rg_folder").'mo_rg_commonfeetp','cmft'); $this->load->model($this->config->item("rg_folder").'mo_rg_fee','fee'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfeetp','cft'); $this->load->model($this->config->item("rg_folder").'mo_rg_studentdomitory','sdm'); $this->load->model($this->config->item("rg_folder").'mo_rg_domitoryfeetp','dft'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefeetp','crft'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf'); $this->load->model($this->config->item("rg_folder").'mo_rg_student','std');
// ---------- หาเด็ก ------------- $this->std->stdId = $stdId; $this->std->get_by_key(TRUE);
// ---------- CommonFee ---------- $con_rs_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $rs_cmf = $this->cmf->qryCmf($con_rs_cmf); foreach ($rs_cmf->result() as $row_cmf) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmf->cmfFeeId; $this->cmf->delete(); }
$sumCommonFee = 0; $con_rs_cmft = array('cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'N' ); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); foreach ($rs_cmft->result() as $row_cmft) { $this->fee->feeId = $row_cmft->cmftFeeId; $qu_fee = $this->fee->get_by_key(); $row_fee = $qu_fee->row();
if ((($row_fee->feePytId == 1) && ($syId == 1)) || ($row_fee->feePytId != 1)) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmft->cmftFeeId; $qu_cmf = $this->cmf->get_by_key();
// Not found if ($qu_cmf->num_rows() == 0) { // Insert CommonFee $this->cmf->cmfAmt = $row_cmft->cmftAmt; $this->cmf->insert(); } } }
$con_qu_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $sumCommonFee = $this->cmf->getSumAmt($con_qu_cmf);
// ---------- ProgramFee ---------- $con_rs_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $rs_cf = $this->cf->qryCf($con_rs_cf); foreach ($rs_cf->result() as $row_cf) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cf->cfFeeId; $this->cf->delete(); }
$sumProgramFee = 0; $con_rs_cft = array('cftCurId' => $curId, 'cftAcY' => $acY, 'cftTmId' => $tmId ); $rs_cft = $this->cft->qryCft($con_rs_cft); foreach ($rs_cft->result() as $row_cft) { $this->fee->feeId = $row_cft->cftFeeId; $qu_fee = $this->fee->get_by_key(); $row_fee = $qu_fee->row();
if ((($row_fee->feePytId == 1) && ($syId == 1)) || ($row_fee->feePytId != 1)) { if ((($row_fee->feeOnTop == 'Y') && ($etId == 2)) || ($row_fee->feeOnTop == 'N')) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cft->cftFeeId; $qu_cf = $this->cf->get_by_key();
// Not found if ($qu_cf->num_rows() == 0) { // Insert ProgramFee $this->cf->cfAmt = $row_cft->cftAmt; $this->cf->insert(); } } } }
$con_qu_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $sumProgramFee = $this->cf->getSumAmt($con_qu_cf);
// ---------- DomFee ---------- $domFee = 0; $con_rs_cmft = array('cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'Y' ); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); if ($rs_cmft->num_rows()) { $this->sdm->sdmStdId = $stdId; $this->sdm->sdmAcY = $acY; $this->sdm->sdmTmId = $tmId; $qu_sdm = $this->sdm->get_by_key();
// Student stay dom if ($qu_sdm->num_rows()) { $this->dft->dftAcY = $acY; $this->dft->dftTmId = $tmId; $this->dft->dftDmId = $qu_sdm->row()->sdmDmId; $qu_dft = $this->dft->get_by_key();
// Found dom fee if ($qu_dft->num_rows()) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $rs_cmft->row()->cmftFeeId; $qu_cmf = $this->cmf->get_by_key();
// Not found if ($qu_cmf->num_rows() == 0) { // Insert CommonFee $this->cmf->cmfAmt = $qu_sdm->row()->sdmNumMonth * $qu_dft->row()->dftAmt; $this->cmf->insert(); $domFee = $this->cmf->cmfAmt; } } } }
// ---------- CourseFee ---------- $sumCourseFee = 0; $reviseY = $this->config->item('reviseY'); $this->crft->crftCurId = $curId; $this->crft->crftAdY = ($acY < $reviseY) ? 0 : $this->std->stdAdY; $this->crft->crftSyId = ($acY < $reviseY) ? 0 : $syId; $this->crft->crftAcY = $acY; $this->crft->crftTmId = $tmId; $qu_crft = $this->crft->get_by_key(); if ($qu_crft->num_rows()) { $con_qu_rf = array('rfStdId' => $stdId, 'rfSyId' => $syId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $qu_rf = $this->rf->qryRf($con_qu_rf);
if ($qu_rf->num_rows()) { $con_qu_rd = array('rdStdId' => $stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $sumcr1 = $this->rd->getSumCr1($con_qu_rd); $sumcr2 = $this->rd->getSumCr2($con_qu_rd);
$this->crf->crfStdId = $stdId; $this->crf->crfAcY = $acY; $this->crf->crfTmId = $tmId; $this->crf->crfRfId = $qu_rf->row()->rfId; $qu_crf = $this->crf->get_by_key(); if ($qu_crf->num_rows()) { // Found // Update CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->update(); } else { // Not Found // Insert CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfLateFineAmt = 0; $this->crf->crfKssFeeAmt = 0; $this->crf->insert(); }
$sumCourseFee = $this->crf->crfLecFeeAmt + $this->crf->crfLabFeeAmt; } }
return $sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee; }
function calFee2552($stdId, $acY, $syId, $tmId, $curId, $etId, $adY) { $this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf'); $this->load->model($this->config->item("rg_folder").'mo_rg_commonfeetp','cmft'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfeetp','cft'); $this->load->model($this->config->item("rg_folder").'mo_rg_fee','fee'); $this->load->model($this->config->item("rg_folder").'mo_rg_studentdomitory','sdm'); $this->load->model($this->config->item("rg_folder").'mo_rg_domitoryfeetp','dft'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefeetp','crft'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
// ---------- CommonFee ---------- $con_rs_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $rs_cmf = $this->cmf->qryCmf($con_rs_cmf); foreach ($rs_cmf->result() as $row_cmf) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmf->cmfFeeId; $this->cmf->delete(); }
$sumCommonFee = 0; $con_rs_cmft = array('cmftAdY' => $adY, 'cmftSyId' => $syId, 'cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'N' ); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); foreach ($rs_cmft->result() as $row_cmft) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmft->cmftFeeId; $qu_cmf = $this->cmf->get_by_key();
// Not found if ($qu_cmf->num_rows() == 0) { // Insert CommonFee $this->cmf->cmfAmt = $row_cmft->cmftAmt; $this->cmf->insert(); } }
$con_qu_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $sumCommonFee = $this->cmf->getSumAmt($con_qu_cmf);
// ---------- ProgramFee ---------- $con_rs_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $rs_cf = $this->cf->qryCf($con_rs_cf); foreach ($rs_cf->result() as $row_cf) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cf->cfFeeId; $this->cf->delete(); }
$sumProgramFee = 0; $con_rs_cft = array('cftCurId' => $curId, 'cftAdY' => $adY, 'cftSyId' => $syId, 'cftAcY' => $acY, 'cftTmId' => $tmId ); $rs_cft = $this->cft->qryCft($con_rs_cft); foreach ($rs_cft->result() as $row_cft) { $this->fee->feeId = $row_cft->cftFeeId; $qu_fee = $this->fee->get_by_key(); $row_fee = $qu_fee->row();
if ((($row_fee->feeOnTop == 'Y') && ($etId == 2)) || ($row_fee->feeOnTop == 'N')) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cft->cftFeeId; $qu_cf = $this->cf->get_by_key();
// Not found if ($qu_cf->num_rows() == 0) { // Insert ProgramFee $this->cf->cfAmt = $row_cft->cftAmt; $this->cf->insert(); } } }
$con_qu_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $sumProgramFee = $this->cf->getSumAmt($con_qu_cf);
// ---------- DomFee ---------- $domFee = 0; $con_rs_cmft = array('cmftAdY' => $adY, 'cmftSyId' => $syId, 'cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'Y' ); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); if ($rs_cmft->num_rows()) { $this->sdm->sdmStdId = $stdId; $this->sdm->sdmAcY = $acY; $this->sdm->sdmTmId = $tmId; $qu_sdm = $this->sdm->get_by_key();
// Student stay dom if ($qu_sdm->num_rows()) { $this->dft->dftAcY = $acY; $this->dft->dftTmId = $tmId; $this->dft->dftDmId = $qu_sdm->row()->sdmDmId; $qu_dft = $this->dft->get_by_key(); // Found dom fee if ($qu_dft->num_rows()) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $rs_cmft->row()->cmftFeeId; $qu_cmf = $this->cmf->get_by_key();
// Not found if ($qu_cmf->num_rows() == 0) { // Insert CommonFee $this->cmf->cmfAmt = $qu_sdm->row()->sdmNumMonth * $qu_dft->row()->dftAmt; $this->cmf->insert(); $domFee = $this->cmf->cmfAmt; } } } }
// ---------- CourseFee ---------- $sumCourseFee = 0; $this->crft->crftCurId = $curId; $this->crft->crftAdY = $adY; $this->crft->crftSyId = $syId; $this->crft->crftAcY = $acY; $this->crft->crftTmId = $tmId; $qu_crft = $this->crft->get_by_key(); if ($qu_crft->num_rows()) { $con_qu_rf = array('rfStdId' => $stdId, 'rfSyId' => $syId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $qu_rf = $this->rf->qryRf($con_qu_rf); if ($qu_rf->num_rows()) { $con_qu_rd = array('rdStdId' => $stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $sumcr1 = $this->rd->getSumCr1($con_qu_rd); $sumcr2 = $this->rd->getSumCr2($con_qu_rd);
$this->crf->crfStdId = $stdId; $this->crf->crfAcY = $acY; $this->crf->crfTmId = $tmId; $this->crf->crfRfId = $qu_rf->row()->rfId; $qu_crf = $this->crf->get_by_key(); if ($qu_crf->num_rows()) { // Found // Update CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->update(); } else { // Not Found // Insert CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfLateFineAmt = 0; $this->crf->crfKssFeeAmt = 0; $this->crf->insert(); }
$sumCourseFee = $this->crf->crfLecFeeAmt + $this->crf->crfLabFeeAmt; } }
return $sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee; } // ##### end ลงทะเบียนเรียนรายกลุ่ม/ชั้นปี
// #### ยกเลิกการลงทะเบียนเรียนรายกลุ่ม/ชั้นปี function delRegisCur() { $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_curriculum','cur'); $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_regist','rg'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
$rs_sy = $this->sy->qrySy(); $this->contents['rs_sy'] = $rs_sy;
$rs_tm = $this->tm->qryTm(); $this->contents['rs_tm'] = $rs_tm;
$i = 0; $arr = array(); $con_rs_cur = array('curStatus' => 'Y'); $ord_rs_cur = array('curName' => 'ASC'); $rs_cur = $this->cur->qryCur($con_rs_cur, $ord_rs_cur); foreach ($rs_cur->result() as $row_cur) { $arr[$i]['level'] = 0; $arr[$i]['name'] = $row_cur->curName;
$i++;
$rs_std = $this->std->qryStdByCurIdGroupAdY($row_cur->curId); foreach ($rs_std->result() as $row_std1) { $stStatus = '3, 4'; $rs_std = $this->std->qryStdByCurIdAdYSstIdStr($row_cur->curId, $row_std1->stdAdY, $stStatus);
foreach ($rs_sy->result() as $row_sy) { foreach ($rs_tm->result() as $row_tm) { $acY = $row_std1->stdAdY + $row_sy->syId - 1;
$con_qu_rf = array('rfAcY' => $acY, 'rfSyId' => $row_sy->syId, 'rfTmId' => $row_tm->tmId, 'rfCurId' => $row_cur->curId ); $sumTtAmt = $this->rf->getSumTotalAmt($con_qu_rf); $sumBl = $this->rf->getSumBalance($con_qu_rf);
$con_qu_rg = array('rgAcY' => $acY, 'rgSyId' => $row_sy->syId, 'rgCurId' => $row_cur->curId ); $maxTmId = $this->rg->getMaxTmId($con_qu_rg);
$con_rs_rd = array('rdAcY' => $acY, 'rdTmId' => $row_tm->tmId, 'coCurId' => $row_cur->curId, 'coSyId' => $row_sy->syId ); $rs_rd = $this->rd->qryRdJoinCoByGrade($con_rs_rd);
// ยกเลิกได้ ต่อเมื่อ เป็นภาค/ปีการศึกษาล่าสุด และ ยังไม่ชำระค่าลงทะเบียน และ ไม่มีสถานะรออนุมัติจบ/สำเร็จการศึกษา และ ยังไม่ส่งเกรด if (($row_std1->stdSyId == $row_sy->syId) && ($maxTmId == $row_tm->tmId) && ($sumTtAmt == $sumBl) && ($rs_std->num_rows() == 0) && ($rs_rd->num_rows() == 0)) { $con_rs_rg = array('rgAcY' => $acY, 'rgTmId' => $row_tm->tmId, 'rgSyId' => $row_sy->syId, 'rgCurId' => $row_cur->curId ); $rs_rg = $this->rg->qryRg($con_rs_rg); if ($rs_rg->num_rows()) { $link = 1; } else { $link = 2; } } else { $link = 0; }
$arr[$i]['level'] = 1; $arr[$i]['name'] = $row_std1->stdAdY; $arr[$i]['url'][] = "{'curId':$row_cur->curId,'acY':$acY,'syId':$row_sy->syId,'tmId':$row_tm->tmId,'adY':$row_std1->stdAdY}"; $arr[$i]['link'][] = $link; } // end foreach tm } // end foreach sy
$i++; } //end foreach std } // end foreach cur $this->contents['rs'] = $arr;
$this->output($this->config->item("rg_folder")."v_delRegisCurriculum"); }
function processDelRegisCur() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $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_regist','rg'); $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_registfee','rf');
$curId = $this->input->post('curId'); $adY = $this->input->post('adY'); $syId = $this->input->post('syId'); $acY = $this->input->post('acY'); $tmId = $this->input->post('tmId');
$flagCommit = true; $this->db->trans_begin();
$con_rs_std = array('stdCurId' => $curId, 'stdAdY' => $adY, 'stdSyId' => $syId ); $ord_rs_std = array('stdCode' => 'ASC'); $rs_std = $this->std->qryStd($con_rs_std, $ord_rs_std); foreach ($rs_std->result() as $row_std) { // EnrollItem $con_rs_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $rs_rd = $this->rd->qryRd($con_rs_rd); foreach ($rs_rd->result() as $row_rd) { // Delete EnrollItem $this->rd->rdStdId = $row_std->stdId; $this->rd->rdAcY = $row_rd->rdAcY; $this->rd->rdTmId = $row_rd->rdTmId; $this->rd->rdSeq = $row_rd->rdSeq; $this->rd->rdCoId = $row_rd->rdCoId; $flagCommit = $this->rd->delete();
$this->co->coId = $row_rd->rdCoId; $this->co->get_by_key(TRUE);
// Update ClassOpenFor if (is_null($this->co->coCurId)) { $this->cof->cofCoId = $row_rd->rdCoId; $this->cof->cofCurId = $curId; $this->cof->get_by_key(TRUE);
$this->cof->cofNumEnroll -= 1; $flagCommit = $this->cof->update(); }
// Update Class $this->co->coNumSeatReg -= 1; $flagCommit = $this->co->update(); } // end foreach rd
// Enroll $con_rs_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId ); $rs_rg = $this->rg->qryRg($con_rs_rg); foreach ($rs_rg->result() as $row_rg) { // Delete Enroll $this->rg->rgStdId = $row_rg->rgStdId; $this->rg->rgAcY = $row_rg->rgAcY; $this->rg->rgTmId = $row_rg->rgTmId; $this->rg->rgSeq = $row_rg->rgSeq; $flagCommit = $this->rg->delete(); }
// CommonFee $con_rs_cmf = array('cmfStdId' => $row_std->stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $rs_cmf = $this->cmf->qryCmf($con_rs_cmf); foreach ($rs_cmf->result() as $row_cmf) { // Delete CommonFee $this->cmf->cmfStdId = $row_cmf->cmfStdId; $this->cmf->cmfAcY = $row_cmf->cmfAcY; $this->cmf->cmfTmId = $row_cmf->cmfTmId; $this->cmf->cmfFeeId = $row_cmf->cmfFeeId; $flagCommit = $this->cmf->delete(); }
// ProgramFee $con_rs_cf = array('cfStdId' => $row_std->stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $rs_cf = $this->cf->qryCf($con_rs_cf); foreach ($rs_cf->result() as $row_cf) { // Delete ProgramFee $this->cf->cfStdId = $row_cf->cfStdId; $this->cf->cfAcY = $row_cf->cfAcY; $this->cf->cfTmId = $row_cf->cfTmId; $this->cf->cfFeeId = $row_cf->cfFeeId; $flagCommit = $this->cf->delete(); }
// CourseFee $con_rs_crf = array('crfStdId' => $row_std->stdId, 'crfAcY' => $acY, 'crfTmId' => $tmId ); $rs_crf = $this->crf->qryCrf($con_rs_crf); foreach ($rs_crf->result() as $row_crf) { // Delete CourseFee $this->crf->crfStdId = $row_crf->crfStdId; $this->crf->crfAcY = $row_crf->crfAcY; $this->crf->crfTmId = $row_crf->crfTmId; $this->crf->crfRfId = $row_crf->crfRfId; $flagCommit = $this->crf->delete(); }
// EnrollFee $con_rs_rf = array('rfStdId' => $row_std->stdId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $rs_rf = $this->rf->qryRf($con_rs_rf); foreach ($rs_rf->result() as $row_rf) { // Delete EnrollFee $this->rf->rfId = $row_rf->rfId; $flagCommit = $this->rf->delete(); } } // end foreach std
if ($this->db->trans_status() === false) { $this->db->trans_rollback(); $flgmsg = "ยกเลิกลงทะเบียนไม่สำเร็จ"; } else { $this->db->trans_commit(); $flgmsg = "ยกเลิกลงทะเบียนสำเร็จ"; }
$this->session->set_flashdata('success_msg', $flgmsg); redirect($this->config->item("rg_folder")."regis/delRegisCur"); }
// ##### ลงทะเบียนรายนักศึกษา function showRegis() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg');
$this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">','</div>'); $this->form_validation->set_rules('stdCode',' ','trim|required|xss_clean');
if($this->form_validation->run() == true) { $stdCode = $this->input->post('stdCode'); $acY = $this->session->userdata('acY_R'); $tmId = $this->session->userdata('tmId_R');
if ($stdCode) { $this->contents['stdCode'] = "";
$con_qu_std = array('stdCode' => $stdCode, 'stdSstId' => 1, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $row_std = $qu_std->row();
$this->contents['stdCode'] = $stdCode; $this->contents['qu_std'] = $qu_std; $this->contents['acY_R'] = $acY; $this->contents['tmId_R'] = $tmId;
$this->tm->tmId = $tmId; $this->contents['qu_tm'] = $this->tm->get_by_key();
$con_rs_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['rs_rd'] = $this->rd->qryRdJoinCoCrs($con_rs_rd);
$con_qu_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId, 'rgStatus' => 'K' ); $qu_rg = $this->rg->qryRg($con_qu_rg); if ($qu_rg->num_rows()) { $this->contents['kssFlag'] = "** รักษาสถานภาพการเป็นนักศึกษา **"; }
$con_qu_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['sumCrAt'] = $this->rd->getSumCrAt($con_qu_rd); } else { $con_qu_std = array('stdCode' => $stdCode, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $this->contents['qu_std'] = $qu_std; } else { $this->contents['err_msg'] = "** ไม่ปรากฏรหัสนักศึกษาดังกล่าวในฐานข้อมูล **"; } } } // end if stdCode } else { $this->contents['err_msg'] = "** กรุณาป้อน **"; }
$this->output($this->config->item("rg_folder")."v_showRegis"); }
function rd_insert() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $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_registfee','rf');
$rgStatus = $this->input->post('rgStatus'); $rgSubmitType = $this->input->post('rgSubmitType'); $stdId = $this->input->post('stdId'); $stdCode = $this->input->post('stdCode'); $curId = $this->input->post('curId'); $syId = $this->input->post('syId'); $acY = $this->input->post('acY'); $tmId = $this->input->post('tmId'); $rdCoId = $this->input->post('rdCoId'); $reviseY = 2552;
$flagCommit = true; $this->db->trans_begin();
$this->std->stdId = $stdId; $qu_std = $this->std->get_by_key(); $row_std = $qu_std->row();
$this->rg->rgStdId = $stdId; $this->rg->rgAcY = $acY; $this->rg->rgTmId = $tmId; $this->rg->rgSeq = 1; $qu_rg = $this->rg->get_by_key(); if ($rgStatus == 'A') { $con_rs_rg = array('rgStdId' => $stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId, 'rgStatus' => $rgStatus ); $qu_rg = $this->rg->qryRg($con_rs_rg); if ($qu_rg->num_rows() == 0) { $con_qu_rg = array('rgStdId' => $stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId ); $tmpSequence = $this->rg->getNextSeq($con_qu_rg); $this->rg->rgSeq = $tmpSequence; } }
if ($qu_rg->num_rows() == 0) { // Insert Enroll $this->rg->rgSyId = $syId; $this->rg->rgCurId = $curId; $this->rg->rgSubmitType = ($rgSubmitType) ? $rgSubmitType : 'B'; $this->rg->rgStatus = $rgStatus; $this->rg->rgCreateUserId = $this->session->userdata('UsLogin'); $this->rg->rgCreateDate = date('Y-m-d H:i:s'); $this->rg->rgUpdateUserId = $this->session->userdata('UsLogin'); $this->rg->rgUpdateDate = date('Y-m-d H:i:s'); $flagCommit = $this->rg->insert(); }
// Insert EnrollItem $this->rd->rdStdId = $stdId; $this->rd->rdAcY = $acY; $this->rd->rdTmId = $tmId; $this->rd->rdSeq = $this->rg->rgSeq; $this->rd->rdCoId = $rdCoId; $this->rd->rdCreditAttempt = $this->input->post('rdCreditAttempt'); $this->rd->rdSection = $this->input->post('rdSection'); $this->rd->rdGrade = ''; $this->rd->rdDocNo = ''; $this->rd->rdCredit1 = $this->input->post('rdCredit1'); $this->rd->rdCredit2 = $this->input->post('rdCredit2'); $this->rd->rdNoCalGPA = 'N'; $this->rd->rdCdId1 = $this->input->post('rdCdId1'); $this->rd->rdCdId2 = $this->input->post('rdCdId2'); $this->rd->rdUpdateUserId = $this->session->userdata('UsLogin'); $this->rd->rdUpdateDate = date('Y-m-d H:i:s'); $this->rd->rdAllowPr = 'N'; $flagCommit = $this->rd->insert();
$this->co->coId = $rdCoId; $this->co->get_by_key(TRUE);
// Update ClassOpenFor if (is_null($this->co->coCurId)) { $this->cof->cofCoId = $rdCoId; $this->cof->cofCurId = $curId; $this->cof->get_by_key(TRUE);
$this->cof->cofNumEnroll += 1; $flagCommit = $this->cof->update(); }
// Update Class $this->co->coNumSeatReg += 1; $flagCommit = $this->co->update();
// Insert EnrollFee $rfId = ''; $con_rs_rf = array('rfStdId' => $stdId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $rs_rf = $this->rf->qryRf($con_rs_rf); // Not found if ($rs_rf->num_rows() == 0) { // Insert EnrollFee $this->rf->rfStdId = $stdId; $this->rf->rfAcY = $acY; $this->rf->rfSyId = $syId; $this->rf->rfTmId = $tmId; $this->rf->rfCurId = $curId; $this->rf->rfTotalAmt = 0; $this->rf->rfBalance = 0; $this->rf->rfRefNo = $acY.$tmId.$this->rg->rgSeq.$stdCode; if ($rgStatus == 'A') { $this->rf->rfRefNo = $acY.$tmId.'1'.$stdCode; } $this->rf->rfCreateDate = date('Y-m-d H:i:s'); $this->rf->rfCreateUserId = $this->session->userdata('UsLogin'); $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rf->insert();
$rfId = $this->rf->last_insert_id(); } else { $rfId = $rs_rf->row()->rfId; }
$this->rf->rfId = $rfId; $this->rf->get_by_key(TRUE);
if ($row_std->stdAdY >= $reviseY) { $this->rf->rfTotalAmt = $this->calFee2552($stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId, $row_std->stdAdY); } else { $this->rf->rfTotalAmt = $this->calFee($stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId); } $this->rf->rfBalance = $this->rf->rfTotalAmt; $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rf->update();
$msg = $this->config->item('rg_msg');
if ($this->db->trans_status() === false || ($this->co->coNumSeatReg > $this->co->coNumSeatOpen)) { // ตัด rgStatus=='A' ออกเพราะไม่ได้ใช้ประโยชน์ $this->db->trans_rollback(); $this->load->vars($flg = array('flg' => $msg[20])); } else { $this->db->trans_commit(); $this->load->vars($flg = array('flg' => $msg[10])); }
if ($rgStatus == 'N') { $this->showRegis(); } else if ($rgStatus == 'A') { if ($rgSubmitType == 'W') { $this->std_showAddWithdraw(); } else { $this->showAddWithdraw(); } } }
function rd_delete() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $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_registwithdraw','rw'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf');
$rgStatus = $this->input->post('rgStatus'); $rgSubmitType = $this->input->post('rgSubmitType'); $stdId = $this->input->post('stdId'); $acY = $this->input->post('acY'); $tmId = $this->input->post('tmId'); $seq = $this->input->post('seq'); $coId = $this->input->post('coId'); $stdCode = $this->input->post('stdCode'); $reviseY = 2552;
$flagCommit = true; $this->db->trans_begin();
$this->std->stdId = $stdId; $qu_std = $this->std->get_by_key(); $row_std = $qu_std->row();
// Delete EnrollItem $this->rd->rdStdId = $stdId; $this->rd->rdAcY = $acY; $this->rd->rdTmId = $tmId; $this->rd->rdSeq = $seq; $this->rd->rdCoId = $coId; $this->rd->get_by_key(TRUE); $flagCommit = $this->rd->delete();
$this->co->coId = $coId; $this->co->get_by_key(TRUE);
// Update ClassOpenFor if (is_null($this->co->coCurId)) { $this->cof->cofCoId = $coId; $this->cof->cofCurId = $row_std->stdCurId; $this->cof->get_by_key(TRUE);
$this->cof->cofNumEnroll -= 1; $flagCommit = $this->cof->update(); }
// Update Class $this->co->coNumSeatReg -= 1; $flagCommit = $this->co->update();
if (($rgStatus == 'A') || ($rgStatus == 'W')) { // เคลียร์การถอนครั้งก่อน $this->rw->rwStdId = $this->rd->rdStdId; $this->rw->rwAcY = $this->rd->rdAcY; $this->rw->rwTmId = $this->rd->rdTmId; $this->rw->rwSeq = $this->rd->rdSeq; $this->rw->rwCoId = $this->rd->rdCoId; $this->rw->delete();
// Insert WithdrawCourse $this->rw->rwStdId = $this->rd->rdStdId; $this->rw->rwAcY = $this->rd->rdAcY; $this->rw->rwTmId = $this->rd->rdTmId; $this->rw->rwSeq = $this->rd->rdSeq; $this->rw->rwCoId = $this->rd->rdCoId; $this->rw->rwCreditAttempt = $this->rd->rdCreditAttempt; $this->rw->rwSection = $this->rd->rdSection; $this->rw->rwGrade = $this->rd->rdGrade; $this->rw->rwDocNo = $this->rd->rdDocNo; $this->rw->rwCredit1 = $this->rd->rdCredit1; $this->rw->rwCredit2 = $this->rd->rdCredit2; $this->rw->rwNoCalGPA = $this->rd->rdNoCalGPA; $this->rw->rwCdId1 = $this->rd->rdCdId1; $this->rw->rwCdId2 = $this->rd->rdCdId2; $this->rw->rwUpdateDate = date('Y-m-d H:i:s'); $this->rw->rwUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rw->insert(); }
if (($rgStatus == 'N') || ($rgStatus == 'A')) { // Insert EnrollFee $rfId = ''; $con_rs_rf = array('rfStdId' => $stdId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $rs_rf = $this->rf->qryRf($con_rs_rf); // Not found if ($rs_rf->num_rows() == 0) { // Insert EnrollFee $this->rf->rfStdId = $stdId; $this->rf->rfAcY = $acY; $this->rf->rfSyId = $row_std->stdSyId; $this->rf->rfTmId = $tmId; $this->rf->rfCurId = $row_std->stdCurId; $this->rf->rfTotalAmt = 0; $this->rf->rfBalance = 0; $this->rf->rfRefNo = $acY.$tmId.$this->rg->rgSeq.$row_std->stdCode; if ($rgStatus == 'A') { $this->rf->rfRefNo = $acY.$tmId.'1'.$row_std->stdCode; } $this->rf->rfCreateDate = date('Y-m-d H:i:s'); $this->rf->rfCreateUserId = $this->session->userdata('UsLogin'); $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rf->insert();
$rfId = $this->rf->last_insert_id(); } else { $rfId = $rs_rf->row()->rfId; }
$this->rf->rfId = $rfId; $this->rf->get_by_key(TRUE);
if ($row_std->stdAdY >= $reviseY) { $this->rf->rfTotalAmt = $this->calFee2552($stdId, $acY, $row_std->stdSyId, $tmId, $row_std->stdCurId, $row_std->stdEtId, $row_std->stdAdY); } else { $this->rf->rfTotalAmt = $this->calFee($stdId, $acY, $row_std->stdSyId, $tmId, $row_std->stdCurId, $row_std->stdEtId); } $this->rf->rfBalance = $this->rf->rfTotalAmt; $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rf->update(); }
$msg = $this->config->item('rg_msg');
if($this->db->trans_status() === false || ($this->co->coNumSeatReg < 0)) { // ตัด rgStatus=='A' ออกเพราะไม่ได้ใช้ประโยชน์ $this->db->trans_rollback(); $this->load->vars($flg = array('flg' => $msg[40])); } else { $this->db->trans_commit(); $this->load->vars($flg = array('flg' => $msg[30])); }
if($rgStatus=='N') { $this->showRegis(); } else if($rgStatus=='A') {
if($rgSubmitType=='W') { $this->std_showAddWithdraw(); } else { $this->showAddWithdraw(); } } else { $this->showWithdraw(); } }
// ####จัดกลุ่มเรียนนักศึกษา function rg_searchSectionStudent() { $this->output($this->config->item("rg_folder")."v_searchSectionStudent"); }
// ####เพิ่มรายวิชาลงทะเบียนรายกลุ่ม/ชั้นปี function rg_showAWaddCurriculum() { $this->output($this->config->item("rg_folder")."v_showAWaddCurriculum"); }
// #### ถอนรายวิชาลงทะเบียนรายกลุ่ม/ชั้นปี function rg_showAWRegistWithdraw() { $this->output($this->config->item("rg_folder")."v_showAWRegistWithdraw"); }
// ###ลงทะเบียนรักษาสถานภาพการเป็นนักศึกษา function showRegisKeepStStatus() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg');
$this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">','</div>'); $this->form_validation->set_rules('stdCode',' ','trim|required|xss_clean');
if($this->form_validation->run() == true) {
$stdCode = $this->input->post('stdCode'); $acY = $this->session->userdata('acY'); $tmId = $this->session->userdata('tmId');
if ($stdCode) { $this->contents['stdCode'] = ""; $stStatus = '1, 2'; $qu_std = $this->std->qryStdByCodeStStatus($stdCode, $stStatus); if ($qu_std->num_rows()) { $this->contents['stdCode'] = $stdCode; $this->contents['acY'] = $acY; $this->contents['tmId'] = $tmId;
$this->tm->tmId = $tmId; $this->contents['qu_tm'] = $this->tm->get_by_key();
$con_qu_std = array('stdCode' => $stdCode, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); $this->contents['qu_std'] = $qu_std; $row_std = $qu_std->row();
$con_rs_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['rs_rd'] = $this->rd->qryRdJoinCoCrs($con_rs_rd);
$con_qu_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId, 'rgStatus' => 'K' ); $qu_rg = $this->rg->qryRg($con_qu_rg); if ($qu_rg->num_rows()) { $this->contents['kssFlag'] = "** รักษาสถานภาพการเป็นนักศึกษา **"; }
$con_qu_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['sumCrAt'] = $this->rd->getSumCrAt($con_qu_rd); } else { $con_qu_std = array('stdCode' => $stdCode, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $this->contents['qu_std'] = $qu_std; } else { $this->contents['err_msg'] = "** ไม่ปรากฏรหัสนักศึกษาดังกล่าวในฐานข้อมูล **"; } } } } else { $this->contents['err_msg'] = "** กรุณาป้อน **"; }
$this->output($this->config->item("rg_folder")."v_showRegisKeepStStatus"); }
function processRegisKeepStStatus() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $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_registwithdraw','rw'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf'); $this->load->model($this->config->item("rg_folder").'mo_rg_studentsummary','ssm');
$stdId = $this->input->post('stdId'); $curId = $this->input->post('curId'); $syId = $this->input->post('syId'); $acY = $this->input->post('acY'); $tmId = $this->input->post('tmId');
$reviseY = 2552;
$flagCommit = true; $this->db->trans_begin();
$this->std->stdId = $stdId; $qu_std = $this->std->get_by_key(); $row_std = $qu_std->row();
$con_qu_rg = array('rgStdId' => $stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId ); $tmpSequence = $this->rg->getNextSeq($con_qu_rg);
// Insert Enroll $this->rg->rgStdId = $stdId; $this->rg->rgAcY = $acY; $this->rg->rgTmId = $tmId; $this->rg->rgSeq = $tmpSequence; $this->rg->rgSyId = $syId; $this->rg->rgCurId = $curId; $this->rg->rgSubmitType = 'B'; $this->rg->rgStatus = 'K'; $this->rg->rgCreateUserId = $this->session->userdata('UsLogin'); $this->rg->rgCreateDate = date('Y-m-d H:i:s'); $this->rg->rgUpdateUserId = $this->session->userdata('UsLogin'); $this->rg->rgUpdateDate = date('Y-m-d H:i:s'); $flagCommit = $this->rg->insert();
$con_rs_rd = array('rdStdId' => $stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $rs_rd = $this->rd->qryRd($con_rs_rd); echo $this->db->last_query(); foreach ($rs_rd->result() as $row_rd) { // Delete EnrollItem $this->rd->rdStdId = $row_rd->rdStdId; $this->rd->rdAcY = $row_rd->rdAcY; $this->rd->rdTmId = $row_rd->rdTmId; $this->rd->rdSeq = $row_rd->rdSeq; $this->rd->rdCoId = $row_rd->rdCoId; $flagCommit = $this->rd->delete();
$this->co->coId = $row_rd->rdCoId; $this->co->get_by_key(TRUE);
// Update ClassOpenFor if (is_null($this->co->coCurId)) { $this->cof->cofCoId = $row_rd->rdCoId; $this->cof->cofCurId = $curId; $this->cof->get_by_key(TRUE);
$this->cof->cofNumEnroll -= 1; $flagCommit = $this->cof->update(); }
// Update Class $this->co->coNumSeatReg -= 1; $flagCommit = $this->co->update();
// Insert WithdrawCourse $this->rw->rwStdId = $row_rd->rdStdId; $this->rw->rwAcY = $row_rd->rdAcY; $this->rw->rwTmId = $row_rd->rdTmId; $this->rw->rwSeq = $row_rd->rdSeq; $this->rw->rwCoId = $row_rd->rdCoId; $this->rw->rwCreditAttempt = $row_rd->rdCreditAttempt; $this->rw->rwSection = $row_rd->rdSection; $this->rw->rwGrade = $row_rd->rdGrade; $this->rw->rwDocNo = $row_rd->rdDocNo; $this->rw->rwCredit1 = $row_rd->rdCredit1; $this->rw->rwCredit2 = $row_rd->rdCredit2; $this->rw->rwNoCalGPA = $row_rd->rdNoCalGPA; $this->rw->rwCdId1 = $row_rd->rdCdId1; $this->rw->rwCdId2 = $row_rd->rdCdId2; $this->rw->rwUpdateDate = date('Y-m-d H:i:s'); $this->rw->rwUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rw->insert();
// Update Enroll $this->rg->rgStdId = $row_rd->rdStdId; $this->rg->rgAcY = $row_rd->rdAcY; $this->rg->rgTmId = $row_rd->rdTmId; $this->rg->rgSeq = $row_rd->rdSeq; $this->rg->get_by_key(TRUE);
$this->rg->rgStatus = 'C'; $flagCommit = $this->rg->update(); } // end foreach rd
$con_rs_rf = array('rfStdId' => $stdId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $rs_rf = $this->rf->qryRf($con_rs_rf); if ($rs_rf->num_rows()) { // ลงทะเบียนมาก่อนแล้ว $row_rf = $rs_rf->row();
if ($row_rf->rfTotalAmt == $row_rf->rfBalance) { // ยังไม่จ่ายเลย $this->rf->rfId = $row_rf->rfId; $this->rf->get_by_key(TRUE);
if ($row_std->stdAdY >= $reviseY) { $this->rf->rfTotalAmt = $this->calFeeAndKSSFee2552($stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId, $row_std->stdAdY); } else { $this->rf->rfTotalAmt = $this->calFeeAndKSSFee($stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId); } $this->rf->rfBalance = $this->rf->rfTotalAmt; $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rf->update(); } else { // จ่ายแล้วทั้งหมด หรือ บางส่วน // Insert 2nd enrollFeeId for keep student status $this->rf->rfStdId = $stdId; $this->rf->rfAcY = $acY; $this->rf->rfSyId = $syId; $this->rf->rfTmId = $tmId; $this->rf->rfCurId = $curId; // ค่ารักษาสภาพ if ($row_std->stdAdY >= $reviseY) { $this->rf->rfTotalAmt = $this->calKSSFee2552($stdId, $acY, $tmId, $curId, $row_std->stdAdY, $syId); } else { $this->rf->rfTotalAmt = $this->calKSSFee($stdId, $acY, $tmId, $curId); } $this->rf->rfBalance = $this->rf->rfTotalAmt; $this->rf->rfRefNo = $acY.$tmId.$tmpSequence.$row_std->stdCode; $this->rf->rfCreateDate = date('Y-m-d H:i:s'); $this->rf->rfCreateUserId = $this->session->userdata('UsLogin'); $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rf->insert(); } } else { // ยังไม่เคยลงทะเบียนมาก่อน // Insert EnrollFee $this->rf->rfStdId = $stdId; $this->rf->rfAcY = $acY; $this->rf->rfSyId = $syId; $this->rf->rfTmId = $tmId; $this->rf->rfCurId = $curId; // ค่ารักษาสภาพ+ค่าใช้จ่ายอื่นๆ(ไม่รวมค่าหน่วยกิต) if ($row_std->stdAdY >= $reviseY) { $this->rf->rfTotalAmt = $this->calFeeAndKSSFee2552($stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId, $row_std->stdAdY); } else { $this->rf->rfTotalAmt = $this->calFeeAndKSSFee($stdId, $acY, $syId, $tmId, $curId, $row_std->stdEtId); } $this->rf->rfBalance = $this->rf->rfTotalAmt; $this->rf->rfRefNo = $acY.$tmId.$tmpSequence.$row_std->stdCode; $this->rf->rfCreateDate = date('Y-m-d H:i:s'); $this->rf->rfCreateUserId = $this->session->userdata('UsLogin'); $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $flagCommit = $this->rf->insert(); } // end if rf
// Update StudentMaster $this->std->get_by_key(TRUE); $this->std->stdSstId = 2; $this->std->stdUpdateUserId = $this->session->userdata('UsLogin'); $this->std->stdUpdateDate = date('Y-m-d H:i:s'); $flagCommit = $this->std->update();
$this->ssm->ssmStdId = $stdId; $this->ssm->ssmAcY = $acY; $this->ssm->ssmTmId = $tmId; $qu_ssm = $this->ssm->get_by_key(); if ($qu_ssm->num_rows()) { // Update StudentStatus $this->ssm->get_by_key(TRUE);
$this->ssm->ssmSstId = 2; $this->ssm->ssmUpdateUserId = $this->session->userdata('UsLogin'); $this->ssm->ssmUpdateDate = date('Y-m-d H:i:s'); $flagCommit = $this->ssm->update(); } else { // Update StudentStatus $this->ssm->ssmStdId = $stdId; $this->ssm->ssmAcY = $acY; $this->ssm->ssmTmId = $tmId; $this->ssm->ssmSyId = $this->std->calSyByStdIdAndAcY($stdId, $acY); $this->ssm->ssmSstId = 2; $this->ssm->ssmGPA = 0; $this->ssm->ssmCreditAttempt = 0; $this->ssm->ssmCreditSatisfy = 0; $this->ssm->ssmCreditPoint = 0; $this->ssm->ssmGPAX = 0; $this->ssm->ssmSumCreditAttempt = 0; $this->ssm->ssmSumCreditSatisfy = 0; $this->ssm->ssmSumCreditPoint = 0; $this->ssm->ssmCreateDate = date('Y-m-d H:i:s'); $this->ssm->ssmCreateUserId = $this->session->userdata('UsLogin'); $this->ssm->ssmUpdateDate = date('Y-m-d H:i:s'); $this->ssm->ssmUpdateUserId = $this->session->userdata('UsLogin'); $this->ssm->ssmSstIdApproveSpe = NULL; $this->ssm->ssmApprover = ''; $this->ssm->ssmRefNo = ''; $this->ssm->ssmApproveDate = ''; $this->ssm->ssmPassStatus = 0; $flagCommit = $this->ssm->insert(); } // end if ssm
if ($this->db->trans_status() === false) { $this->db->trans_rollback(); } else { $this->db->trans_commit(); }
$this->showRegisKeepStStatus(); }
function calFeeAndKSSFee($stdId, $acY, $syId, $tmId, $curId, $etId) { $this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf'); $this->load->model($this->config->item("rg_folder").'mo_rg_commonfeetp','cmft'); $this->load->model($this->config->item("rg_folder").'mo_rg_fee','fee'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfeetp','cft'); $this->load->model($this->config->item("rg_folder").'mo_rg_studentdomitory','sdm'); $this->load->model($this->config->item("rg_folder").'mo_rg_domitoryfeetp','dft'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefeetp','crft'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
// ---------- CommonFee ---------- $con_rs_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $rs_cmf = $this->cmf->qryCmf($con_rs_cmf); foreach ($rs_cmf->result() as $row_cmf) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmf->cmfFeeId; $this->cmf->delete(); }
$sumCommonFee = 0; $con_rs_cmft = array('cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'N' ); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); foreach ($rs_cmft->result() as $row_cmft) { $this->fee->feeId = $row_cmft->cmftFeeId; $qu_fee = $this->fee->get_by_key(); $row_fee = $qu_fee->row();
if ((($row_fee->feePytId == 1) && ($syId == 1)) || ($row_fee->feePytId != 1)) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmft->cmftFeeId; $qu_cmf = $this->cmf->get_by_key();
// Not found if ($qu_cmf->num_rows() == 0) { // Insert CommonFee $this->cmf->cmfAmt = $row_cmft->cmftAmt; $this->cmf->insert(); } } }
$con_qu_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $sumCommonFee = $this->cmf->getSumAmt($con_qu_cmf);
// ---------- ProgramFee ---------- $con_rs_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $rs_cf = $this->cf->qryCf($con_rs_cf); foreach ($rs_cf->result() as $row_cf) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cf->cfFeeId; $this->cf->delete(); }
$sumProgramFee = 0; $con_rs_cft = array('cftCurId' => $curId, 'cftAcY' => $acY, 'cftTmId' => $tmId ); $rs_cft = $this->cft->qryCft($con_rs_cft); foreach ($rs_cft->result() as $row_cft) { $this->fee->feeId = $row_cft->cftFeeId; $qu_fee = $this->fee->get_by_key(); $row_fee = $qu_fee->row();
if ((($row_fee->feePytId == 1) && ($syId == 1)) || ($row_fee->feePytId != 1)) { if ((($row_fee->feeOnTop == 'Y') && ($etId == 2)) || ($row_fee->feeOnTop == 'N')) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cft->cftFeeId; $qu_cf = $this->cf->get_by_key();
// Not found if ($qu_cf->num_rows() == 0) { // Insert ProgramFee $this->cf->cfAmt = $row_cft->cftAmt; $this->cf->insert(); } } } }
$con_qu_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $sumProgramFee = $this->cf->getSumAmt($con_qu_cf);
// ---------- DomFee ---------- $domFee = 0; $con_rs_cmft = array('cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'Y'); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); if ($rs_cmft->num_rows()) { $this->sdm->sdmStdId = $stdId; $this->sdm->sdmAcY = $acY; $this->sdm->sdmTmId = $tmId; $qu_sdm = $this->sdm->get_by_key();
// Student stay dom if ($qu_sdm->num_rows()) { $this->dft->dftAcY = $acY; $this->dft->dftTmId = $tmId; $this->dft->dftDmId = $qu_sdm->row()->sdmDmId; $qu_dft = $this->dft->get_by_key();
// Found dom fee if ($qu_dft->num_rows()) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $rs_cmft->row()->cmftFeeId; $qu_cmf = $this->cmf->get_by_key();
// Not found if ($qu_cmf->num_rows() == 0) { // Insert CommonFee $this->cmf->cmfAmt = $qu_sdm->row()->sdmNumMonth * $qu_dft->row()->dftAmt; $this->cmf->insert(); $domFee = $this->cmf->cmfAmt; } } } }
// ---------- CourseFee ---------- $sumCourseFee = 0; $this->crft->crftCurId = $curId; $this->crft->crftAdY = 0; $this->crft->crftSyId = 0; $this->crft->crftAcY = $acY; $this->crft->crftTmId = $tmId; $qu_crft = $this->crft->get_by_key(); if ($qu_crft->num_rows()) { $con_qu_rf = array('rfStdId' => $stdId, 'rfSyId' => $syId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $qu_rf = $this->rf->qryRf($con_qu_rf);
if ($qu_rf->num_rows()) { $con_qu_rd = array('rdStdId' => $stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $sumcr1 = $this->rd->getSumCr1($con_qu_rd); $sumcr2 = $this->rd->getSumCr2($con_qu_rd);
$this->crf->crfStdId = $stdId; $this->crf->crfAcY = $acY; $this->crf->crfTmId = $tmId; $this->crf->crfRfId = $qu_rf->row()->rfId; $qu_crf = $this->crf->get_by_key();
if ($qu_crf->num_rows()) { // Found // Update CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfKssFeeAmt = $qu_crft->row()->crftKssFee; $this->crf->update(); } else { // Not Found // Insert CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfLateFineAmt = 0; $this->crf->crfKssFeeAmt = $qu_crft->row()->crftKssFee; $this->crf->insert(); }
$sumCourseFee = $this->crf->crfLecFeeAmt + $this->crf->crfLabFeeAmt + $this->crf->crfKssFeeAmt; } }
return $sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee; }
function calFeeAndKSSFee2552($stdId, $acY, $syId, $tmId, $curId, $etId, $adY) { $this->load->model($this->config->item("rg_folder").'mo_rg_commonfee','cmf'); $this->load->model($this->config->item("rg_folder").'mo_rg_commonfeetp','cmft'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfee','cf'); $this->load->model($this->config->item("rg_folder").'mo_rg_curriculumfeetp','cft'); $this->load->model($this->config->item("rg_folder").'mo_rg_fee','fee'); $this->load->model($this->config->item("rg_folder").'mo_rg_studentdomitory','sdm'); $this->load->model($this->config->item("rg_folder").'mo_rg_domitoryfeetp','dft'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefeetp','crft'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
// ---------- CommonFee ---------- $con_rs_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $rs_cmf = $this->cmf->qryCmf($con_rs_cmf); foreach ($rs_cmf->result() as $row_cmf) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmf->cmfFeeId; $this->cmf->delete(); } $sumCommonFee = 0; $con_rs_cmft = array('cmftAdY' => $adY, 'cmftSyId' => $syId, 'cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'N' ); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); foreach ($rs_cmft->result() as $row_cmft) { $this->cmf->cmfStdId = $stdId; $this->cmf->cmfAcY = $acY; $this->cmf->cmfTmId = $tmId; $this->cmf->cmfFeeId = $row_cmft->cmftFeeId; $qu_cmf = $this->cmf->get_by_key();
// Not found if ($qu_cmf->num_rows() == 0) { // Insert CommonFee $this->cmf->cmfAmt = $row_cmft->cmftAmt; $this->cmf->insert(); } }
$con_qu_cmf = array('cmfStdId' => $stdId, 'cmfAcY' => $acY, 'cmfTmId' => $tmId ); $sumCommonFee = $this->cmf->getSumAmt($con_qu_cmf);
// ---------- ProgramFee ---------- $con_rs_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $rs_cf = $this->cf->qryCf($con_rs_cf); foreach ($rs_cf->result() as $row_cf) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cf->cfFeeId; $this->cf->delete(); }
$sumProgramFee = 0; $con_rs_cft = array('cftCurId' => $curId, 'cftAdY' => $adY, 'cftSyId' => $syId, 'cftAcY' => $acY, 'cftTmId' => $tmId ); $rs_cft = $this->cft->qryCft($con_rs_cft); foreach ($rs_cft->result() as $row_cft) { $this->fee->feeId = $row_cft->cftFeeId; $qu_fee = $this->fee->get_by_key(); $row_fee = $qu_fee->row();
if ((($row_fee->feeOnTop == 'Y') && ($etId == 2)) || ($row_fee->feeOnTop == 'N')) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $row_cft->cftFeeId; $qu_cf = $this->cf->get_by_key();
// Not found if ($qu_cf->num_rows() == 0) { // Insert ProgramFee $this->cf->cfAmt = $row_cft->cftAmt; $this->cf->insert(); } } }
$con_qu_cf = array('cfStdId' => $stdId, 'cfAcY' => $acY, 'cfTmId' => $tmId ); $sumProgramFee = $this->cf->getSumAmt($con_qu_cf);
// ---------- DomFee ---------- $domFee = 0; $con_rs_cmft = array('cmftAdY' => $adY, 'cmftSyId' => $syId, 'cmftAcY' => $acY, 'cmftTmId' => $tmId, 'cmftIsDom' => 'Y' ); $rs_cmft = $this->cmft->qryCmft($con_rs_cmft); if ($rs_cmft->num_rows()) { $this->sdm->sdmStdId = $stdId; $this->sdm->sdmAcY = $acY; $this->sdm->sdmTmId = $tmId; $qu_sdm = $this->sdm->get_by_key();
// Student stay dom if ($qu_sdm->num_rows()) { $this->dft->dftAcY = $acY; $this->dft->dftTmId = $tmId; $this->dft->dftDmId = $qu_sdm->row()->sdmDmId; $qu_dft = $this->dft->get_by_key();
// Found dom fee if ($qu_dft->num_rows()) { $this->cf->cfStdId = $stdId; $this->cf->cfAcY = $acY; $this->cf->cfTmId = $tmId; $this->cf->cfFeeId = $rs_cmft->row()->cmftFeeId; $qu_cf = $this->cf->get_by_key();
// Not found if ($qu_cf->num_rows() == 0) { // Insert CommonFee $this->cf->cfAmt = $qu_sdm->row()->sdmNumMonth * $qu_dft->row()->dftAmt; $this->cf->insert(); $domFee = $this->cf->cfAmt; } } } }
// ---------- CourseFee ---------- $sumCourseFee = 0; $this->crft->crftCurId = $curId; $this->crft->crftAdY = $adY; $this->crft->crftSyId = $syId; $this->crft->crftAcY = $acY; $this->crft->crftTmId = $tmId; $qu_crft = $this->crft->get_by_key(); if ($qu_crft->num_rows()) { $con_qu_rf = array('rfStdId' => $stdId, 'rfSyId' => $syId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $qu_rf = $this->rf->qryRf($con_qu_rf);
if ($qu_rf->num_rows()) { $con_qu_rd = array('rdStdId' => $stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $sumcr1 = $this->rd->getSumCr1($con_qu_rd); $sumcr2 = $this->rd->getSumCr2($con_qu_rd);
$this->crf->crfStdId = $stdId; $this->crf->crfAcY = $acY; $this->crf->crfTmId = $tmId; $this->crf->crfRfId = $qu_rf->row()->rfId; $qu_crf = $this->crf->get_by_key(); if ($qu_crf->num_rows()) { // Found // Update CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfKssFeeAmt = $qu_crft->row()->crftKssFee; $this->crf->update(); } else { // Not Found // Insert CourseFee $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfLateFineAmt = 0; $this->crf->crfKssFeeAmt = $qu_crft->row()->crftKssFee; $this->crf->insert(); }
$sumCourseFee = $this->crf->crfLecFeeAmt + $this->crf->crfLabFeeAmt + $this->crf->crfKssFeeAmt; } } return $sumCommonFee + $sumProgramFee + $domFee + $sumCourseFee; }
function calKSSFee($stdId, $acY, $tmId, $curId) { $this->load->model($this->config->item("rg_folder").'mo_rg_coursefeetp','crft'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
// ---------- CourseFee ---------- $sumCourseFee = 0; $this->crft->crftCurId = $curId; $this->crft->crftAdY = 0; $this->crft->crftSyId = 0; $this->crft->crftAcY = $acY; $this->crft->crftTmId = $tmId; $qu_crft = $this->crft->get_by_key();
// Insert CourseFee $con_qu_rf = array('rfStdId' => $stdId, 'rfSyId' => 0, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $qu_rf = $this->rf->qryRf($con_qu_rf); if ($qu_rf->num_rows()) { $con_qu_rd = array('rdStdId' => $stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $sumcr1 = $this->rd->getSumCr1($con_qu_rd); $sumcr2 = $this->rd->getSumCr2($con_qu_rd);
$this->crf->crfStdId = $stdId; $this->crf->crfAcY = $acY; $this->crf->crfTmId = $tmId; $this->crf->crfRfId = $qu_rf->row()->rfId; $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfLateFineAmt = 0; $this->crf->crfKssFeeAmt = $qu_crft->row()->crftKssFee; $this->crf->insert();
$sumCourseFee = $this->crf->crfKssFeeAmt; }
return $sumCourseFee; }
function calKSSFee2552($stdId, $acY, $tmId, $curId, $adY, $syId) { $this->load->model($this->config->item("rg_folder").'mo_rg_coursefeetp','crft'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_coursefee','crf');
// ---------- CourseFee ---------- $sumCourseFee = 0; $this->crft->crftCurId = $curId; $this->crft->crftAdY = $adY; $this->crft->crftSyId = $syId; $this->crft->crftAcY = $acY; $this->crft->crftTmId = $tmId; $qu_crft = $this->crft->get_by_key();
// Insert CourseFee $con_qu_rf = array('rfStdId' => $stdId, 'rfSyId' => $syId, 'rfAcY' => $acY, 'rfTmId' => $tmId ); $qu_rf = $this->rf->qryRf($con_qu_rf); if ($qu_rf->num_rows()) { $con_qu_rd = array('rdStdId' => $stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $sumcr1 = $this->rd->getSumCr1($con_qu_rd); $sumcr2 = $this->rd->getSumCr2($con_qu_rd);
$this->crf->crfStdId = $stdId; $this->crf->crfAcY = $acY; $this->crf->crfTmId = $tmId; $this->crf->crfRfId = $qu_rf->row()->rfId; $this->crf->crfLecFeeAmt = $sumcr1 * $qu_crft->row()->crftLecCreditFee; $this->crf->crfLabFeeAmt = $sumcr2 * $qu_crft->row()->crftLabCreditFee; $this->crf->crfLateFineAmt = 0; $this->crf->crfKssFeeAmt = $qu_crft->row()->crftKssFee; $this->crf->insert();
$sumCourseFee = $this->crf->crfKssFeeAmt; }
return $sumCourseFee; } // end รักษาสภาพ
// ### เพิ่ม-ถอนรายวิชาลงทะเบียน function showAddWithdraw() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
$stdCode = $this->input->post('stdCode');
if ($stdCode) { $this->contents['stdCode'] = "";
$con_qu_std = array('stdCode' => $stdCode, 'stdSstId' => 1, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $row_std = $qu_std->row();
$this->contents['stdCode'] = $stdCode; $this->contents['qu_std'] = $qu_std;
$acY = $this->session->userdata('acY'); $this->contents['acY'] = $acY;
$tmId = $this->session->userdata('tmId'); $this->contents['tmId'] = $tmId;
$con_qu_rg = array('rgStdId' => $row_std->stdId); $maxAcY = $this->rg->getMaxAcY($con_qu_rg);
$this->contents['maxAcY'] = $maxAcY;
$con_qu_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $maxAcY ); $maxTmId = $this->rg->getMaxTmId($con_qu_rg); $this->contents['maxTmId'] = $maxTmId;
$con_rs_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['rs_rd'] = $this->rd->qryRdJoinCoCrs($con_rs_rd);
$con_rs_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId, 'rgStatus' => 'K' ); $rs_rg = $this->rg->qryRg($con_rs_rg); if ($rs_rg->num_rows()) { $this->contents['kssFlag'] = "** รักษาสถานภาพการเป็นนักศึกษา **"; }
$con_qu_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['sumCrAt'] = $this->rd->getSumCrAt($con_qu_rd); } else { $con_qu_std = array('stdCode' => $stdCode, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $this->contents['qu_std'] = $qu_std; } else { $this->contents['err_msg'] = "** ไม่ปรากฏรหัสนักศึกษาดังกล่าวในฐานข้อมูล **"; } } } // end if stdCode
$this->output($this->config->item("rg_folder")."v_showAddWithdraw"); }
// ### ถอนรายวิชาลงทะเบียน หลังช่วงเพิ่ม-ถอน function showWithdraw() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg');
$stdCode = $this->input->post('stdCode');
if ($stdCode) { $this->contents['stdCode'] = "";
$con_qu_std = array('stdCode' => $stdCode, 'stdSstId' => 1, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $row_std = $qu_std->row();
$this->contents['stdCode'] = $stdCode; $this->contents['qu_std'] = $qu_std;
$acY = $this->session->userdata('acY'); $this->contents['acY'] = $acY;
$tmId = $this->session->userdata('tmId'); $this->contents['tmId'] = $tmId;
$con_rs_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['rs_rd'] = $this->rd->qryRdJoinCoCrs($con_rs_rd);
$con_rs_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId, 'rgStatus' => 'K' ); $rs_rg = $this->rg->qryRg($con_rs_rg); if ($rs_rg->num_rows()) { $this->contents['kssFlag'] = "** รักษาสถานภาพการเป็นนักศึกษา **"; }
$con_qu_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['sumCrAt'] = $this->rd->getSumCrAt($con_qu_rd); } else { $con_qu_std = array('stdCode' => $stdCode, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $this->contents['qu_std'] = $qu_std; } else { $this->contents['err_msg'] = "** ไม่ปรากฏรหัสนักศึกษาดังกล่าวในฐานข้อมูล **"; } } }
$this->output($this->config->item("rg_folder")."v_showWithdraw"); }
// ### คำนวณค่าลงทะเบียนเรียน function showCalFeeCur() { $this->load->model($this->config->item("rg_folder").'mo_rg_term','tm');
$acY = $this->session->userdata('acY'); $tmId = $this->session->userdata('tmId');
$this->contents['acY'] = $acY; $this->contents['tmId'] = $tmId; $this->contents['rs_tm'] = $this->tm->get_options('', '', '', 'y');
$this->output($this->config->item("rg_folder")."v_showCalFeeCurriculum"); }
function processCalFeeCur() { $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|required|xss_clean'); $this->form_validation->set_rules('tmIdAdmit',' ','trim|required|xss_clean'); $this->form_validation->set_rules('adY',' ','trim|required|xss_clean'); $this->form_validation->set_rules('syId',' ','trim|required|xss_clean'); $this->form_validation->set_rules('acY',' ','trim|required|exact_length[4]|xss_clean'); $this->form_validation->set_rules('tmId',' ','trim|required|xss_clean'); $this->form_validation->set_rules('syId2',' ','trim|required|xss_clean');
if($this->form_validation->run() == true) { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_registfee','rf');
$curId = $this->input->post('curId'); $adY = $this->input->post('adY'); $syId = $this->input->post('syId'); $acY =$this->input->post('acY'); $tmId = $this->input->post('tmId'); $syId2 = $this->input->post('syId2'); $reviseY = 2552;
$con_rs_std = array('stdCurId' => $curId, 'stdSyId' => $syId, '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) { $rs_rf = $this->rf->qryRfByStdIdAcYTmIdNoPay($row_std->stdId, $acY, $tmId); // Found สามารถคำนวณค่าใช้จ่ายใหม่ได้ก็ต่อเมื่อยังไม่ได้ชำระเงินเท่านั้น if ($rs_rf->num_rows()) { $this->rf->rfId = $rs_rf->row()->rfId; $this->rf->get_by_key(TRUE);
if ($row_std->stdAdY >= $reviseY) { $this->rf->rfTotalAmt = $this->calFee2552($row_std->stdId, $acY, $syId2, $tmId, $curId, $row_std->stdEtId, $row_std->stdAdY); } else { $this->rf->rfTotalAmt = $this->calFee($row_std->stdId, $acY, $syId2, $tmId, $curId, $row_std->stdEtId); } $this->rf->rfBalance = $this->rf->rfTotalAmt; $this->rf->rfUpdateDate = date('Y-m-d H:i:s'); $this->rf->rfUpdateUserId = $this->session->userdata('UsLogin'); $this->rf->update(); } }
redirect($this->config->item('rg_folder').'regis/showCalFeeCur'); } else { $this->showCalFeeCur(); } }
// ##### student start เพิ่ม-ถอนรายวิชาลงทะเบียน function std_showAddWithdraw() { $this->load->model($this->config->item("rg_folder").'mo_rg_student','std'); $this->load->model($this->config->item("rg_folder").'mo_rg_acadconfig','ac'); $this->load->model($this->config->item("rg_folder").'mo_rg_schedule','sd'); $this->load->model($this->config->item("rg_folder").'mo_rg_regist','rg'); $this->load->model($this->config->item("rg_folder").'mo_rg_registdetails','rd');
$stdCode = $this->session->userdata('UsPsCode'); $acY_R = $this->session->userdata('acY_R'); $tmId_R = $this->session->userdata('tmId_R');
$acY = $this->session->userdata('acY'); $this->contents['acY'] = $acY;
$tmId = $this->session->userdata('tmId'); $this->contents['tmId'] = $tmId;
$con_qu_std = array('stdCode' => $stdCode, 'stdSstId' => 1, 'stdGenStatus' => 'Y' ); $qu_std = $this->std->qryStdJoinPfCurSySstElv($con_qu_std); if ($qu_std->num_rows()) { $row_std = $qu_std->row(); $this->contents['qu_std'] = $qu_std;
$forceAssess = $this->forceAssess(); if ($forceAssess) { $qu_sd = $this->sd->qrySdByAcYTmIdAWDate($acY_R, $tmId_R, getNowDate()); //$qu_sd = $this->sd->qrySdByAcYTmIdAWDate($acY_R, $tmId_R, '2011-06-15');
if (!$qu_sd->num_rows()) { $msg = "ไม่สามารถดำเนินการเพิ่ม-ถอนรายวิชาลงทะเบียนได้<br />เนื่องจากไม่อยู่ในช่วงเพิ่ม-ถอนรายวิชา";
$this->session->set_flashdata('msg', $msg); redirect($this->config->item("rg_folder")."msg/err_msg"); }
$con_qu_rg = array('rgStdId' => $row_std->stdId); $maxAcY = $this->rg->getMaxAcY($con_qu_rg); $this->contents['maxAcY'] = $maxAcY;
$con_qu_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $maxAcY ); $this->contents['maxTmId'] = $this->rg->getMaxTmId($con_qu_rg);
$con_rs_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['rs_rd'] = $this->rd->qryRdJoinCoCrs($con_rs_rd);
$con_rs_rg = array('rgStdId' => $row_std->stdId, 'rgAcY' => $acY, 'rgTmId' => $tmId, 'rgStatus' => 'K' ); $rs_rg = $this->rg->qryRg($con_rs_rg); if ($rs_rg->num_rows()) { $this->contents['kssFlag'] = "** รักษาสถานภาพการเป็นนักศึกษา **"; }
$con_qu_rd = array('rdStdId' => $row_std->stdId, 'rdAcY' => $acY, 'rdTmId' => $tmId ); $this->contents['sumCrAt'] = $this->rd->getSumCrAt($con_qu_rd); } // end if forceAssess } else { $this->contents['err_msg'] = "** ไม่ปรากฏรหัสนักศึกษาดังกล่าวในฐานข้อมูล **"; }
$this->output($this->config->item("rg_folder")."v_std_showAddWithdraw"); } // ##### student end เพิ่ม-ถอนรายวิชาลงทะเบียน } ?>
|