From 0f152c9227f1d36b68f472692df74050b093ae25 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Sat, 3 Dec 2022 15:12:07 +0530 Subject: [PATCH] MIS report officer name fixes : ps --- api/application/controllers/SMC_Credit_PD_Controller.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 74578550..47d17a54 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1132,6 +1132,7 @@ class SMC_Credit_PD_Controller extends REST_Controller { public function smcCreditPDMisReport_post() { + //echo "i am Here";die(); //$lender_id = $this->uri->segment(2); $officer_name = $this->post('officer_name'); $from_date = $this->post('from_date'); @@ -1179,13 +1180,18 @@ class SMC_Credit_PD_Controller extends REST_Controller { //$SMC_CREDIT_PD = $this->SMC_Credit_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array,$order_by,'DESC'); - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno, PDTYPE.type_name, PDTRIGGER.lender_applicant_id, PDTRIGGER.fk_product_id, PRODUCT.abbr, PDTRIGGER.pd_status, PDAPPLICANTSDETAILS.applicant_name, (SELECT createdon FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon, (SELECT concat(m_user_profile.first_name," " ,m_user_profile.last_name) FROM h_common_masters JOIN m_user_profile on h_common_masters.new_value = m_user_profile.userid where PDTRIGGER.pd_id = primary_key AND field_name = "fk_pd_allocated_to" order by log_id DESC limit 1) as officer_name,PDTRIGGER.mis_report_remarks,PDTRIGGER.vendor_status,PDTRIGGER.fk_city,CITY.name as city_name'); + //Dont Delete below Select Statement Because 3rd dec22 MIS Officer Name REPORTED by Venkat + //$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno, PDTYPE.type_name, PDTRIGGER.lender_applicant_id, PDTRIGGER.fk_product_id, PRODUCT.abbr, PDTRIGGER.pd_status, PDAPPLICANTSDETAILS.applicant_name, (SELECT createdon FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon, (SELECT concat(m_user_profile.first_name," " ,m_user_profile.last_name) FROM h_common_masters JOIN m_user_profile on h_common_masters.new_value = m_user_profile.userid where PDTRIGGER.pd_id = primary_key AND field_name = "fk_pd_allocated_to" order by log_id DESC limit 1) as officer_name,PDTRIGGER.mis_report_remarks,PDTRIGGER.vendor_status,PDTRIGGER.fk_city,CITY.name as city_name'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.pd_sno, PDTYPE.type_name, PDTRIGGER.lender_applicant_id, PDTRIGGER.fk_product_id, PRODUCT.abbr, PDTRIGGER.pd_status, PDAPPLICANTSDETAILS.applicant_name, (SELECT createdon FROM h_common_masters where PDTRIGGER.pd_id = primary_key AND field_name = "pd_status" order by log_id DESC limit 1) as updatedon,PDTRIGGER.mis_report_remarks,PDTRIGGER.vendor_status,PDTRIGGER.fk_city,CITY.name as city_name'); $this->db->SELECT('(SELECT GROUP_CONCAT(concat(m_user_profile.first_name, " ", m_user_profile.last_name,"(",DATE_FORMAT(h_common_masters.createdon, "%d-%m-%Y %r"),") ")) FROM h_common_masters JOIN m_user_profile on h_common_masters.fk_createdby = m_user_profile.userid where PDTRIGGER.pd_id = h_common_masters.primary_key and field_name = "video_call_initiate_user" order by log_id DESC) as video_call_initiate_user, (SELECT count(log_id) FROM h_common_masters where PDTRIGGER.pd_id = h_common_masters.primary_key and field_name = "video_call_initiate_user") as total_video'); + $this->db->SELECT('concat(ifnull(mup.first_name, mup1.first_name)," ",ifnull(mup.last_name, mup1.last_name)) AS officer_name'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(PRODUCTS.' as PRODUCT','PDTRIGGER.fk_product_id = PRODUCT.product_id','LEFT'); $this->db->JOIN(PDTYPE.' as PDTYPE','PDTRIGGER.fk_pd_type = PDTYPE.pd_type_id','LEFT'); $this->db->JOIN(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS','PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id and and PDAPPLICANTSDETAILS.applicant_type = 1','LEFT'); $this->db->JOIN(CITY.' as CITY','PDTRIGGER.fk_city = CITY.city_id','LEFT'); + $this->db->JOIN('m_user_profile AS mup','mup.userid = PDTRIGGER.fk_pd_allocated_to and PDTRIGGER.pd_status = "COMPLETED"','LEFT'); + $this->db->JOIN('m_user_profile AS mup1','mup1.userid = PDTRIGGER.fk_updatedby and PDTRIGGER.pd_status = "COMPLETED"','LEFT'); //$this->db->JOIN(COMMONMASTER.' as COMMONMASTER','PDTRIGGER.pd_id = PDAPPLICANTSDETAILS.fk_pd_id and and PDAPPLICANTSDETAILS.applicant_type = 1 and COMMONMASTER.primary_key and COMMONMASTER.table_name = "t_pd_triggered" and COMMONMASTER.field_name = "pd_status" and COMMONMASTER.new_value = "COMPLETED"'); //$this->db->WHERE('PDTRIGGER.pd_status','COMPLETED');