<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Icd_rep_ctrl extends user_icd_index {
 
	
	public function __construct(){
		parent::__construct(); 
		$data = array();
		$this->load->model('admin_model');
		$this->load->model('report_model');
	}
	 
	 
	/*----------------- load local report_search_list page -----------------*/
	public function icd_rep_search($rep_type=""){		
		$data['sdata'] 				= array(); 			
		$data['subview'] 			= 'icd/icd_reports/icd_report_search';
		$data['active_cls'] 		= 'irep_cls';
		
		$data['url_list'] 			= $this->admin_model->get_result_array_with_one_where('user_role_list','url_status','1');	
		$data['sdata']['rep_type']	= $rep_type; 
		$data['sdata']['rep_result']= array(); 
		
		// if($this->user['panel_type']=='9'){
		// 	$data['subview'] 	= 'icd/token_type/local/l_geo_local_list';
		// }else if($this->user['panel_type']=='10'){
		// 	$data['subview'] 	= 'icd/token_type/local/l_igeo_local_list';
		// }else if($this->user['panel_type']=='11'){
		// 	$data['subview'] 	= 'icd/token_type/local/l_iao_local_list'; 
		// }else if($this->user['panel_type']=='12'){
		// 	$data['subview'] 	= 'icd/token_type/local/l_iomo_local_list';
		// }	


		// echo $this->db->last_query(); return;
		if($this->user['panel_type']=='0'){
			$this->load->view('common/icd_sidepanel',$data); 			
		}else if($this->user['panel_type']=='20'){
			$this->load->view('icd/common/icd_sidepanel',$data); 			
		}
	}
	

	/*----------------- get report search details page -----------------*/
	public function rep_search_details(){		
		$data['sdata'] 				= array(); 			
		$data['subview'] 			= 'icd/icd_reports/icd_report_search';
		$data['active_cls'] 		= 'irep_cls';
		
		$data['url_list'] 			= $this->admin_model->get_result_array_with_one_where('user_role_list','url_status','1');	
		$data['sdata']['rep_type']	= $this->input->post('rep_type'); 
		$data['sdata']['rep_form_data']	= array(); 

		if($data['sdata']['rep_type']=='icd'){
		
			$date_in	= $this->input->post('date_in'); 
			$date_out	= $this->input->post('date_out'); 
			$con_no		= $this->input->post('con_no'); 
			$bill_la_no	= $this->input->post('bill_la_no'); 
			$ref_no		= $this->input->post('ref_no'); 
			$tok_no		= $this->input->post('tok_no'); 
			$ge_no		= $this->input->post('ge_no'); 
			// var_dump($_POST);return;

			foreach($_POST as $post_key=>$post_rows){ 
				$data['sdata']['rep_form_data'][$post_key] = $this->input->post($post_key); 
			}
			// var_dump($data['sdata']['rep_form_data']);return;
			$data['sdata']['rep_result']= array();
			if(isset($date_in) ||isset($date_out) ||isset($con_no) ||isset($bill_la_no) ||isset($ref_no) ||isset($tok_no) || isset($ge_no)){
				$data['sdata']['rep_result']= $this->report_model->get_icd_report_search($date_in,$date_out,$con_no,$bill_la_no,$ref_no,$tok_no,$ge_no);
			}
			// echo $this->db->last_query();return;
		}else{
			$data['sdata']['rep_result']= array();
		}


		// echo $this->db->last_query(); return;
		if($this->user['panel_type']=='0'){
			$this->load->view('common/icd_sidepanel',$data); 			
		}else if($this->user['panel_type']=='20'){
			$this->load->view('icd/common/icd_sidepanel',$data); 			
		}

	}

	
 

 
	
	
	
}
