$value) { $this->saveRecords($value,D_GENERAL_IND); } } if(isset($gen_data_dump['relationship_data'])) { foreach ($gen_data_dump['relationship_data'] as $key => $value) { $this->saveRecords($value,D_GEN_RELATIONSHIP); } } } function saveBusinessDUmpData($business_data_dump) { print_r($business_data_dump); echo "*****************"; if(isset($business_data_dump['single_business_items'])) { $this->saveRecords($business_data_dump['single_business_items'],D_BUSINESS_FORM); } if(isset($business_data_dump['partners_details'])) { foreach ($business_data_dump['partners_details'] as $key => $value) { $this->saveRecords($value,D_BUSINESS_PARTNERS); } } if(isset($business_data_dump['type_of_activity_details'])) { foreach ($business_data_dump['type_of_activity_details'] as $key => $value) { $this->saveRecords($value,D_BUSIENSS_TYPE); } } if(isset($business_data_dump['business_relatinship_data'])) { foreach ($business_data_dump['business_relatinship_data'] as $key => $value) { $this->saveRecords($value,D_BUSINESS_RELATINSHIP); } } if(isset($business_data_dump['products'])) { foreach ($business_data_dump['products'] as $index => $activity_data) { foreach ($activity_data as $key => $value) { $this->saveRecords($value,D_BUSINESS_PRODUCTS); } } } } ### G-sheet Queries Starts Here public function getId($flag,$keyword){ if($flag == 1){ $value = trim($keyword); $value = strtolower($value); $select = "entity_id";$table = "m_entity";$where = "short_name";} if($flag == 2){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); $select = "product_id"; $table = "m_products"; $where = "abbr";} if($flag == 3){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); $select = "subproduct_id"; $table = "m_subproducts"; $where = "abbr";} if($flag == 4){ $value = trim($keyword);$value = strtolower($value); $select = "customer_segment_id"; $table = "m_customer_segment"; $where = "abbr";} if($flag == 5){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); $select = "state_id"; $table = "m_states"; $where = "name";} if($flag == 6){ $value = trim($keyword); $value = strtolower($value); $select = "pincode_id";$where = "pincode";$table = "m_pincode";} if($flag == 7){ $value = rtrim($keyword," ");$value = ltrim($value," "); $value = strtolower($value); $select = "city_id";$where = "name";$table = "m_city";} if($flag == 8){ $value = rtrim($keyword," ");$value = ltrim($value," ");$value = strtolower($value); $select = "userid";$where = "concat(m_user_profile.first_name, ' ', m_user_profile.last_name)";$table = "m_user_profile";} if($flag == 9){ $value = trim($keyword);$value = strtolower($value); $select = "userid";$where = "first_name";$table = "m_user_profile";} if($flag == 10){ $value = trim($keyword);$value = strtolower($value); $select = "title_id";$where = "name";$table = "m_titles";} $this->db->select($select); $this->db->from($table); $this->db->where($where." LIKE '%$value%'"); $this->db->where("isactive",1); // print_r($this->db->last_query());die(); $row = $this->db->get()->row(); if (isset($row)) { $id = $row->$select; } else { $id = ""; } return $id; } public function getPDSerialNO($pd_id){ $this->db->select('pd_sno'); $this->db->from(PDTRIGGER); $this->db->where('pd_id',$pd_id); $row = $this->db->get()->row(); $sno = (isset($row)) ? $row->pd_sno : ""; return $sno; } // public function GsheetData($GSdata){ // } ### G-sheet Queries Ends Here ### CSV-XLsheet Queries Starts Here public function getDataDumpRequestList(){ $this->db->SELECT('DATADUMPREQUEST.request_id,DATADUMPREQUEST.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,DATADUMPREQUEST.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr,DATADUMPREQUEST.fk_pd_type_id,PDTYPE.type_name as pd_type_name,DATADUMPREQUEST.fk_customer_segment_id,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr,DATADUMPREQUEST.fk_city_id,CITY.name as city_name,DATE_FORMAT(DATADUMPREQUEST.from_date, "%d/%m/%Y") as from_date,DATE_FORMAT(DATADUMPREQUEST.to_date, "%d/%m/%Y") as to_date,DATADUMPREQUEST.status,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,DATADUMPREQUEST.fk_createdby ,DATE_FORMAT(DATADUMPREQUEST.createdon, "%d/%m/%Y") as createdon'); $this->db->FROM(DATADUMPREQUEST.' as DATADUMPREQUEST'); $this->db->JOIN(ENTITY.' as ENTITY','DATADUMPREQUEST.fk_lender_id = ENTITY.entity_id ','LEFT'); $this->db->JOIN(PRODUCTS.' as PRODUCTS','DATADUMPREQUEST.fk_product_id = PRODUCTS.product_id','LEFT'); $this->db->JOIN(PDTYPE.' as PDTYPE','DATADUMPREQUEST.fk_pd_type_id = PDTYPE.pd_type_id','LEFT'); $this->db->JOIN(CUSTOMERSEGMENT.' as CUSTOMERSEGMENT','DATADUMPREQUEST.fk_customer_segment_id = CUSTOMERSEGMENT.customer_segment_id','LEFT'); $this->db->JOIN(CITY.' as CITY','DATADUMPREQUEST.fk_city_id = CITY.city_id','LEFT'); $this->db->JOIN(USERPROFILE.' as USERPROFILE','DATADUMPREQUEST.fk_createdby = USERPROFILE.userid','LEFT'); $result_array = $this->db->GET()->result_array(); return $result_array; } ### CSV-XLsheet Queries Ends Here function getRequestForDataDump($arr,$take, $skip){ //print_r($arr); $fromd = isset($arr[0]['from_date'])?$arr[0]['from_date']:null; $tod= isset($arr[0]['to_date'])?$arr[0]['to_date']:null; $type = isset($arr[0]['fk_pd_type_id'])?$arr[0]['fk_pd_type_id']:null; $prod = isset($arr[0]['fk_product_id'])?$arr[0]['fk_product_id']:null; $lender = isset($arr[0]['fk_lender_id'])?$arr[0]['fk_lender_id']:null; $cseg = isset($arr[0]['fk_customer_segment_id'])?$arr[0]['fk_customer_segment_id']:null; $city = isset($arr[0]['fk_city_id'])?$arr[0]['fk_city_id']:null; ### 2 tables t_pd_form_details_json and t_pd_triggered $this->db->select('PDFORMDETAILSJSON.pd_form_detail_json_id, PDFORMDETAILSJSON.fk_pd_id, PDFORMDETAILSJSON.fk_form_id, PDFORMDETAILSJSON.isactive, PDFORMDETAILSJSON.json, DATE_FORMAT(PDFORMDETAILSJSON.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDFORMDETAILSJSON.processed_json, PDFORMDETAILSJSON.updatedon,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %H:%i:%s") as completed_on,PDTRIGGER.fk_product_id, PDTRIGGER.fk_customer_segment,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.createdon'); $this->db->from(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON'); $this->db->join(PDTRIGGER.' as PDTRIGGER','PDTRIGGER.pd_id = PDFORMDETAILSJSON.fk_pd_id ','LEFT'); if(($fromd != "" || $fromd != null) && ($tod != "" || $tod != null)) { $this->db->where('PDTRIGGER.completed_on BETWEEN '. "'$fromd'". ' AND '. "'$tod'" ); } else if($fromd != "" && $fromd != null) { $this->db->where("DATE_FORMAT(PDTRIGGER.completed_on,'%Y-%m-%d')",$fromd); } else if($tod != "" && $tod != null) { $this->db->where("DATE_FORMAT(PDTRIGGER.completed_on,'%Y-%m-%d')",$tod); } if($prod != ""){ $this->db->where('PDTRIGGER.fk_product_id',$prod); } if($type != ""){ $this->db->where('PDTRIGGER.fk_pd_type',$type); } if($cseg != ""){ $this->db->where('PDTRIGGER.fk_customer_segment',$cseg); } if($city != ""){ $this->db->where('PDTRIGGER.fk_city',$city); } if($lender != ""){ $this->db->where('PDTRIGGER.fk_lender_id',$lender); } $this->db->WHERE('PDFORMDETAILSJSON.isactive',1); $this->db->order_by('PDFORMDETAILSJSON.pd_form_detail_json_id','desc'); // $this->db->limit(5); $this->db->limit($take, $skip); $result = $this->db->get()->result_array(); // echo count($result);print_r($result);print_r($this->db->last_query());die(); return $result; } }