diff --git a/api/application/controllers/Data_Dump_Controller.php b/api/application/controllers/Data_Dump_Controller.php index be297077..66baf82f 100644 --- a/api/application/controllers/Data_Dump_Controller.php +++ b/api/application/controllers/Data_Dump_Controller.php @@ -574,6 +574,7 @@ class Data_Dump_Controller extends REST_Controller $pdsno = $this->get('pdsno'); $from_date = $this->get('from_date'); $to_date = $this->get('to_date'); + $entity = $this->get('lender_id'); $pdid_arr = array(); // testing purpose $msg = ''; @@ -584,10 +585,18 @@ class Data_Dump_Controller extends REST_Controller 'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1', 'jointype' => 'LEFT' )); + if(!empty($entity)){ + $lender_where = array('PDTRIGGER.fk_lender_id' => $entity); + } + else{ + $data['dataStatus'] = false; + $data['message'] = 'Lender Not Found'; + $this->response($data, REST_Controller::HTTP_OK); + } if (!empty($pdsno)) { $msg = "PD Serial No => " . $pdsno; log_message('ERROR', $msg); - $tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.pd_sno' => $pdsno); + $where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.pd_sno' => $pdsno); }else if(($from_date != "" || $from_date != null) && ($to_date != "" || $to_date != null)){ $newDate1 = date("Y-m-d", strtotime($from_date)); $newDate2 = date("Y-m-d", strtotime($to_date)); @@ -599,17 +608,17 @@ class Data_Dump_Controller extends REST_Controller FROM h_common_masters as logmaster WHERE logmaster.new_value = "QC_COMPLETED" AND PDTRIGGER.pd_id = logmaster.primary_key) BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'"; - $tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, $where => null); + $where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, $where => null); } else{ $msg = "90th date => " . $_90th_date; log_message('ERROR', $msg); - $tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, '(SELECT + $where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, '(SELECT MAX(DATE_FORMAT(logmaster.createdon, "%d/%m/%Y")) FROM h_common_masters as logmaster WHERE logmaster.new_value = "QC_COMPLETED" AND PDTRIGGER.pd_id = logmaster.primary_key) <=' => $_90th_date); } - + $tgr_cond_arr = array_merge($lender_where,$where_arr); // 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11 $tgr_dtls = $this->PD_Model->getJoinRecords($columns, $table, $joins, $tgr_cond_arr); log_message('ERROR', "Trigger Details Total Records => " . count($tgr_dtls));