From e5b342f94687d8046682c788b9d06196d7dd6d78 Mon Sep 17 00:00:00 2001 From: "sanjeev.p" Date: Sat, 30 Oct 2021 15:40:26 +0530 Subject: [PATCH] city added in sales PD : ps --- .../controllers/Sales_PD_Controller.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 4e99c6cd..b0afd5c8 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -198,7 +198,7 @@ class Sales_PD_Controller extends REST_Controller { { $all_section_data = $this->Sales_PD_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $sales_pd_id,'isactive' => 1),SALESPD_SECTION_DATA,array(),'','section_id','ASC'); - // print_r(json_decode($all_section_data[2]['section_data'],true));//die(); + // print_r(json_decode($all_section_data[0]['section_data'],true));die(); $view_data['master'] = $sales_pd_data; foreach ($all_section_data as $sec_key => $section) { @@ -278,7 +278,7 @@ class Sales_PD_Controller extends REST_Controller { $lender_id = $this->uri->segment(2); $user_id = $this->uri->segment(3); $role = $this->uri->segment(4); - $columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.sales_pd_sno','SALES_PD_DATA.applicant_name','concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name','SALES_PD_DATA.applicant_id','SALES_PD_DATA.lender_id','SALES_PD_DATA.product_id','SALES_PD_DATA.is_pdf','SALES_PD_DATA.is_edited','ENTITY.short_name','PRODUCT.abbr','SALES_PD_DATA.status','SALES_PD_DATA.sales_pd_type','SALES_PD_DATA.rand_string','SALES_PD_DATA.isactive', + $columns = array('SALES_PD_DATA.sales_pd_id','SALES_PD_DATA.sales_pd_sno','SALES_PD_DATA.applicant_name','concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as officer_name','SALES_PD_DATA.applicant_id','SALES_PD_DATA.lender_id','SALES_PD_DATA.product_id','SALES_PD_DATA.is_pdf','SALES_PD_DATA.is_edited','ENTITY.short_name','PRODUCT.abbr','SALES_PD_DATA.status','SALES_PD_DATA.sales_pd_type','SALES_PD_DATA.rand_string','SALES_PD_DATA.isactive','SALES_PD_DATA.city_id','CITY.name as city_name', '(CASE WHEN SALES_PD_DATA.status = "STARTED" THEN SALES_PD_DATA.createdon WHEN SALES_PD_DATA.status = "COMPLETED" THEN SALES_PD_DATA.completed_date ELSE NULL END) AS createdon' // ,"DATE_FORMAT(SALES_PD_DATA.createdon,'%Y-%m-%d') as modify","DATE_ADD(CURDATE(),INTERVAL '-10' DAY) as currd", // "(CURDATE()) as daye10" @@ -291,6 +291,9 @@ class Sales_PD_Controller extends REST_Controller { array('table' => PRODUCTS. ' as PRODUCT', 'condition' =>'SALES_PD_DATA.product_id = PRODUCT.product_id', 'jointype' => 'INNER'), + array('table' => CITY. ' as CITY', + 'condition' =>'SALES_PD_DATA.city_id = CITY.city_id', + 'jointype' => 'LEFT'), array('table' => USERPROFILE. ' as USERPROFILE', 'condition' =>'SALES_PD_DATA.createdby = USERPROFILE.userid', 'jointype' => 'LEFT') @@ -547,6 +550,7 @@ class Sales_PD_Controller extends REST_Controller { } $count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $records['lender_id'],'product_id' => $records['product_id'],'isactive' => 1),SALES_PD_DATA); + // die(); if($records['sales_pd_id'] == '' || $records['sales_pd_id'] == null) @@ -768,6 +772,7 @@ class Sales_PD_Controller extends REST_Controller { //update Applicant ID and applicant Name to sales pD master Table $applicant_id = null; $applicant_name = ''; + $city = ''; if($records['questions']) { foreach ($records['questions'] as $g_key => $g_value) @@ -781,12 +786,17 @@ class Sales_PD_Controller extends REST_Controller { { $applicant_name = $g_value['answer_value']; } + + if($g_value['question_key'] == 'city') + { + $city = $g_value['answer_value']; + } } } - $update_fields = array('applicant_name' => $applicant_name,'applicant_id' => $applicant_id); + $update_fields = array('applicant_name' => $applicant_name,'applicant_id' => $applicant_id,'city_id'=>$city); $this->Sales_PD_Model->updateRecords($update_fields,SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id));