From 65d0369bc0ea520b01c9432b4802cbadca5213f2 Mon Sep 17 00:00:00 2001 From: velz Date: Wed, 5 Dec 2018 20:12:18 +0530 Subject: [PATCH] PDF ADDED --- api/application/composer.json | 3 +- api/application/composer.lock | 206 +++++++++++++---- api/application/config/autoload.php | 2 +- api/application/config/constants.php | 6 +- api/application/config/routes.php | 3 +- api/application/controllers/PD_Controller.php | 86 ++++++- api/application/docs/sample.pdf | 211 ++++-------------- api/application/docs/temp.html | 1 + api/application/libraries/Pdfgenerator.php | 37 +++ api/application/models/PD_Model.php | 13 +- 10 files changed, 344 insertions(+), 224 deletions(-) create mode 100644 api/application/docs/temp.html create mode 100644 api/application/libraries/Pdfgenerator.php diff --git a/api/application/composer.json b/api/application/composer.json index 2addfdaf..87658d6e 100644 --- a/api/application/composer.json +++ b/api/application/composer.json @@ -17,7 +17,8 @@ "monolog/monolog": "^1.23", "ddeboer/tesseract": "^1.1", "aws/aws-sdk-php": "^3.64", - "amphp/amp": "^1.2" + "amphp/amp": "^1.2", + "dompdf/dompdf" : "0.6.*" }, "suggest": { diff --git a/api/application/composer.lock b/api/application/composer.lock index 408aead2..578ef0d4 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": "b4b72b09cfc21e95dae4ddb7c00d11d6", + "content-hash": "9943dfa2aab14b4fe39a2ba1f65b56d9", "packages": [ { "name": "amphp/amp", @@ -65,16 +65,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.64.15", + "version": "3.80.3", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "22ad993c1ed7a85d660768d30d773babbc7d38bd" + "reference": "f1f724c48a49350250950d80d16b348e5e748e3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/22ad993c1ed7a85d660768d30d773babbc7d38bd", - "reference": "22ad993c1ed7a85d660768d30d773babbc7d38bd", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f1f724c48a49350250950d80d16b348e5e748e3c", + "reference": "f1f724c48a49350250950d80d16b348e5e748e3c", "shasum": "" }, "require": { @@ -82,7 +82,7 @@ "ext-pcre": "*", "ext-simplexml": "*", "ext-spl": "*", - "guzzlehttp/guzzle": "^5.3.1|^6.2.1", + "guzzlehttp/guzzle": "^5.3.3|^6.2.1", "guzzlehttp/promises": "~1.0", "guzzlehttp/psr7": "^1.4.1", "mtdowling/jmespath.php": "~2.2", @@ -95,6 +95,8 @@ "doctrine/cache": "~1.4", "ext-dom": "*", "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", "nette/neon": "^2.3", "phpunit/phpunit": "^4.8.35|^5.4.3", "psr/cache": "^1.0" @@ -103,7 +105,8 @@ "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", "doctrine/cache": "To use the DoctrineCacheAdapter", "ext-curl": "To send requests using cURL", - "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages" + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" }, "type": "library", "extra": { @@ -141,7 +144,7 @@ "s3", "sdk" ], - "time": "2018-08-17T20:48:05+00:00" + "time": "2018-12-04T20:31:51+00:00" }, { "name": "ddeboer/tesseract", @@ -187,6 +190,47 @@ ], "time": "2013-06-26T21:04:54+00:00" }, + { + "name": "dompdf/dompdf", + "version": "v0.6.2", + "source": { + "type": "git", + "url": "https://github.com/dompdf/dompdf.git", + "reference": "cc06008f75262510ee135b8cbb14e333a309f651" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/cc06008f75262510ee135b8cbb14e333a309f651", + "reference": "cc06008f75262510ee135b8cbb14e333a309f651", + "shasum": "" + }, + "require": { + "phenx/php-font-lib": "0.2.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "include/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + }, + { + "name": "Brian Sweeney", + "email": "eclecticgeek@gmail.com" + } + ], + "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", + "homepage": "https://github.com/dompdf/dompdf", + "time": "2015-12-07T04:07:13+00:00" + }, { "name": "guzzlehttp/guzzle", "version": "6.3.3", @@ -305,32 +349,33 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.4.2", + "version": "1.5.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c" + "reference": "9f83dded91781a01c63574e387eaa769be769115" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c", - "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/9f83dded91781a01c63574e387eaa769be769115", + "reference": "9f83dded91781a01c63574e387eaa769be769115", "shasum": "" }, "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -360,26 +405,27 @@ "keywords": [ "http", "message", + "psr-7", "request", "response", "stream", "uri", "url" ], - "time": "2017-03-20T17:10:46+00:00" + "time": "2018-12-04T20:46:45+00:00" }, { "name": "monolog/monolog", - "version": "1.23.0", + "version": "1.24.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4" + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4", - "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", + "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266", "shasum": "" }, "require": { @@ -444,7 +490,7 @@ "logging", "psr-3" ], - "time": "2017-06-19T01:22:40+00:00" + "time": "2018-11-05T09:00:11+00:00" }, { "name": "mtdowling/jmespath.php", @@ -501,6 +547,40 @@ ], "time": "2016-12-03T22:08:25+00:00" }, + { + "name": "phenx/php-font-lib", + "version": "0.2.2", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-font-lib.git", + "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", + "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "classes/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse, export and make subsets of different types of font files.", + "homepage": "https://github.com/PhenX/php-font-lib", + "time": "2014-02-01T15:22:28+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -553,16 +633,16 @@ }, { "name": "psr/log", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", "shasum": "" }, "require": { @@ -596,7 +676,47 @@ "psr", "psr-3" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "reference": "5601c8a83fbba7ef674a7369456d12f1e0d0eafa", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~3.7.0", + "satooshi/php-coveralls": ">=1.0" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2016-02-11T07:05:27+00:00" }, { "name": "smalot/pdfparser", @@ -649,25 +769,25 @@ }, { "name": "symfony/process", - "version": "v3.4.14", + "version": "v3.3.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f" + "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/0414db29bd770ec5a4152683e655f55efd4fa60f", - "reference": "0414db29bd770ec5a4152683e655f55efd4fa60f", + "url": "https://api.github.com/repos/symfony/process/zipball/07432804942b9f6dd7b7377faf9920af5f95d70a", + "reference": "07432804942b9f6dd7b7377faf9920af5f95d70a", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": ">=5.5.9" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "3.3-dev" } }, "autoload": { @@ -694,20 +814,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2018-07-26T11:19:56+00:00" + "time": "2017-07-13T13:05:09+00:00" }, { "name": "tecnickcom/tcpdf", - "version": "6.2.17", + "version": "6.2.26", "source": { "type": "git", "url": "https://github.com/tecnickcom/TCPDF.git", - "reference": "64fc19439863e1b1314487a72a74d9bfd0b55a53" + "reference": "367241059ca166e3a76490f4448c284e0a161f15" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/64fc19439863e1b1314487a72a74d9bfd0b55a53", - "reference": "64fc19439863e1b1314487a72a74d9bfd0b55a53", + "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/367241059ca166e3a76490f4448c284e0a161f15", + "reference": "367241059ca166e3a76490f4448c284e0a161f15", "shasum": "" }, "require": { @@ -756,20 +876,20 @@ "pdf417", "qrcode" ], - "time": "2018-02-24T11:48:20+00:00" + "time": "2018-10-16T17:24:05+00:00" }, { "name": "thiagoalessio/tesseract_ocr", - "version": "2.6.3", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/thiagoalessio/tesseract-ocr-for-php.git", - "reference": "48bfc260ef08a061cc0d6fe43b00f915ce909485" + "reference": "cf9534a7bef895ba2106ff8ea199e193118c5a7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thiagoalessio/tesseract-ocr-for-php/zipball/48bfc260ef08a061cc0d6fe43b00f915ce909485", - "reference": "48bfc260ef08a061cc0d6fe43b00f915ce909485", + "url": "https://api.github.com/repos/thiagoalessio/tesseract-ocr-for-php/zipball/cf9534a7bef895ba2106ff8ea199e193118c5a7e", + "reference": "cf9534a7bef895ba2106ff8ea199e193118c5a7e", "shasum": "" }, "require": { @@ -801,7 +921,7 @@ "Tesseract", "text recognition" ], - "time": "2018-07-24T18:30:18+00:00" + "time": "2018-11-09T19:12:03+00:00" } ], "packages-dev": [], diff --git a/api/application/config/autoload.php b/api/application/config/autoload.php index a3d5aebe..746c2e22 100644 --- a/api/application/config/autoload.php +++ b/api/application/config/autoload.php @@ -89,7 +89,7 @@ $autoload['drivers'] = array(); | | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array('url', 'form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts'); +$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts'); /* | ------------------------------------------------------------------- diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 665b69f5..c16a9595 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', '(listLessPDDetails/:any)'); // no errors //defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', '(listAllTemplates/:any)'); // no errors -defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'getFullPDDetails'); // no errors +defined('ROUTE_LOGIN') OR define('ROUTE_LOGIN', 'generatePDReport'); // no errors /*********************AWS resources Constants*************************************************/ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','sineedgedevprofilepic'); @@ -427,13 +427,15 @@ defined('BOUNCEMASTERID') OR define('BOUNCEMASTERID','bounce_id'); defined('EXISTINGLOANTYPES') OR define('EXISTINGLOANTYPES','m_existing_loan_types'); defined('EXISTINGLOANTYPESID') OR define('EXISTINGLOANTYPESID','existing_loan_type_id'); -/*NOT IN TEST ENV*/ defined('REPORTTEMPLATES') OR define('REPORTTEMPLATES','m_report_templates'); defined('REPORTTEMPLATESID') OR define('REPORTTEMPLATESID','report_template_id'); defined('PDADDTIONALREQUIREMENTS') OR define('PDADDTIONALREQUIREMENTS','t_pd_addtional_requirements'); defined('PDADDTIONALREQUIREMENTSID') OR define('PDADDTIONALREQUIREMENTSID','add_req_id'); +defined('NONINDIVIDUALENTITIES') OR define('NONINDIVIDUALENTITIES','m_non_individual_entities'); +defined('NONINDIVIDUALENTITIESID') OR define('NONINDIVIDUALENTITIESID','non_individual_entity_id'); + diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 775dfd83..44c6b11b 100644 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -164,7 +164,8 @@ $route['saveAssessedIncomeHouseholdExpenses'] = 'PD_Controller/saveAssessedIncom $route['saveAssessedIncomeMonthwiseItems'] = 'PD_Controller/saveAssessedIncomeMonthwiseItems'; $route['calculateAssessedIncome'] = 'PD_Controller/calculateAssessedIncome'; $route['saveAssessedIncomeCalculateMode'] = 'PD_Controller/saveAssessedIncomeCalculateMode'; -$route['savePDAddtionalRequiremets'] = 'PD_Controller/savePDAdditionalRequiremets'; +$route['savePDAdditionalRequiremets'] = 'PD_Controller/savePDAdditionalRequiremets'; +$route['generatePDReport'] = 'PD_Controller/generatePDReport'; //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 27a4c94e..5c84db41 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -21,6 +21,7 @@ class PD_Controller extends REST_Controller { $this->load->library('AWS_S3'); $this->load->library('AWS_SNS'); $this->load->helper('GETPDFORMDETAILS'); + $this->load->library('pdfgenerator'); } @@ -230,7 +231,11 @@ class PD_Controller extends REST_Controller { $pd_details = json_decode($this->post('pd_details'),true); - $pd_addtional_requirements = json_decode($this->post('addtional_requirements'),true); + $pd_addtional_requirements = array(); + if($this->post('addtional_requirements')) + { + $pd_addtional_requirements = json_decode($this->post('addtional_requirements'),true); + } $pd_applicant_details = json_decode($this->post('pd_applicant_details'),true); $pd_document_titles = ""; $pd_document_from_mobile = ""; @@ -362,13 +367,16 @@ class PD_Controller extends REST_Controller { if($pd_id != null || $pd_id != '') { - foreach($pd_applicant_details as $pd_applicant_detail) + if(count($pd_applicant_details)) { - $pd_applicant_detail['fk_pd_id'] = $pd_id; - $co_applicant_id = $this->PD_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); - if($co_applicant_id != null || $co_applicant_id != '') + foreach($pd_applicant_details as $pd_applicant_detail) { - $count = $count + 1; + $pd_applicant_detail['fk_pd_id'] = $pd_id; + $co_applicant_id = $this->PD_Model->saveRecords($pd_applicant_detail,PDAPPLICANTSDETAILS); + if($co_applicant_id != null || $co_applicant_id != '') + { + $count = $count + 1; + } } } } @@ -1628,7 +1636,7 @@ class PD_Controller extends REST_Controller { $pd_details = $this->PD_Model->getPDMasterDetails($pd_id); $result_array = $this->PD_Model->getPDFormDetails($pd_id,$pd_form_id); - print_r($result_array);die(); + //print_r($result_array);die(); //call helper function for get structured key,value pairs $final_array = GETPDFORMDETAILS::getPDFormDetailsStructured($result_array,$pd_id,$pd_form_id); // *****************************Get Docs from bucket @@ -2539,17 +2547,77 @@ class PD_Controller extends REST_Controller { { $records = $this->post('records'); $pdid = $records['pd_id']; + $final_report_string = "RAW"; + + $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); + //Get PD Report Functions $fields = array('report_template_id', 'fk_template_id','content'); - $where_condition_array = array('fk_template_id'=>$records['fk_template_id'],'isactive'=>1); + $where_condition_array = array('fk_template_id'=>$pd_master_details[0]['fk_pd_template_id'],'isactive'=>1); $result_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,REPORTTEMPLATES); - + $final_report_string = $result_array[0]['content']; + print_r($final_report_string); if(count($result_array)) { + preg_match_all("/{{(.*?)}}/",$result_array[0]['content'],$keys_from_template); + //print_r($keys_from_template); + $pd_form_raw_data = $this->PD_Model->getPDFormDetails($pdid); + //print_r($pd_form_raw_data); + + foreach($keys_from_template[1] as $key_from_template => $template_key) + { + foreach($pd_form_raw_data as $pd_form_raw_data_key => $pd_form_raw) + + { + if($temp_key = array_search($template_key,$pd_form_raw)) + //if(array_key_exists($template_key,$pd_form_raw_data)) + { + + $result_array[0]['content'] = str_replace($keys_from_template[0][$key_from_template],$pd_form_raw_data[$pd_form_raw_data_key]['column_value'],$result_array[0]['content']); + //echo "\n\n"; + //print_r($final_report_string); + + } + + + } + + } + } + echo "\n\n"; + print_r($result_array[0]['content']); + + $output_file = APPPATH."/docs/temp.html"; + $ifp = fopen( $output_file, 'wb' ); + fwrite( $ifp, $result_array[0]['content'] ); + fclose( $ifp ); + //print_r($output_file); + $file= file_get_contents($output_file); + $pdf_doc = $this->pdfgenerator->generate($file, $filename='original_version', $stream=false, $paper = 'A4', $orientation = "portrait"); + print_r($pdf_doc); + // $bucketname = LENDER_BUCKET_NAME_PREFIX.'1'; + // $key = 'pd'.'1'.'/'.'pd_report_original_version.pdf'; + // $sourcefile = $pdf_doc; + + // $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); + // $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); + // print_r($s3result); + // if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + // { + // echo "done"; + // } + + // $output_file2 = APPPATH."/docs/sample.pdf"; + // echo file_put_contents($output_file2, $pdf_doc,FILE_APPEND); + //write_file($output_file2, $pdf_doc); + + // $ifp2 = fopen( $output_file2, 'wb' ); + // fwrite( $ifp2, $pdf_doc ); + // fclose( $ifp2 ); } } \ No newline at end of file diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index c0e31a07..cb513b77 100644 --- a/api/application/docs/sample.pdf +++ b/api/application/docs/sample.pdf @@ -1,198 +1,85 @@ %PDF-1.3 -% - 1 0 obj -<< -/Type /Catalog +<< /Type /Catalog /Outlines 2 0 R -/Pages 3 0 R ->> +/Pages 3 0 R >> endobj - 2 0 obj -<< -/Type /Outlines -/Count 0 ->> +<< /Type /Outlines /Count 0 >> endobj - 3 0 obj -<< -/Type /Pages -/Count 2 -/Kids [ 4 0 R 6 0 R ] +<< /Type /Pages +/Kids [6 0 R +] +/Count 1 +/Resources << +/ProcSet 4 0 R +/Font << +/F1 8 0 R +/F2 9 0 R >> +>> +/MediaBox [0.000 0.000 595.280 841.890] + >> endobj - 4 0 obj -<< -/Type /Page -/Parent 3 0 R -/Resources << -/Font << -/F1 9 0 R ->> -/ProcSet 8 0 R ->> -/MediaBox [0 0 612.0000 792.0000] -/Contents 5 0 R ->> +[/PDF /Text ] endobj - 5 0 obj -<< /Length 1074 >> -stream -2 J -BT -0 0 0 rg -/F1 0027 Tf -57.3750 722.2800 Td -( A Simple PDF File ) Tj -ET -BT -/F1 0010 Tf -69.2500 688.6080 Td -( This is a small demonstration .pdf file - ) Tj -ET -BT -/F1 0010 Tf -69.2500 664.7040 Td -( just for use in the Virtual Mechanics tutorials. More text. And more ) Tj -ET -BT -/F1 0010 Tf -69.2500 652.7520 Td -( text. And more text. And more text. And more text. ) Tj -ET -BT -/F1 0010 Tf -69.2500 628.8480 Td -( And more text. And more text. And more text. And more text. And more ) Tj -ET -BT -/F1 0010 Tf -69.2500 616.8960 Td -( text. And more text. Boring, zzzzz. And more text. And more text. And ) Tj -ET -BT -/F1 0010 Tf -69.2500 604.9440 Td -( more text. And more text. And more text. And more text. And more text. ) Tj -ET -BT -/F1 0010 Tf -69.2500 592.9920 Td -( And more text. And more text. ) Tj -ET -BT -/F1 0010 Tf -69.2500 569.0880 Td -( And more text. And more text. And more text. And more text. And more ) Tj -ET -BT -/F1 0010 Tf -69.2500 557.1360 Td -( text. And more text. And more text. Even more. Continued on page 2 ...) Tj -ET -endstream -endobj - -6 0 obj << -/Type /Page +/Creator (DOMPDF) +/CreationDate (D:20181205201105+05'30') +/ModDate (D:20181205201105+05'30') +>> +endobj +6 0 obj +<< /Type /Page /Parent 3 0 R -/Resources << -/Font << -/F1 9 0 R ->> -/ProcSet 8 0 R ->> -/MediaBox [0 0 612.0000 792.0000] /Contents 7 0 R >> endobj - 7 0 obj -<< /Length 676 >> +<< /Filter /FlateDecode +/Length 385 >> stream -2 J -BT -0 0 0 rg -/F1 0027 Tf -57.3750 722.2800 Td -( Simple PDF File 2 ) Tj -ET -BT -/F1 0010 Tf -69.2500 688.6080 Td -( ...continued from page 1. Yet more text. And more text. And more text. ) Tj -ET -BT -/F1 0010 Tf -69.2500 676.6560 Td -( And more text. And more text. And more text. And more text. And more ) Tj -ET -BT -/F1 0010 Tf -69.2500 664.7040 Td -( text. Oh, how boring typing this stuff. But not as boring as watching ) Tj -ET -BT -/F1 0010 Tf -69.2500 652.7520 Td -( paint dry. And more text. And more text. And more text. And more text. ) Tj -ET -BT -/F1 0010 Tf -69.2500 640.8000 Td -( Boring. More, a little more text. The end, and just as well. ) Tj -ET +x}j0y-H%kŷūʖ ˲^;iD |(aIy-WP&QTrf/ $3|f/>ߥޭ rS~`@d(QZ/GpY.$-:]xRW*7<3YوW>8|?7s1}N+ +! =D& <ܜNˏo mNG<3\>ufW'+26jZ=atFGgcvmg?o*$GRd~4xgo:soO@l^]rlugS"TIets I$Ed$mܞ/9nX lkm endstream endobj - 8 0 obj -[/PDF /Text] -endobj - -9 0 obj -<< -/Type /Font +<< /Type /Font /Subtype /Type1 /Name /F1 -/BaseFont /Helvetica +/BaseFont /Times-Roman /Encoding /WinAnsiEncoding >> endobj - -10 0 obj -<< -/Creator (Rave \(http://www.nevrona.com/rave\)) -/Producer (Nevrona Designs) -/CreationDate (D:20060301072826) +9 0 obj +<< /Type /Font +/Subtype /Type1 +/Name /F2 +/BaseFont /Times-Bold +/Encoding /WinAnsiEncoding >> endobj - xref -0 11 -0000000000 65535 f -0000000019 00000 n -0000000093 00000 n -0000000147 00000 n -0000000222 00000 n -0000000390 00000 n -0000001522 00000 n -0000001690 00000 n -0000002423 00000 n -0000002456 00000 n -0000002574 00000 n - +0 10 +0000000000 65535 f +0000000009 00000 n +0000000074 00000 n +0000000120 00000 n +0000000284 00000 n +0000000313 00000 n +0000000427 00000 n +0000000490 00000 n +0000000947 00000 n +0000001056 00000 n trailer << -/Size 11 +/Size 10 /Root 1 0 R -/Info 10 0 R +/Info 5 0 R >> - startxref -2714 +1164 %%EOF diff --git a/api/application/docs/temp.html b/api/application/docs/temp.html new file mode 100644 index 00000000..8ddd615c --- /dev/null +++ b/api/application/docs/temp.html @@ -0,0 +1 @@ +

My html content

Hi Karthi Raj,

This is 50, I am form {{org_name}}, {{place}} , your transaction number ({{trans_number}}), has been activated,

can you please list all check checkcheck.

Hope will get reply soon!!

Regards,

Rahit,

{{place}}

list all supplier details below

Resico

\ No newline at end of file diff --git a/api/application/libraries/Pdfgenerator.php b/api/application/libraries/Pdfgenerator.php new file mode 100644 index 00000000..b452fb22 --- /dev/null +++ b/api/application/libraries/Pdfgenerator.php @@ -0,0 +1,37 @@ +load_html($html); + $dompdf->set_paper($paper, $orientation); + $dompdf->render(); + if ($stream) { + $dompdf->stream($filename.".pdf", array("Attachment" => 0)); + } else { + //return $dompdf->output(); + $output_file2 = APPPATH."/docs/sample.pdf"; + echo file_put_contents($output_file2, $dompdf->output()); + // $CI =& get_instance(); + // $CI->load->helper('file'); + // write_file(APPPATH."/docs/sample.pdf",$dompdf->output()); + } + } +} + + +?> \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 6fdbb953..db6db99c 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -84,7 +84,7 @@ class PD_Model extends SPARQ_Model { foreach($result_array as $key => $result) { - $this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation,RELATIONSHIPS.name as relation_name,PDAPPLICANTSDETAILS.landline'); + $this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation,RELATIONSHIPS.name as relation_name,PDAPPLICANTSDETAILS.landline,PDAPPLICANTSDETAILS.company_name'); $this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS'); $this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id','LEFT'); $this->db->JOIN(CITY.' as CITY','PDAPPLICANTSDETAILS.fk_city = CITY.city_id','LEFT'); @@ -175,7 +175,7 @@ class PD_Model extends SPARQ_Model { */ public function getApplicantsDetails($pdid) { - $this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation,RELATIONSHIPS.name as relation_name,PDAPPLICANTSDETAILS.landline'); + $this->db->SELECT('PDAPPLICANTSDETAILS.pd_co_applicant_id, PDAPPLICANTSDETAILS.fk_pd_id, PDAPPLICANTSDETAILS.applicant_name, PDAPPLICANTSDETAILS.applicant_type, PDAPPLICANTSDETAILS.mobile_no, PDAPPLICANTSDETAILS.email, PDAPPLICANTSDETAILS.addressline1, PDAPPLICANTSDETAILS.addressline2, PDAPPLICANTSDETAILS.addressline3, PDAPPLICANTSDETAILS.fk_city, PDAPPLICANTSDETAILS.fk_state, PDAPPLICANTSDETAILS.pincode,PDAPPLICANTSDETAILS.relation,RELATIONSHIPS.name as relation_name,PDAPPLICANTSDETAILS.landline,PDAPPLICANTSDETAILS.company_name'); $this->db->FROM(PDAPPLICANTSDETAILS.' as PDAPPLICANTSDETAILS'); $this->db->JOIN(STATE.' as STATE','PDAPPLICANTSDETAILS.fk_state = STATE.state_id','LEFT'); $this->db->JOIN(CITY.' as CITY','PDAPPLICANTSDETAILS.fk_city = CITY.city_id','LEFT'); @@ -899,14 +899,17 @@ class PD_Model extends SPARQ_Model { // return $categories; } - public function getPDFormDetails($pd_id,$pd_form_id) + public function getPDFormDetails($pd_id,$pd_form_id = "") { - $this->db->SELECT('PDFORMDETAILS.iter_column_name,PDFORMDETAILS.iter_sub_column_name,PDFORMDETAILS.iteration, PDFORMDETAILS.column_name, PDFORMDETAILS.column_id, PDFORMDETAILS.column_value, PDFORMDETAILS.createdon, PDFORMDETAILS.fk_createdby,USERPROFILE.first_name,USERPROFILE.last_name'); + $this->db->SELECT('PDFORMDETAILS.fk_pd_id,PDFORMDETAILS.fk_form_id,PDFORMDETAILS.iter_column_name,PDFORMDETAILS.iter_sub_column_name,PDFORMDETAILS.iteration, PDFORMDETAILS.column_name, PDFORMDETAILS.column_id, PDFORMDETAILS.column_value, PDFORMDETAILS.createdon, PDFORMDETAILS.fk_createdby,USERPROFILE.first_name,USERPROFILE.last_name'); $this->db->FROM(PDFORMDETAILS.' as PDFORMDETAILS'); $this->db->JOIN(USERPROFILE.' as USERPROFILE','PDFORMDETAILS.fk_createdby = USERPROFILE.userid','LEFT'); $this->db->WHERE('PDFORMDETAILS.fk_pd_id',$pd_id); - $this->db->WHERE('PDFORMDETAILS.fk_form_id',$pd_form_id); + if($pd_form_id != "") + { + $this->db->WHERE('PDFORMDETAILS.fk_form_id',$pd_form_id); + } $this->db->WHERE('PDFORMDETAILS.isactive',1); $form_details = $this->db->GET()->result_array(); return $form_details;