<?php



class Icd_model extends CI_Model{	

	public function __construct(){
		//database loading
		$this->load->database();
	}
	
	public function get_user_name($l_id)
	{
        $this->db->select('*')
        ->from('login');
        $this->db->where('i_user_id',$l_id);
        $query=$this->db->get(); 
        return $query->result_array();
	}
	
	public function get_icd_details_list($idl_id='',$idl_mceo_status='',$idl_pteo_status='',$idl_ppo_status='',$idl_feao_status='',$idl_fnl_update_feao_status='',$idl_tno_completed_status='',$idl_geo_completed_status=''){
		$this->db->select('*')
				->from('icd_details_list')
				->join('container_status_list','container_status_list.csl_id=icd_details_list.idl_csl_id')
				->join('cargo_type_list','cargo_type_list.ctl_id=icd_details_list.idl_ctl_id')
				->join('payment_agency_list','payment_agency_list.pal_id=icd_details_list.idl_pal_id');
		if($idl_mceo_status!=''){
			$this->db->where('idl_mceo_status',$idl_mceo_status);
		}
		if($idl_pteo_status!=''){
			$this->db->where('idl_pteo_status',$idl_pteo_status);
		}
		if($idl_ppo_status!=''){
			$this->db->where('idl_ppo_status',$idl_ppo_status);
		}
		if($idl_feao_status!=''){
			$this->db->where('idl_feao_status',$idl_feao_status);
		}
		if($idl_fnl_update_feao_status!=''){
			$this->db->where('idl_fnl_update_feao_status',$idl_fnl_update_feao_status);
		}
		if($idl_tno_completed_status!=''){
			$this->db->where('idl_tno_completed_status',$idl_tno_completed_status);
		}
		if($idl_geo_completed_status!=''){
			$this->db->where('idl_geo_completed_status',$idl_geo_completed_status);
		}
		
		
		if($idl_id!=''){
			$this->db->where('idl_id',$idl_id);
			$query=$this->db->get();
			return $query->row_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}

	public function get_icdl_details_list($idl_id='',$icdl_id='',$icdl_tno_status='',$icdl_cvo_status='',$icdl_geo_status=''){
		$this->db->select('*')
				->from('icd_container_details_list')
				->join('icd_details_list','icd_details_list.idl_id=icd_container_details_list.icdl_idl_id')
				->join('icd_service_list','icd_service_list.isl_id=icd_container_details_list.icdl_isl_id','left')
				->join('currency_list','currency_list.cul_id=icd_container_details_list.icdl_cul_id','left');
		if($idl_id!=''){
			$this->db->where('idl_id',$idl_id);
		}
		if($icdl_tno_status!=''){
			$this->db->where('icdl_tno_status',$icdl_tno_status);
		}
 
		if($icdl_cvo_status!=''){
			$this->db->where('icdl_cvo_status',$icdl_cvo_status);
		}
		if($icdl_geo_status!=''){
			$this->db->where('icdl_geo_status',$icdl_geo_status);
		}
		
		if($icdl_id!=''){
			$this->db->where('icdl_id',$icdl_id);
			$query=$this->db->get();
			return $query->row_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}


	public function get_icd_igedl_details_list($idl_id='',$igedl_id='',$token_no='',$igedl_tno_status='',$igedl_tno_iomo_status='',$igedl_geo_status='',$igedl_iao_status='',$igedl_geo_printout_status='',$igedl_igeo_status='',$igedl_igeo_gate_out_pass_status='',$igedl_iomo_gop_autho_status='',$igedl_iao_print_out_status='',$igedl_verify_cvo_status='',$igedl_verify_print_cvo_status='',$igedl_cvo_status='',$igedl_cvao_status='',$igedl_fnl_cvao_status='',$igedl_cro_status='',$igedl_fnl_update_cro_status='',$igedl_crao_status='',$igedl_ico_geo_status='',$idl_csl_id='',$igedl_token_type='',$igedl_icoa_iao_status='',$igedl_ico_print_out_geo_status='',$igedl_icolg_igeo_status='',$igedl_igpoelg_igeo_status='',$igedl_igpoal_iomo_status='',$igedl_igpoal_igeo_status='',$igedl_iolelmg_geo_status='',$igedl_iolelmg_iao_status='',$igedl_iolelmg_proceed_geo_sataus='',$igedl_ioleig_igeo_status='',$igedl_igpvole_igeo_status='',$igedl_igpvolel_iomo_status='',$igedl_igpvolel_iao_status='',$igedl_iovgete_geo_status='',$igedl_iovgete_igeo_status='',$igedl_iovgete_proceed_geo_status='',$igedl_iovgete_aproove_iao_status='',$igedl_gpote_igeo_status='',$igedl_gpote_aproove_iomo_status='',$igedl_igvpote_igeo_status='',$igedl_otm_geo_status='',$igedl_otm_iao_status='',$igedl_otm_proceed_geo_status='',$igedl_otm_igeo_status='',$igedl_tm_igeo_status='',$igedl_tm_iomo_status='',$igedl_tm_print_igeo_status=''){
		$this->db->select('*')
				->from('icd_gate_entry_details_list')
				->join('icd_details_list','icd_details_list.idl_id=icd_gate_entry_details_list.igedl_idl_id')
				->join('container_status_list','container_status_list.csl_id=icd_details_list.idl_csl_id')
				->join('cargo_type_list','cargo_type_list.ctl_id=icd_details_list.idl_ctl_id')
				->join('payment_agency_list','payment_agency_list.pal_id=icd_details_list.idl_pal_id')
				->join('agent_list','agent_list.agl_id=icd_gate_entry_details_list.igedl_agl_id','Left')
				->join('login','login.l_id=icd_gate_entry_details_list.igedl_agl_id','Left')
				->join('importer_list','importer_list.iml_id=icd_gate_entry_details_list.igedl_importer_name','Left');
				
		
		if($idl_id!=''){
			$this->db->where('idl_id',$idl_id);
		}
		if($igedl_tno_status!=''){
			$this->db->where('igedl_tno_status',$igedl_tno_status);
		}
		if($igedl_tno_iomo_status!=''){
			$this->db->where('igedl_tno_iomo_status',$igedl_tno_iomo_status);
		}
		if($igedl_geo_status!=''){
			$this->db->where('igedl_geo_status',$igedl_geo_status);
		}
		if($igedl_iao_status!=''){
			$this->db->where('igedl_iao_status',$igedl_iao_status);
		}
		if($igedl_geo_printout_status!=''){
			$this->db->where('igedl_geo_printout_status',$igedl_geo_printout_status);
		}
		if($igedl_igeo_status!=''){
			$this->db->where('igedl_igeo_status',$igedl_igeo_status);
		}
		if($igedl_igeo_gate_out_pass_status!=''){
			$this->db->where('igedl_igeo_gate_out_pass_status',$igedl_igeo_gate_out_pass_status);
		}
		if($igedl_iomo_gop_autho_status!=''){
			$this->db->where('igedl_iomo_gop_autho_status',$igedl_iomo_gop_autho_status);
		}
		if($igedl_iao_print_out_status!=''){
			$this->db->where('igedl_iao_print_out_status',$igedl_iao_print_out_status);
		}
		if($igedl_verify_cvo_status!=''){
			$this->db->where('igedl_verify_cvo_status',$igedl_verify_cvo_status);
		}
		if($igedl_verify_print_cvo_status!=''){
			$this->db->where('igedl_verify_print_cvo_status',$igedl_verify_print_cvo_status);
		}
		if($igedl_cvo_status!=''){
			$this->db->where('igedl_cvo_status',$igedl_cvo_status);
		}
		if($igedl_cvao_status!=''){
			$this->db->where('igedl_cvao_status',$igedl_cvao_status);
		}
		if($igedl_fnl_cvao_status!=''){
			$this->db->where('igedl_fnl_cvao_status',$igedl_fnl_cvao_status);
		}
		if($igedl_cro_status!=''){
			$this->db->where('igedl_cro_status',$igedl_cro_status);
		}
		if($igedl_fnl_update_cro_status!=''){
			$this->db->where('igedl_fnl_update_cro_status',$igedl_fnl_update_cro_status);
		}
		if($igedl_crao_status!=''){
			$this->db->where('igedl_crao_status',$igedl_crao_status);
		}
		if($igedl_ico_geo_status!=''){
			$this->db->where('igedl_ico_geo_status',$igedl_ico_geo_status);
		}
		if($idl_csl_id!=''){
			$this->db->where('idl_csl_id',$idl_csl_id);
		}
		if($igedl_token_type!=''){
			$this->db->where('igedl_token_type',$igedl_token_type);
		}
		if($igedl_icoa_iao_status!=''){
			$this->db->where('igedl_icoa_iao_status',$igedl_icoa_iao_status);
		}
		if($igedl_ico_print_out_geo_status!=''){
			$this->db->where('igedl_ico_print_out_geo_status',$igedl_ico_print_out_geo_status);
		}
		if($igedl_icolg_igeo_status!=''){
			$this->db->where('igedl_icolg_igeo_status',$igedl_icolg_igeo_status);
		}
		if($igedl_igpoelg_igeo_status!=''){
			$this->db->where('igedl_igpoelg_igeo_status',$igedl_igpoelg_igeo_status);
		}
		if($igedl_igpoal_iomo_status!=''){
			$this->db->where('igedl_igpoal_iomo_status',$igedl_igpoal_iomo_status);
		}
		if($igedl_igpoal_igeo_status!=''){
			$this->db->where('igedl_igpoal_igeo_status',$igedl_igpoal_igeo_status);
		}
		if($igedl_iolelmg_geo_status!=''){
			$this->db->where('igedl_iolelmg_geo_status',$igedl_iolelmg_geo_status);
		}
		if($igedl_iolelmg_iao_status!=''){
			$this->db->where('igedl_iolelmg_iao_status',$igedl_iolelmg_iao_status);
		}
		if($igedl_iolelmg_proceed_geo_sataus!=''){
			$this->db->where('igedl_iolelmg_proceed_geo_sataus',$igedl_iolelmg_proceed_geo_sataus);
		}
		if($igedl_ioleig_igeo_status!=''){
			$this->db->where('igedl_ioleig_igeo_status',$igedl_ioleig_igeo_status);
		}
		if($igedl_igpvole_igeo_status!=''){
			$this->db->where('igedl_igpvole_igeo_status',$igedl_igpvole_igeo_status);
		}
		if($igedl_igpvolel_iomo_status!=''){
			$this->db->where('igedl_igpvolel_iomo_status',$igedl_igpvolel_iomo_status);
		}
		if($igedl_igpvolel_iao_status!=''){
			$this->db->where('igedl_igpvolel_iao_status',$igedl_igpvolel_iao_status);
		}
		if($igedl_iovgete_geo_status!=''){
			$this->db->where('igedl_iovgete_geo_status',$igedl_iovgete_geo_status);
		}
		if($igedl_iovgete_igeo_status!=''){
			$this->db->where('igedl_iovgete_igeo_status',$igedl_iovgete_igeo_status);
		}
		if($igedl_iovgete_proceed_geo_status!=''){
			$this->db->where('igedl_iovgete_proceed_geo_status',$igedl_iovgete_proceed_geo_status);
		}
		if($igedl_iovgete_aproove_iao_status!=''){
			$this->db->where('igedl_iovgete_aproove_iao_status',$igedl_iovgete_aproove_iao_status);
		}
		if($igedl_gpote_igeo_status!=''){
			$this->db->where('igedl_gpote_igeo_status',$igedl_gpote_igeo_status);
		}
		if($igedl_gpote_aproove_iomo_status!=''){
			$this->db->where('igedl_gpote_aproove_iomo_status',$igedl_gpote_aproove_iomo_status);
		}
		if($igedl_igvpote_igeo_status!=''){
			$this->db->where('igedl_igvpote_igeo_status',$igedl_igvpote_igeo_status);
		}
		if($igedl_otm_geo_status!=''){
			$this->db->where('igedl_otm_geo_status',$igedl_otm_geo_status);
		}
		if($igedl_otm_iao_status!=''){
			$this->db->where('igedl_otm_iao_status',$igedl_otm_iao_status);
		}
		if($igedl_otm_proceed_geo_status!=''){
			$this->db->where('igedl_otm_proceed_geo_status',$igedl_otm_proceed_geo_status);
		}
		if($igedl_otm_igeo_status!=''){
			$this->db->where('igedl_otm_igeo_status',$igedl_otm_igeo_status);
		}
		if($igedl_tm_igeo_status!=''){
			$this->db->where('igedl_tm_igeo_status',$igedl_tm_igeo_status);
		}
		if($igedl_tm_iomo_status!=''){
			$this->db->where('igedl_tm_iomo_status',$igedl_tm_iomo_status);
		}
		if($igedl_tm_print_igeo_status!=''){
			$this->db->where('igedl_tm_print_igeo_status',$igedl_tm_print_igeo_status);
		}
		
		
		
		if($igedl_id!=''){
			$this->db->where('igedl_id',$igedl_id);
			$query=$this->db->get();
		//	print_r($this->db);exit;
			return $query->row_array();
			// 			return $query->result_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}
	
	
	public function get_icd_igedl_details_list_print($idl_id='',$igedl_id='',$token_no='',$igedl_tno_status='',$igedl_tno_iomo_status='',$igedl_geo_status='',$igedl_iao_status='',$igedl_geo_printout_status='',$igedl_igeo_status='',$igedl_igeo_gate_out_pass_status='',$igedl_iomo_gop_autho_status='',$igedl_iao_print_out_status='',$igedl_verify_cvo_status='',$igedl_verify_print_cvo_status='',$igedl_cvo_status='',$igedl_cvao_status='',$igedl_fnl_cvao_status='',$igedl_cro_status='',$igedl_fnl_update_cro_status='',$igedl_crao_status='',$igedl_ico_geo_status='',$idl_csl_id='',$igedl_token_type='',$igedl_icoa_iao_status='',$igedl_ico_print_out_geo_status='',$igedl_icolg_igeo_status='',$igedl_igpoelg_igeo_status='',$igedl_igpoal_iomo_status='',$igedl_igpoal_igeo_status='',$igedl_iolelmg_geo_status='',$igedl_iolelmg_iao_status='',$igedl_iolelmg_proceed_geo_sataus='',$igedl_ioleig_igeo_status='',$igedl_igpvole_igeo_status='',$igedl_igpvolel_iomo_status='',$igedl_igpvolel_iao_status='',$igedl_iovgete_geo_status='',$igedl_iovgete_igeo_status='',$igedl_iovgete_proceed_geo_status='',$igedl_iovgete_aproove_iao_status='',$igedl_gpote_igeo_status='',$igedl_gpote_aproove_iomo_status='',$igedl_igvpote_igeo_status='',$igedl_otm_geo_status='',$igedl_otm_iao_status='',$igedl_otm_proceed_geo_status='',$igedl_otm_igeo_status='',$igedl_tm_igeo_status='',$igedl_tm_iomo_status='',$igedl_tm_print_igeo_status=''){
		$this->db->select('*')
				->from('icd_gate_entry_details_list')
				->join('icd_details_list','icd_details_list.idl_id=icd_gate_entry_details_list.igedl_idl_id')
				->join('container_status_list','container_status_list.csl_id=icd_details_list.idl_csl_id')
				->join('cargo_type_list','cargo_type_list.ctl_id=icd_details_list.idl_ctl_id')
				->join('payment_agency_list','payment_agency_list.pal_id=icd_details_list.idl_pal_id')
				->join('agent_list','agent_list.agl_id=icd_gate_entry_details_list.igedl_agl_id','Left')
				->join('login','login.l_id=icd_gate_entry_details_list.igedl_agl_id','Left')
				->join('importer_list','importer_list.iml_id=icd_gate_entry_details_list.igedl_importer_name','Left');
				
		
		if($idl_id!=''){
			$this->db->where('idl_id',$idl_id);
		}
		if($igedl_tno_status!=''){
			$this->db->where('igedl_tno_status',$igedl_tno_status);
		}
		if($igedl_tno_iomo_status!=''){
			$this->db->where('igedl_tno_iomo_status',$igedl_tno_iomo_status);
		}
		if($igedl_geo_status!=''){
			$this->db->where('igedl_geo_status',$igedl_geo_status);
		}
		if($igedl_iao_status!=''){
			$this->db->where('igedl_iao_status',$igedl_iao_status);
		}
		if($igedl_geo_printout_status!=''){
			$this->db->where('igedl_geo_printout_status',$igedl_geo_printout_status);
		}
		if($igedl_igeo_status!=''){
			$this->db->where('igedl_igeo_status',$igedl_igeo_status);
		}
		if($igedl_igeo_gate_out_pass_status!=''){
			$this->db->where('igedl_igeo_gate_out_pass_status',$igedl_igeo_gate_out_pass_status);
		}
		if($igedl_iomo_gop_autho_status!=''){
			$this->db->where('igedl_iomo_gop_autho_status',$igedl_iomo_gop_autho_status);
		}
		if($igedl_iao_print_out_status!=''){
			$this->db->where('igedl_iao_print_out_status',$igedl_iao_print_out_status);
		}
		if($igedl_verify_cvo_status!=''){
			$this->db->where('igedl_verify_cvo_status',$igedl_verify_cvo_status);
		}
		if($igedl_verify_print_cvo_status!=''){
			$this->db->where('igedl_verify_print_cvo_status',$igedl_verify_print_cvo_status);
		}
		if($igedl_cvo_status!=''){
			$this->db->where('igedl_cvo_status',$igedl_cvo_status);
		}
		if($igedl_cvao_status!=''){
			$this->db->where('igedl_cvao_status',$igedl_cvao_status);
		}
		if($igedl_fnl_cvao_status!=''){
			$this->db->where('igedl_fnl_cvao_status',$igedl_fnl_cvao_status);
		}
		if($igedl_cro_status!=''){
			$this->db->where('igedl_cro_status',$igedl_cro_status);
		}
		if($igedl_fnl_update_cro_status!=''){
			$this->db->where('igedl_fnl_update_cro_status',$igedl_fnl_update_cro_status);
		}
		if($igedl_crao_status!=''){
			$this->db->where('igedl_crao_status',$igedl_crao_status);
		}
		if($igedl_ico_geo_status!=''){
			$this->db->where('igedl_ico_geo_status',$igedl_ico_geo_status);
		}
		if($idl_csl_id!=''){
			$this->db->where('idl_csl_id',$idl_csl_id);
		}
		if($igedl_token_type!=''){
			$this->db->where('igedl_token_type',$igedl_token_type);
		}
		if($igedl_icoa_iao_status!=''){
			$this->db->where('igedl_icoa_iao_status',$igedl_icoa_iao_status);
		}
		if($igedl_ico_print_out_geo_status!=''){
			$this->db->where('igedl_ico_print_out_geo_status',$igedl_ico_print_out_geo_status);
		}
		if($igedl_icolg_igeo_status!=''){
			$this->db->where('igedl_icolg_igeo_status',$igedl_icolg_igeo_status);
		}
		if($igedl_igpoelg_igeo_status!=''){
			$this->db->where('igedl_igpoelg_igeo_status',$igedl_igpoelg_igeo_status);
		}
		if($igedl_igpoal_iomo_status!=''){
			$this->db->where('igedl_igpoal_iomo_status',$igedl_igpoal_iomo_status);
		}
		if($igedl_igpoal_igeo_status!=''){
			$this->db->where('igedl_igpoal_igeo_status',$igedl_igpoal_igeo_status);
		}
		if($igedl_iolelmg_geo_status!=''){
			$this->db->where('igedl_iolelmg_geo_status',$igedl_iolelmg_geo_status);
		}
		if($igedl_iolelmg_iao_status!=''){
			$this->db->where('igedl_iolelmg_iao_status',$igedl_iolelmg_iao_status);
		}
		if($igedl_iolelmg_proceed_geo_sataus!=''){
			$this->db->where('igedl_iolelmg_proceed_geo_sataus',$igedl_iolelmg_proceed_geo_sataus);
		}
		if($igedl_ioleig_igeo_status!=''){
			$this->db->where('igedl_ioleig_igeo_status',$igedl_ioleig_igeo_status);
		}
		if($igedl_igpvole_igeo_status!=''){
			$this->db->where('igedl_igpvole_igeo_status',$igedl_igpvole_igeo_status);
		}
		if($igedl_igpvolel_iomo_status!=''){
			$this->db->where('igedl_igpvolel_iomo_status',$igedl_igpvolel_iomo_status);
		}
		if($igedl_igpvolel_iao_status!=''){
			$this->db->where('igedl_igpvolel_iao_status',$igedl_igpvolel_iao_status);
		}
		if($igedl_iovgete_geo_status!=''){
			$this->db->where('igedl_iovgete_geo_status',$igedl_iovgete_geo_status);
		}
		if($igedl_iovgete_igeo_status!=''){
			$this->db->where('igedl_iovgete_igeo_status',$igedl_iovgete_igeo_status);
		}
		if($igedl_iovgete_proceed_geo_status!=''){
			$this->db->where('igedl_iovgete_proceed_geo_status',$igedl_iovgete_proceed_geo_status);
		}
		if($igedl_iovgete_aproove_iao_status!=''){
			$this->db->where('igedl_iovgete_aproove_iao_status',$igedl_iovgete_aproove_iao_status);
		}
		if($igedl_gpote_igeo_status!=''){
			$this->db->where('igedl_gpote_igeo_status',$igedl_gpote_igeo_status);
		}
		if($igedl_gpote_aproove_iomo_status!=''){
			$this->db->where('igedl_gpote_aproove_iomo_status',$igedl_gpote_aproove_iomo_status);
		}
		if($igedl_igvpote_igeo_status!=''){
			$this->db->where('igedl_igvpote_igeo_status',$igedl_igvpote_igeo_status);
		}
		if($igedl_otm_geo_status!=''){
			$this->db->where('igedl_otm_geo_status',$igedl_otm_geo_status);
		}
		if($igedl_otm_iao_status!=''){
			$this->db->where('igedl_otm_iao_status',$igedl_otm_iao_status);
		}
		if($igedl_otm_proceed_geo_status!=''){
			$this->db->where('igedl_otm_proceed_geo_status',$igedl_otm_proceed_geo_status);
		}
		if($igedl_otm_igeo_status!=''){
			$this->db->where('igedl_otm_igeo_status',$igedl_otm_igeo_status);
		}
		if($igedl_tm_igeo_status!=''){
			$this->db->where('igedl_tm_igeo_status',$igedl_tm_igeo_status);
		}
		if($igedl_tm_iomo_status!=''){
			$this->db->where('igedl_tm_iomo_status',$igedl_tm_iomo_status);
		}
		if($igedl_tm_print_igeo_status!=''){
			$this->db->where('igedl_tm_print_igeo_status',$igedl_tm_print_igeo_status);
		}
		
		
		
		if($igedl_id!=''){
			$this->db->where('igedl_id',$igedl_id);
			$query=$this->db->get();
		//	print_r($this->db);exit;
			//return $query->row_array();
			return $query->result_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}


	public function get_icdl_iidl_details_list($icdl_id='',$igedl_id='',$iidl_id='',$icdl_tno_status='',$icdl_cvo_status=''){

		$this->db->select('*')
				->from('igedl_icdl_details_list')
				->join('icd_gate_entry_details_list','icd_gate_entry_details_list.igedl_id=igedl_icdl_details_list.iidl_igedl_id')
				->join('icd_container_details_list','icd_container_details_list.icdl_id=igedl_icdl_details_list.iidl_icdl_id')
				->join('transporter_list','transporter_list.tl_id=icd_container_details_list.icdl_transporter','left')
				
				->join('icd_details_list','icd_details_list.idl_id=icd_container_details_list.icdl_idl_id')
				->join('icd_service_list','icd_service_list.isl_id=icd_container_details_list.icdl_isl_id','left')
				->join('currency_list','currency_list.cul_id=icd_container_details_list.icdl_cul_id','left');
				
		

		if($igedl_id!=''){
			$this->db->where('igedl_id',$igedl_id);
		}
		if($icdl_tno_status!=''){
			$this->db->where('icdl_tno_status',$icdl_tno_status);
		}
		if($icdl_cvo_status!=''){
			$this->db->where('icdl_cvo_status',$icdl_cvo_status);
		}
		
		if($icdl_id!=''){
			$this->db->where('icdl_id',$icdl_id);
			$query=$this->db->get();
			return $query->row_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}

	public function get_icdl_itml_details_list($itml_id='',$igetl_id='',$idl_id=''){

		$this->db->select('*')
				->from('icd_transit_material_list');
		

		if($igetl_id!=''){
			$this->db->where('itml_igetl_id',$igetl_id);
		}
		if($idl_id!=''){
			$this->db->where('itml_idl_id',$idl_id);
		}
		
		if($itml_id!=''){
			$this->db->where('itml_id',$itml_id);
			$query=$this->db->get();
			return $query->row_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}


	public function get_icdl_igetl_details_list($idl_id='',$igedl_id='',$igetl_id='',$token_no='',$idl_csl_id='',$igetl_token_type='',$igedl_cro_status='',$igetl_cro_status='',$igetl_fnl_update_cro_status='',$igetl_crao_status='',$igetl_ico_geo_status='',$igetl_icoa_iao_status='',$igetl_ico_print_out_geo_status='',$igetl_icolg_igeo_status='',$igetl_igpoelg_igeo_status='',$igetl_igpoal_iomo_status='',$igetl_igpoal_igeo_status='',$igetl_iolelmg_geo_status='',$igetl_iolelmg_iao_status='',$igetl_iolelmg_proceed_geo_sataus='',$igetl_ioleig_igeo_status='',$igetl_igpvole_igeo_status='',$igetl_igpvolel_iomo_status='',$igetl_igpvolel_iao_status='',$igetl_iovgete_geo_status='',$igetl_iovgete_igeo_status='',$igetl_iovgete_proceed_geo_status='',$igetl_iovgete_aproove_iao_status='',$igetl_gpote_igeo_status='',$igetl_gpote_aproove_iomo_status='',$igetl_igvpote_igeo_status='',$igetl_otm_geo_status='',$igetl_otm_iao_status='',$igetl_otm_proceed_geo_status='',$igetl_otm_igeo_status='',$igetl_tm_igeo_status='',$igetl_tm_iomo_status='',$igetl_tm_print_igeo_status=''){
		$this->db->select('*')
				->from('icd_gate_entry_token_list')
				->join('icd_gate_entry_details_list','icd_gate_entry_details_list.igedl_id=icd_gate_entry_token_list.igetl_igedl_id')
				->join('icd_details_list','icd_details_list.idl_id=icd_gate_entry_details_list.igedl_idl_id')
				->join('container_status_list','container_status_list.csl_id=icd_details_list.idl_csl_id')
				->join('cargo_type_list','cargo_type_list.ctl_id=icd_details_list.idl_ctl_id')
				->join('payment_agency_list','payment_agency_list.pal_id=icd_details_list.idl_pal_id')
				->join('agent_list','agent_list.agl_id=icd_gate_entry_details_list.igedl_agl_id','Left')
				->join('transporter_list','transporter_list.tl_id=icd_gate_entry_token_list.igetl_transporter','left')
				->join('importer_list','importer_list.iml_id=icd_gate_entry_details_list.igedl_importer_name','Left');		

		
		
		if($idl_id!=''){
			$this->db->where('idl_id',$idl_id);
		}
		if($igedl_id!=''){
			$this->db->where('igedl_id',$igedl_id);
		}
		if($token_no!=''){
			$this->db->where('igetl_token_no',$token_no);
		}
		
		if($idl_csl_id!=''){
			$this->db->where('idl_csl_id',$idl_csl_id);
		}
		
		if($igetl_token_type!=''){
			$this->db->where('igetl_token_type',$igetl_token_type);
		}
		if($igedl_cro_status!=''){
			$this->db->where('igedl_cro_status',$igedl_cro_status);
		}
		if($igetl_cro_status!=''){
			$this->db->where('igetl_cro_status',$igetl_cro_status);
		}
		if($igetl_fnl_update_cro_status!=''){
			$this->db->where('igetl_fnl_update_cro_status',$igetl_fnl_update_cro_status);
		}
		if($igetl_crao_status!=''){
			$this->db->where('igetl_crao_status',$igetl_crao_status);
		}
		if($igetl_ico_geo_status!=''){
			$this->db->where('igetl_ico_geo_status',$igetl_ico_geo_status);
		}
		if($igetl_icoa_iao_status!=''){
			$this->db->where('igetl_icoa_iao_status',$igetl_icoa_iao_status);
		}
		if($igetl_ico_print_out_geo_status!=''){
			$this->db->where('igetl_ico_print_out_geo_status',$igetl_ico_print_out_geo_status);
		}
		if($igetl_icolg_igeo_status!=''){
			$this->db->where('igetl_icolg_igeo_status',$igetl_icolg_igeo_status);
		}
		if($igetl_igpoelg_igeo_status!=''){
			$this->db->where('igetl_igpoelg_igeo_status',$igetl_igpoelg_igeo_status);
		}
		if($igetl_igpoal_iomo_status!=''){
			$this->db->where('igetl_igpoal_iomo_status',$igetl_igpoal_iomo_status);
		}
		if($igetl_igpoal_igeo_status!=''){
			$this->db->where('igetl_igpoal_igeo_status',$igetl_igpoal_igeo_status);
		}
		if($igetl_iolelmg_geo_status!=''){
			$this->db->where('igetl_iolelmg_geo_status',$igetl_iolelmg_geo_status);
		}
		if($igetl_iolelmg_iao_status!=''){
			$this->db->where('igetl_iolelmg_iao_status',$igetl_iolelmg_iao_status);
		}
		if($igetl_iolelmg_proceed_geo_sataus!=''){
			$this->db->where('igetl_iolelmg_proceed_geo_sataus',$igetl_iolelmg_proceed_geo_sataus);
		}
		if($igetl_ioleig_igeo_status!=''){
			$this->db->where('igetl_ioleig_igeo_status',$igetl_ioleig_igeo_status);
		}
		if($igetl_igpvole_igeo_status!=''){
			$this->db->where('igetl_igpvole_igeo_status',$igetl_igpvole_igeo_status);
		}
		if($igetl_igpvolel_iomo_status!=''){
			$this->db->where('igetl_igpvolel_iomo_status',$igetl_igpvolel_iomo_status);
		}
		if($igetl_igpvolel_iao_status!=''){
			$this->db->where('igetl_igpvolel_iao_status',$igetl_igpvolel_iao_status);
		}



		if($igetl_iovgete_geo_status!=''){
			$this->db->where('igetl_iovgete_geo_status',$igetl_iovgete_geo_status);
		}
		if($igetl_iovgete_igeo_status!=''){
			$this->db->where('igetl_iovgete_igeo_status',$igetl_iovgete_igeo_status);
		}
		if($igetl_iovgete_proceed_geo_status!=''){
			$this->db->where('igetl_iovgete_proceed_geo_status',$igetl_iovgete_proceed_geo_status);
		}
		if($igetl_iovgete_aproove_iao_status!=''){
			$this->db->where('igetl_iovgete_aproove_iao_status',$igetl_iovgete_aproove_iao_status);
		}
		if($igetl_gpote_igeo_status!=''){
			$this->db->where('igetl_gpote_igeo_status',$igetl_gpote_igeo_status);
		}
		if($igetl_gpote_aproove_iomo_status!=''){
			$this->db->where('igetl_gpote_aproove_iomo_status',$igetl_gpote_aproove_iomo_status);
		}
		if($igetl_igvpote_igeo_status!=''){
			$this->db->where('igetl_igvpote_igeo_status',$igetl_igvpote_igeo_status);
		}
		if($igetl_otm_geo_status!=''){
			$this->db->where('igetl_otm_geo_status',$igetl_otm_geo_status);
		}
		if($igetl_otm_iao_status!=''){
			$this->db->where('igetl_otm_iao_status',$igetl_otm_iao_status);
		}
		if($igetl_otm_proceed_geo_status!=''){
			$this->db->where('igetl_otm_proceed_geo_status',$igetl_otm_proceed_geo_status);
		}
		if($igetl_otm_igeo_status!=''){
			$this->db->where('igetl_otm_igeo_status',$igetl_otm_igeo_status);
		}
		if($igetl_tm_igeo_status!=''){
			$this->db->where('igetl_tm_igeo_status',$igetl_tm_igeo_status);
		}
		if($igetl_tm_iomo_status!=''){
			$this->db->where('igetl_tm_iomo_status',$igetl_tm_iomo_status);
		}
		if($igetl_tm_print_igeo_status!=''){
			$this->db->where('igetl_tm_print_igeo_status',$igetl_tm_print_igeo_status);
		}
		

		
		
		if($igetl_id!=''){
			$this->db->where('igetl_id',$igetl_id);
			$query=$this->db->get();
			return $query->row_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}


	public function get_icdl_ivcl_details_list($icdl_id='',$igedl_id='',$ivcl_id='',$icdl_tno_status='',$icdl_cvo_status='',$icdl_cro_status=''){

		$this->db->select('*')
				->from('icd_verified_container_list')
				->join('icd_gate_entry_details_list','icd_gate_entry_details_list.igedl_id=icd_verified_container_list.ivcl_igedl_id')
				->join('icd_container_details_list','icd_container_details_list.icdl_id=icd_verified_container_list.ivcl_icdl_id')
				->join('transporter_list','transporter_list.tl_id=icd_container_details_list.icdl_transporter','left')		
				->join('icd_details_list','icd_details_list.idl_id=icd_container_details_list.icdl_idl_id')
				->join('icd_service_list','icd_service_list.isl_id=icd_container_details_list.icdl_isl_id','left')
				->join('currency_list','currency_list.cul_id=icd_container_details_list.icdl_cul_id','left');
				
		

		if($igedl_id!=''){
			$this->db->where('igedl_id',$igedl_id);
		}
		if($icdl_tno_status!=''){
			$this->db->where('icdl_tno_status',$icdl_tno_status);
		}
		if($icdl_cvo_status!=''){
			$this->db->where('icdl_cvo_status',$icdl_cvo_status);
		}
		if($icdl_cro_status!=''){
			$this->db->where('icdl_cro_status',$icdl_cro_status);
		}
		
		if($ivcl_id!=''){
			$this->db->where('ivcl_id',$ivcl_id);
			$query=$this->db->get();
			return $query->row_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}

	public function get_ivcl_verification_list($igedl_verify_print_cvo_status){

		$this->db->select('*')
				->from('icd_verified_container_list')
				->join('icd_gate_entry_details_list','icd_gate_entry_details_list.igedl_id=icd_verified_container_list.ivcl_igedl_id')
				->join('icd_container_details_list','icd_container_details_list.icdl_id=icd_verified_container_list.ivcl_icdl_id')
				->join('transporter_list','transporter_list.tl_id=icd_container_details_list.icdl_transporter','left')		
				->join('icd_details_list','icd_details_list.idl_id=icd_container_details_list.icdl_idl_id')
				->join('icd_service_list','icd_service_list.isl_id=icd_container_details_list.icdl_isl_id','left')
				->join('currency_list','currency_list.cul_id=icd_container_details_list.icdl_cul_id','left')
				->join('agent_list','agent_list.agl_id=icd_gate_entry_details_list.igedl_agl_id','Left')
				->join('importer_list','importer_list.iml_id=icd_gate_entry_details_list.igedl_importer_name','Left')
				
				
				->where('icdl_cvo_status','1')
				->where('icdl_container_cvo_delete','1')				
				->where('igedl_verify_cvo_status','1')
				->where('igedl_cvao_status','0');
				if($igedl_verify_print_cvo_status!=''){
					$this->db->where('igedl_verify_print_cvo_status',$igedl_verify_print_cvo_status);
						
				}
				
			$query=$this->db->get();
			return $query->result_array();
				
	}

	public function get_icdl_itncl_details_list($icdl_id='',$igetl_id='',$itncl_id='',$icdl_tno_status='',$icdl_cvo_status='',$icdl_cro_status=''){

		$this->db->select('*')
				->from('icd_token_no_container_list')
				->join('icd_gate_entry_token_list','icd_gate_entry_token_list.igetl_id=icd_token_no_container_list.itncl_igetl_id')
				->join('icd_gate_entry_details_list','icd_gate_entry_details_list.igedl_id=icd_gate_entry_token_list.igetl_igedl_id')
				->join('icd_container_details_list','icd_container_details_list.icdl_id=icd_token_no_container_list.itncl_icdl_id')
				->join('transporter_list','transporter_list.tl_id=icd_container_details_list.icdl_transporter','left')		
				->join('icd_details_list','icd_details_list.idl_id=icd_container_details_list.icdl_idl_id')
				->join('icd_service_list','icd_service_list.isl_id=icd_container_details_list.icdl_isl_id','left')
				->join('currency_list','currency_list.cul_id=icd_container_details_list.icdl_cul_id','left');
				
		

		if($icdl_id!=''){
			$this->db->where('icdl_id',$icdl_id);
		}
		if($igetl_id!=''){
			$this->db->where('igetl_id',$igetl_id);
		}
		if($icdl_tno_status!=''){
			$this->db->where('icdl_tno_status',$icdl_tno_status);
		}
		if($icdl_cvo_status!=''){
			$this->db->where('icdl_cvo_status',$icdl_cvo_status);
		}
		if($icdl_cro_status!=''){
			$this->db->where('icdl_cro_status',$icdl_cro_status);
		}
		
		if($itncl_id!=''){
			$this->db->where('itncl_id',$itncl_id);
			$query=$this->db->get();
			return $query->row_array();
		}				
		else{		
			$query=$this->db->get();
			return $query->result_array();
		}		
	}




	
	
	





	

	


	





}	

?>