From 838343e68c8ddf1f4cb1e82e71f4a825e48669e4 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Mon, 4 Jan 2021 15:16:09 +0530 Subject: [PATCH] SALES PD FILTER & CALCEL PD REMARK --- api/application/controllers/PD_Controller.php | 13 ++++++++++++- api/application/controllers/Sales_PD_Controller.php | 7 ++++--- api/application/helpers/custom_pdalerts_helper.php | 2 +- api/application/models/Sales_PD_Model.php | 5 ++++- .../report_templates/JSONTOREPORT_SAL_SMARTPD.php | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 8aa0347b..7473afc9 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -886,6 +886,7 @@ class PD_Controller extends REST_Controller { { $pd_details = $this->post('records'); //print_r($pd_details);die(); + $pd_cancel_remark = ''; log_message('ERROR',"UpdatePD Called"); // log_message('ERROR',print_r($pd_details)); if((isset($pd_details['pd_id']) && $pd_details['pd_id'] != "" ) && (isset($pd_details['random_string']) && $pd_details['random_string'] != " ")) @@ -1045,10 +1046,20 @@ class PD_Controller extends REST_Controller { $pd_details['pd_status'] == INPROGRESS; } + if(isset($pd_details['pd_status']) && ($pd_details['pd_status'] == CANCELLED )) + { + $pd_cancel_remark = $pd_details['remark']; + unset($pd_details['remark']); + } $where_condition_array = array('pd_id' => $pd_details['pd_id'],'random_string' => $pd_details['random_string']); $pd_id_modified = $this->PD_Model->updateRecords($pd_details,PDTRIGGER,$where_condition_array); // print_r($this->db->last_query()); + //update pd cancel remrks if any + if($pd_cancel_remark) + { + $this->PD_Model->saveRecords(array('fk_pd_id' => $pd_details['pd_id'],'remark' => $pd_cancel_remark,'createdby' => $pd_details['fk_updatedby'],),PDREMARKS); + } //Update Address table,if primary address choosed if($primary_address_id != null) { @@ -1861,7 +1872,7 @@ public function assignPDTempalate($data) $fields = array('pdteam_id'); $where_condition_array = array('team_name' => "General"); $general_team_id = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDTEAM); - + // print_r($general_team_id);die(); if(count($general_team_id)) { diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index aca2d1ab..4188926b 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -525,7 +525,7 @@ class Sales_PD_Controller extends REST_Controller { $section_names = array('1' => 'General Section','2' => 'Fund Requirement','3' => 'stakeholders','4' => 'Institution Details','5' => 'Product Information','6' => 'Financial Information','7' => 'Final Remraks','8' => 'Officer Details','9' => 'Photography'); } - $count = $this->Sales_PD_Model->selectCustomRecords(array('count(*) as count'),array('lender_id' => $records['lender_id'],'product_id' => $records['product_id']),SALES_PD_DATA); + $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) @@ -983,8 +983,9 @@ public function filterSalesPDList_post() { $pd_applicant_name = strtolower($records['pd_applicant_name']); $pd_officer_name = isset($records['pd_officer']) ? $records['pd_officer'] : null ; $sales_pd_officer_id = isset($records['sales_pd_officer_id']) ? $records['sales_pd_officer_id'] : null ; - $result_data=$this->Sales_PD_Model->getSalesPDListwithFilters($pd_status,$pd_from_date,$pd_to_date,$pd_products,$pd_lender,$pd_applicant_name,$pd_officer_name,$sales_pd_officer_id); - // print_r ($result_data); + $sales_pd_type = isset($records['sales_pd_type']) ? $records['sales_pd_type'] : null ; + $result_data=$this->Sales_PD_Model->getSalesPDListwithFilters($pd_status,$pd_from_date,$pd_to_date,$pd_products,$pd_lender,$pd_applicant_name,$pd_officer_name,$sales_pd_officer_id,$sales_pd_type); + // print_r (count($result_data));die(); if(count($result_data)){ $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; diff --git a/api/application/helpers/custom_pdalerts_helper.php b/api/application/helpers/custom_pdalerts_helper.php index b35a414a..485da4d6 100644 --- a/api/application/helpers/custom_pdalerts_helper.php +++ b/api/application/helpers/custom_pdalerts_helper.php @@ -50,7 +50,7 @@ class CUSTOM_PDALERTS } - if($core_details[0]['pd_status'] == ALLOCATED_TO_PARTNER && $core_details[0]['vendor_email'] != '') + if($core_details[0]['pd_status'] == ALLOCATED_TO_FIA && $core_details[0]['vendor_email'] != '') { $msg = 'Dear Team,\n\n New PD has been Allocated to you. \" {{applicant_name}} \" ID - \" {{applicant_id}} \" .\n\nWarm Regards,\nSineedge Consulting Private Limited.'; $msg = PDALERTS::stringReplace($msg,$core_details,'MAIL'); diff --git a/api/application/models/Sales_PD_Model.php b/api/application/models/Sales_PD_Model.php index 7557e4f4..9b9869cc 100644 --- a/api/application/models/Sales_PD_Model.php +++ b/api/application/models/Sales_PD_Model.php @@ -8,7 +8,7 @@ class Sales_PD_Model extends SPARQ_Model { public function __construct() { parent::__construct(); } - public function getSalesPDListwithFilters($pd_status = '',$pd_from_date = '',$pd_to_date = '',$pd_products = '',$pd_lender = '',$pd_applicant_name = '',$pd_officer_name = '',$sales_pd_officer_id) { + public function getSalesPDListwithFilters($pd_status = '',$pd_from_date = '',$pd_to_date = '',$pd_products = '',$pd_lender = '',$pd_applicant_name = '',$pd_officer_name = '',$sales_pd_officer_id,$sales_pd_type = '') { // SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, 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,PRODUCTS.abbr,DATE_FORMAT(SALES_PD_DATA.createdon, "%d/%m/%Y") as pd_createdon,SALES_PD_DATA.status $this->db->SELECT(' SALES_PD_DATA.sales_pd_sno, SALES_PD_DATA.sales_pd_id, 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,PRODUCTS.abbr,SALES_PD_DATA.createdon, DATE_FORMAT(SALES_PD_DATA.createdon, "%Y-%m-%d") as pd_createdon, SALES_PD_DATA.status,SALES_PD_DATA.sales_pd_type,SALES_PD_DATA.rand_string'); @@ -44,6 +44,9 @@ class Sales_PD_Model extends SPARQ_Model { if(!empty($sales_pd_officer_id)) { $this->db->WHERE('SALES_PD_DATA.createdby',$sales_pd_officer_id); } + if(!empty($sales_pd_type)) { + $this->db->WHERE('SALES_PD_DATA.sales_pd_type',$sales_pd_type); + } $this->db->WHERE('SALES_PD_DATA.isactive',1); $this->db->order_by('SALES_PD_DATA.sales_pd_id','desc'); $this->db->limit(1000,0); diff --git a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php index 0a7120b8..4d1d72c7 100644 --- a/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php +++ b/api/application/views/report_templates/JSONTOREPORT_SAL_SMARTPD.php @@ -1743,7 +1743,7 @@ font-weight: bolder;; //echo $pd_offiecer_status_about_neighbor; if(count($existNeighRefCheck)>0){ - print_r($existNeighRefCheck);die(); + print_r($existNeighRefCheck);//die(); ?> $nfValue) {