diff --git a/api/application/composer.json b/api/application/composer.json index 9c575533..6938f88b 100644 --- a/api/application/composer.json +++ b/api/application/composer.json @@ -19,7 +19,7 @@ "aws/aws-sdk-php": "^3.64", "amphp/amp": "^1.2", "dompdf/dompdf" : "0.6.*", - "smarty/smarty": "^3.1" + "tecnickcom/tcpdf": "^6.2" }, "suggest": { diff --git a/api/application/composer.lock b/api/application/composer.lock index 52d77872..ba5a94ac 100644 --- a/api/application/composer.lock +++ b/api/application/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "2a71fd7716b51eccdfd921f2362198b9", + "content-hash": "5c78e1c8273b1893de422b5c5c44d72f", "packages": [ { "name": "amphp/amp", @@ -65,16 +65,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.80.3", + "version": "3.81.6", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "f1f724c48a49350250950d80d16b348e5e748e3c" + "reference": "0e07e92ec7042316ffc79ef290cf7bbb7d7be24b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f1f724c48a49350250950d80d16b348e5e748e3c", - "reference": "f1f724c48a49350250950d80d16b348e5e748e3c", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0e07e92ec7042316ffc79ef290cf7bbb7d7be24b", + "reference": "0e07e92ec7042316ffc79ef290cf7bbb7d7be24b", "shasum": "" }, "require": { @@ -144,7 +144,7 @@ "s3", "sdk" ], - "time": "2018-12-04T20:31:51+00:00" + "time": "2018-12-14T22:50:05+00:00" }, { "name": "ddeboer/tesseract", @@ -767,59 +767,6 @@ ], "time": "2018-06-23T08:43:13+00:00" }, - { - "name": "smarty/smarty", - "version": "v3.1.33", - "source": { - "type": "git", - "url": "https://github.com/smarty-php/smarty.git", - "reference": "dd55b23121e55a3b4f1af90a707a6c4e5969530f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/smarty-php/smarty/zipball/dd55b23121e55a3b4f1af90a707a6c4e5969530f", - "reference": "dd55b23121e55a3b4f1af90a707a6c4e5969530f", - "shasum": "" - }, - "require": { - "php": ">=5.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "files": [ - "libs/bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-3.0" - ], - "authors": [ - { - "name": "Monte Ohrt", - "email": "monte@ohrt.com" - }, - { - "name": "Uwe Tews", - "email": "uwe.tews@googlemail.com" - }, - { - "name": "Rodney Rehm", - "email": "rodney.rehm@medialize.de" - } - ], - "description": "Smarty - the compiling PHP template engine", - "homepage": "http://www.smarty.net", - "keywords": [ - "templating" - ], - "time": "2018-09-12T20:54:16+00:00" - }, { "name": "symfony/process", "version": "v3.3.6", @@ -933,16 +880,16 @@ }, { "name": "thiagoalessio/tesseract_ocr", - "version": "2.7.1", + "version": "2.7.2", "source": { "type": "git", "url": "https://github.com/thiagoalessio/tesseract-ocr-for-php.git", - "reference": "cf9534a7bef895ba2106ff8ea199e193118c5a7e" + "reference": "3df8862309e049a25828b6db181d18ddddd8cdb0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thiagoalessio/tesseract-ocr-for-php/zipball/cf9534a7bef895ba2106ff8ea199e193118c5a7e", - "reference": "cf9534a7bef895ba2106ff8ea199e193118c5a7e", + "url": "https://api.github.com/repos/thiagoalessio/tesseract-ocr-for-php/zipball/3df8862309e049a25828b6db181d18ddddd8cdb0", + "reference": "3df8862309e049a25828b6db181d18ddddd8cdb0", "shasum": "" }, "require": { @@ -974,7 +921,7 @@ "Tesseract", "text recognition" ], - "time": "2018-11-09T19:12:03+00:00" + "time": "2018-12-11T19:38:54+00:00" } ], "packages-dev": [], diff --git a/api/application/config/constants.php b/api/application/config/constants.php index a3009aac..2263fe46 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -87,7 +87,7 @@ defined('EXIT__AUTO_MAX') OR define('EXIT__AUTO_MAX', 125); // highest auto // define login route name for token verification //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllEntites/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getListOfPDReportVersions'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN','getFullPDDetails'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); diff --git a/api/application/config/routes.php b/api/application/config/routes.php index d349b912..f12e058c 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -172,7 +172,9 @@ $route['getLatestPDReportBlob'] = 'PD_Controller/getLatestPDReportBlob'; $route['saveNewVersionOfPDReport'] = 'PD_Controller/saveNewVersionOfPDReport'; $route['getListOfPDReportVersions'] = 'PD_Controller/getListOfPDReportVersions'; $route['swapOlderPDReportToLatest'] = 'PD_Controller/swapOlderPDReporttoLatest'; + $route['smartyTestFunction'] = 'PD_Controller/smartyTestFunction'; +$route['codeigniterViewTest'] = 'PD_Controller/codeigniterViewTest'; //PD Form Related $route['getPDFormDetails'] = 'PD_Controller/getPDFormDetails'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 1395143c..bff80a1b 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -9,10 +9,12 @@ defined('BASEPATH') OR exit('No direct script access allowed'); require_once APPPATH . '/libraries/REST_Controller.php'; -//require_once APPPATH . '/libraries/Smartie.php'; +require_once APPPATH . '/libraries/Smartie.php'; +//require BASEPATH.'core/Controller.php'; class PD_Controller extends REST_Controller { +//class PD_Controller extends CI_Controller { function __construct() { @@ -23,7 +25,8 @@ class PD_Controller extends REST_Controller { $this->load->library('AWS_SNS'); $this->load->helper('GETPDFORMDETAILS'); $this->load->library('pdfgenerator'); - //$this->load->library('smarty'); + $this->load->library('pdfgen_tcpdf'); + } @@ -2673,15 +2676,16 @@ class PD_Controller extends REST_Controller { if(file_put_contents($output_file2, $pdf_doc)) { $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + $main_applicant_name = $pd_master_details[0]['main_applicant']; $key = ""; if($is_regenerate == 0) { - $key = 'pd'.$pdid.'/pd_reports/version0.pdf'; + $key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'._version0.pdf'; } else { $latest_version = $pd_master_details[0]['pd_report_latest_version'] + 1; - $key = 'pd'.$pdid.'/pd_reports/version'.$latest_version.'.pdf'; + $key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'.version'.$latest_version.'.pdf'; } $sourcefile = $output_file2; @@ -2711,6 +2715,7 @@ class PD_Controller extends REST_Controller { //call all reports functionality and send it. + $key = 'pd'.$pdid.'/pd_reports/'; $urls = $this->getALLPDReportsSingedURLs($bucketname,$key,$pdid); if($id != null || $id != "" ) @@ -2749,6 +2754,7 @@ class PD_Controller extends REST_Controller { $fk_createdby = $records['fk_createdby']; //Get PD Master Details $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); + $main_applicant_name = $pd_master_details[0]['main_applicant']; //print_r($pd_master_details); //update BLOB in pd trigger Table @@ -2781,7 +2787,7 @@ class PD_Controller extends REST_Controller { if(file_put_contents($output_file2, $pdf_doc)) { $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; - $key = 'pd'.$pdid.'/pd_reports/'.'version'.$latest_version.'.pdf'; + $key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'_version'.$latest_version.'.pdf'; $sourcefile = $output_file2; $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); @@ -2828,7 +2834,7 @@ class PD_Controller extends REST_Controller { //Get PD Master Details $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); - + $main_applicant_name = $pd_master_details[0]['main_applicant']; $lender_id = $pd_master_details[0]['fk_lender_id']; $bucket_name = LENDER_BUCKET_NAME_PREFIX.$lender_id; @@ -2848,7 +2854,7 @@ class PD_Controller extends REST_Controller { { $data['dataStatus'] = false; $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['msg'] = 'PD Report Not Generated/Report Not Available!'; + $data['msg'] = 'PD Report Not Generated'; $this->response($data,REST_Controller::HTTP_OK); } @@ -2997,6 +3003,9 @@ class PD_Controller extends REST_Controller { $records = $this->post('records'); $pdid = $records['pd_id']; + + $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); + $main_applicant_name = $pd_master_details[0]['main_applicant']; $doc_name = $records['doc_name']; $fk_createdby = $records['fk_createdby']; @@ -3059,7 +3068,7 @@ class PD_Controller extends REST_Controller { if(file_put_contents($output_file2, $pdf_doc)) { $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; - $key = 'pd'.$pdid.'/pd_reports/'.'version'.($pd_master_details[0]['pd_report_latest_version'] + 1).'.pdf'; + $key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'_version'.($pd_master_details[0]['pd_report_latest_version'] + 1).'.pdf'; $sourcefile = $output_file2; $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); @@ -3132,10 +3141,76 @@ class PD_Controller extends REST_Controller { $this->smarty->assign('title','Test Title'); $this->smarty->assign('description', 'Test Description'); //$this->smarty->display('index.tpl'); - $data['Name'] = 'test namenkenk'; + $data['pdif'] = '10'; + $data['main_applicant_name'] = 'Mr.Ram Kumar'; + $data['cus_seg'] = 'SENP-AI'; + $data['lender_name'] = 'HDFC'; + $data['product'] = 'Home Loan'; + $data['type_of_activity'] = 'Manufacturing'; + $data['applicants'] = array(array('name' => 'Rajesh Kumar','age' => '56'),array('name' => 'santhosh Kumar','age' => '45')); + $this->smarty->assign("FirstName", array("John", "Mary", "James", "Henry")); $fin = $this->smarty->view('index.tpl' , $data); - echo "dsds"; + + // echo "CON"; print_r($fin); + + // $temp_array = array('content' => $fin,'fk_pd_id'=> 555); + // $id = $this->PD_Model->saveRecords($temp_array,PDREPORTSVERSIONBLOB); + + // $data['dataStatus'] = true; + // $data['status'] = REST_Controller::HTTP_NOT_MODIFIED; + // $data['msg'] = $fin; + // $this->response($data,REST_Controller::HTTP_OK); + + $output_file = APPPATH."/docs/temp.html"; + $ifp = fopen( $output_file, 'wb' ); + //fwrite( $ifp, $original_template ); + fwrite( $ifp, $fin ); + fclose( $ifp ); + //print_r($output_file); + $file= file_get_contents($output_file); + $pdf_doc = $this->pdfgenerator->generate($file, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); + //print_r($pdf_doc); + + + $output_file2 = APPPATH."/docs/sample.pdf"; + echo file_put_contents($output_file2, $pdf_doc); + + + } + + + public function codeigniterViewTest_post() + { + + $data['pdid'] = '500'; + $data['main_applicant_name'] = 'Mr.Ram Kumar'; + $data['cus_seg'] = 'SENP-AI'; + $data['lender_name'] = 'HDFC'; + $data['product'] = 'Home Loan'; + $data['sub_product'] = 'Home Resale'; + $data['type_of_activity'] = 'Manufacturing'; + $data['applicants'] = array( + array('name' => 'Rajesh Kumar','age' => '56','relation'=>'Brother','es'=>'Salaried','cn'=>'TCS'), + array('name' => 'santhosh Kumar','age' => '45','relation'=>'Brother','es'=>'Selfemployee','cn'=>'ABC Pvt Ltd'), + array('name' => 'Jiv Kumar','age' => '65','relation'=>'Father','es'=>'No','cn'=>'-'), + array('name' => 'Selvi','age' => '60','relation'=>'Mother','es'=>'Housewife','cn'=>'-'), + ); + $t = $this->load->view('report_templates/SALCASH',$data,true); + print_r($t); + + //PDF Gen using DOM PDF + //$pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); + //End of PDF Gen using DOM PDF + + //PDF GEN BY TCPDF + + //PDF GEN BY TCPDF + + $output_file2 = APPPATH."/docs/sample.pdf"; + echo file_put_contents($output_file2, $pdf_doc); + + // echo $ci_instant; } } \ No newline at end of file diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index 2178e9b6..e69de29b 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/docs/temp.html b/api/application/docs/temp.html index f570edbb..4d47efff 100644 --- a/api/application/docs/temp.html +++ b/api/application/docs/temp.html @@ -1,171 +1,157 @@ -
My html content
Hi Karthi Raj,
-This is Karthi Raj, I am form 50, 2 , your Qualification number (2), has been activated,
-can you please verify with your local branch.
-Hope will get reply soon!!
-Regards,
-Sriram,
-Main Raw Materials are Listed Below Edietd
-check checkcheck
- -Suppliers are Listed Below
- -| Resico | -test | -9685471122 | -3 | -1 | -
Customer Segment: SENP-AI
+Lender: HDFC
+
+ Product :- Home Loan
+Sub Product: Home Resale
+
+ Business Info - Type Of Activity
+| Company | +Contact | +Relation | +Earing Status | +Company Name | +Age Eligibilty | +
|---|---|---|---|---|---|
| Rajesh Kumar | +56 | +Brother | +Salaried | +TCS | ++ |
| santhosh Kumar | +45 | +Brother | +Selfemployee | +ABC Pvt Ltd | ++ |
| Jiv Kumar | +65 | +Father | +No | +- | +NA | +
| Selvi | +60 | +Mother | +Housewife | +- | ++ |
Main Applicant Name:
+ +Customer Segment:
+Lender:
+
+ Product :-
+Sub Product:
+
+ Business Info - Type Of Activity
+| Company | +Contact | +Relation | +Earing Status | +Company Name | +Age Eligibilty | +
|---|---|---|---|---|---|
| + | + | + | + | + | 60){ echo "NA";}?> | +
{$Name}
+PD Report ID: {$pdid} +Main Applicant Name: {$main_applicant_name} +Customer Segment: {$cus_seg} +Lender: {$lender_name} +Product :- {$product}
+ + +Business Info - Type Of Activity
+{if $type_of_activity eq "Manufacturing"} + Manufacturing Products +{elseif $type_of_activity eq "Retails"} + Retails + {elseif $type_of_activity eq "Service Providers"} + Service Providers +{else} + Others +{/if} + +List of Co - Applicant's with Foreach
+{foreach $applicants as $applicant} +{if $applicant.name > 50} +List of Co - Applicant's With Section
+{section name=a loop=$applicants} + {$applicants[a].name} * + {$applicants[a].age}tpl_vars['Name']->value;?> +Customer Segment: tpl_vars['cus_seg']->value;?> + +Lender: tpl_vars['lender_name']->value;?> + +
Product :- tpl_vars['product']->value;?>
+ + +Business Info - Type Of Activity
+tpl_vars['type_of_activity']->value == "Manufacturing") {?> + Manufacturing Products +tpl_vars['type_of_activity']->value == "Retails") {?> + Retails + tpl_vars['type_of_activity']->value == "Service Providers") {?> + Service Providers + + Others + + +List of Co - Applicant's with Foreach
+smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['applicants']->value, 'applicant'); +if ($_from !== null) { +foreach ($_from as $_smarty_tpl->tpl_vars['applicant']->value) { +if ($_smarty_tpl->tpl_vars['applicant']->value['name'] > 50) {?> +List of Co - Applicant's With Section
+tpl_vars['applicants']->value) ? count($_loop) : max(0, (int) $_loop)); +$__section_a_0_total = $__section_a_0_loop; +$_smarty_tpl->tpl_vars['__smarty_section_a'] = new Smarty_Variable(array()); +if ($__section_a_0_total !== 0) { +for ($__section_a_0_iteration = 1, $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] = 0; $__section_a_0_iteration <= $__section_a_0_total; $__section_a_0_iteration++, $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']++){ +?> + tpl_vars['applicants']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] : null)]['name'];?> + * + tpl_vars['applicants']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_a']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_a']->value['index'] : null)]['age'];?> +