diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 8a44da51..17350c5b 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1528,9 +1528,9 @@ public function filterSalesPDList_post() { $view_data['applicant_details'] = $this->PD_Model->getApplicantsDetails($records['pd_id']); //$pd_section_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,'fk_pd_id' => $records['pd_id']),SMC_CREDIT_PD_SECTION_DATA,array(),'','fk_form_id','ASC'); $pd_section_data = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($records['pd_id'],$view_data['pd_master_details'][0]['fk_product_id'],null,null,'REPORT'); - $common_fields = array('pdid'=>$view_data['pd_master_details'][0]['pd_id'], + $common_fields = array('pdid'=>111, 'product'=>$view_data['pd_master_details'][0]['product_abbr'], - 'caseno'=>$view_data['pd_master_details'][0]['pd_sno']); + 'caseno'=>'MWISE00840'); // print_r($pd_section_data);die(); $forms_data_to_be_get_direct_from_excel_sheet = array(3,9,10,15); @@ -1667,7 +1667,7 @@ public function filterSalesPDList_post() { $html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true); } - // echo $html_content;exit(); + exit(); $pdf_name = $view_data['pd_master_details'][0]['main_applicant']; $new_pdf_name = "PD_Report_".$view_data['pd_master_details'][0]['main_applicant']; @@ -1885,10 +1885,29 @@ public function filterSalesPDList_post() { log_message('ERROR','## CreditPDReportforCETApp Fns Entered'); $get = $this->get('credit_pd_id'); if(!empty($get)){ - // $data['report'] = $this->prepareSalesPDReport($get); - // $statusMsg = 'Report Generated'; - $this->prepareSalesPDReport($get); - log_message('ERROR',"Credit Report Generated for CET App"); + $pd_master_details = $this->PD_Model->getPDMasterDetails($get); + + $old_pdf_name = $pd_master_details[0]['main_applicant']; + $old_key = 'pd'.$records['pd_id'].'/pd_reports/'.$old_pdf_name.'.pdf'; + + $new_pdf_name = "PD_Report_".$pd_master_details[0]['main_applicant']; + $new_key = 'pd'.$records['pd_id'].'/pd_reports/'.$new_pdf_name.'.pdf'; + + $bucket_name = LENDER_BUCKET_NAME_PREFIX.(ENVIRONMENT == 'production' ? 7 : 35); + + $output_file = $this->external_path ."/pd_reports/" . $get . "/temp.pdf"; + + $_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$old_key,'30 minutes'); + + $headers = @get_headers($_uri); + if($headers && strpos( $headers[0], '200')) { + $singed_uri = $_uri; + }else { + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$new_key,'30 minutes'); + } + $data['records'] = $singed_uri; + log_message('ERROR',"Credit Report Generated for CET App"); + $statusMsg = 'Report Available.'; }else{ log_message('ERROR','Credit Report Not Available for CET App'); $statusMsg = 'Report Not Available.';