From 60e2e80a8aa93e930d19623654591ecdab25fa82 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 21 Nov 2022 14:56:34 +0530 Subject: [PATCH] read excel State ID : ps --- api/application/helpers/readexceldata_helper.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/api/application/helpers/readexceldata_helper.php b/api/application/helpers/readexceldata_helper.php index dfcb0f50..4de91122 100644 --- a/api/application/helpers/readexceldata_helper.php +++ b/api/application/helpers/readexceldata_helper.php @@ -184,8 +184,13 @@ class readexceldata { $display = $address['address'].', '.$address['city'].', '.$address['state'].', '.$address['pincode']; - $pincode = $CI->PD_Model->selectCustomRecords(array('*'),array('pincode' => $address['pincode']),PINCODE); - $city = $CI->PD_Model->selectCustomRecords(array('*'),array('lower(name)' => strtolower($address['city'])),CITY); + $state = $CI->PD_Model->selectCustomRecords(array('*'),array('lower(name)' => strtolower($address['state'])),STATE); + if(is_array($state) && count($state)) + { $state_id = $state[0]['state_id']; + $pincode = $CI->PD_Model->selectCustomRecords(array('*'),array('pincode' => $address['pincode'],'fk_state_id'=>$state_id ),PINCODE); + $city = $CI->PD_Model->selectCustomRecords(array('*'),array('lower(name)' => strtolower($address['city']),'fk_state_id'=>$state_id),CITY); + } + // print_r($CI->db->last_query()); // $state = $CI->PD_Model->selectCustomRecords(array('*'),array('pincode' => $address['pincode']),PINCODE,1); $fields_to_insert = array('file_id' => SELF::$current_excel_file_id,'addressline' => $address['address']); @@ -295,7 +300,7 @@ class readexceldata $return_data = array(); unset($sheetData[1]); - // print_r($sheetData); + // print_r($sheetData); // die(); $main_applicant_column_name = ''; foreach ($sheetData as $key => $value)