purge_pddata from date and to date : ps

This commit is contained in:
VE10-Sanjeev 2022-09-17 20:21:51 +05:30
parent 09bbb166ce
commit def80961cc

View File

@ -569,9 +569,10 @@ class Data_Dump_Controller extends REST_Controller
public function renamingExistingPDinfo_get()
{
log_message('ERROR', "renamingExistingPDinfo Fns Called");
$_90th_date = date("Y/m/d", strtotime('-90 days'));
$_90th_date = date("d/m/Y", strtotime('-90 days'));
$pdsno = $this->get('pdsno');
$from_date = $this->get('from_date');
$to_date = $this->get('to_date');
$pdid_arr = array(); // testing purpose
$columns = array('PDTRIGGER.pd_id', 'PDTRIGGER.addressline1', 'PDTRIGGER.addressline2', 'PDTRIGGER.addressline3', 'PDTRIGGER.pd_contact_mobileno', 'PDTRIGGER.pd_contact_landline', 'PDTRIGGER.pd_sno', 'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") as createdon', 'PDAPPLICANTSDETAILS.pd_co_applicant_id', 'PDTRIGGER.pd_contact_person_mail', 'PDTRIGGER.fk_lender_id');
$table = PDTRIGGER . ' as PDTRIGGER';
@ -583,7 +584,13 @@ class Data_Dump_Controller extends REST_Controller
if (!empty($pdsno)) {
log_message('ERROR', "PD Serial No => " . $pdsno);
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.pd_sno' => $pdsno);
} else {
}else if(($from_date != "" || $from_date != null) && ($to_date != "" || $to_date != null)){
$newDate1 = date("d/m/Y", strtotime($from_date));
$newDate2 = date("d/m/Y", strtotime($to_date));
$where = 'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, $where => null);
}
else {
log_message('ERROR', "90th date => " . $_90th_date);
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'DATE_FORMAT(PDTRIGGER.createdon, "%d/%m/%Y") <=' => $_90th_date);
}
@ -591,6 +598,8 @@ class Data_Dump_Controller extends REST_Controller
// 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11
log_message('ERROR', "trigger details Total count " . count($tgr_cond_arr));
$tgr_dtls = $this->PD_Model->getJoinRecords($columns, $table, $joins, $tgr_cond_arr);
// print_r($this->db->last_query());die();
// print_r($tgr_dtls);die();
// $i = 0; // testing Purpose only
// for($i = 0 ;$i < 3;$i++){ // testing purpose only.
for ($i = 0; $i < count($tgr_dtls); $i++) {
@ -931,6 +940,8 @@ class Data_Dump_Controller extends REST_Controller
$destination_path = $this->external_path . "/pd_reports/" . $pdid . "/" . $docname;
if (file_exists($destination_path)) {
unlink($destination_path);
}else{
mkdir($destination_path, 0777);
}
$bucketname = LENDER_BUCKET_NAME_PREFIX . $pdlenid;