Max DateFormat in PurgePD : ps

This commit is contained in:
VE10-Sanjeev 2022-11-08 11:10:24 +05:30
parent 221210cd36
commit 8a76a67ed2

View File

@ -591,22 +591,31 @@ class Data_Dump_Controller extends REST_Controller
}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));
$msg = "PD Completed Date Given Format => " . $from_date ." to ".$to_date;
$msg = "PD QC-Completed Date Given Format => " . $from_date ." to ".$to_date;
log_message('ERROR', $msg." Changed ".$newDate1." to ".$newDate2);
$where = 'DATE(PDTRIGGER.completed_on) BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
// $where = 'DATE(PDTRIGGER.completed_on) BETWEEN ' ."'$newDate1'". ' AND ' ."'$newDate2'";
$where = '(SELECT
MAX(DATE(logmaster.createdon))
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);
}
else{
$msg = "90th date => " . $_90th_date;
log_message('ERROR', $msg);
$tgr_cond_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'DATE_FORMAT(PDTRIGGER.completed_on, "%d/%m/%Y") <=' => $_90th_date);
$tgr_cond_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);
}
// '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));
// echo count($tgr_dtls);
// print_r($tgr_dtls); print_r($this->db->last_query());die();
// print_r($tgr_dtls);
// print_r($this->db->last_query());die();
// $i = 0; // testing Purpose only
// for($i = 0 ;$i < 3;$i++){ // testing purpose only.
if(!empty($tgr_dtls)){