CETapp credit pd FIxes : PS

This commit is contained in:
VE10-Sanjeev 2023-01-06 17:12:18 +05:30
parent 887f8e666c
commit 413dee0255
2 changed files with 38 additions and 11 deletions

View File

@ -270,27 +270,46 @@ class SMC_Credit_PD_Controller extends REST_Controller {
function uploadCreditPDDataToCETApp_get()
{
log_message('ERROR', '#### upload SMC Credit PDData To CETApp Called');
$this->load->helper('smc_creditpd');
$smc_credit_pd = $this->uri->segment(2);
$mater_details = $this->PD_Model->getPDMasterDetails($smc_credit_pd);
$pd_section_data = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($smc_credit_pd,$mater_details[0]['fk_product_id'],null,null,'REPORT');
log_message('ERROR', '#### Total Credit PD is ' . count($pd_section_data));
if (!empty($pd_section_data)) {
$forms_data_to_be_get_direct_from_excel_sheet = array(3, 9, 10, 15);
$companylist = $this->getCompanyName($pd_section_data[0]);
if (count($pd_section_data) > 0) {
$common_fields = array('pdid'=>$mater_details[0]['pd_id'],
'product'=>$mater_details[0]['product_abbr'],
'caseno'=>$mater_details[0]['pd_sno']);
foreach ($pd_section_data as $key => $value) {
// foreach ($pd_section_data as $key => $value) {
// if (isset($value['json']) && $value['json'] != '') {
// $filter_form_id[$key] = $value['fk_form_id'];
// $CETAPP_creditPD_data[$value['form_name']] = json_decode($value['json'],true);
// } else {
// if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
// $data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
// $filter_form_id[$key] = $value['fk_form_id'];
// $CETAPP_creditPD_data[$value['form_name']] = json_decode($data_from_excel,true);
// }
// }
// }
foreach ($pd_section_data as $key => $value)
{
if (isset($value['json']) && $value['json'] != '') {
$value['json'] = smc_creditpd::getSMCCreditPDReportContent($value,$smc_credit_pd,$companylist);
$filter_form_id[$key] = $value['fk_form_id'];
$CETAPP_creditPD_data[$value['form_name']] = json_decode($value['json'],true);
} else {
if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
// $view_data['pd_section_data'][$value['fk_form_id']] = $value['json'];
$CETAPP_creditPD_data[$value['form_name']] = $value['json'];
}
else
{
if (in_array($value['fk_form_id'], $forms_data_to_be_get_direct_from_excel_sheet)) {
$data_from_excel = $this->loadDataFromExcelBusiProcess($mater_details, $value['fk_form_id']);
$filter_form_id[$key] = $value['fk_form_id'];
//print_r($data_from_excel);die();
// $view_data['pd_section_data'][$value['fk_form_id']] = $data_from_excel;
$CETAPP_creditPD_data[$value['form_name']] = json_decode($data_from_excel,true);
$filter_form_id[$key] = $value['fk_form_id'];
}
}
}
@ -342,9 +361,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
$CETAPP_creditPD_data['Key Stakeholders in Business']['key_stakeholders'] = $temp_arr;
}
} // ### LFMP key_stakeholders ends
if ((in_array(1, $filter_form_id)) && (in_array(21, $filter_form_id)))
// && (in_array(4,$filter_form_id)))
{
// print_r($filter_form_id);die();
$officer_id = isset($mater_details[0]['fk_updatedby']) ? $mater_details[0]['fk_updatedby'] : '';
$visit_date = isset($mater_details[0]['pd_visit_date']) ? $mater_details[0]['pd_visit_date'] : '';
if (!empty($officer_id)) {
@ -356,7 +373,7 @@ class SMC_Credit_PD_Controller extends REST_Controller {
}
}
}
}
cet_creditpd::pushwithcetcreditpdapi($common_fields, $CETAPP_creditPD_data);
// print_r($CETAPP_creditPD_data);
// $path = $this->external_path ."/pd_reports/" . $mater_details[0]['pd_id'] . "/new-file-5-".$mater_details[0]['pd_id'].".json";

View File

@ -26,6 +26,16 @@ class CET_CREDITPD
$headers = array('Content-Type: application/json');
$ch = curl_init();
$output_data = json_encode( $fields );
// log_message('ERROR','#### output_data '.$output_data);
// $path = $path ."/tmp/".$fields['pdid'].".json";
// $fp = fopen($path, 'w');
// fwrite($fp, $output_data);
// if(file_put_contents($path, $output_data))
// {
// $message = "<label class='text-success'>File createed and data added Success fully</p>";
// echo $message;
// }die();
// print_r($fields);die();
// log_message('ERROR',"PullcreditPDData api Request Format : ".$output_data);
// curl_setopt( $ch,CURLOPT_URL, "https://demo.devopsmcfinance.com/cet_creditpd/api/PullCreditPdData");
curl_setopt( $ch,CURLOPT_URL, CET_CREDIT_PD_INTEGRATION_URL);