selectRecords('m_list_of_masters'); } public function selectCustomMasterRecords($table_constant) { $master_tables_field_names = $this->config->item('master_tables_field_names'); $master_tables_pkid = $this->config->item('master_tables_pkid'); if($table_constant == 'PDLOCATIONAPPROACH' || $table_constant == 'PDOFFICERRECOMMENDATIONS') { $order = $master_tables_pkid[$table_constant]; $master_data = $this->db->SELECT('*')->FROM(constant($table_constant))->ORDER_BY('is_others')->ORDER_BY($order)->GET()->result_array(); return $master_data; } else { $order = $master_tables_field_names[$table_constant]; $master_data = $this->db->SELECT('*')->FROM(constant($table_constant))->WHERE('isactive',1)->ORDER_BY('is_others')->ORDER_BY($order)->GET()->result_array(); //echo count($master_data);die(); return $master_data; } // print_r($this->db->last_query()); // die(); } /** * This Function is used to Get The PD Team Related Datas for Listing */ // public function pdteamlist(){ // $result = $this->db->get(PDTEAM)->result_array(); // if(count($result) !=0){ // foreach($result as $key=> $r){ // $cities = $this->db->get_where(PDTEAMMAP,array('fk_team_id'=>$r['pdteam_id']))->result_array(); // array_push($result[$key],$cities); // } // } // return $result; // } public function pdteamlist(){ $result = $this->db->get(PDTEAM)->result_array(); if(count($result) !=0){ foreach($result as $key=> $r){ $cities = $this->db->get_where(PDTEAMCITY,array('fk_pdteam_id'=>$r['pdteam_id']))->result_array(); array_push($result[$key],$cities); } } return $result; } /** * This Function is used to inserting new Data * argument 1 '$city' = Which is get from Controller (cityid), * argument 2 '$teamid' = Which is get From COntroller (teamid), */ public function checkCityData($city,$teamid) { $this->db->select('PDTEAMCITY.fk_city_id'); $this->db->where('PDTEAMCITY.fk_pdteam_id',$teamid); $this->db->where('PDTEAMCITY.fk_city_id',$city); $result = $this->db->get(PDTEAMCITY.' as PDTEAMCITY')->result(); if(!empty($result)){} else { $this->db->insert(PDTEAMCITY, array('fk_city_id'=>$city,'fk_pdteam_id'=>$teamid)); } } /** * This Function is used to inserting new Data * argument 1 '$product' = Which is get from Controller (productid), * argument 2 '$teamid' = Which is get From COntroller (teamid), */ public function checkProductData($product,$teamid) { $this->db->select('PDTEAMPRODUCT.fk_product_id'); $this->db->where('PDTEAMPRODUCT.fk_pdteam_id',$teamid); $this->db->where('PDTEAMPRODUCT.fk_product_id',$product); $this->db->where('PDTEAMPRODUCT.isactive',1); $result = $this->db->get(PDTEAMPRODUCT.' as PDTEAMPRODUCT')->result(); if(!empty($result)){} else { $this->db->insert(PDTEAMPRODUCT, array('fk_product_id'=>$product,'fk_pdteam_id'=>$teamid)); } } /** * This Function is used to inserting new Data * argument 1 '$cs' = Which is get from Controller (Customersegmentid), * argument 2 '$teamid' = Which is get From COntroller (teamid), */ public function checkCustomerSegmentData($cs,$teamid) { $this->db->select('PDTEAMCUSTOMERSEGMENT.fk_cs_id'); $this->db->where('PDTEAMCUSTOMERSEGMENT.fk_pdteam_id',$teamid); $this->db->where('PDTEAMCUSTOMERSEGMENT.fk_cs_id',$cs); $this->db->where('PDTEAMCUSTOMERSEGMENT.isactive',1); $result = $this->db->get(PDTEAMCUSTOMERSEGMENT.' as PDTEAMCUSTOMERSEGMENT')->result(); if(!empty($result)) {} else { $this->db->insert(PDTEAMCUSTOMERSEGMENT, array('fk_cs_id'=>$cs,'fk_pdteam_id'=>$teamid)); } } /** * This Function is used to Delete The Datas * argument 1 '$record_data' = Which is get from Controller,Its Have Deleted datas * argument 2 '$table_name' = Which table have to delete * argument 3 '$where_condition_array'= Delete the Datas Based on condition * argument 4 '$print_query' = To Display The Queries */ public function deleteRecords($record_data = array(),$table_name,$where_condition_array = array(),$print_query = '') { $data = $this->db->delete($table_name,$record_data,$where_condition_array); if($print_query == 1) { print_r($this->db->last_query()); } return $data; } function getAppVersion($client = null) { $this->db->SELECT('version_info_id, version, release_notes'); $this->db->FROM(APP_VERSION_INFO); $this->db->ORDER_BY(APP_VERSION_INFOID,'desc'); if($client == 'MOB') { $this->db->LIMIT(1,0); } $data = $this->db->GET()->result_array(); //print_r($this->db->last_query());die(); return $data; } function getSMCTempAddresses($excel_file_id) { $columns = array('SMC_TEMP_ADDRESS.*',"concat(SMC_TEMP_ADDRESS.addressline,', ',CITY.name,', ',STATE.name,', ',PINCODE.pincode) as display",'CITY.name as city_name','STATE.name as state_name','PINCODE.pincode'); $table = SMC_TEMP_ADDRESS.' as SMC_TEMP_ADDRESS'; $where_condition_array = array('SMC_TEMP_ADDRESS.file_id' => $excel_file_id); $joins = array( array( 'table' => CITY. ' as CITY', 'condition' => 'SMC_TEMP_ADDRESS.city = CITY.city_id ', 'jointype' => 'INNER' ), array( 'table' => STATE. ' as STATE', 'condition' => 'SMC_TEMP_ADDRESS.state = STATE.state_id ', 'jointype' => 'INNER' ), array( 'table' => PINCODE. ' as PINCODE', 'condition' => 'SMC_TEMP_ADDRESS.pincode = PINCODE.pincode_id ', 'jointype' => 'INNER' ) ); return $result = $this->getJoinRecords($columns,$table,$joins,$where_condition_array); } }