diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 4388a067..60a8cb3c 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -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"; diff --git a/api/application/helpers/cet_creditpd_helper.php b/api/application/helpers/cet_creditpd_helper.php index 9e5cc907..ff8d5d90 100644 --- a/api/application/helpers/cet_creditpd_helper.php +++ b/api/application/helpers/cet_creditpd_helper.php @@ -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 = "