G-Sheet Lender Credit Person : ps
This commit is contained in:
parent
600e0b6c56
commit
ea0f7d782d
@ -192,7 +192,7 @@ class Data_Dump_Controller extends REST_Controller
|
||||
if (count($applicant_title_name) > 1) {
|
||||
$pd_applicant_details[$j]['applicant_name'] = $applicant_title_name[1];
|
||||
$pd_applicant_details[$j]['applicant_title_name'] = $this->Data_Dump_Model->getId(10, $applicant_title_name[0]);
|
||||
$this->Data_Dump_Model->getId(10, $GSdata["LenderCreditName"]);
|
||||
// $this->Data_Dump_Model->getId(10, $GSdata["LenderCreditName"]);
|
||||
} else {
|
||||
$pd_applicant_details[$j]['applicant_name'] = $applicatantParts[$j];
|
||||
}
|
||||
@ -342,10 +342,10 @@ class Data_Dump_Controller extends REST_Controller
|
||||
$pd_details['remarks'] = $GSdata["Remarks"];
|
||||
log_message('ERROR', "G-Sheet For PD Step 2.14 (Remarks) : " . $pd_details['remarks']);
|
||||
}
|
||||
if (isset($GSdata["LenderCreditName"]) && $GSdata["LenderCreditName"] != "") {
|
||||
$pd_details['lender_credit_person'] = $this->Data_Dump_Model->getId(8, $GSdata["LenderCreditName"]);
|
||||
log_message('ERROR', "G-Sheet For PD Step 2.15 (Lender Credit Person) GSheet data : " . $GSdata["LenderCreditName"]);
|
||||
}
|
||||
// if (isset($GSdata["LenderCreditName"]) && $GSdata["LenderCreditName"] != "") {
|
||||
// $pd_details['lender_credit_person'] = $this->Data_Dump_Model->getId(8, $GSdata["LenderCreditName"]);
|
||||
// log_message('ERROR', "G-Sheet For PD Step 2.15 (Lender Credit Person) GSheet data : " . $GSdata["LenderCreditName"]);
|
||||
// }
|
||||
|
||||
## Default Status section;
|
||||
$pd_details['pd_status'] = TRIGGERED;
|
||||
@ -570,132 +570,163 @@ class Data_Dump_Controller extends REST_Controller
|
||||
public function renamingExistingPDinfo_get()
|
||||
{
|
||||
log_message('ERROR', "renamingExistingPDinfo Fns Called");
|
||||
$_90th_date = date("d/m/Y", strtotime('-90 days'));
|
||||
$day_limit = "";
|
||||
$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 = '';
|
||||
|
||||
$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','DATE_FORMAT(PDTRIGGER.completed_on, "%d/%m/%Y") as completedon','PDAPPLICANTSDETAILS.pd_co_applicant_id', 'PDTRIGGER.pd_contact_person_mail', 'PDTRIGGER.fk_lender_id');
|
||||
$table = PDTRIGGER . ' as PDTRIGGER';
|
||||
$joins = array(array(
|
||||
'table' => PDAPPLICANTSDETAILS . ' as PDAPPLICANTSDETAILS',
|
||||
'condition' => 'PDAPPLICANTSDETAILS.fk_pd_id = PDTRIGGER.pd_id AND PDAPPLICANTSDETAILS.isactive = 1 AND PDAPPLICANTSDETAILS.applicant_type = 1',
|
||||
'jointype' => 'LEFT'
|
||||
));
|
||||
|
||||
$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','DATE_FORMAT(PDTRIGGER.completed_on, "%d/%m/%Y") as completedon','PDAPPLICANTSDETAILS.pd_co_applicant_id', 'PDTRIGGER.pd_contact_person_mail', 'PDTRIGGER.fk_lender_id');
|
||||
$table = PDTRIGGER . ' as PDTRIGGER';
|
||||
$joins = array(array(
|
||||
'table' => PDAPPLICANTSDETAILS . ' as PDAPPLICANTSDETAILS',
|
||||
'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);
|
||||
$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));
|
||||
$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 = '(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'";
|
||||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, $where => null);
|
||||
}
|
||||
else{
|
||||
$msg = "90th date => " . $_90th_date;
|
||||
log_message('ERROR', $msg);
|
||||
$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));
|
||||
// echo count($tgr_dtls);
|
||||
// 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)){
|
||||
for ($i = 0; $i < count($tgr_dtls); $i++) {
|
||||
$pdid = $tgr_dtls[$i]['pd_id'];
|
||||
log_message('ERROR', "trigger details for Loop inx = " . $i . " PDID = " . $pdid);
|
||||
$earliest['trigger_details'] = $tgr_dtls[$i];
|
||||
if (!empty($pdid)) {
|
||||
$apcnt_fields = array('pd_co_applicant_id', 'mobile_no', 'additional_mobile_no', 'landline', 'email', 'addressline1', 'addressline2', 'addressline3', 'company_name', 'applicant_name');
|
||||
$apcnt_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
$apcnt_dtls = $this->PD_Model->selectCustomRecords($apcnt_fields, $apcnt_cond_arr, PDAPPLICANTSDETAILS);
|
||||
log_message('ERROR', "Total Applicant Details for " . $pdid . " = " . count($apcnt_dtls));
|
||||
if (!empty($apcnt_dtls)) {
|
||||
$earliest['applicant_details'] = $apcnt_dtls;
|
||||
if(empty($pdsno) && empty($from_date) && empty($to_date) && empty($entity)){
|
||||
$msg = "";
|
||||
$to_get_entity_id = $this->PD_Model->selectCustomRecords(array('fk_lender_id'), array('pd_status' => QC_COMPLETED),PDTRIGGER, array(), '', '', '', 'fk_lender_id');
|
||||
print_r($this->db->last_query());
|
||||
print_r($to_get_entity_id);die();
|
||||
for ($i = 0; $i < count($to_get_entity_id); $i++) {
|
||||
$entity = $to_get_entity_id[$i]['fk_lender_id'];
|
||||
$select = array('data_purge_days');
|
||||
$condit = array('isactive' => 1,'fk_entity_type_id'=> 2,'entity_id'=>$entity);
|
||||
$value = $this->PD_Model->selectCustomRecords($select, $condit, ENTITY);
|
||||
// print_r($value);
|
||||
if(!empty($value)){
|
||||
$days = $value[0]['data_purge_days'];
|
||||
}
|
||||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.fk_lender_id' => $entity, '(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) <=' => date("d/m/Y", strtotime("-".$days." days")));
|
||||
// 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11
|
||||
|
||||
$result[] = $this->PD_Model->getJoinRecords($columns, $table, $joins, $where_arr);
|
||||
echo "---------------------------";
|
||||
print_r($this->db->last_query());
|
||||
// print_r($result);
|
||||
$msg = $msg." PD QC-Completed Given Entity =>". $entity ." ". $days." days and lastdate ".$day_limit;
|
||||
}
|
||||
$addr_fields = array('pd_address_id', 'addressline1');
|
||||
$addr_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
$addr_dtls = $this->PD_Model->selectCustomRecords($addr_fields, $addr_cond_arr, PDADDRESS);
|
||||
log_message('ERROR', "Total Address Details for " . $pdid . " = " . count($addr_dtls));
|
||||
if (!empty($addr_dtls)) {
|
||||
$earliest['address_details'] = $addr_dtls;
|
||||
// print_r($result);
|
||||
$tgr_dtls = array_merge(...$result);
|
||||
|
||||
|
||||
log_message('ERROR', "Trigger Details Total Records => " . count($tgr_dtls));
|
||||
|
||||
}
|
||||
else{
|
||||
if (!empty($pdsno)) {
|
||||
$msg = "PD Serial No => " . $pdsno;
|
||||
log_message('ERROR', $msg);
|
||||
$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));
|
||||
$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 = '(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'";
|
||||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, $where => null);
|
||||
}
|
||||
$json_fields = array('pd_form_detail_json_id', 'json', 'processed_json', 'fk_pd_id', 'fk_form_id');
|
||||
$json_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
$json_dtls = $this->PD_Model->selectCustomRecords($json_fields, $json_cond_arr, PDFORMDETAILSJSON);
|
||||
log_message('ERROR', "Total JSON Details for " . $pdid . " = " . count($json_dtls));
|
||||
if (!empty($json_dtls)) {
|
||||
$earliest['json_details'] = $json_dtls;
|
||||
}
|
||||
$previous_json_fields = array('pd_form_detail_json_id');
|
||||
$previous_json_cond_arr = array('isactive' => 0, 'fk_pd_id' => $pdid);
|
||||
$previous_json_dtls = $this->PD_Model->selectCustomRecords($previous_json_fields, $previous_json_cond_arr, PDFORMDETAILSJSON);
|
||||
log_message('ERROR', "Total IN-Active JSON Details for " . $pdid . " = " . count($previous_json_dtls));
|
||||
if (!empty($previous_json_dtls)) {
|
||||
foreach ($previous_json_dtls as $val) {
|
||||
$result[] = $val['pd_form_detail_json_id'];
|
||||
else if(!empty($entity)){
|
||||
$condit = array('isactive' => 1,'fk_entity_type_id'=> 2,'entity_id'=>$entity);
|
||||
$value = $this->PD_Model->selectCustomRecords($select, $condit, ENTITY);
|
||||
if(!empty($value)){
|
||||
$days = $value[0]['data_purge_days'];
|
||||
$day_limit = date("d/m/Y", strtotime("-".$days." days"));
|
||||
$where_arr = array('PDTRIGGER.pd_status' => QC_COMPLETED, 'PDTRIGGER.fk_lender_id' => $entity, '(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) <=' => $day_limit);
|
||||
|
||||
$msg = "PD QC-Completed Given Entity =>". $entity ." ". $days." days and lastdate ".$day_limit;
|
||||
}
|
||||
$this->db->where_in('pd_form_detail_json_id', $result);
|
||||
$this->db->delete(PDFORMDETAILSJSON);
|
||||
}
|
||||
|
||||
$docs_fields = array('pd_document_id', 'pd_document_title', 'pd_document_name');
|
||||
$docs_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
$docs_dtls = $this->PD_Model->selectCustomRecords($docs_fields, $docs_cond_arr, PDDOCUMENTS);
|
||||
log_message('ERROR', "Total Document Details for " . $pdid . " = " . count($docs_dtls));
|
||||
if (!empty($docs_dtls)) {
|
||||
$earliest['docs_details'] = $docs_dtls;
|
||||
|
||||
}
|
||||
// 'PDTRIGGER.fk_customer_segment'=> 11 // 1 4 5 8 9 10 11
|
||||
$tgr_dtls = $this->PD_Model->getJoinRecords($columns, $table, $joins, $where_arr);
|
||||
log_message('ERROR', "Trigger Details Total Records => " . count($tgr_dtls));
|
||||
}
|
||||
|
||||
$return = $this->renamingProcess($earliest);
|
||||
// print_r($tgr_dtls);die();
|
||||
|
||||
// if(!empty($return)){
|
||||
// array_push($pdid_arr['updated pdid'],$return);
|
||||
// array_push($pdid_arr['data'],$earliest);}
|
||||
array_push($pdid_arr,$pdid);
|
||||
}
|
||||
|
||||
// array_push($img_response, $pdid);
|
||||
$data['dataStatus'] = true;
|
||||
$data['records'] = $pdid_arr;
|
||||
$data['message'] = $msg;
|
||||
// $data['earliest'] = $earliest;
|
||||
$data['totalDetailsInCount'] =count($tgr_dtls);
|
||||
// $data['before 90 days data'] = $tgr_dtls;
|
||||
}else{
|
||||
$data['dataStatus'] = false;
|
||||
$data['message'] = 'There is no data in QC-Completed '.$msg;
|
||||
$data['totalDetailsInCount'] = count($tgr_dtls);
|
||||
}
|
||||
$this->response($data, REST_Controller::HTTP_OK);
|
||||
if(!empty($tgr_dtls)){
|
||||
// for ($i = 0; $i < count($tgr_dtls); $i++) {
|
||||
// $pdid = $tgr_dtls[$i]['pd_id'];
|
||||
// log_message('ERROR', "trigger details for Loop inx = " . $i . " PDID = " . $pdid);
|
||||
// $earliest['trigger_details'] = $tgr_dtls[$i];
|
||||
// if (!empty($pdid)) {
|
||||
// $apcnt_fields = array('pd_co_applicant_id', 'mobile_no', 'additional_mobile_no', 'landline', 'email', 'addressline1', 'addressline2', 'addressline3', 'company_name', 'applicant_name');
|
||||
// $apcnt_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
// $apcnt_dtls = $this->PD_Model->selectCustomRecords($apcnt_fields, $apcnt_cond_arr, PDAPPLICANTSDETAILS);
|
||||
// log_message('ERROR', "Total Applicant Details for " . $pdid . " = " . count($apcnt_dtls));
|
||||
// if (!empty($apcnt_dtls)) {
|
||||
// $earliest['applicant_details'] = $apcnt_dtls;
|
||||
// }
|
||||
// $addr_fields = array('pd_address_id', 'addressline1');
|
||||
// $addr_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
// $addr_dtls = $this->PD_Model->selectCustomRecords($addr_fields, $addr_cond_arr, PDADDRESS);
|
||||
// log_message('ERROR', "Total Address Details for " . $pdid . " = " . count($addr_dtls));
|
||||
// if (!empty($addr_dtls)) {
|
||||
// $earliest['address_details'] = $addr_dtls;
|
||||
// }
|
||||
// $json_fields = array('pd_form_detail_json_id', 'json', 'processed_json', 'fk_pd_id', 'fk_form_id');
|
||||
// $json_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
// $json_dtls = $this->PD_Model->selectCustomRecords($json_fields, $json_cond_arr, PDFORMDETAILSJSON);
|
||||
// log_message('ERROR', "Total JSON Details for " . $pdid . " = " . count($json_dtls));
|
||||
// if (!empty($json_dtls)) {
|
||||
// $earliest['json_details'] = $json_dtls;
|
||||
// }
|
||||
// $previous_json_fields = array('pd_form_detail_json_id');
|
||||
// $previous_json_cond_arr = array('isactive' => 0, 'fk_pd_id' => $pdid);
|
||||
// $previous_json_dtls = $this->PD_Model->selectCustomRecords($previous_json_fields, $previous_json_cond_arr, PDFORMDETAILSJSON);
|
||||
// log_message('ERROR', "Total IN-Active JSON Details for " . $pdid . " = " . count($previous_json_dtls));
|
||||
// if (!empty($previous_json_dtls)) {
|
||||
// foreach ($previous_json_dtls as $val) {
|
||||
// $result[] = $val['pd_form_detail_json_id'];
|
||||
// }
|
||||
// $this->db->where_in('pd_form_detail_json_id', $result);
|
||||
// $this->db->delete(PDFORMDETAILSJSON);
|
||||
// }
|
||||
|
||||
// $docs_fields = array('pd_document_id', 'pd_document_title', 'pd_document_name');
|
||||
// $docs_cond_arr = array('isactive' => 1, 'fk_pd_id' => $pdid);
|
||||
// $docs_dtls = $this->PD_Model->selectCustomRecords($docs_fields, $docs_cond_arr, PDDOCUMENTS);
|
||||
// log_message('ERROR', "Total Document Details for " . $pdid . " = " . count($docs_dtls));
|
||||
// if (!empty($docs_dtls)) {
|
||||
// $earliest['docs_details'] = $docs_dtls;
|
||||
// }
|
||||
// }
|
||||
|
||||
// $return = $this->renamingProcess($earliest);
|
||||
|
||||
// // if(!empty($return)){
|
||||
// // array_push($pdid_arr['updated pdid'],$return);
|
||||
// // array_push($pdid_arr['data'],$earliest);}
|
||||
// array_push($pdid_arr,$pdid);
|
||||
// }
|
||||
|
||||
// array_push($img_response, $pdid);
|
||||
// $data['dataStatus'] = true;
|
||||
// $data['records'] = $pdid_arr;
|
||||
// $data['message'] = $msg;
|
||||
// // $data['earliest'] = $earliest;
|
||||
// $data['totalDetailsInCount'] =count($tgr_dtls);
|
||||
// $data['before 90 days data'] = $tgr_dtls;
|
||||
}else{
|
||||
$data['dataStatus'] = false;
|
||||
$data['message'] = 'There is no data in QC-Completed '.$msg;
|
||||
$data['totalDetailsInCount'] = count($tgr_dtls);
|
||||
}
|
||||
$this->response($data, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
public function renamingProcess($details)
|
||||
@ -1056,7 +1087,7 @@ class Data_Dump_Controller extends REST_Controller
|
||||
$this->response($dat, REST_Controller::HTTP_OK);
|
||||
}
|
||||
|
||||
public function deleteS3Images($pdLenId,$pdid){
|
||||
public function deleteS3Images($pdLenId,$pdid){
|
||||
// public function deleteS3Images_get(){
|
||||
// $pdid = $this->get('pdid');$rs = $this->get('rs');
|
||||
// $master = $this->PD_Model->getPDMasterDetails($pdid,$rs);
|
||||
@ -1090,4 +1121,4 @@ class Data_Dump_Controller extends REST_Controller
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user