Viewing file:      basedata_1.php (25.95 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php include('ea_controller.php'); class Basedata extends Ea_controller {
  //    function __construct() { //        parent::Controller(); //    }
      // ##### start ta     function ta_input() {         $this->load->model($this->config->item("ea_folder").'mo_typeaward','ta');
          $this->ta->taId = $this->input->post('taId');         $this->contents['qu_ta'] = $this->ta->get_by_key();
          $this->contents['rs_ta'] = $this->ta->qryTa('','','');
          $this->output($this->config->item("ea_folder")."v_addTypeAward", $this->session->flashdata('msg'));     }     function ta_search() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('namesearch','คำค้น','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_typeaward','ta');
              $namesearch = $this->input->post('namesearch');
              $con_rs_ta = array('taNameT'    => '%'.$namesearch.'%');                          $this->contents['rs_ta'] = $this->ta->qryTa_2($con_rs_ta,'','');
              $this->output($this->config->item("ea_folder")."v_addTypeAward");         } else {             $this->ta_input();         }     }     function ta_popup() {         $this->load->model($this->config->item("ea_folder").'mo_typeaward','ta');
          $ord_rs_ta = array('taNameT'    => '');         $this->contents['rs_ta'] = $this->ta->qryTa('',$ord_rs_ta,'');         $this->contents['UsName'] = $this->session->userdata('UsName');
          $this->output_detail($this->config->item("ea_folder")."v_printTypeAward");     }     function ta_insert_update() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('taId',' ','trim|xss_clean');         $this->form_validation->set_rules('taNameT','ชื่อประเภทรางวัล (ไทย)','trim|required|xss_clean');         $this->form_validation->set_rules('taNameE','ชื่อประเภทรางวัล (อังกฤษ)','trim|required|xss_clean');
          $flgmsg = 0;         if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_typeaward','ta');
              $con_rs_ta = array('taNameT' => $this->input->post('taNameT'),                                'taNameE' => $this->input->post('taNameE'));             $rs_ta = $this->ta->qryTa($con_rs_ta,'','');
              if(!$rs_ta->num_rows()) {                                  $this->ta->taNameE = $this->input->post('taNameE');                 $this->ta->taNameT = $this->input->post('taNameT');
                  if($this->input->post('taId')=='') {                     $this->ta->taId = '';                     $this->ta->insert();                     $flgmsg = 1;                 } else {                     $this->ta->taId = $this->input->post('taId');                     $this->ta->update();                     $flgmsg = 1;                 }                              }             $this->session->set_flashdata('msg', 2);
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 2);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', 1);             }             redirect($this->config->item("ea_folder")."basedata/ta_input");         } else {             $this->ta_input();         }     }     function ta_delete() {         $this->load->model($this->config->item("ea_folder").'mo_typeaward','ta');
          $this->ta->taId = $this->input->post('taId');         $this->ta->delete();         $this->session->set_flashdata('msg', 3);         redirect($this->config->item("ea_folder")."basedata/ta_input");     }     // ##### end ta
      function la_input() {         $this->load->model($this->config->item("ea_folder").'mo_levelaward','la');
          $this->la->laId = $this->input->post('laId');         $this->contents['qu_la'] = $this->la->get_by_key();
          $this->contents['rs_la'] = $this->la->qryLa('','','');
          $this->output($this->config->item("ea_folder")."v_addLevelAward", $this->session->flashdata('msg'));     }     function la_popup() {          $this->load->model($this->config->item("ea_folder").'mo_levelaward','la');         $this->contents['rs_la'] = $this->la->qryLa('','','');         $this->contents['UsName'] = $this->session->userdata('UsName');
          $this->output_detail($this->config->item("ea_folder")."v_printLevelAward");     }     function la_search() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('namesearch','คำค้น','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_levelaward','la');             $namesearch = $this->input->post('namesearch');
              $con_rs_la = array('laNameT'    => $namesearch);             $this->contents['rs_la'] = $this->la->qryLa_2($con_rs_la,'','');
              $this->output($this->config->item("ea_folder")."v_addLevelAward");         } else {             $this->la_input();         }     }     function la_insert_update() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('laId',' ','trim|xss_clean');         $this->form_validation->set_rules('laNameT','ชื่อระดับการได้รับรางวัล (ไทย)','trim|required|xss_clean');         $this->form_validation->set_rules('laNameE','ชื่อระดับการได้รับรางวัล (อังกฤษ)','trim|required|xss_clean');
          $flgmsg = 0;         if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_levelaward','la');
              $con_rs_la = array('laNameT' => $this->input->post('laNameT'),                                'laNameE' => $this->input->post('laNameE'));             $rs_la = $this->la->qryLa($con_rs_la,'','');
              if(!$rs_la->num_rows()) {                                  $this->la->laNameE = $this->input->post('laNameE');                 $this->la->laNameT = $this->input->post('laNameT');
                  if($this->input->post('laId')=='') {                     $this->la->laId = '';                     $this->la->insert();                     $flgmsg = 1;                 } else {                     $this->la->laId = $this->input->post('laId');                     $this->la->update();                     $flgmsg = 1;                 }                              }             $this->session->set_flashdata('msg', 2);
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 2);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', 1);             }             redirect($this->config->item("ea_folder")."basedata/la_input");         } else {             $this->la_input();         }     }     function la_delete() {         $this->load->model($this->config->item("ea_folder").'mo_levelaward','la');
          $this->la->laId = $this->input->post('laId');         $this->la->delete();         $this->session->set_flashdata('msg', 3);         redirect($this->config->item("ea_folder")."basedata/la_input");     }
      // ##### start edu     function edu_input() {         $this->load->model($this->config->item("ea_folder").'mo_education','edu');
          $this->edu->eduId = $this->input->post('eduId');         $this->contents['qu_edu'] = $this->edu->get_by_key();
          $ord_rs_edu = array('eduName'    => '');         $this->contents['rs_edu'] = $this->edu->qryEdu('',$ord_rs_edu);
          $this->output($this->config->item("ea_folder")."v_addEducation", $this->session->flashdata('msg'));     }     function edu_search() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('namesearch','คำค้น','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_education','edu');
              $namesearch = $this->input->post('namesearch');
              $con_rs_edu = array('eduName'    => $namesearch);             $this->contents['rs_edu'] = $this->edu->qryEdu_2($con_rs_edu,'','');
              $this->output($this->config->item("ea_folder")."v_addEducation");         } else {             $this->edu_input();         }     }     function edu_popup() {         $this->load->model($this->config->item("ea_folder").'mo_education','edu');
          $ord_rs_edu = array('eduName' => '');         $this->contents['rs_edu'] = $this->edu->qryEdu('',$ord_rs_edu,'');         $this->contents['UsName'] = $this->session->userdata('UsName');
          $this->output_detail($this->config->item("ea_folder")."v_printEducation");     }     function edu_insert_update() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('eduId',' ','trim|xss_clean');         $this->form_validation->set_rules('eduName','ชื่อสถานศึกษา','trim|required|xss_clean');
          $flgmsg = 0;         if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_education','edu');
              $con_rs_edu = array('eduName' => $this->input->post('eduName'),                                 'pbriId'  => '0');             $rs_edu = $this->edu->qryEdu($con_rs_edu,'','');
              if(!$rs_edu->num_rows()) {                                  $this->edu->eduName = $this->input->post('eduName');
                  if($this->input->post('eduId')=='') {                     $this->edu->eduId = '';                     $this->edu->pbriId = '0';                     $this->edu->insert();                     $flgmsg = 1;                 } else {                     $this->edu->eduId = $this->input->post('eduId');                     $this->edu->update();                     $flgmsg = 1;                 }                              }             $this->session->set_flashdata('msg', 2);
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 2);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', 1);             }             redirect($this->config->item("ea_folder")."basedata/edu_input");         } else {             $this->edu_input();         }     }     function edu_delete() {         $this->load->model($this->config->item("ea_folder").'mo_education','edu');
          $this->edu->eduId = $this->input->post('eduId');         $this->edu->delete();         $this->session->set_flashdata('msg', 3);         redirect($this->config->item("ea_folder")."basedata/edu_input");     }     // ##### start edu
      //ข้อมูลหลักสูตร     function pa_input(){         $this->load->model($this->config->item("ea_folder").'mo_programalumni','pa');
          $this->pa->paId = $this->input->post('paId');         $this->contents['qu_pa'] = $this->pa->get_by_key();
          $this->contents['rs_pa'] = $this->pa->qryPa('','','');              $this->output($this->config->item("ea_folder")."v_addProgramAlumni", $this->session->flashdata('msg'));     }     function pa_popup() {         $this->load->model($this->config->item("ea_folder").'mo_programalumni','pa');
          $ord_rs_pa = array('paName'    => '');         $this->contents['rs_pa'] = $this->pa->qryPa('',$ord_rs_pa,'');         $this->contents['UsName'] = $this->session->userdata('UsName');
          $this->output_detail($this->config->item("ea_folder")."v_printProgramAlumni");     }     function pa_search() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('psearch','คำค้น','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_programalumni','pa');
              $psearch = $this->input->post('psearch');
              $con_rs_pa = array('paName'    => $psearch);             $this->contents['rs_pa'] = $this->pa->qryPa_2($con_rs_pa,'','');
              $this->output($this->config->item("ea_folder")."v_addProgramAlumni");         } else {             $this->pa_input();         }     }     function pa_insert_update() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('paId',' ','trim|xss_clean');         $this->form_validation->set_rules('paName','ชื่อหลักสูตร','trim|required|xss_clean');
          $flgmsg = 0;         if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_programalumni','pa');
              $con_rs_pa = array('paName' => $this->input->post('paName'));             $rs_pa = $this->pa->qryPa($con_rs_pa,'','');
              if(!$rs_pa->num_rows()) {                                  $this->pa->paName = $this->input->post('paName');
                  if($this->input->post('paId')=='') {                     $this->pa->paId = '';                     $this->pa->insert();                     $flgmsg = 1;                 } else {                     $this->pa->paId = $this->input->post('paId');                     $this->pa->update();                     $flgmsg = 1;                 }                              }
              $this->session->set_flashdata('msg', 2);
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 2);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', 1);             }
              redirect($this->config->item("ea_folder")."basedata/pa_input");         } else {             $this->pa_input();         }     }     function pa_delete() {         $this->load->model($this->config->item("ea_folder").'mo_programalumni','pa');
          $this->pa->paId = $this->input->post('paId');         $this->pa->delete();
          $this->session->set_flashdata('msg', 3);
          redirect($this->config->item("ea_folder")."basedata/pa_input");     }     //ข้อมูลระดับการศึกาษา     function ledu_input(){         $this->load->model($this->config->item("ea_folder").'mo_leveledu','ledu');
          $this->ledu->leduId = $this->input->post('leduId');         $this->contents['qu_ledu'] = $this->ledu->get_by_key();
          $this->contents['rs_ledu'] = $this->ledu->qryLedu('','','');              $this->output($this->config->item("ea_folder")."v_addLevelEdu", $this->session->flashdata('msg'));     }     function ledu_popup() {         $this->load->model($this->config->item("ea_folder").'mo_leveledu','ledu');                  $ord_rs_ledu = array('leduName' => '');         $this->contents['rs_ledu'] = $this->ledu->qryLedu('',$ord_rs_ledu ,'');         $this->contents['UsName'] = $this->session->userdata('UsName');
          $this->output_detail($this->config->item("ea_folder")."v_printLevelEdu");     }     function ledu_search() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('ledusearch','คำค้น','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_leveledu','ledu');
              $ledusearch = $this->input->post('ledusearch');
              $con_rs_ledu = array('leduName'    => $ledusearch);             $this->contents['rs_ledu'] = $this->ledu->qryLedu_2($con_rs_ledu,'','');
              $this->output($this->config->item("ea_folder")."v_addLevelEdu");         } else {             $this->ledu_input();         }     }     function ledu_insert_update() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('leduId',' ','trim|xss_clean');         $this->form_validation->set_rules('leduName','ชื่อระดับการศึกษา (ไทย)','trim|required|xss_clean');         $this->form_validation->set_rules('leduNameEng','ชื่อระดับการศึกษา (อังกฤษ)','trim|required|xss_clean');         $this->form_validation->set_rules('leduAbbr','ชื่อย่อระดับการศึกษา (ไทย)','trim|required|xss_clean');         $this->form_validation->set_rules('leduAbbrEng','ชื่อย่อระดับการศึกษา (อังกฤษ)','trim|required|xss_clean');
          $flgmsg = 0;         if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_leveledu','ledu');
              $con_rs_ledu = array('leduName'        =>    $this->input->post('leduName'),                                  'leduNameEng'    =>    $this->input->post('leduNameEng'),                                  'leduAbbr'        =>    $this->input->post('leduAbbr'),                                  'leduAbbrEng'    =>    $this->input->post('leduAbbrEng'),                                  'pbriId'        =>    '0');             $rs_ledu = $this->ledu->qryLedu($con_rs_ledu,'','');
              if(!$rs_ledu->num_rows()) {                                  $this->ledu->leduName = $this->input->post('leduName');                 $this->ledu->leduNameEng = $this->input->post('leduNameEng');                 $this->ledu->leduAbbr = $this->input->post('leduAbbr');                 $this->ledu->leduAbbrEng = $this->input->post('leduAbbrEng');                 $this->ledu->pbriId = '0';
                  if($this->input->post('leduId')=='') {                     $this->ledu->leduId = '';                     $this->ledu->insert();                                          $flgmsg = 1;
                  } else {                     $this->ledu->leduId = $this->input->post('leduId');                     $this->ledu->update();                     $flgmsg = 1;
                  }                              }
              $this->session->set_flashdata('msg', 2);
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 2);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', 1);             }
              redirect($this->config->item("ea_folder")."basedata/ledu_input");         } else {             $this->ledu_input();         }     }     function ledu_delete() {         $this->load->model($this->config->item("ea_folder").'mo_leveledu','ledu');
          $this->ledu->leduId = $this->input->post('leduId');         $this->ledu->delete();
          $this->session->set_flashdata('msg', 3);
          redirect($this->config->item("ea_folder")."basedata/ledu_input");     }     //ข้อมูลสาขาวิชาการศึกษา     function medu_input(){         $this->load->model($this->config->item("ea_folder").'mo_majoredu','medu');
          $this->medu->meduId = $this->input->post('meduId');         $this->contents['qu_medu'] = $this->medu->get_by_key();
          $this->contents['rs_medu'] = $this->medu->qryMedu('','','');              $this->output($this->config->item("ea_folder")."v_addMajorEdu", $this->session->flashdata('msg'));     }     function medu_popup() {         $this->load->model($this->config->item("ea_folder").'mo_majoredu','medu');
          $ord_rs_medu = array('meduName' => '');         $this->contents['rs_medu'] = $this->medu->qryMedu('',$ord_rs_medu,'');         $this->contents['UsName'] = $this->session->userdata('UsName');
          $this->output_detail($this->config->item("ea_folder")."v_printMajorEdu");     }     function medu_search() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('medusearch','คำค้น','trim|required|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_majoredu','medu');
              $medusearch = $this->input->post('medusearch');
              $con_rs_medu = array('meduName'    => $medusearch);             $this->contents['rs_medu'] = $this->medu->qryMedu_2($con_rs_medu,'','');
              $this->output($this->config->item("ea_folder")."v_addMajorEdu");         } else {             $this->medu_input();         }     }     function medu_insert_update() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('meduId',' ','trim|xss_clean');         $this->form_validation->set_rules('meduName','ข้อมูลสาขาวิชาการศึกษา','trim|required|xss_clean');
          $flgmsg = 0;         if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_majoredu','medu');
              $con_rs_medu = array('meduName'    =>    $this->input->post('meduName'),                                  'pbriId'    =>    '0');                  $rs_medu = $this->medu->qryMedu($con_rs_medu,'','');
              if(!$rs_medu->num_rows()) {                                  $this->medu->meduName = $this->input->post('meduName');                 $this->medu->pbriId = '0';
                  if($this->input->post('meduId')=='') {                     $this->medu->meduId = '';                     $this->medu->insert();                     $flgmsg = 1;
                  } else {                     $this->medu->meduId = $this->input->post('meduId');                     $this->medu->update();                     $flgmsg = 1;                 }             }
              $this->session->set_flashdata('msg', 2);
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 2);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', 1);             }                              redirect($this->config->item("ea_folder")."basedata/medu_input");         } else {             $this->medu_input();         }     }     function medu_delete() {         $this->load->model($this->config->item("ea_folder").'mo_majoredu','medu');
          $this->medu->meduId = $this->input->post('meduId');         $this->medu->delete();
          $this->session->set_flashdata('msg', 3);
          redirect($this->config->item("ea_folder")."basedata/medu_input");     }
      //ข้อมูลเงินเดือนขั้นต่ำ     function bs_input(){         $this->load->model($this->config->item("ea_folder").'mo_basesalary','bs');         $this->load->model($this->config->item("ea_folder").'mo_leveledu','ledu');
          //---[กรณีแก้ไขข้อมูล]         $bsId = $this->input->post('bsId');         $con_qu_bs = array('bsId'    => $bsId);         $this->contents['qu_bs'] = $this->bs->qryBsJoinLeduAndEdg($con_qu_bs);         //---[จบกรณีแก้ไขข้อมูล]
          $this->contents['rs_edg'] = $this->bs->get_options_edg();         $this->contents['rs_ledu'] = $this->ledu->get_options_ledu();         $this->contents['rs_bs'] = $this->bs->qryBsJoinLeduAndEdg();
          $this->output($this->config->item("ea_folder")."v_addBaseSalary", $this->session->flashdata('msg'));     }     function bs_popup() {         $this->load->model($this->config->item("ea_folder").'mo_basesalary','bs');
          $ord_rs_bs = array('edgName' => '');         $this->contents['rs_bs'] = $this->bs->qryBsJoinLeduAndEdg('',$ord_rs_bs);         $this->contents['UsName'] = $this->session->userdata('UsName');
          $this->output_detail($this->config->item("ea_folder")."v_printBaseSalary");     }     function bs_search() {         $this->load->model($this->config->item("ea_folder").'mo_basesalary','bs');         $this->load->model($this->config->item("ea_folder").'mo_leveledu','ledu');
          $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('edgId','วุฒิการศึกษา','trim|xss_clean');         $this->form_validation->set_rules('leduId','ชื่อระดับการศึกษา','trim|xss_clean');
          $this->contents['rs_edg'] = $this->bs->get_options_edg();         $this->contents['rs_ledu'] = $this->ledu->get_options_ledu();
          $edgId = $this->input->post('edgId');         $leduId = $this->input->post('leduId');
          if($this->form_validation->run() == true && ($edgId!='' || $leduId!='')) {             if($edgId!='' && $leduId=='')                 $con_rs_bs = array('bs.edgId'    => $edgId);             else if($edgId=='' && $leduId!='')                 $con_rs_bs = array('bs.leduId'    => $leduId);             else if($edgId!='' && $leduId!='')                 $con_rs_bs = array('bs.edgId'    => $edgId,                                    'bs.leduId'    => $leduId);             $ord_rs_bs = array('edgName' => '');             $this->contents['rs_bs'] = $this->bs->qryBsJoinLeduAndEdg($con_rs_bs,$ord_rs_bs);         } else {             $this->contents['flgerr'] = "กรุณาป้อนคำค้นลงในช่องใดช่องหนึ่ง";         }
          $this->output($this->config->item("ea_folder")."v_addBaseSalary");     }     //---[callback function สำหรับเช็ควันที่เริ่มต้น-วันที่สิ้นสุด]     function checkFrDate($str, $field) {         $frDate = splitDateForm2($str);          $toDate = splitDateForm2($this->input->post($field));
          if($frDate > $toDate) {             $this->form_validation->set_message('checkFrDate', '%s ต้องน้อยกว่าหรือเท่ากับ วันที่สิ้นสุด'); return FALSE;         } else {              return TRUE;          }     }     //---[จบ callback function สำหรับเช็ควันที่เริ่มต้น-วันที่สิ้นสุด]     function bs_insert_update() {         $this->load->library('form_validation');         $this->form_validation->set_error_delimiters('<font color="red">','</font>');         $this->form_validation->set_rules('edgId','วุฒิการศึกษา','trim|required|xss_clean');         $this->form_validation->set_rules('leduId','ชื่อระดับการศึกษา','trim|required|xss_clean');         $this->form_validation->set_rules('bsStartPost','ประกาศเมื่อ','trim|callback_checkFrDate[bsEndPost]xss_clean');         $this->form_validation->set_rules('bsEndPost','สิ้นสุดเมื่อ','trim|xss_clean');         $this->form_validation->set_rules('bsAmount','จำนวนเงินขั้นต่ำ','trim|integer|required|xss_clean');         $this->form_validation->set_rules('bsId',' ','trim|xss_clean');
          if($this->form_validation->run() == true) {             $this->load->model($this->config->item("ea_folder").'mo_basesalary','bs');
              $flgmsg = 0;             $this->db->trans_begin();             $bsId = $this->input->post('bsId');             $edgId = $this->input->post('edgId');             $leduId = $this->input->post('leduId');             $bsStartPost = splitDateForm2($this->input->post('bsStartPost'),'-');             $bsEndPost = splitDateForm2($this->input->post('bsEndPost'),'-');             $bsAmount = $this->input->post('bsAmount');
              $this->bs->bsId = $bsId;             $qu_bs = $this->bs->get_by_key();             if(!$qu_bs->num_rows()) {                 $con_rs_bs = array('edgId'    => $edgId,                                    'leduId'    => $leduId);                 $rs_bs = $this->bs->qryBs($con_rs_bs);                 if(!$rs_bs->num_rows()) {                     $this->bs->bsId = $bsId;                     $this->bs->edgId = $edgId;                     $this->bs->leduId = $leduId;                     $this->bs->bsStartPost = $bsStartPost;                     $this->bs->bsEndPost = $bsEndPost;                     $this->bs->bsAmount = $bsAmount;                     $this->bs->insert();                     $flgmsg = 1;                 }             } else {                 $rs_bs = $this->bs->qryBsNotId($edgId,$leduId,$bsId);                 if(!$rs_bs->num_rows()) {                     $this->bs->bsId = $bsId;                     $this->bs->get_by_key(TRUE);                     $this->bs->edgId = $edgId;                     $this->bs->leduId = $leduId;                     $this->bs->bsStartPost = $bsStartPost;                     $this->bs->bsEndPost = $bsEndPost;                     $this->bs->bsAmount = $bsAmount;                     $this->bs->update();                     $flgmsg = 1;                 }             }                          $this->session->set_flashdata('msg', 2);
              if($this->db->trans_status() === false) {                 $this->db->trans_rollback();                 if($flgmsg)                     $this->session->set_flashdata('msg', 2);                 } else {                 $this->db->trans_commit();                 if($flgmsg)                     $this->session->set_flashdata('msg', 1);             }             redirect($this->config->item("ea_folder")."basedata/bs_input");         } else {             $this->bs_input();         }     }
      function bs_delete() {         $this->load->model($this->config->item("ea_folder").'mo_basesalary','bs');
          $bsId = $this->input->post('bsId');
          $this->bs->bsId = $bsId;         $this->bs->delete();
          if($this->db->trans_status() === false) {             $this->db->trans_rollback();             $this->session->set_flashdata('msg', 41);         } else {             $this->db->trans_commit();             $this->session->set_flashdata('msg', 30);         }
          redirect($this->config->item("ea_folder")."basedata/bs_input");     }      } ?>
  |