Viewing file: project.php (32.3 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include('sa_controller.php'); class Project extends Sa_controller { function main_project(){
if($this->input->post('year')){ $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj; $dpj->dpj_bgY = $this->input->post('year'); $data['rs_dpj'] = $dpj->get_data_relation(); echo $this->view("v_add_edit_budget", $data); }else{ $this->load->model($this->config->item('sa_folder').'sa_initialbudget_model','ib'); if ($this->ib->get_all()->num_rows()) { $data['qu_ib'] = $this->ib->get_options('n'); $data['yr'] = 1; } else { $data['qu_ib'] = $this->ib->get_options_noyear(); $data['yr'] = 0; } $this->output("v_add_edit_budget", $data); } }
/** คำอธิบายฟังก์ชั่น: มีไว้บันทึกงบประมาณโครงการ */ function add_edit_project($id='') { $data['text'] = 'nothing';
if ($this->input->server('REQUEST_METHOD') === 'POST') {// do something $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->form_validation->set_rules('mpj_year', ' ', 'trim|required|xss_clean'); $this->form_validation->set_rules('mpj_name', ' ', 'trim|required|xss_clean'); $this->form_validation->set_rules('mpj_code', ' ', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { // your code $this->main_project(); } else { $this->load->model($this->config->item('sa_folder').'sa_main_project_model','mpj'); $mpj = $this->mpj; $mpj->mpj_code = trim($this->input->post('mpj_code')); $mpj->mpj_year = trim($this->input->post('mpj_year')); $mpj->mpj_name = trim($this->input->post('mpj_name')); $mpj->mpj_status = 1; $mpj->insert();
$this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj; $dpj->dpj_mpj_id = $mpj->last_insert_id; $dpj->dpj_fr_date = date('Y-m-d'); $dpj->dpj_to_date = date('Y-m-d'); $dpj->insert(); redirect($this->config->item('sa_folder').'project/plandetail/'.$mpj->last_insert_id); } } } /** คำอธิบายฟังก์ชั่น: มีไว้สร้างโครงการใหม่ */ function add_project(){ $data['text'] = 'nothing'; $this->load->model($this->config->item('sa_folder').'sa_main_project_model','mpj'); $cl = $this->mpj; $data['rs_club'] = $cl->get_options(); $this->output("v_add_project", $data); }
/** คำอธิบายฟังก์ชั่น: มีไว้บันทึกข้อมูลโครงการ */ function do_add_project($id='') { $data['text'] = 'nothing';
if ($this->input->server('REQUEST_METHOD') === 'POST') {// do something $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>'); $this->form_validation->set_rules('mpj_year', ' ', 'trim|required|xss_clean'); $this->form_validation->set_rules('mpj_code', 'รหัสโครงการ', 'trim|required|xss_clean'); $this->form_validation->set_rules('mpj_name', 'ชื่อโครงการ', 'trim|required|xss_clean');
$this->form_validation->set_rules('dpj_id', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('dpj_owner', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('dpj_mpj_id', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('dpj_sub_name', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('dpj_manager', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_objective', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_result', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('atb_type1', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_indicator', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_target', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_place', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_fr_date', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_to_date', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_procedure', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('dpj_creator', ' ', 'trim|xss_clean');//|required
$ch_atb_id = 'N'; if ($this->input->post('atb_type1') == 1) { for ($i=1; $i<$this->input->post('atb_id'); $i++){ $this->form_validation->set_rules('atb_id'.$i, ' ', 'trim|xss_clean'); if ($this->input->post('atb_id'.$i) != ''){ $ch_atb_id = 'Y'; } } } else { $ch_atb_id = 'Y'; $this->form_validation->set_rules('stp_stg_id', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('stp_strategy', ' ', 'trim|xss_clean');//|required $this->form_validation->set_rules('stp_goal', ' ', 'trim|xss_clean');//|required }
if ($this->form_validation->run() == FALSE ) {//|| $ch_atb_id == 'N' // your code if ($ch_atb_id == 'N') { $this->load->vars( array('ch_atb_id' => '<br><font color="red"> กรุณาเลือกคุณลักษณะโครงการ </font>')); }
$this->load->vars(array('set_error'=>'<font color="red">ข้อมูลไม่ถูกต้อง ไม่สามารถบันทึกได้</font>')); $this->plandetail(1,$this->input->post('mpj_id'));// } else { $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj; $this->load->model($this->config->item('sa_folder').'sa_task_project_model','tp'); $tp = $this->tp; $this->load->model($this->config->item('sa_folder').'sa_integration_project_model','igp'); $igp = $this->igp; $this->load->model($this->config->item('sa_folder').'sa_indicator_project_model','ind'); $ind = $this->ind; $this->load->model($this->config->item('sa_folder').'sa_strategic_project_model','stp'); $stp = $this->stp; $this->load->model($this->config->item('sa_folder').'sa_main_project_model','mpj'); $mpj = $this->mpj; $this->load->model($this->config->item('sa_folder').'sa_co_owner_proj_model','cop'); $cop = $this->cop; $this->load->model($this->config->item('sa_folder').'sa_integration_course_model','igc'); $igc = $this->igc; /* $mpj->mpj_id = trim($this->input->post('mpj_id')); $mpj->mpj_code = trim($this->input->post('mpj_code')); $mpj->mpj_year = trim($this->input->post('mpj_year')); $mpj->mpj_name = trim($this->input->post('mpj_name')); $mpj->update(); */ $dpj->dpj_id = trim($this->input->post('dpj_id')); $dpj->dpj_mpj_id = trim($this->input->post('mpj_id')); $dpj->dpj_sub_name = trim($this->input->post('mpj_name')); $dpj->dpj_owner = trim($this->input->post('dpj_owner')); $dpj->dpj_manager = trim($this->input->post('dpj_manager')); $dpj->dpj_adviser = trim($this->input->post('dpj_adviser')); $dpj->dpj_objective = trim($this->input->post('dpj_objective')); $dpj->dpj_result = trim($this->input->post('dpj_result')); $dpj->dpj_attribute = trim($this->input->post('atb_type1')); $dpj->dpj_indicator = trim($this->input->post('dpj_indicator')); $dpj->dpj_target = trim($this->input->post('dpj_target')); $dpj->dpj_place = trim($this->input->post('dpj_place')); $dpj->dpj_fr_date = splitDateForm2($this->input->post('dpj_fr_date'),'-'); $dpj->dpj_to_date = splitDateForm2($this->input->post('dpj_to_date'),'-'); $dpj->dpj_procedure = trim($this->input->post('dpj_procedure')); $dpj->dpj_creator = trim($this->input->post('dpj_creator'));
$dpj->dpj_seq = 0; $dpj->dpj_year = date('Y')+543; $dpj->dpj_bgY = trim($this->input->post('mpj_year')); $dpj->dpj_code = trim($this->input->post('mpj_code'));
$dpj->dpj_status = 0; // สถานะของโครงการ/กิจกรรม 1 รออนุมัติ, 1 อนุมัติแล้ว
if($this->input->post('dpj_id')!=''){ $dpj->update(); }else{ $dpj->insert(); $dpj->dpj_id = $dpj->last_insert_id; }
$tp->tp_mpj_id = $dpj->dpj_id; $tp->delete_atb(); $stp->stp_mpj_id = $dpj->dpj_id; $stp->delete_stp();
$a = explode("###", $this->input->post('wk11_co')); foreach ($a as $value) { $v = explode(":", $value); $igc->igc_mjp_id = $dpj->dpj_id; $igc->igc_crs_id = trim($v[0]); $igc->insert(); }
if ($this->input->post('atb_type1') == 1){ for ($i=1; $i<$this->input->post('atb_id'); $i++){ if ($this->input->post('atb_id'.$i) != ''){ $tp->tp_mpj_id = $dpj->dpj_id; $tp->tp_atb_id = trim($this->input->post('atb_id'.$i)); $tp->insert(); } } } else if ($this->input->post('atb_type1') == 2){ $stp->stp_mpj_id = $dpj->dpj_id; $stp->stp_stg_id = trim($this->input->post('stp_stg_id')); $stp->stp_strategy = trim($this->input->post('stp_strategy')); $stp->stp_goal = trim($this->input->post('stp_goal')); $stp->insert(); }
$igp->igp_mjp_id = $dpj->dpj_id; $igp->delete_igp(); for ($i=1; $i<$this->input->post('itg_id'); $i++){ if ($this->input->post('itg_id'.$i) != ''){ $igp->igp_mjp_id = $dpj->dpj_id; $igp->igp_itg_id = trim($this->input->post('itg_id'.$i)); $igp->insert(); } }
$cop->cop_mpj_id = $dpj->dpj_id; $cop->delete_cop(); $co_owner = $this->input->post('co_owner'); for ($i = 0; $i < count($co_owner); $i++) { if ( $co_owner[$i] != '' ) { $cop->cop_mpj_id = $dpj->dpj_id; $cop->cop_sc_id = $co_owner[$i]; $cop->insert(); } }
$this->session->set_flashdata('set_error', '<font color="green">บันทึกข้อมูลเรียบร้อยแล้ว</font>');
redirect($this->config->item('sa_folder').'project/plandetail/1/'.$dpj->dpj_id); } } }
function add_edit_budget($id='') { $data['text'] = 'nothing';
if ($this->input->server('REQUEST_METHOD') === 'POST') {// do something $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->form_validation->set_rules('mpj_id', 'mpj_id', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { // your code $this->main_project(); } else { $this->load->model($this->config->item('sa_folder').'sa_planbudget_model','pb'); $pb = $this->pb;
$pb->delete_pb($this->input->post('mpj_id')); for ($i=1; $i<$this->input->post('sb_pid'); $i++) { if ($this->input->post('sb_pidc'.$i) != '') { $pb->pb_pl_id = trim($this->input->post('mpj_id')); $pb->pb_sb_id = trim($this->input->post('sb_pid'.$i)); $pb->pb_cost = trim($this->input->post('sb_pidc'.$i)); $pb->insert(); } } redirect($this->config->item('sa_folder').'project/plandetail/3/'.$this->input->post('mpj_id')); } } }
function add_edit_target($id='') { $data['text'] = 'nothing';
if ($this->input->server('REQUEST_METHOD') === 'POST') {// do something $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->form_validation->set_rules('mpj_id', ' ', 'trim|required|xss_clean'); $this->form_validation->set_rules('std', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('smo', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('teach', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('off', ' ', 'trim|xss_clean'); $this->form_validation->set_rules('other', ' ', 'trim|xss_clean'); if ($this->form_validation->run() == FALSE) { // your code $this->main_project(); } else { $this->load->model($this->config->item('sa_folder').'sa_target_group_model','tg'); $tg = $this->tg; $tg->delete_tg($this->input->post('mpj_id'));
if($this->input->post('smo') != ''){ $tg_sc_id = $this->input->post('tg_sc_id'); $num_smo = $this->input->post('num_smo');
for ($i = 0; $i < count($tg_sc_id); $i++) { if ($tg_sc_id[$i]!='') { $tg->tg_sc_id = ($tg_sc_id[$i]=='')? NULL : $tg_sc_id[$i]; $tg->tg_num = $num_smo[$i]; $tg->tg_type = $this->input->post('smo'); $tg->tg_dpj_id = $this->input->post('mpj_id'); $tg->insert(); } } }
if($this->input->post('std') != ''){ $cur_id = $this->input->post('cur_id'); $sy_id = $this->input->post('sy_id'); $num_std = $this->input->post('num_std');
for ($i = 0; $i < count($cur_id); $i++) { if ($cur_id[$i]!='') { $tg->tg_cur_id = ($cur_id[$i]=='')? NULL : $cur_id[$i]; $tg->tg_tm_id = ($sy_id[$i]=='')? NULL : $sy_id[$i]; $tg->tg_num = $num_std[$i]; $tg->tg_type = $this->input->post('std'); $tg->tg_dpj_id = $this->input->post('mpj_id'); $tg->tg_sc_id = NULL; $tg->insert(); } } }
if($this->input->post('teach') != ''){ $tg->tg_num = $this->input->post('num_teach'); $tg->tg_type = $this->input->post('teach'); $tg->tg_dpj_id = $this->input->post('mpj_id'); $tg->tg_sc_id = NULL; $tg->insert(); }
if($this->input->post('off') != ''){ $tg->tg_num = $this->input->post('num_off'); $tg->tg_type = $this->input->post('off'); $tg->tg_dpj_id = $this->input->post('mpj_id'); $tg->tg_sc_id = NULL; $tg->insert(); }
if($this->input->post('other') != ''){ $tg->tg_num = $this->input->post('num_other'); $tg->tg_type = $this->input->post('other'); $tg->tg_dpj_id = $this->input->post('mpj_id'); $tg->tg_sc_id = NULL; $tg->insert(); } redirect($this->config->item('sa_folder').'project/plandetail/4/'.$this->input->post('mpj_id')); } } }
function delete_mpj() { $this->load->model($this->config->item('sa_folder').'sa_main_project_model','mpj'); $mpj = $this->mpj; $mpj->mpj_id = $this->input->post('mpj_id'); $mpj->delete(); redirect($this->config->item('sa_folder').'project/main_project'); }
function delete_dpj($id) { $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $this->load->model($this->config->item('sa_folder').'sa_target_group_model','tg'); $this->load->model($this->config->item('sa_folder').'sa_planbudget_model','pb'); $this->load->model($this->config->item('sa_folder').'sa_co_owner_proj_model','cop');
$dpj = $this->dpj; $tg = $this->tg; $pb = $this->pb; $cop = $this->cop;
//$dpj->dpj_mpj_id = $id; //$rs_acp = $dpj->getByMpj(); $dpj->dpj_id = $id;// $rs_acp = $dpj->get_by_key();// foreach ($rs_acp->result() as $row_acp) { $tg->delete_tg($row_acp->dpj_id); $pb->delete_pb($row_acp->dpj_id); $cop->cop_mpj_id = $row_acp->dpj_id;// $cop->delete_cop();//
$dpj->dpj_id = $row_acp->dpj_id; $dpj->delete(); }
$tg->delete_tg($id); $pb->delete_pb($id);
$dpj->dpj_id = $id;//$this->input->post('dpj_id'); $dpj->delete();
redirect($this->config->item('sa_folder').'project/main_project'); }
function delete_apc($acp_id,$mpj_id) { $this->load->model($this->config->item('sa_folder').'sa_activity_project_model','apc'); $apc = $this->apc; $apc->acp_id = $acp_id; $apc->delete();
redirect($this->config->item('sa_folder').'project/plandetail/2/'.$mpj_id); }
function delete_tg($tg_id,$mpj_id) { $this->load->model($this->config->item('sa_folder').'sa_target_group_model','tg'); $tg = $this->tg; $tg->tg_id = $tg_id; $tg->delete();
redirect($this->config->item('sa_folder').'project/plandetail/4/'.$mpj_id); }
function delete_cop($cop_id,$mpj_id) { $this->load->model($this->config->item('sa_folder').'sa_co_owner_proj_model','cop'); $cop = $this->cop; $cop->cop_id = $cop_id; $cop->delete();
redirect($this->config->item('sa_folder').'project/plandetail/1/'.$mpj_id); }
function delete_igc($igc_id,$mpj_id) { $this->load->model($this->config->item('sa_folder').'sa_integration_course_model','igc'); $igc = $this->igc; $igc->igc_id = $igc_id; $igc->delete();
redirect($this->config->item('sa_folder').'project/plandetail/1/'.$mpj_id); }
function add_edit_activity($id='') { $data['text'] = 'nothing';
if ($this->input->server('REQUEST_METHOD') === 'POST') {// do something $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$this->form_validation->set_rules('mpj_id', ' ', 'trim|required|xss_clean'); $this->form_validation->set_rules('num_acp[]', 'กิจกรรม', 'trim|required|xss_clean'); if ($this->form_validation->run() == FALSE) { // your code $this->plandetail('2',$this->input->post('mpj_id')); } else { $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj;
$dpj->dpj_id = trim($this->input->post('mpj_id')); $qu_mpj = $dpj->get_by_key(); $row_mpj = $qu_mpj->row(); $num_acp = $this->input->post('num_acp');
$dpj->dpj_mpj_id = trim($this->input->post('mpj_id')); $qu_apc = $dpj->getByMpj(); $num_apc = $qu_apc->num_rows(); for ($i = 0; $i < count($num_acp); $i++) { if ( $num_acp[$i] != '' ) { $dpj->dpj_id = ''; $dpj->dpj_mpj_id = trim($this->input->post('mpj_id')); $dpj->dpj_sub_name = trim($num_acp[$i]); $dpj->dpj_fr_date = date('Y-m-d'); $dpj->dpj_to_date = date('Y-m-d'); $dpj->dpj_seq = ($num_apc+1+$i); $dpj->dpj_year = $row_mpj->dpj_year; $dpj->dpj_bgY = $row_mpj->dpj_bgY; $dpj->dpj_code = $row_mpj->dpj_code.'-'.$dpj->dpj_seq; $dpj->insert(); } } redirect($this->config->item('sa_folder').'project/plandetail/2/'.$this->input->post('mpj_id')); } } }
function plandetail($tab=1, $id='') { $data['mpj_year'] = $this->input->post('mpj_year'); //$mpj_id = ($id=='')?$this->input->post('mpj_id'):$id; //$acp_id = $this->input->post('acp_id'); $f_tab = $this->input->post('tab'); $f_id = $this->input->post('f_id');
// ค่าที่จะใช้ในหน้าวิว $tab = ($f_tab!="") ? $f_tab : $tab; $id = ($id!='')?$id:$this->input->post('mpj_id'); // id project
$this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj;
$data['qu_mpj'] = ''; $dpj->dpj_id = $id; $data['qu_dpj'] = $dpj->get_by_key(); if($data['qu_dpj']->num_rows()>0){ $rs_dpj = $data['qu_dpj']->row(); if($rs_dpj->dpj_mpj_id!=0){ $dpj->dpj_id = $rs_dpj->dpj_mpj_id; $qu_mpj = $dpj->get_by_key(); $data['qu_mpj'] = $qu_mpj; } } $data['mpj_id'] = $id; //$data['mpj_id'] = $mpj_id; //$data['acp_id'] = $acp_id; if($tab==1) { //$id = (($id)? $id : $this->input->post('mpj_id')); ///$this->load->model($this->config->item('sa_folder').'sa_main_project_model','mpj'); //$mpj = $this->mpj; //$mpj->mpj_id = $mpj_id;//$id //$qu_mpj = $mpj->get_by_key(); //$data['qu_mpj'] = $qu_mpj;
$this->load->model($this->config->item('sa_folder').'sa_attribute_model','atb'); $atb = $this->atb; $data['qu_atb'] = $atb->qu_mpj($id);
$this->load->model($this->config->item('sa_folder').'sa_integration_model','itg'); $itg = $this->itg; $data['qu_itg'] = $itg->qu_mpj($id);
$this->load->model($this->config->item('sa_folder').'sa_strategic_model','stg'); $stg = $this->stg; $data['qu_stg'] = $stg->get_options();
$this->load->model($this->config->item('sa_folder').'sa_indicator_model','ind'); $ind = $this->ind; $ind->ind_mpj_id = $id;//$mpj->mpj_id; $data['rs_ind'] = $ind->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_strategic_project_model','stp'); $stp = $this->stp; $stp->stp_mpj_id = $id;//$mpj->mpj_id; $data['qu_stp'] = $stp->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_initialbudget_model','ib'); $ib = $this->ib; $data['qu_ib'] = $ib->get_options('n');
$this->load->model($this->config->item('sa_folder').'sa_smo_club_model','sc'); $sc = $this->sc; $data['opt_sc'] = $sc->get_options();
$this->load->model($this->config->item('sa_folder').'sa_co_owner_proj_model','cop'); $cop = $this->cop; $cop->cop_mpj_id = $id; $data['rs_co'] = $cop->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_integration_course_model','igc'); $igc = $this->igc; $igc->igc_mjp_id = $id; $data['rs_igc'] = $igc->get_by_mpj();
$data['ck_id'] = $id; //$data['tab'] = $tab;
$data['v'] = $this->load->view($this->config->item('sa_folder').'v_plandetail',$data,TRUE); } else if($tab==2) { // tab กิจกรรม $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj; $dpj->dpj_id = $id; $qu_mpj = $dpj->get_by_key(); $data['qu_mpj'] = $qu_mpj;
$dpj->dpj_mpj_id = $id; $data['rs_acp'] = $dpj->getByMpj();//$acp->get_by_mpj_id();
$data['v'] = $this->load->view($this->config->item('sa_folder').'v_plandetail_t5',$data,TRUE); } else if($tab==3) { $this->load->model($this->config->item('sa_folder').'sa_main_project_model','mpj'); $mpj = $this->mpj; $mpj->mpj_id = $id; $qu_mpj = $mpj->get_by_key();
$data['qu_mpj'] = $qu_mpj;
$this->load->model($this->config->item('sa_folder').'sa_planbudget_model','pb'); $pb = $this->pb; $pb->pb_pl_id = $id; $data['qu_sb'] = $pb->qu_joinsb(); //$data['tab'] = 2; //$this->output("v_plandetail_t2", $data);
$data['v'] = $this->load->view($this->config->item('sa_folder').'v_plandetail_t2',$data,TRUE); } else if($tab==4) { $this->load->model($this->config->item('sa_folder').'sa_main_project_model','mpj'); $mpj = $this->mpj; $mpj->mpj_id = $id; $qu_mpj = $mpj->get_by_key(); $data['qu_mpj'] = $qu_mpj;
$this->load->model($this->config->item('sa_folder').'sa_target_group_model','tg'); $tg = $this->tg; $tg->tg_dpj_id = $id; $data['rs_tg'] = $tg->get_by_dpj();
$this->load->model($this->config->item('rg_folder').'mo_rg_student','std'); $std = $this->std; $cur_grp = array('stdCurId'=>'stdCurId'); $rs_cur = $std->qryCurGen("", $cur_grp); $opt[''] = '-- เลือกหลักสูตร --'; foreach($rs_cur->result() as $row) { $opt[$row->curId] = $row->curName; } $data['rs_cur'] = $opt; $this->load->model($this->config->item('rg_folder').'mo_rg_studyyear','sy'); $sy = $this->sy; $rs_sy =$sy->qrySy(); $opt2[''] = 'ทุกชั้นปี'; foreach($rs_sy->result() as $row) { $opt2[$row->syId] = $row->syName; } $data['rs_sy'] =$opt2; //$data['tab'] = 3; //$this->output("v_plandetail_t3", $data);
// -------- ตัวเลือกสโมสรและชมรม $this->load->model($this->config->item('sa_folder').'sa_smo_club_model','sc'); $rs_smo = $this->sc->get_options(); $data['rs_smo'] = $rs_smo;
$data['v'] = $this->load->view($this->config->item('sa_folder').'v_plandetail_t3',$data,TRUE); }
$data['tab'] = $tab; $data['id'] = $id; $data['pj_type'] = ''; // main or sub $this->output("v_mainPlandetail", $data); }
function offer_dpj($dpj_id) { $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj;
$dpj->dpj_status = 1; // สถานะของโครงการ/กิจกรรม 1 รออนุมัติ, 2 อนุมัติแล้ว $dpj->dpj_us_offer = $this->session->userdata('UsID'); // รหัสผู้เสนอโครงการ/กิจกรรม $dpj->dpj_date_offer = date('Y-m-d'); // วันที่เสนอโครงการ/กิจกรรม $dpj->dpj_id = $dpj_id;
$dpj->offer_dpj();
redirect($this->config->item('sa_folder').'project/main_project'); }
function approve_project() { if($this->input->post('year')){ $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj; $dpj->dpj_bgY = $this->input->post('year'); $data['rs_dpj'] = $dpj->get_data_relation(); echo $this->view("v_approve_project", $data); }else{ $this->load->model($this->config->item('sa_folder').'sa_initialbudget_model','ib'); if ($this->ib->get_all()->num_rows()) { $data['qu_ib'] = $this->ib->get_options('n'); $data['yr'] = 1; } else { $data['qu_ib'] = $this->ib->get_options_noyear(); $data['yr'] = 0; } $this->output("v_approve_project", $data); } }
function approve_dpj($dpj_id) { $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj;
$dpj->dpj_status = 2; // สถานะของโครงการ/กิจกรรม 1 รออนุมัติ, 2 อนุมัติแล้ว $dpj->dpj_us_approve = $this->session->userdata('UsID'); // รหัสผู้เสนอโครงการ/กิจกรรม $dpj->dpj_date_approve = date('Y-m-d'); // วันที่เสนอโครงการ/กิจกรรม $dpj->dpj_id = $dpj_id;
$dpj->approve_dpj();
redirect($this->config->item('sa_folder').'project/approve_project'); }
function detail_dpj() { $id = $this->input->post('dpj_id'); $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj;
$data['qu_mpj'] = ''; $dpj->dpj_id = $id; $data['qu_dpj'] = $dpj->get_join_by_key(); if($data['qu_dpj']->num_rows()>0){ $rs_dpj = $data['qu_dpj']->row(); if($rs_dpj->dpj_mpj_id!=0){ $dpj->dpj_id = $rs_dpj->dpj_mpj_id; $qu_mpj = $dpj->get_by_key(); $data['qu_mpj'] = $qu_mpj; } }
$this->load->model($this->config->item('sa_folder').'sa_attribute_model','atb'); $atb = $this->atb; $data['qu_atb'] = $atb->qu_mpj($id);
$this->load->model($this->config->item('sa_folder').'sa_integration_model','itg'); $itg = $this->itg; $data['qu_itg'] = $itg->qu_mpj($id);
$this->load->model($this->config->item('sa_folder').'sa_indicator_model','ind'); $ind = $this->ind; $ind->ind_mpj_id = $id;//$mpj->mpj_id; $data['rs_ind'] = $ind->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_strategic_project_model','stp'); $stp = $this->stp; $stp->stp_mpj_id = $id;//$mpj->mpj_id; $data['qu_stp'] = $stp->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_co_owner_proj_model','cop'); $cop = $this->cop; $cop->cop_mpj_id = $id; $data['rs_co'] = $cop->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_integration_course_model','igc'); $igc = $this->igc; $igc->igc_mjp_id = $id; $data['rs_igc'] = $igc->get_by_mpj();
$dpj->dpj_mpj_id = $id; $data['rs_acp'] = $dpj->getByMpj();
$this->load->model($this->config->item('sa_folder').'sa_planbudget_model','pb'); $pb = $this->pb; $pb->pb_pl_id = $id; $data['qu_sb'] = $pb->qu_joinsb();
$this->load->model($this->config->item('sa_folder').'sa_target_group_model','tg'); $tg = $this->tg;
$this->load->model($this->config->item('sa_folder').'sa_vehicle_club_model','vc'); $vc = $this->vc;
$tg->tg_dpj_id = $id; $data['rs_tg'] = $tg->get_by_dpj();
$data['vc'] = $vc;
$this->output_popup("v_detail_dpj", $data); }
function conclude_project() { if($this->input->post('year')){ $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj; $dpj->dpj_bgY = $this->input->post('year'); $data['rs_dpj'] = $dpj->get_data_relation(); echo $this->view("v_conclude_project", $data); }else{ $this->load->model($this->config->item('sa_folder').'sa_initialbudget_model','ib'); if ($this->ib->get_all()->num_rows()) { $data['qu_ib'] = $this->ib->get_options('n'); $data['yr'] = 1; } else { $data['qu_ib'] = $this->ib->get_options_noyear(); $data['yr'] = 0; } $this->output("v_conclude_project", $data); } }
function detail_conclude_dpj() { $id = $this->input->post('dpj_id'); $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj;
$data['qu_mpj'] = ''; $dpj->dpj_id = $id; $data['qu_dpj'] = $dpj->get_join_by_key(); if($data['qu_dpj']->num_rows()>0){ $rs_dpj = $data['qu_dpj']->row(); if($rs_dpj->dpj_mpj_id!=0){ $dpj->dpj_id = $rs_dpj->dpj_mpj_id; $qu_mpj = $dpj->get_by_key(); $data['qu_mpj'] = $qu_mpj; } }
$this->load->model($this->config->item('sa_folder').'sa_attribute_model','atb'); $atb = $this->atb; $data['qu_atb'] = $atb->qu_mpj($id);
$this->load->model($this->config->item('sa_folder').'sa_integration_model','itg'); $itg = $this->itg; $data['qu_itg'] = $itg->qu_mpj($id);
$this->load->model($this->config->item('sa_folder').'sa_indicator_model','ind'); $ind = $this->ind; $ind->ind_mpj_id = $id;//$mpj->mpj_id; $data['rs_ind'] = $ind->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_strategic_project_model','stp'); $stp = $this->stp; $stp->stp_mpj_id = $id;//$mpj->mpj_id; $data['qu_stp'] = $stp->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_co_owner_proj_model','cop'); $cop = $this->cop; $cop->cop_mpj_id = $id; $data['rs_co'] = $cop->get_by_mpj();
$this->load->model($this->config->item('sa_folder').'sa_integration_course_model','igc'); $igc = $this->igc; $igc->igc_mjp_id = $id; $data['rs_igc'] = $igc->get_by_mpj();
$dpj->dpj_mpj_id = $id; $data['rs_acp'] = $dpj->getByMpj();
$this->load->model($this->config->item('sa_folder').'sa_planbudget_model','pb'); $pb = $this->pb; $pb->pb_pl_id = $id; $data['qu_sb'] = $pb->qu_joinsb();
$this->load->model($this->config->item('sa_folder').'sa_target_group_model','tg'); $tg = $this->tg; $tg->tg_dpj_id = $id; $data['rs_tg'] = $tg->get_by_dpj();
$this->output("v_detail_conclude_dpj", $data); }
function add_conclude_dpj() { $this->load->model($this->config->item('sa_folder').'sa_detail_project_model','dpj'); $dpj = $this->dpj;
$dpj->dpj_conclude = $this->input->post('dpj_conclude'); $dpj->dpj_id = $this->input->post('dpj_id');
$dpj->conclude_dpj(); $this->session->set_flashdata('message', '<font color="#669900">บันทึกผลการดำเนินงานเรียบร้อยแล้ว</font>'); redirect($this->config->item('sa_folder').'project/conclude_project'); } }
|