From 1d52e1e460a028a2dc83ed974f3878459afbe306 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Thu, 1 Jun 2023 09:57:38 +0530 Subject: [PATCH] MIS Report filter dorpdown : ps --- .../controllers/SMC_Credit_PD_Controller.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 4767123f..6b73b0c6 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1361,7 +1361,13 @@ class SMC_Credit_PD_Controller extends REST_Controller { $officer_name = $this->post('officer_name'); $from_date = $this->post('from_date'); $to_date = $this->post('to_date'); + $date_type = $this->post('date_type'); + if($date_type == 1) $filtered_column = 'createdon'; + else if($date_type == 2) $filtered_column = 'updatedon'; + else if($date_type == 3) $filtered_column = 'completed_on'; + else $filtered_column = 'completed_on'; + // $columns = array('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','COMMONMASTER.createdon',('(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 m_user_profile.first_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')); // $table = PDTRIGGER.' as PDTRIGGER'; @@ -1426,13 +1432,14 @@ class SMC_Credit_PD_Controller extends REST_Controller { if($from_date) { // $this->db->WHERE('date(PDTRIGGER.updatedon) >=',$from_date); - $this->db->WHERE('date(PDTRIGGER.completed_on) >=',$from_date); + // $this->db->WHERE('date(PDTRIGGER.completed_on) >=',$from_date); + $this->db->WHERE('date(PDTRIGGER.'.$filtered_column.') >=',$from_date); } - if($to_date) { // $this->db->WHERE('date(PDTRIGGER.updatedon) <=',$to_date); - $this->db->WHERE('date(PDTRIGGER.completed_on) <=',$to_date); + // $this->db->WHERE('date(PDTRIGGER.completed_on) <=',$to_date); + $this->db->WHERE('date(PDTRIGGER.'.$filtered_column.') <=',$to_date); } if($officer_name) @@ -1442,9 +1449,8 @@ class SMC_Credit_PD_Controller extends REST_Controller { // AND date(PDTRIGGER.createdon) >= '2021-02-16' // AND date(PDTRIGGER.createdon) <= '2021-02-19' $this->db->ORDER_BY('PDTRIGGER.pd_id DESC'); - $SMC_CREDIT_PD = $this->db->GET()->result_array(); - // print_r($this->db->last_query());die(); + //print_r($this->db->last_query());die(); if(count($SMC_CREDIT_PD)) { $data['dataStatus'] = true;