diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 21dec05b..3c434873 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -2513,8 +2513,9 @@ public function filterSalesPDList_post() { $day_limit = date("d/m/Y", strtotime("-".$days." days")); $select = array('*'); $smc_lender_id = ENVIRONMENT == 'production' ? 7 : 35; //SMC lender id MWISE in live and demo - $limit_condition = "(DATE_FORMAT(completed_on,'%d/%m/%Y') <= '".$day_limit ."' OR DATE_FORMAT(updatedon,'%d/%m/%Y') <= '".$day_limit."')"; + // $limit_condition = "(DATE_FORMAT(completed_on,'%d/%m/%Y') <= '".$day_limit ."' OR DATE_FORMAT(createdon,'%d/%m/%Y') <= '".$day_limit."')"; $condit = array('pd_status' => 'COMPLETED','fk_lender_id' => $smc_lender_id); + $condit['DATE_FORMAT(createdon, "%Y-%m-%d") <= DATE_SUB(CURDATE(), INTERVAL 60 DAY)'] =null; if(!empty($pd_id)) $condit['pd_id'] = $pd_id; $condit[$limit_condition]=null; $value = $this->SMC_Credit_PD_Model->selectCustomRecords($select, $condit, PDTRIGGER); @@ -2538,6 +2539,8 @@ public function filterSalesPDList_post() { }else{ $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_OK; + $data['message'] = 'NO SMC credit PD Data Less than or equal to '.$day_limit; + log_message('ERROR', '#### NO SMC credit PD Data Less than or equal to '.$day_limit); } $this->response($data,REST_Controller::HTTP_OK); } diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index 0d377cc2..abd94b96 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -2062,9 +2062,12 @@ public function filterSalesPDList_post() { $days = 60; $day_limit = date("d/m/Y", strtotime("-".$days." days")); $select = array('*'); - $condit = array('isactive' => 1,'status' => 'COMPLETED','(DATE_FORMAT(completed_date, "%d/%m/%Y")) <=' => $day_limit); + // $condit = array('isactive' => 1,'status' => 'COMPLETED','(DATE_FORMAT(completed_date, "%d/%m/%Y")) <=' => $day_limit); + $condit = array('isactive' => 1,'status' => 'COMPLETED'); + $condit['DATE_FORMAT(completed_date, "%Y-%m-%d") <= DATE_SUB(CURDATE(), INTERVAL 60 DAY)'] =null; if(!empty($sales_pd_id)) $condit['sales_pd_id'] = $sales_pd_id; $value = $this->Sales_PD_Model->selectCustomRecords($select, $condit, SALES_PD_DATA); + // print_r($this->db->last_query());die(); // echo count($value); if(!empty($value)){ $flag = 0;$ids=array(); @@ -2085,6 +2088,8 @@ public function filterSalesPDList_post() { }else{ $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_OK; + $data['message'] = 'NO Sales PD Data Less than or equal to '.$day_limit; + log_message('ERROR', '#### NO Sales PD Data Less than or equal to '.$day_limit ); } $this->response($data,REST_Controller::HTTP_OK); }