From 9aa7ce3bd4375d09e944221ccdd045955ac1603a Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Thu, 14 Nov 2019 12:25:32 +0530 Subject: [PATCH] MONEY WISE SALE PD RELATED --- api/application/controllers/PD_Controller.php | 4 ++-- .../controllers/Sales_PD_Controller.php | 24 ++++++++++++++----- .../report_templates/JSONTOREPORT_CLIX.php | 12 +++++----- .../{MONEYWISE_LFMP.php => SMC_LFMP.php} | 0 4 files changed, 26 insertions(+), 14 deletions(-) rename api/application/views/sale_pd_templates/{MONEYWISE_LFMP.php => SMC_LFMP.php} (100%) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 94227712..0b590dea 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4801,7 +4801,7 @@ public function getPDFormDetailsJSON_post() //Get Common Images $data['pd_images']['common_images'] = $this->PD_Model->getSignedPDDocsURL($pdid,null,null,'common',null,'report'); $temp = 'DEFAULT DATA'; - if($data['pd_master_details'][0]['lender_short_name'] == 'CLIX' || ($data['pd_master_details'][0]['lender_short_name'] == 'SMC' && $data['pd_master_details'][0]['product_abbr'] == 'BL')) + if($data['pd_master_details'][0]['lender_short_name'] == 'CLIX' || ($data['pd_master_details'][0]['lender_short_name'] == 'SMC'))// && $data['pd_master_details'][0]['product_abbr'] == 'BL')) { $temp = $this->load->view('report_templates/JSONTOREPORT_CLIX',$data,true); } @@ -6024,7 +6024,7 @@ public function getPDFormDetailsJSON_post() $t = ""; if(!count($add_on_pd)) { - if($data['pd_master_details'][0]['lender_short_name'] == 'CLIX' || ($data['pd_master_details'][0]['lender_short_name'] == 'SMC' && $data['pd_master_details'][0]['product_abbr'] == 'BL')) + if($data['pd_master_details'][0]['lender_short_name'] == 'CLIX' || ($data['pd_master_details'][0]['lender_short_name'] == 'SMC'))// && $data['pd_master_details'][0]['product_abbr'] == 'BL')) { $t = $this->load->view('report_templates/JSONTOREPORT_CLIX',$data,true); } diff --git a/api/application/controllers/Sales_PD_Controller.php b/api/application/controllers/Sales_PD_Controller.php index ee191f98..d15cfadd 100644 --- a/api/application/controllers/Sales_PD_Controller.php +++ b/api/application/controllers/Sales_PD_Controller.php @@ -101,12 +101,12 @@ class Sales_PD_Controller extends REST_Controller { $where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $sales_pd_id); $sales_pd_data = $this->Sales_PD_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); - print_r($sales_pd_data);//die(); + //print_r($sales_pd_data);//die(); if($sales_pd_data) { $bucket_name = LENDER_BUCKET_NAME_PREFIX.$sales_pd_data[0]['lender_id']; - $key = 'sales_pd/'.$sales_pd_id; + $key = 'sales_pd/'.$sales_pd_id.'/'.$sales_pd_id.'.pdf'; if(!file_exists($this->external_path.'/sales_pd/'.$sales_pd_id)) { @@ -122,18 +122,30 @@ class Sales_PD_Controller extends REST_Controller { //End of PDF Gen using DOM PDF $output_file = $this->external_path ."/sales_pd/" . $sales_pd_id . "/temp.pdf"; $bytes = file_put_contents($output_file, $pdf_doc); - die(); - $bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key.'/1.pdf','sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf'); + //die(); + $bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$this->external_path.'/sales_pd/'.$sales_pd_id.'/temp.pdf'); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) { - echo 'SUCESS'; + //echo 'SUCESS'; + $this->Sales_PD_Model->updateRecords(array('is_pdf' => 1,'is_edited' => 0),SALES_PD_DATA,array('sales_pd_id' => $sales_pd_id)); + + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $singed_uri; + $this->response($data,REST_Controller::HTTP_OK); } } else { - + + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'30 minutes'); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $singed_uri; + $this->response($data,REST_Controller::HTTP_OK); } } diff --git a/api/application/views/report_templates/JSONTOREPORT_CLIX.php b/api/application/views/report_templates/JSONTOREPORT_CLIX.php index 9d707026..9822f1f2 100644 --- a/api/application/views/report_templates/JSONTOREPORT_CLIX.php +++ b/api/application/views/report_templates/JSONTOREPORT_CLIX.php @@ -2544,7 +2544,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $client_seventh_row .= $trading_product['trade_product_credit_days_from'] && $trading_product['trade_product_credit_days_to']? ''. $trading_product['trade_product_credit_days_from'].' to '. $trading_product['trade_product_credit_days_to'].' days'.'' :' NIL ' ; - $client_eigth_row .= isset($main_raw_material['trade_product_contribution_total_turnover']) && $main_raw_material['trade_product_contribution_total_turnover'] != "" ? ''. $main_raw_material['trade_product_contribution_total_turnover'].'' :' NA ' ; + $client_eigth_row .= isset($trading_product['trade_product_contribution_total_turnover']) && $trading_product['trade_product_contribution_total_turnover'] != "" ? ''. $trading_product['trade_product_contribution_total_turnover'].'' :' NA ' ; } @@ -2591,7 +2591,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $client_seventh_row .= $service_product['service_provider_product_credit_days_from'] && $service_product['service_provider_product_credit_days_to']? ''. $service_product['service_provider_product_credit_days_from'].' to '. $service_product['service_provider_product_credit_days_to'].' days'.'' :' NIL ' ; - $client_eigth_row .= isset($main_raw_material['service_provider_contribution_total_turnover']) && $main_raw_material['service_provider_contribution_total_turnover'] != "" ? ''. $main_raw_material['service_provider_contribution_total_turnover'].'' :' NA ' ; + $client_eigth_row .= isset($service_product['service_provider_contribution_total_turnover']) && $service_product['service_provider_contribution_total_turnover'] != "" ? ''. $service_product['service_provider_contribution_total_turnover'].'' :' NA ' ; } } @@ -2642,7 +2642,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); @@ -2829,7 +2829,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $supplier_seventh_row .= $tradeRow['trade_product_credit_days_from'] && $tradeRow['trade_product_credit_days_to'] ? ''. $tradeRow['trade_product_credit_days_from'].' to '. $tradeRow['trade_product_credit_days_to'].' days' : 'NA'; - $supplier_eigth_row .= isset($raw['trade_product_contribution_total_purchase']) && $raw['trade_product_contribution_total_purchase'] != "" ? ''.$raw['trade_product_contribution_total_purchase'] .'' : ' NA ' ; + $supplier_eigth_row .= isset($tradeRow['trade_product_contribution_total_purchase']) && $tradeRow['trade_product_contribution_total_purchase'] != "" ? ''.$tradeRow['trade_product_contribution_total_purchase'] .'' : ' NA ' ; ///array_push($supplierResult,$temp); //} @@ -2875,7 +2875,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); $supplier_seventh_row .= $serviceRow['service_provider_credit_days_from'] && $serviceRow['service_provider_credit_days_to'] ? ''. $serviceRow['service_provider_credit_days_from'].' to '. $serviceRow['service_provider_credit_days_to'].' days' : 'NA'; - $supplier_eigth_row .= isset($raw['service_provider_contribution_total_purchase']) && $raw['service_provider_contribution_total_purchase'] != "" ? ''.$raw['service_provider_contribution_total_purchase'] .'' : ' NA ' ; + $supplier_eigth_row .= isset($serviceRow['service_provider_contribution_total_purchase']) && $serviceRow['service_provider_contribution_total_purchase'] != "" ? ''.$serviceRow['service_provider_contribution_total_purchase'] .'' : ' NA ' ; //array_push($supplierResult,$temp); //} @@ -2927,7 +2927,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo $supplier_third_row; echo $supplier_fourth_row; - if($pd_master_details[0]['lender_short_name'] == 'MONEYWISE') + if($pd_master_details[0]['lender_short_name'] == 'SMC') { echo $supplier_fifth_row; diff --git a/api/application/views/sale_pd_templates/MONEYWISE_LFMP.php b/api/application/views/sale_pd_templates/SMC_LFMP.php similarity index 100% rename from api/application/views/sale_pd_templates/MONEYWISE_LFMP.php rename to api/application/views/sale_pd_templates/SMC_LFMP.php