From 3174ff076cbb8b95bdf557e584f5616f39b189a6 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Wed, 4 Jan 2023 15:45:55 +0530 Subject: [PATCH] pdf meger removed and fi changes : ps --- api/application/composer.json | 3 +- api/application/composer.lock | 169 +- api/application/config/routes.php | 4 + api/application/controllers/PD_Controller.php | 48 +- .../Request_DataDump_Controller.php | 1897 ++++++++++++++++- api/application/models/Data_Dump_Model.php | 47 + .../JSONTOREPORT_FI_OV_DI.php | 38 +- .../JSONTOREPORT_FI_OV_SAL.php | 8 +- .../report_templates/JSONTOREPORT_FI_RV.php | 11 +- 9 files changed, 2009 insertions(+), 216 deletions(-) diff --git a/api/application/composer.json b/api/application/composer.json index 3feef0eb..f3b10333 100644 --- a/api/application/composer.json +++ b/api/application/composer.json @@ -26,8 +26,7 @@ "twilio/sdk": "^6.10", "phpoffice/phpspreadsheet": "^1.15", "johnathanmiller/secure-env-php": "^2.0", - "google/apiclient": "^2.0", - "jurosh/pdf-merge": "^2.1" + "google/apiclient": "^2.0" }, "suggest": { diff --git a/api/application/composer.lock b/api/application/composer.lock index 337b06a1..59de0153 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": "8fc0a51600d01d7c91e51c6a63b2b3f2", + "content-hash": "ecfa4a8917d77187eb7582e019969b78", "packages": [ { "name": "amphp/amp", @@ -928,55 +928,6 @@ }, "time": "2019-01-07T06:56:58+00:00" }, - { - "name": "jurosh/pdf-merge", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/jurosh/php-pdf-merge.git", - "reference": "89ba3446c9f38c573e3b8bf577d2f22993494130" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jurosh/php-pdf-merge/zipball/89ba3446c9f38c573e3b8bf577d2f22993494130", - "reference": "89ba3446c9f38c573e3b8bf577d2f22993494130", - "shasum": "" - }, - "require": { - "php": ">=5.6.20", - "setasign/fpdf": "^1.8", - "setasign/fpdi": "^2.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/Jurosh/PDFMerge/PDFMerger.php", - "src/Jurosh/PDFMerge/PDFObject.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Juraj Husar", - "email": "jurosh@jurosh.com", - "homepage": "http://jurosh.com" - } - ], - "description": "PHP PDF Merger", - "homepage": "https://github.com/jurosh/php-pdf-merge", - "keywords": [ - "merge", - "pdf" - ], - "support": { - "issues": "https://github.com/jurosh/php-pdf-merge/issues", - "source": "https://github.com/jurosh/php-pdf-merge/tree/remove" - }, - "time": "2021-03-28T19:57:14+00:00" - }, { "name": "maennchen/zipstream-php", "version": "2.1.0", @@ -2337,124 +2288,6 @@ }, "time": "2021-12-11T13:40:54+00:00" }, - { - "name": "setasign/fpdf", - "version": "1.8.5", - "source": { - "type": "git", - "url": "https://github.com/Setasign/FPDF.git", - "reference": "f4104a04c9a3f95c4c26a0a0531abebcc980987a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDF/zipball/f4104a04c9a3f95c4c26a0a0531abebcc980987a", - "reference": "f4104a04c9a3f95c4c26a0a0531abebcc980987a", - "shasum": "" - }, - "require": { - "ext-gd": "*", - "ext-zlib": "*" - }, - "type": "library", - "autoload": { - "classmap": [ - "fpdf.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Olivier Plathey", - "email": "oliver@fpdf.org", - "homepage": "http://fpdf.org/" - } - ], - "description": "FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.", - "homepage": "http://www.fpdf.org", - "keywords": [ - "fpdf", - "pdf" - ], - "support": { - "source": "https://github.com/Setasign/FPDF/tree/1.8.5" - }, - "time": "2022-11-18T07:02:00+00:00" - }, - { - "name": "setasign/fpdi", - "version": "v2.3.6", - "source": { - "type": "git", - "url": "https://github.com/Setasign/FPDI.git", - "reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/6231e315f73e4f62d72b73f3d6d78ff0eed93c31", - "reference": "6231e315f73e4f62d72b73f3d6d78ff0eed93c31", - "shasum": "" - }, - "require": { - "ext-zlib": "*", - "php": "^5.6 || ^7.0 || ^8.0" - }, - "conflict": { - "setasign/tfpdf": "<1.31" - }, - "require-dev": { - "phpunit/phpunit": "~5.7", - "setasign/fpdf": "~1.8", - "setasign/tfpdf": "1.31", - "squizlabs/php_codesniffer": "^3.5", - "tecnickcom/tcpdf": "~6.2" - }, - "suggest": { - "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured." - }, - "type": "library", - "autoload": { - "psr-4": { - "setasign\\Fpdi\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jan Slabon", - "email": "jan.slabon@setasign.com", - "homepage": "https://www.setasign.com" - }, - { - "name": "Maximilian Kresse", - "email": "maximilian.kresse@setasign.com", - "homepage": "https://www.setasign.com" - } - ], - "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.", - "homepage": "https://www.setasign.com/fpdi", - "keywords": [ - "fpdf", - "fpdi", - "pdf" - ], - "support": { - "issues": "https://github.com/Setasign/FPDI/issues", - "source": "https://github.com/Setasign/FPDI/tree/v2.3.6" - }, - "funding": [ - { - "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi", - "type": "tidelift" - } - ], - "time": "2021-02-11T11:37:01+00:00" - }, { "name": "smalot/pdfparser", "version": "v0.13.3", diff --git a/api/application/config/routes.php b/api/application/config/routes.php index 4da28ee2..d80d4741 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -370,6 +370,9 @@ $route['getListPDOfficersForNotification'] = 'PD_Controller/getListPDOfficersFor $route['sendNotificationToOfficers'] = 'PD_Controller/sendNotificationToOfficers'; $route['saveDatadumpRequest'] = 'Request_DataDump_Controller/saveDatadumpRequest'; $route['getDatadumpRequestList'] = 'Request_DataDump_Controller/getDatadumpRequestList'; +$route['downloadDatadumpRequest'] = 'Request_DataDump_Controller/downloadDatadumpRequest'; +$route['CSVfile'] = 'Request_DataDump_Controller/CSVfile'; + $route['addgoogleCalenderEvent'] = 'GC_Event_Controller/addGoogleCalenterEvent';//dummy checking purpose $route['getEventList'] = 'GC_Event_Controller/getGoogleCalenderEventList';//dummy checking purpose @@ -411,6 +414,7 @@ $route['smcPhotoPDFDownload'] = 'SMC_Credit_PD_Controller/imgPDFDownload'; $route['myFunction']='Flyhi_Controller/myFunction'; $route['previewDigiLockerDocs']='Flyhi_Controller/previewDigiLockerDocs'; $route['applicantWiseDigiLockerDocs']='Flyhi_Controller/DigiLockerDocs'; +$route['DigiLockerPDFMerge']='Flyhi_Controller/DigiLockerPDFMerge'; $route['purge_pddata']='Data_Dump_Controller/renamingExistingPDinfo'; $route['checkjsonPD']='Data_Dump_Controller/checkjsonPD'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 08091090..daee6171 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -4513,19 +4513,19 @@ class PD_Controller extends REST_Controller // die(); //PDF Gen using DOM PDF $pdf_doc = $this->pdfgenerator->generate($temp, $filename = 'version', $stream = false, $paper = 'A4', $orientation = "portrait"); - $details = $this->PD_Model->getDocsDetails($pdid); - if(!empty($details)){ - for($i=0;$iaws_s3->getSingleObjectInaBucketAsSignedURI($bucketname, $dockey, '+30 minutes'); - $src_local_file = XLPATH.'/tmp/'.$details[$i]['pd_document_name']; - $ifp = fopen( $src_local_file, 'wb' ); - fwrite( $ifp, $doc_singed_uri ); - fclose( $ifp ); - chmod($src_local_file, 0777); - $docsdetails[] = $details[$i]['pd_document_name']; - } - } + // $details = $this->PD_Model->getDocsDetails($pdid); + // if(!empty($details)){ + // for($i=0;$iaws_s3->getSingleObjectInaBucketAsSignedURI($bucketname, $dockey, '+30 minutes'); + // $src_local_file = XLPATH.'/tmp/'.$details[$i]['pd_document_name']; + // $ifp = fopen( $src_local_file, 'wb' ); + // fwrite( $ifp, $doc_singed_uri ); + // fclose( $ifp ); + // chmod($src_local_file, 0777); + // $docsdetails[] = $details[$i]['pd_document_name']; + // } + // } // ALTER TABLE `sineedgedemo`.`t_pd_documents` // ADD COLUMN `docs_merge` TINYINT(4) NULL DEFAULT '0' AFTER `content_type`; //End of PDF Gen using DOM PDF @@ -4534,16 +4534,16 @@ class PD_Controller extends REST_Controller // echo $output_file2; // die(); if (file_put_contents($output_file2, $pdf_doc)) { - if(!empty($docsdetails)){ - $pdf = new \Jurosh\PDFMerge\PDFMerger; - // $pdf = new PDFMerger; - $pdf->addPDF($output_file2, 'all'); - foreach($docsdetails as $doc) - { - $pdf->addPDF(XLPATH.'/tmp/'.$doc, 'all'); - } - $pdf->merge('file', $output_file2); - } + // if(!empty($docsdetails)){ + // $pdf = new \Jurosh\PDFMerge\PDFMerger; + // // $pdf = new PDFMerger; + // $pdf->addPDF($output_file2, 'all'); + // foreach($docsdetails as $doc) + // { + // $pdf->addPDF(XLPATH.'/tmp/'.$doc, 'all'); + // } + // $pdf->merge('file', $output_file2); + // } $sourcefile = $output_file2; // print_r($sourcefile);die(); $bucket_data = array('bucket_name' => $bucketname, 'key' => $newkey, 'sourcefile' => $sourcefile); @@ -5976,7 +5976,7 @@ class PD_Controller extends REST_Controller // echo $data['pd_master_details'][0]['fk_pd_type']; echo $t; - die(); + // die(); $total_replaces = substr_count($t, ''); for ($i = 0; $i < $total_replaces; $i++) { diff --git a/api/application/controllers/Request_DataDump_Controller.php b/api/application/controllers/Request_DataDump_Controller.php index 679a49bd..34187276 100755 --- a/api/application/controllers/Request_DataDump_Controller.php +++ b/api/application/controllers/Request_DataDump_Controller.php @@ -69,5 +69,1900 @@ class Request_DataDump_Controller extends REST_Controller { } } - + public function CSVfile_get(){ + // try 1; + $list = [ + ["Name" => "John", "Gender" => "M"], + ["Name" => "Doe", "Gender" => "M"], + ["Name" => "Sara", "Gender" => "F"] + ]; + $filename = XLPATH.'/tmp/sanjeev.csv'; + $fp = fopen($filename, 'w'); + //Write the header + fputcsv($fp, array_keys($list[0])); + //Write fields + foreach ($list as $fields) { + fputcsv($fp, $fields); + } + fclose($fp); + // ---- + // try 2; + $data = [ + ['Symbol', 'Company', 'Price'], + ['GOOG', 'Google Inc.', '800'], + ['AAPL', 'Apple Inc.', '500'], + ['AMZN', 'Amazon.com Inc.', '250'], + ['YHOO', 'Yahoo! Inc.', '250'], + ['FB', 'Facebook, Inc.', '30'], + ]; + + $filename = XLPATH.'/tmp/sanjeev2.csv'; + + // open csv file for writing + $f = fopen($filename, 'w'); + + if ($f === false) { + die('Error opening the file ' . $filename); + } + + // write each row at a time to a file + foreach ($data as $row) { + fputcsv($f, $row); + } + + // close the file + fclose($f); + } + + public function downloadDatadumpRequest_get(){ + log_message('ERROR','## Download Request For XL-datadump inside Fns'); + ## Sample Params : + $id = $this->get('request_id'); + log_message('ERROR','## Request For XL-datadump RequestID - '.$id); + //die('Error opening the file '); + ## Gathering Data based on params. + $fields = array('*'); + $where_condition_array = array('request_id' => $id); + $result_data = $this->Data_Dump_Model->selectCustomRecords($fields, $where_condition_array, DATADUMPREQUEST); + $requested_details = $this->Data_Dump_Model->getRequestForDataDump($result_data); + log_message('ERROR','## Request For XL-datadump Requested-data count - '.count($requested_details)); + if (!empty($requested_details)){ + $folder = XLPATH.'/tmp/sanjeev'; // changed to request-id don't forgot. + if(!is_dir($folder)) mkdir($folder, 0777, TRUE); + for($i=0;$i < count($requested_details);$i++){ + $processedJson = json_decode($requested_details[$i]['processed_json'],TRUE); + ### '18', 'General Information', + if($processedJson['formid'] == 18){ + $filename = $folder.'/General.csv'; + // open csv file for writing + $f = fopen($filename, 'w'); + if ($f === false) { + die('Error opening the file ' . $filename); + } + } + if($processedJson['formid'] == 18){ +// '1', 'Supplier Details' +// '2', 'Client Details' +// '5', 'Address Details' +// '10', 'Loan Details' +// '6', 'Family Details' +// '13', 'Business Information' +// '12', 'Employment Information' +// '14', 'Financial Information' +// '9', 'Other Income Details' +// '8', 'Existing Loan Obligations' +// '11', 'Stock Details' +// '4', 'Other Assets' +// '7', 'Banking Details' +// '16', 'Assessed Income' +// '17', 'Rental Verification' +// '19', 'Neighbourhood / Reference Check' +// '20', 'Final Remarks Form' +// '21', 'Business Banking' +// '22', 'Business Assets' +// '23', 'Future Plan and Business Environment' +// '24', 'Credit Manager Queries' +// '26', 'Photograph' +// '27', 'FI General Information' +// '28', 'FI Address Details' +// '29', 'FI Office Visit Information' +// '30', 'FI Residence Visit Information' +// '31', 'FI Credit Manager Queries' +// '32', 'FI Neighbourhood Details' +// '33', 'FI Final Remarks' + } + } + } + + public function getRequestForDataDump2_post(){ + + + + // echo "\n The file $file exists"; + // $pathinfo = pathinfo($file); print_r($pathinfo); + + // '3', 'Personal Details', + // '15', 'Lender Representative', + // '16', 'Assessed Income', + // '17', 'Rental Verification', + // '23', 'Future Plan and Business Environment', + // '25', 'Vendor PD Form', + // '26', 'Photograph', + $requested_details = $this->Data_Dump_Model->getRequestForDataDump(array()); + $A=0;$B=0;$C=0;$E=0;$F=0;$G=0;$I=0;$L=0;$N=0;$O=0;$S=0; // GobalScope; + $CI=0;$SU=0;$FI=0;$FAD=0;$BI=0;$BB=0;$BA=0;$EI=0; + // print_r($requested_details);die(); + for($i=0;$i < count($requested_details);$i++){ + // echo "\n inx : ".$i; + $processedJson = json_decode($requested_details[$i]['processed_json'],TRUE); + ### '18', 'General Information', + if($processedJson['formid'] == 18){ + // echo "\n I have Gerenal Form Details C on below the Dtls"; + // + $XL->setActiveSheetIndex(0); + if($G==0){$G=3;} + $a = $G;$b = $G;$c = $G;$d = $G; + // print_r($processedJson['individuals']); + $individuals = $processedJson['individuals']; + if(!empty($individuals)){ + for($j=0;$jgetActiveSheet()->setCellValue('A'.$a,$processedJson['pdid']); + $XL->getActiveSheet()->setCellValue('B'.$a,$individuals[$j]['applicant_name']) + ->setCellValue('C'.$a,($individuals[$j]['is_applicant'] == 1) ? 'true' :'false') + ->setCellValue('D'.$a,($individuals[$j]['is_person_met'] == 1) ? 'true' : 'false') + ->setCellValue('E'.$a,!empty($individuals[$j]['age'])?$individuals[$j]['age']:"-") + ->setCellValue('F'.$a,!empty($individuals[$j]['qualification_master'])?$individuals[$j]['qualification_master']:"-") + ->setCellValue('G'.$a,!empty($individuals[$j]['course_name'])?$individuals[$j]['course_name']:"-"); + $a++; + }}else{ + $XL->getActiveSheet()->setCellValue('B'.$G,"-") + ->setCellValue('C'.$G,"-") + ->setCellValue('D'.$G,"-") + ->setCellValue('E'.$G,"-") + ->setCellValue('F'.$G,"-") + ->setCellValue('G'.$G,"-"); + } + $XL->getActiveSheet()->setCellValue('H'.$G,!empty($processedJson['is_kyc'])?$processedJson['is_kyc']:"-"); + $companies = $processedJson['companies']; + if(!empty($companies)){ + for($j=0;$jgetActiveSheet()->setCellValue('J'.$b,$companies[$j]['company_name']) + ->setCellValue('K'.$b,($companies[$j]['is_company_applicant'] == 1) ? 'true' :'false') + ->setCellValue('L'.$b,!empty($companies[$j]['business_entity_type_master'])?$companies[$j]['business_entity_type_master']:"-") + ->setCellValue('M'.$b,!empty($companies[$j]['business_month'])?$companies[$j]['business_month']:"-") + ->setCellValue('N'.$b,!empty($companies[$j]['business_years'])?$companies[$j]['business_years']:"-") + ->setCellValue('O'.$b,!empty($companies[$j]['business_date_object'])?$companies[$j]['business_date_object']:"-"); + $b++; + }}else{ + $XL->getActiveSheet()->setCellValue('J'.$G,"-") + ->setCellValue('K'.$G,"-") + ->setCellValue('L'.$G,"-") + ->setCellValue('M'.$G,"-") + ->setCellValue('N'.$G,"-") + ->setCellValue('O'.$G,"-"); + } + $personsWithRelationships = $processedJson['persons_with_relationships']; + // print_r($personsWithRelationships); + if(!empty($personsWithRelationships)){ + for($j=0;$jgetActiveSheet()->setCellValue('P'.$c,!empty($personsWithRelationships[$j]['pd_co_applicant_id_master'])?$personsWithRelationships[$j]['pd_co_applicant_id_master']:"-") + ->setCellValue('Q'.$c,($personsWithRelationships[$j]['relationship_master'] == "") ? 'Not Related' : $personsWithRelationships[$j]['relationship_master']) + ->setCellValue('R'.$c,!empty($personsWithRelationships[$j]['relation_to_master'])?$personsWithRelationships[$j]['relation_to_master']:"-"); + $c++; + }}else{ + $XL->getActiveSheet()->setCellValue('P'.$G,"-") + ->setCellValue('Q'.$G,"-") + ->setCellValue('R'.$G,"-"); + } + + $companyWithRelationships = $processedJson['company_with_relationships']; + if(!empty($companyWithRelationships)){ + for($j=0;$jgetActiveSheet()->setCellValue('S'.$d,!empty($companyWithRelationships[$j]['applicant_name_master'])?$companyWithRelationships[$j]['applicant_name_master']:"-") + ->setCellValue('T'.$d,!empty($companyWithRelationships[$j]['company_relationship_master'])?$companyWithRelationships[$j]['company_relationship_master']:"-") + ->setCellValue('U'.$d,!empty($companyWithRelationships[$j]['company_name'])?$companyWithRelationships[$j]['company_name']:"-"); + $d++; + }}else{ + $XL->getActiveSheet()->setCellValue('S'.$G,"-") + ->setCellValue('T'.$G,"-") + ->setCellValue('U'.$G,"-"); + } + $XL->getActiveSheet()->setCellValue('V'.$G,$processedJson['general_remark']); + if (count($individuals) >= count($companies) && count($individuals) >= count($companyWithRelationships)){ + $max = count($individuals);} + if (count($companies) >= count($individuals) && count($companies) >= count($companyWithRelationships)){ + $max = count($companies);} + if (count($companyWithRelationships) >= count($individuals) && count($companyWithRelationships) >= count($companies)){ + $max = count($companyWithRelationships);} + if($max>0){ + for($x=$G;$x<($G+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $G = ($G+$max);} + else{ + $XL->getActiveSheet()->setCellValue('A'.$G,$processedJson['pdid']); + $G++; + } + + }### General Info Ends Here. + ### '5', 'Address Details', + if($processedJson['formid'] == 5){ + $XL->setActiveSheetIndex(1); + if($A==0)$A=2; + $a = $A;$b = $A; + $addresses = $processedJson['addresses']; + for($j=0;$jgetActiveSheet()->setCellValue('A'.$a,$processedJson['pdid']); + $XL->getActiveSheet()->setCellValue('B'.$a,$addresses[$j]['address']) + ->setCellValue('C'.$a,!empty($addresses[$j]['state_master'])?$addresses[$j]['state_master']:"-") + ->setCellValue('D'.$a,!empty($addresses[$j]['city_master'])?$addresses[$j]['city_master']:"-") + ->setCellValue('E'.$a,!empty($addresses[$j]['pincode_master'])? $addresses[$j]['pincode_master']:"-") + ->setCellValue('F'.$a,!empty($addresses[$j]['pincode_others'])? $addresses[$j]['pincode_others']:"-") + ->setCellValue('N'.$b,!empty($addresses[$j]['address_type_master']) ? $addresses[$j]['address_type_master'] : "-") + ->setCellValue('O'.$b,!empty($addresses[$j]['address_type_others']) ? $addresses[$j]['address_type_others'] : "-") + ->setCellValue('P'.$b,!empty($addresses[$j]['locality_master']) ? $addresses[$j]['locality_master'] : "-") + ->setCellValue('Q'.$b,!empty($addresses[$j]['locality_others'])? $addresses[$j]['locality_others'] :"-") + ->setCellValue('R'.$b,!empty($addresses[$j]['pd_location_master'])?$addresses[$j]['pd_location_master']:"-") + ->setCellValue('S'.$b,!empty($addresses[$j]['comment_locality_master'])?$addresses[$j]['comment_locality_master']:"-") + ->setCellValue('T'.$b,!empty($addresses[$j]['estimated_area'])?$addresses[$j]['estimated_area']:"-") + ->setCellValue('U'.$b,!empty($addresses[$j]['uom_master'])?$addresses[$j]['uom_master']:"-") + ->setCellValue('V'.$b,!empty($addresses[$j]['uom_others'])?$addresses[$j]['uom_others']:"-"); + $a++; + } + if($processedJson['is_pd_done_on_initiated_address'] == 1){ + $XL->getActiveSheet()->setCellValue('G'.$A,"Yes")->setCellValue('H'.$A,"-") + ->setCellValue('I'.$A,"-")->setCellValue('J'.$A,"-")->setCellValue('K'.$A,"-") + ->setCellValue('L'.$A,"-")->setCellValue('M'.$A,"-"); + }else{ + $XL->getActiveSheet()->setCellValue('G'.$A,"No"); + $alternativeAddresses = $processedJson['alternative_addresses']; + for($j=0;$jgetActiveSheet()->setCellValue('A'.$a,$processedJson['pdid']); + $XL->getActiveSheet()->setCellValue('H'.$b,!empty($alternativeAddresses[$j]['alternative_address'])?$alternativeAddresses[$j]['alternative_address']:"-") + ->setCellValue('I'.$b,!empty($alternativeAddresses[$j]['state_master'])?$alternativeAddresses[$j]['state_master']:"-") + ->setCellValue('J'.$b,!empty($alternativeAddresses[$j]['city_master'])?$alternativeAddresses[$j]['city_master']:"-") + ->setCellValue('K'.$a,!empty($alternativeAddresses[$j]['pincode_master'])?$alternativeAddresses[$j]['pincode_master']:"-") + ->setCellValue('L'.$a,!empty($alternativeAddresses[$j]['alternative_pincode_others'])?$alternativeAddresses[$j]['alternative_pincode_others']:"-") + ->setCellValue('M'.$b,!empty($alternativeAddresses[$j]['reason_for_alternative_address'])?$alternativeAddresses[$j]['reason_for_alternative_address']:"-") + ->setCellValue('N'.$b,!empty($alternativeAddresses[$j]['address_type_master']) ? $alternativeAddresses[$j]['address_type_master'] : "-") + ->setCellValue('O'.$b,!empty($alternativeAddresses[$j]['address_type_others']) ? $alternativeAddresses[$j]['address_type_others'] : "-") + ->setCellValue('P'.$b,!empty($alternativeAddresses[$j]['locality_master']) ? $alternativeAddresses[$j]['locality_master'] : "-") + ->setCellValue('Q'.$b,!empty($alternativeAddresses[$j]['locality_others'])? $alternativeAddresses[$j]['locality_others'] :"-") + ->setCellValue('R'.$b,!empty($alternativeAddresses[$j]['pd_location_master'])?$alternativeAddresses[$j]['pd_location_master']:"-") + ->setCellValue('S'.$b,!empty($alternativeAddresses[$j]['comment_locality_master'])?$alternativeAddresses[$j]['comment_locality_master']:"-") + ->setCellValue('T'.$b,!empty($alternativeAddresses[$j]['estimated_area'])?$alternativeAddresses[$j]['estimated_area']:"-") + ->setCellValue('U'.$b,!empty($alternativeAddresses[$j]['uom_master'])?$alternativeAddresses[$j]['uom_master']:"-") + ->setCellValue('V'.$b,!empty($alternativeAddresses[$j]['uom_others'])?$alternativeAddresses[$j]['uom_others']:"-"); + $b++; + } + } + $XL->getActiveSheet()->setCellValue('W'.$A,$processedJson['address_form_remark']); + $max = max(count($addresses),count($alternativeAddresses)); + if($max>0){ + for($x=$A;$x<($A+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $A = $A+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$A,$processedJson['pdid']); + $A++; + } + + } + ### Address Dtls Ends Here. + ### '10', 'Loan Details', + if($processedJson['formid'] == 10){ + // echo $processedJson['facility_amount']; + $XL->setActiveSheetIndex(2); + if($L==0)$L=3; + $XL->getActiveSheet()->setCellValue('A'.$L,!empty($processedJson['pdid'])?$processedJson['pdid']:"-") + ->setCellValue('B'.$L,!empty($processedJson['loan_amount'])?$processedJson['loan_amount']:"-") + ->setCellValue('C'.$L,!empty($processedJson['loan_tenure'])?$processedJson['loan_tenure']:"-") + ->setCellValue('D'.$L,!empty($processedJson['sub_product'])?$processedJson['sub_product']:"-") + ->setCellValue('E'.$L,!empty($processedJson['end_use_master']) ? implode(",",$processedJson['end_use_master']) : "-") + ->setCellValue('F'.$L,!empty($processedJson['end_use_other']) ? $processedJson['end_use_other'] : "-") + ->setCellValue('G'.$L,!empty($processedJson['is_transfer'])?$processedJson['is_transfer']:"-") + ->setCellValue('H'.$L,!empty($processedJson['own_contribution'])?$processedJson['own_contribution']:"-") + ->setCellValue('I'.$L,!empty($processedJson['source_of_own_contribution_master']) ?implode(",",$processedJson['source_of_own_contribution_master']) : "-") + ->setCellValue('J'.$L,!empty($processedJson['other_source'])?$processedJson['other_source'] : "-") + ->setCellValue('K'.$L,!empty($processedJson['balance_transfer_amount'])?$processedJson['balance_transfer_amount']:"-") + ->setCellValue('L'.$L,!empty($processedJson['lender_master'])?$processedJson['lender_master']:"-") + ->setCellValue('M'.$L,!empty($processedJson['other_bt_lender'])?$processedJson['other_bt_lender']:"-") + ->setCellValue('N'.$L,!empty($processedJson['topup_amount'])?$processedJson['topup_amount']:"-") + ->setCellValue('O'.$L,!empty($processedJson['end_use_topup_master']) ?$processedJson['end_use_topup_master']:"-") + ->setCellValue('P'.$L,!empty($processedJson['other_end_use_topup']) ?$processedJson['other_end_use_topup']:"-") + ->setCellValue('Q'.$L,!empty($processedJson['emi_level'])?$processedJson['emi_level']:"-") + ->setCellValue('R'.$L,!empty($processedJson['property_type_master']) ?$processedJson['property_type_master']:"-") + ->setCellValue('S'.$L,!empty($processedJson['property_type_others']) ?$processedJson['property_type_others']:"-") + ->setCellValue('T'.$L,!empty($processedJson['owners_list_master'])?implode(",",$processedJson['owners_list_master']):"-") + ->setCellValue('U'.$L,!empty($processedJson['construction_status_master'])?$processedJson['construction_status_master']:"-") + ->setCellValue('V'.$L,!empty($processedJson['emv_per_customer'])?$processedJson['emv_per_customer']:"-") + ->setCellValue('W'.$L,!empty($processedJson['property_seller'])?$processedJson['property_seller']:"-") + ->setCellValue('X'.$L,!empty($processedJson['address'])?$processedJson['address']:"-") + ->setCellValue('Y'.$L,!empty($processedJson['state_master'])?$processedJson['state_master']:"-") + ->setCellValue('Z'.$L,!empty($processedJson['city_master'])?$processedJson['city_master']:"-") + ->setCellValue('AA'.$L,!empty($processedJson['pincode_master']) ? $processedJson['pincode_master']:"-") + ->setCellValue('AB'.$L,!empty($processedJson['other_pincode']) ? $processedJson['other_pincode']:"-") + ->setCellValue('AC'.$L,!empty($processedJson['loandetails_remarks'])?$processedJson['loandetails_remarks']:"-") + ->setCellValue('AD'.$L,!empty($processedJson['facility_amount'])?$processedJson['facility_amount']:"-") + ->setCellValue('AE'.$L,!empty($processedJson['anchor_name'])?$processedJson['anchor_name']:"-") + ->setCellValue('AF'.$L,!empty($processedJson['vintage_anchor_year'])?$processedJson['vintage_anchor_year']:"-") + ->setCellValue('AG'.$L,!empty($processedJson['vintage_anchor_month'])?$processedJson['vintage_anchor_month']:"-") + ->setCellValue('AH'.$L,!empty($processedJson['monthly_business_anchor'])?$processedJson['monthly_business_anchor']:"-") + ->setCellValue('AI'.$L,!empty($processedJson['business_concentration'])?$processedJson['business_concentration']:"-") + ->setCellValue('AJ'.$L,!empty($processedJson['credit_period_days'])?$processedJson['credit_period_days']:"-") + ->setCellValue('AK'.$L,!empty($processedJson['payment_mechanism'])?$processedJson['payment_mechanism']:"-") + ->setCellValue('AL'.$L,!empty($processedJson['average_invoicevalue'])?$processedJson['average_invoicevalue']:"-") + ->setCellValue('AM'.$L,!empty($processedJson['peakseasons_anchor'])?$processedJson['peakseasons_anchor']:"-") + ->setCellValue('AN'.$L,!empty($processedJson['sales_low_months'])?$processedJson['sales_low_months']:"-") + ->setCellValue('AO'.$L,!empty($processedJson['peak_season_comment'])?$processedJson['peak_season_comment']:"-") + ->setCellValue('AP'.$L,!empty($processedJson['anchor_notes'])?$processedJson['anchor_notes']:"-") + ->setCellValue('AQ'.$L,!empty($processedJson['debitcredit_notes'])?$processedJson['debitcredit_notes']:"-") + ->setCellValue('AR'.$L,!empty($processedJson['stock_related_anchor'])?$processedJson['stock_related_anchor']:"-") + ->setCellValue('AS'.$L,!empty($processedJson['sample_invoices'])?$processedJson['sample_invoices']:"-") + ->setCellValue('AT'.$L,!empty($processedJson['sampleinvoices_no'])?$processedJson['sampleinvoices_no']:"-") + ->setCellValue('AU'.$L,!empty($processedJson['sampleinvoices_yes'])?$processedJson['sampleinvoices_yes']:"-"); + +// ->setCellValue('AN'.$L,$processedJson['is_transfer + +// ->setCellValue('AA'.$L,$processedJson['is_there_total_fund + +// ->setCellValue('U'.$L,$processedJson['fund_amt + + + + + + $L++; + } + ### Loan Dtls Ends Here + ### '7', 'Banking Details of Individuals', + if($processedJson['formid'] == 7){ + $XL->setActiveSheetIndex(4); + if($B==0){$B=3;} + $XL->getActiveSheet()->setCellValue('A'.$B,$processedJson['pdid'])->setCellValue('L'.$B,!empty($processedJson['banking_form_remark'])?$processedJson['banking_form_remark']:"-"); + $a = $B; + $Individualbankdtls = $processedJson['banking_details']; + if(!empty($Individualbankdtls)){ + for($j=0;$jgetActiveSheet() + ->setCellValue('B'.$a,!empty($Individualbankdtls[$j]['bank_info_available'])?($Individualbankdtls[$j]['bank_info_available']) ? 'Yes' :'No':"-") + ->setCellValue('C'.$a,!empty($Individualbankdtls[$j]['applicant_name_master'])?$Individualbankdtls[$j]['applicant_name_master']:"-") + ->setCellValue('D'.$a,!empty($Individualbankdtls[$j]['other_applicant'])?$Individualbankdtls[$j]['other_applicant']:"-") + ->setCellValue('E'.$a,!empty($Individualbankdtls[$j]['bank_name_master'])?$Individualbankdtls[$j]['bank_name_master']:"-") + ->setCellValue('F'.$a,!empty($Individualbankdtls[$j]['other_bank'])?$Individualbankdtls[$j]['other_bank']:"-") + ->setCellValue('G'.$a,!empty($Individualbankdtls[$j]['account_type_master'])?$Individualbankdtls[$j]['account_type_master']:"-") + ->setCellValue('H'.$a,!empty($Individualbankdtls[$j]['limit'])?$Individualbankdtls[$j]['limit']:"-") + ->setCellValue('I'.$a,!empty($Individualbankdtls[$j]['is_main'])?$Individualbankdtls[$j]['is_main']:"-") + ->setCellValue('J'.$a,!empty($Individualbankdtls[$j]['vintage_year'])?$Individualbankdtls[$j]['vintage_year']:"-") + ->setCellValue('K'.$a,!empty($Individualbankdtls[$j]['vintage_month'])?$Individualbankdtls[$j]['vintage_month']:"-"); + $a++; + }}else{ + $XL->getActiveSheet() + ->setCellValue('B'.$B,"-") + ->setCellValue('C'.$B,"-") + ->setCellValue('D'.$B,"-") + ->setCellValue('E'.$B,"-") + ->setCellValue('F'.$B,"-") + ->setCellValue('G'.$B,"-") + ->setCellValue('H'.$B,"-") + ->setCellValue('I'.$B,"-") + ->setCellValue('J'.$B,"-") + ->setCellValue('K'.$B,"-"); + } + $max = count($Individualbankdtls); + for($x=$B;$x<($B+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $B = $B+$max; + } + ### Banking Dtls Ends Here + ### '6', 'Family Details', + if($processedJson['formid'] == 6){ + $XL->setActiveSheetIndex(5); + if($FAD==0){$FAD=3;} + $a=$FAD;$b=$FAD; + $XL->getActiveSheet()->setCellValue('AB'.$FAD,!empty($processedJson['family_details_form_remark'])?$processedJson['family_details_form_remark']:"-"); + $familydetails = $processedJson['family_details']; + $familymemberdetailscount = 0; + if(!empty($familydetails)){ + for($j=0;$jgetActiveSheet() + ->setCellValue('B'.$a,!empty($familydetails[$j]['selected_person_master'])?$familydetails[$j]['selected_person_master']:"-") + ->setCellValue('C'.$a,!empty($familydetails[$j]['residence_state_master'])?$familydetails[$j]['residence_state_master']:"-") + ->setCellValue('D'.$a,!empty($familydetails[$j]['residence_city_master'])?$familydetails[$j]['residence_city_master']:"-") + ->setCellValue('E'.$a,!empty($familydetails[$j]['residence_place'])?$familydetails[$j]['residence_place']:"-") + ->setCellValue('F'.$a,!empty($familydetails[$j]['residence_pincode_master'])?$familydetails[$j]['residence_pincode_master']:"-") + ->setCellValue('G'.$a,!empty($familydetails[$j]['residence_other_pincode'])?$familydetails[$j]['residence_other_pincode']:"-") + ->setCellValue('H'.$a,!empty($familydetails[$j]['residence_No_of_years'])?$familydetails[$j]['residence_No_of_years']:"-") + ->setCellValue('I'.$a,!empty($familydetails[$j]['residence_No_of_months'])?$familydetails[$j]['residence_No_of_months']:"-") + ->setCellValue('J'.$a,!empty($familydetails[$j]['residence_ownership_master'])?$familydetails[$j]['residence_ownership_master']:"-") + ->setCellValue('K'.$a,!empty($familydetails[$j]['ownershipOther'])?$familydetails[$j]['ownershipOther']:"-") + ->setCellValue('Z'.$a,!empty($familydetails[$j]['no_family_mem_clix'])?$familydetails[$j]['no_family_mem_clix']:"-") + ->setCellValue('AA'.$a,!empty($familydetails[$j]['no_dependents_clix'])?$familydetails[$j]['no_dependents_clix']:"-"); + $familymemberdetails = $familydetails[$j]['family_members_details']; + if($familymemberdetails[0]['family_member_name'] != ""){ + for($k=0;$kgetActiveSheet() + ->setCellValue('L'.$b,!empty($familymemberdetails[$k]['family_member_salutation_master'])?$familymemberdetails[$k]['family_member_salutation_master']:"-") + ->setCellValue('M'.$b,!empty($familymemberdetails[$k]['family_member_name'])?$familymemberdetails[$k]['family_member_name']:"-") + ->setCellValue('N'.$b,!empty($familymemberdetails[$k]['family_member_age'])?$familymemberdetails[$k]['family_member_age']:"-") + ->setCellValue('O'.$b,!empty($familymemberdetails[$k]['family_member_relationship_master'])?$familymemberdetails[$k]['family_member_relationship_master']:"-") + ->setCellValue('P'.$b,!empty($familymemberdetails[$k]['family_member_earning_status'])?($familymemberdetails[$k]['family_member_earning_status'] == 1)?"Earning": "Non Earning":"-") + ->setCellValue('Q'.$b,!empty($familymemberdetails[$k]['non_earning_occupation_master'])?$familymemberdetails[$k]['non_earning_occupation_master']:"-") + ->setCellValue('R'.$b,!empty($familymemberdetails[$k]['non_earning_if_others'])?$familymemberdetails[$k]['non_earning_if_others']:"-") + ->setCellValue('S'.$b,!empty($familymemberdetails[$k]['non_earning_if_schoolorcollege'])?$familymemberdetails[$k]['non_earning_if_schoolorcollege']:"-") + ->setCellValue('T'.$b,!empty($familymemberdetails[$k]['non_earning_if_retired_from'])?$familymemberdetails[$k]['non_earning_if_retired_from']:"-") + ->setCellValue('U'.$b,!empty($familymemberdetails[$k]['earning_segment_master']) ? $familymemberdetails[$k]['earning_segment_master'] :"-" ) + ->setCellValue('V'.$b,!empty($familymemberdetails[$k]['earning_if_others_segment'])?$familymemberdetails[$k]['earning_if_others_segment']:"-") + ->setCellValue('W'.$b,!empty($familymemberdetails[$k]['earning_gross_income_per_month'])?$familymemberdetails[$k]['earning_gross_income_per_month']:"-") + ->setCellValue('X'.$b,!empty($familymemberdetails[$k]['earning_name_of_the_employer_or_business'])?$familymemberdetails[$k]['earning_name_of_the_employer_or_business']:"-") + ->setCellValue('Y'.$b,!empty($familymemberdetails[$k]['earning_number_of_years_in_employment_or_business'])?$familymemberdetails[$k]['earning_number_of_years_in_employment_or_business']:"-"); + $b++; + } + $familymemberdetailscount = count($familymemberdetails); + }else{ + $XL->getActiveSheet() + ->setCellValue('L'.$a,"-")->setCellValue('M'.$a,"-")->setCellValue('N'.$a,"-")->setCellValue('O'.$a,"-")->setCellValue('P'.$a,"-") + ->setCellValue('Q'.$a,"-")->setCellValue('R'.$a,"-")->setCellValue('S'.$a,"-")->setCellValue('T'.$a,"-")->setCellValue('U'.$a,"-") + ->setCellValue('V'.$a,"-")->setCellValue('W'.$a,"-")->setCellValue('X'.$a,"-")->setCellValue('Y'.$a,"-"); + } + // print_r($familymemberdetails); + $a++; + } + }else{ + $XL->getActiveSheet() + ->setCellValue('B'.$FAD,"-")->setCellValue('C'.$FAD,"-")->setCellValue('D'.$FAD,"-") + ->setCellValue('E'.$FAD,"-")->setCellValue('F'.$FAD,"-")->setCellValue('G'.$FAD,"-")->setCellValue('H'.$FAD,"-") + ->setCellValue('I'.$FAD,"-")->setCellValue('J'.$FAD,"-")->setCellValue('K'.$FAD,"-")->setCellValue('L'.$FAD,"-") + ->setCellValue('M'.$FAD,"-")->setCellValue('N'.$FAD,"-")->setCellValue('O'.$FAD,"-")->setCellValue('P'.$FAD,"-") + ->setCellValue('Q'.$FAD,"-")->setCellValue('R'.$FAD,"-")->setCellValue('S'.$FAD,"-")->setCellValue('T'.$FAD,"-") + ->setCellValue('U'.$FAD,"-")->setCellValue('V'.$FAD,"-")->setCellValue('W'.$FAD,"-")->setCellValue('X'.$FAD,"-")->setCellValue('Y'.$FAD,"-"); + } + $max = max($familymemberdetailscount,count($familydetails)); + if($max>0){ + for($x=$FAD;$x<($FAD+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $FAD = $FAD+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$FAD,$processedJson['pdid']); + $FAD++; + } + + + + } + ### Family Dtls Ends Here + ### '4', 'Other Assets', + if($processedJson['formid'] == 4){ + $XL->setActiveSheetIndex(3); + if($O==0){$O=2;} + $XL->getActiveSheet()->setCellValue('B'.$O,($processedJson['asset_info_available']) ? 'Yes' :'No') + ->setCellValue('AE'.$O,($processedJson['assets_form_remark'])?$processedJson['assets_form_remark']:"-"); + $a = $O; + $otherassetdetails = $processedJson['assets_details']; + if(!empty($otherassetdetails)){ + for($j=0;$jgetActiveSheet()->setCellValue('D'.$a,$subdetails[0]['any_other_assets']); + }else if(!empty($subdetails[0]['equipment_manufacturing_description'])){ + $XL->getActiveSheet()->setCellValue('D'.$a,$subdetails[0]['equipment_manufacturing_description']); + }else{$XL->getActiveSheet()->setCellValue('D'.$a,"-");} + // if(!empty($subdetails[0]['other_frequency_mode'])){ + // $XL->getActiveSheet()->setCellValue('P'.$a,$subdetails[0]['investments_type_master']); + // }else{$XL->getActiveSheet()->setCellValue('P'.$a,"-");} + if(!empty($subdetails[0]['property_type_master'])){$XL->getActiveSheet()->setCellValue('E'.$a,$subdetails[0]['property_type_master']);} + else{$XL->getActiveSheet()->setCellValue('E'.$a,"-");} + if(!empty($subdetails[0]['other_property_type'])){$XL->getActiveSheet()->setCellValue('F'.$a,$subdetails[0]['other_property_type']);} + else{$XL->getActiveSheet()->setCellValue('F'.$a,"-");} + if(!empty($subdetails[0]['address_of_the_property'])){$XL->getActiveSheet()->setCellValue('G'.$a,$subdetails[0]['address_of_the_property']);} + else{$XL->getActiveSheet()->setCellValue('G'.$a,"-");} + if(!empty($subdetails[0]['describe_of_the_property_asset'])){$XL->getActiveSheet()->setCellValue('H'.$a,$subdetails[0]['describe_of_the_property_asset']);} + else{$XL->getActiveSheet()->setCellValue('H'.$a,"-");} + if(!empty($subdetails[0]['area_covered_by_this_property'])){$XL->getActiveSheet()->setCellValue('I'.$a,$subdetails[0]['area_covered_by_this_property']);} + else{$XL->getActiveSheet()->setCellValue('I'.$a,"-");} + if(!empty($subdetails[0]['uom_master'])){$XL->getActiveSheet()->setCellValue('J'.$a,$subdetails[0]['uom_master']);} + else{$XL->getActiveSheet()->setCellValue('J'.$a,"-");} + if(!empty($subdetails[0]['other_uom'])){$XL->getActiveSheet()->setCellValue('K'.$a,$subdetails[0]['other_uom']);} + else{$XL->getActiveSheet()->setCellValue('K'.$a,"-");} + if(!empty($subdetails[0]['vehicle_type_master'])){$XL->getActiveSheet()->setCellValue('L'.$a,$subdetails[0]['vehicle_type_master']); + }else{$XL->getActiveSheet()->setCellValue('L'.$a,"-");} + if(!empty($subdetails[0]['other_vehicle_type'])){$XL->getActiveSheet()->setCellValue('M'.$a,$subdetails[0]['other_vehicle_type']); + }else{$XL->getActiveSheet()->setCellValue('M'.$a,"-");} + if(!empty($subdetails[0]['manufacturer_model_vehicle'])){$XL->getActiveSheet()->setCellValue('N'.$a,$subdetails[0]['manufacturer_model_vehicle']);} + else{$XL->getActiveSheet()->setCellValue('N'.$a,"-");} + if(!empty($subdetails[0]['premium_paid'])){$XL->getActiveSheet()->setCellValue('O'.$a,$subdetails[0]['premium_paid']); + }else{$XL->getActiveSheet()->setCellValue('O'.$a,"-");} + if(!empty($subdetails[0]['frequency_mode_master'])){$XL->getActiveSheet()->setCellValue('P'.$a,$subdetails[0]['frequency_mode_master']); + }else{$XL->getActiveSheet()->setCellValue('P'.$a,"-");} + if(!empty($subdetails[0]['sum_assured'])){$XL->getActiveSheet()->setCellValue('Q'.$a,$subdetails[0]['sum_assured']); + }else{$XL->getActiveSheet()->setCellValue('Q'.$a,"-");} + if(!empty($subdetails[0]['members_coverd'])){$XL->getActiveSheet()->setCellValue('R'.$a,$subdetails[0]['members_coverd']); + }else{$XL->getActiveSheet()->setCellValue('R'.$a,"-");} + if(!empty($subdetails[0]['investments_type_master'])){$XL->getActiveSheet()->setCellValue('S'.$a,$subdetails[0]['investments_type_master']); + }else{$XL->getActiveSheet()->setCellValue('S'.$a,"-");} + if(!empty($subdetails[0]['other_investments_type'])){$XL->getActiveSheet()->setCellValue('T'.$a,$subdetails[0]['other_investments_type']); + }else{$XL->getActiveSheet()->setCellValue('T'.$a,"-");} + if(!empty($subdetails[0]['amount_of_invest'])){$XL->getActiveSheet()->setCellValue('W'.$a,$subdetails[0]['amount_of_invest']); + }else{$XL->getActiveSheet()->setCellValue('W'.$a,"-");} + if(!empty($subdetails[0]['bank_name'])){$XL->getActiveSheet()->setCellValue('V'.$a,$subdetails[0]['bank_name']); + }else{$XL->getActiveSheet()->setCellValue('V'.$a,"-");} + if(!empty($subdetails[0]['in_which_organisation'])){$XL->getActiveSheet()->setCellValue('U'.$a,$subdetails[0]['in_which_organisation']); + }else{$XL->getActiveSheet()->setCellValue('U'.$a,"-");} + $XL->getActiveSheet() + ->setCellValue('C'.$a,!empty($otherassetdetails[$j]['assets_mode_master'])?$otherassetdetails[$j]['assets_mode_master']:"-") + ->setCellValue('X'.$a,!empty($otherassetdetails[$j]['approximate_market_value'])?$otherassetdetails[$j]['approximate_market_value']:"-") + ->setCellValue('Y'.$a,!empty($otherassetdetails[$j]['name_of_the_owner']) ? implode(",",$nameowned) : "-") + ->setCellValue('Z'.$a,!empty($otherassetdetails[$j]['other_owner']) ?$otherassetdetails[$j]['other_owner']:"-") + ->setCellValue('AA'.$a,!empty($otherassetdetails[$j]['vintage_personal'])?$otherassetdetails[$j]['vintage_personal']:"-") + ->setCellValue('AB'.$a,!empty($otherassetdetails[$j]['asset_months'])?$otherassetdetails[$j]['asset_months']:"-") + ->setCellValue('AC'.$a,!empty($otherassetdetails[$j]['purchase_year'])?$otherassetdetails[$j]['purchase_year']:"-") + ->setCellValue('AD'.$a,!empty($otherassetdetails[$j]['emi'])?$otherassetdetails[$j]['emi']:"-"); + $a++; + }}else{ + $XL->getActiveSheet() + ->setCellValue('C'.$O,"-")->setCellValue('D'.$O,"-")->setCellValue('E'.$O,"-")->setCellValue('F'.$O,"-")->setCellValue('G'.$O,"-")->setCellValue('H'.$O,"-")->setCellValue('I'.$O,"-")->setCellValue('J'.$O,"-")->setCellValue('K'.$O,"-")->setCellValue('L'.$O,"-")->setCellValue('M'.$O,"-") + ->setCellValue('N'.$O,"-")->setCellValue('O'.$O,"-")->setCellValue('P'.$O,"-")->setCellValue('Q'.$O,"-")->setCellValue('R'.$O,"-")->setCellValue('S'.$O,"-")->setCellValue('T'.$O,"-")->setCellValue('U'.$O,"-")->setCellValue('V'.$O,"-")->setCellValue('W'.$O,"-")->setCellValue('X'.$O,"-") + ->setCellValue('Y'.$O,"-")->setCellValue('Z'.$O,"-")->setCellValue('AA'.$O,"-")->setCellValue('AB'.$O,"-")->setCellValue('AC'.$O,"-")->setCellValue('AD'.$O,"-"); + } + $max = count($otherassetdetails); + for($x=$O;$x<($O+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $O = $O+$max; + } + ### Other Asset Ends Here + ### '8', 'Existing Loan Obligations', + if($processedJson['formid'] == 8){ + $XL->setActiveSheetIndex(6); + if($E==0)$E=3; + $a = $E; + $XL->getActiveSheet()->setCellValue('B'.$E,!empty($processedJson['existing_loan'])?$processedJson['existing_loan']:"-") + ->setCellValue('C'.$E,!empty($processedJson['loan_info_available'])?$processedJson['loan_info_available']:"-") + ->setCellValue('S'.$E,!empty($processedJson['tot_running_loans'])?$processedJson['tot_running_loans']:"-") + ->setCellValue('T'.$E,!empty($processedJson['tot_emi_paid'])?$processedJson['tot_emi_paid']:"-") + ->setCellValue('U'.$E,!empty($processedJson['tot_outstanding_loans'])?$processedJson['tot_outstanding_loans']:"-") + ->setCellValue('V'.$E,!empty($processedJson['currentloan_remarks'])?$processedJson['currentloan_remarks']:"-"); + $exist_loan = $processedJson['loan_details']; + if(!empty($exist_loan)){ + for($j=0;$jgetActiveSheet()->setCellValue('I'.$a,"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,$exist_loan[$j]['emi']); + $XL->getActiveSheet()->setCellValue('K'.$a,"-"); + $XL->getActiveSheet()->setCellValue('L'.$a,"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,"-"); + } + if($exist_loan[$j]['frequency'] == '2'){ //'Yearly' + $XL->getActiveSheet()->setCellValue('I'.$a,"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,"-"); + $XL->getActiveSheet()->setCellValue('K'.$a,"-"); + $XL->getActiveSheet()->setCellValue('L'.$a,"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,$exist_loan[$j]['emi']);} + if($exist_loan[$j]['frequency'] == '3'){ //'Every 6 months', + $XL->getActiveSheet()->setCellValue('I'.$a,"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,"-"); + $XL->getActiveSheet()->setCellValue('K'.$a,"-"); + $XL->getActiveSheet()->setCellValue('L'.$a,"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,$exist_loan[$j]['emi']); + $XL->getActiveSheet()->setCellValue('N'.$a,"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,"-");} + if($exist_loan[$j]['frequency'] == '4'){ //'Every 15 days', + $XL->getActiveSheet()->setCellValue('I'.$a,"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,"-"); + $XL->getActiveSheet()->setCellValue('K'.$a,$exist_loan[$j]['emi']); + $XL->getActiveSheet()->setCellValue('L'.$a,"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,"-");} + if($exist_loan[$j]['frequency'] == '5'){ //'Daily', + $XL->getActiveSheet()->setCellValue('K'.$a,"-"); + $XL->getActiveSheet()->setCellValue('I'.$a,$exist_loan[$j]['emi']); + $XL->getActiveSheet()->setCellValue('J'.$a,"-"); + $XL->getActiveSheet()->setCellValue('L'.$a,"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,"-");} + if($exist_loan[$j]['frequency'] == '6'){ //'Every 3 months', + $XL->getActiveSheet()->setCellValue('I'.$a,"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,"-"); + $XL->getActiveSheet()->setCellValue('K'.$a,"-"); + $XL->getActiveSheet()->setCellValue('L'.$a,$exist_loan[$j]['emi']); + $XL->getActiveSheet()->setCellValue('M'.$a,"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,"-");} + if($exist_loan[$j]['frequency'] == '7'){ //'Monthly', + $XL->getActiveSheet()->setCellValue('I'.$a,"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,"-"); + $XL->getActiveSheet()->setCellValue('K'.$a,"-"); + $XL->getActiveSheet()->setCellValue('L'.$a,"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,$exist_loan[$j]['emi']); + $XL->getActiveSheet()->setCellValue('O'.$a,"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,"-");} + if($exist_loan[$j]['frequency'] == '8'){ //'Every 12 days', + $XL->getActiveSheet()->setCellValue('I'.$a,"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,$exist_loan[$j]['emi']); + $XL->getActiveSheet()->setCellValue('K'.$a,"-"); + $XL->getActiveSheet()->setCellValue('L'.$a,"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,"-");} + + $XL->getActiveSheet()->setCellValue('D'.$a,isset($exist_loan[$j]['loan_type_master'])?($exist_loan[$j]['others_loan_type']!="")?"Other(".$exist_loan[$j]['others_loan_type'].")":$exist_loan[$j]['loan_type_master']:"") + ->setCellValue('E'.$a,!empty($exist_loan[$j]['loan_amount'])?$exist_loan[$j]['loan_amount']:"-") + ->setCellValue('F'.$a,!empty($exist_loan[$j]['lender_master'])?$exist_loan[$j]['lender_master']:"-") + ->setCellValue('G'.$a,!empty($exist_loan[$j]['loan_taken_by'])?implode(",",$loantaken):"-") + ->setCellValue('H'.$a,!empty($exist_loan[$j]['frequency_master'])?$exist_loan[$j]['frequency_master']:"-") + ->setCellValue('P'.$a,!empty($exist_loan[$j]['original_tenure'])?$exist_loan[$j]['original_tenure']:"-") + ->setCellValue('Q'.$a,!empty($exist_loan[$j]['current_balance_tenure'])?$exist_loan[$j]['current_balance_tenure']:"-") + ->setCellValue('R'.$a,!empty($exist_loan[$j]['elapsed_tenure'])?$exist_loan[$j]['elapsed_tenure']:"-"); + $a++; + } + } + else{ + $XL->getActiveSheet()->setCellValue('D'.$E,"-")->setCellValue('E'.$E,"-")->setCellValue('F'.$E,"-")->setCellValue('G'.$E,"-")->setCellValue('H'.$E,"-") + ->setCellValue('I'.$E,"-")->setCellValue('J'.$E,"-")->setCellValue('K'.$E,"-")->setCellValue('L'.$E,"-")->setCellValue('M'.$E,"-")->setCellValue('N'.$E,"-") + ->setCellValue('O'.$E,"-")->setCellValue('P'.$E,"-")->setCellValue('Q'.$E,"-")->setCellValue('R'.$E,"-")->setCellValue('S'.$E,"-")->setCellValue('T'.$E,"-"); + + } + $max = count($exist_loan); + for($x=$E;$x<($E+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $E = $E+$max; + } + ### Existing Loan Ends Here + ### '9', 'Other Income Details', + if($processedJson['formid'] == 9){ + $XL->setActiveSheetIndex(7); + if($I==0)$I=3; + $a = $I; + $XL->getActiveSheet()->setCellValue('B'.$I,$processedJson['other_income']?$processedJson['other_income']:"-") + ->setCellValue('I'.$I,!empty($processedJson['otherincome_remarks'])?$processedJson['otherincome_remarks']:"-"); + $other_incdtls = $processedJson['income_details']; + if(!empty($other_incdtls)){ + for($j=0;$jgetActiveSheet()->setCellValue('C'.$a,isset($other_incdtls[$j]['source_master'])?$other_incdtls[$j]['source_master']:"-") + ->setCellValue('D'.$a,!empty($other_incdtls[$j]['others_source'])?$other_incdtls[$j]['others_source']:"-") + ->setCellValue('E'.$a,!empty($other_incdtls[$j]['address'])?$other_incdtls[$j]['address']:"-") + ->setCellValue('F'.$a,!empty($other_incdtls[$j]['income_earned_by'])?implode(",",$incomeearnedby):"-") + ->setCellValue('G'.$a,!empty($other_incdtls[$j]['amount'])?$other_incdtls[$j]['amount']:"-") + ->setCellValue('H'.$a,!empty($other_incdtls[$j]['frequency_master'])?$other_incdtls[$j]['frequency_master']:"-"); + $a++; + } + }else{ + $XL->getActiveSheet()->setCellValue('C'.$I,"-")->setCellValue('D'.$I,"-")->setCellValue('E'.$I,"-")->setCellValue('F'.$I,"-")->setCellValue('G'.$I,"-")->setCellValue('H'.$I,"-"); + } + $max = count($other_incdtls); + for($x=$I;$x<($I+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $I = $I+$max; + } + ### Other Income Dtls Ends Here + ### '19', 'Neighbourhood / Reference Check', + if($processedJson['formid'] == 19){ + $XL->setActiveSheetIndex(8); + if($N==0)$N=4; + $a = $N;$b = $N; + // $XL->getActiveSheet()->setCellValue('A'.$N,$processedJson['pdid']); + $neighbourhood = $processedJson['neighbourhood_list']; + if(!empty($neighbourhood)){ + for($j=0;$jgetActiveSheet()->setCellValue('B'.$a,!empty($neighbourhood[$j]['neighbourhood_name'])?$neighbourhood[$j]['neighbourhood_name']:"-") + ->setCellValue('C'.$a,!empty($neighbourhood[$j]['do_know'])?$neighbourhood[$j]['do_know']:"-") + ->setCellValue('D'.$a,!empty($neighbourhood[$j]['did_not_know_the_business_operation']) ? $neighbourhood[$j]['how_long_do_know_in_month'] : 'Do not know') + ->setCellValue('E'.$a,!empty($neighbourhood[$j]['did_not_know_the_business_operation']) ? $neighbourhood[$j]['how_long_do_know_in_year'] : 'Do not know') + ->setCellValue('F'.$a,!empty($neighbourhood[$j]['did_not_know_the_owner']) ? (implode(",",$orgOwn)) : 'Do not know' ) + ->setCellValue('G'.$a,!empty($neighbourhood[$j]['other_organisation_owner'])?$neighbourhood[$j]['other_organisation_owner']:"-"); + $a++; + } + $XL->getActiveSheet()->setCellValue('H'.$N,!empty($processedJson['neighbourhood_status'])?$processedJson['neighbourhood_status']:"-"); + }else{ + $XL->getActiveSheet()->setCellValue('B'.$N,"-")->setCellValue('C'.$N,"-")->setCellValue('D'.$N,"-") + ->setCellValue('E'.$N,"-")->setCellValue('F'.$N,"-")->setCellValue('G'.$N,"-")->setCellValue('H'.$N,"-"); + } + $reference = $processedJson['referencecheck_list']; + if(!empty($reference)){ + for($j=0;$jgetActiveSheet()->setCellValue('I'.$b,!empty($reference[$j]['reference_name'])?$reference[$j]['reference_name']:"-") + ->setCellValue('J'.$b,!empty($reference[$j]['mobile'])?$reference[$j]['mobile']:"-") + ->setCellValue('K'.$b,!empty($reference[$j]['landline'])?$reference[$j]['landline']:"-") + ->setCellValue('L'.$b,!empty($reference[$j]['location'])?$reference[$j]['location']:"-") + ->setCellValue('M'.$b,!empty($reference[$j]['relationship_with_master'])?$reference[$j]['relationship_with_master']:"-") + ->setCellValue('N'.$b,!empty($reference[$j]['others'])?$reference[$j]['others']:"-") + ->setCellValue('O'.$b,!empty($reference[$j]['year_relation_applicant'])?$reference[$j]['year_relation_applicant']:"-") + ->setCellValue('P'.$b,!empty($reference[$j]['months_relation_applicant'])?$reference[$j]['months_relation_applicant']:"-") + ->setCellValue('Q'.$b,!empty($reference[$j]['business_volume_amount'])?$reference[$j]['business_volume_amount']:"-") + ->setCellValue('R'.$b,!empty($reference[$j]['business_volume_unit_master'])?$reference[$j]['business_volume_unit_master']:"-") + ->setCellValue('S'.$b,!empty($reference[$j]['reference_final_remarks'])?$reference[$j]['reference_final_remarks']:"-") + ->setCellValue('T'.$b,!empty($reference[$j]['specify_final_remark'])?$reference[$j]['specify_final_remark']:"-"); + $b++; + } + }else{ + $XL->getActiveSheet()->setCellValue('I'.$N,"-")->setCellValue('J'.$N,"-")->setCellValue('K'.$N,"-") + ->setCellValue('L'.$N,"-")->setCellValue('M'.$N,"-")->setCellValue('N'.$N,"-") + ->setCellValue('O'.$N,"-")->setCellValue('P'.$N,"-")->setCellValue('Q'.$N,"-") + ->setCellValue('Q'.$N,"-")->setCellValue('R'.$N,"-")->setCellValue('S'.$N,"-")->setCellValue('T'.$N,"-"); + } + $XL->getActiveSheet()->setCellValue('U'.$N,!empty($processedJson['neighbour_reference_remark'])?$processedJson['neighbour_reference_remark']:"-"); + + + + if(count($neighbourhood) >= count($reference)){$max = count($neighbourhood);} + else{$max = count($reference);} + for($x=$N;$x<($N+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $N=$N+$max; + } + ### Neighbour References Ends Here + ### '24', 'Credit Manager Queries', + if($processedJson['formid'] == 24){ + $XL->setActiveSheetIndex(9); + if($C==0)$C=3; + $covidsec = $processedJson['covid_section']; + $XL->getActiveSheet()->setCellValue('A'.$C,$processedJson['pdid'])->setCellValue('L'.$C,!empty($processedJson['common_remarks'])?$processedJson['common_remarks']:"-") + ->setCellValue('C'.$C,!empty($covidsec['business_impacted_by_covid19'])?$covidsec['business_impacted_by_covid19']:"-") + ->setCellValue('D'.$C,!empty($covidsec['business_impacted_by_covid19_Yes'])?$covidsec['business_impacted_by_covid19_Yes']:"-") + ->setCellValue('E'.$C,!empty($covidsec['business_impacted_by_covid19_No'])?$covidsec['business_impacted_by_covid19_No']:"-") + ->setCellValue('F'.$C,!empty($covidsec['avail_loan_moratorium_facility'])?$covidsec['avail_loan_moratorium_facility']:"-") + ->setCellValue('G'.$C,!empty($covidsec['avail_any_loan'])?$covidsec['avail_any_loan']:"-") + ->setCellValue('H'.$C,!empty($covidsec['avail_any_loan_Yes'])?$covidsec['avail_any_loan_Yes']:"-") + ->setCellValue('I'.$C,!empty($covidsec['sales_or_revenue_amt'])?$covidsec['sales_or_revenue_amt']:"-") + ->setCellValue('J'.$C,!empty($covidsec['mentioned_turover_validated'])?$covidsec['mentioned_turover_validated']:"-") + ->setCellValue('K'.$C,!empty($covidsec['mentioned_turover_validated_Yes'])?$covidsec['mentioned_turover_validated_Yes']:"-"); + + $C++; + // print_r($processedJson['covid_section']); + } + + ### Credit Manager Queries Ends Here + ### '20', 'Final Remarks Form', + if($processedJson['formid'] == 20){ + $XL->setActiveSheetIndex(10); + if($FI==0)$FI=3; + $XL->getActiveSheet()->setCellValue('A'.$FI,$processedJson['pdid']) + ->setCellValue('B'.$FI,!empty($processedJson['final_custormer_remark_type_master'])?$processedJson['final_custormer_remark_type_master']:"-") + ->setCellValue('C'.$FI,!empty($processedJson['final_other_customer_behaviour'])?$processedJson['final_other_customer_behaviour']:"-") + ->setCellValue('D'.$FI,!empty($processedJson['is_service_provided'])?$processedJson['is_service_provided']:"-") + ->setCellValue('E'.$FI,!empty($processedJson['market_intelligence'])?$processedJson['market_intelligence']:"-") + ->setCellValue('F'.$FI,!empty($processedJson['pd_officers_recommendation_master'])?$processedJson['pd_officers_recommendation_master']:"-") + ->setCellValue('G'.$FI,!empty($processedJson['others_pd_officers_recommendation'])?$processedJson['others_pd_officers_recommendation']: "-") + ->setCellValue('H'.$FI,!empty($processedJson['was_the_pd_address_ogl'])?$processedJson['was_the_pd_address_ogl']:"-") + ->setCellValue('I'.$FI,!empty($processedJson['mode_of_transport_during_visit'])?$processedJson['mode_of_transport_during_visit']:"-"); + + if($processedJson['pd_officers_recommendation'] == 2){//"Positive"; + $arrpos = array(); + foreach($processedJson['recommendation_positive'] as $pos){ + array_push($arrpos,$pos['reason_for_positive']); + } + $XL->getActiveSheet()->setCellValue('J'.$FI,implode(",",$arrpos));} + else if($processedJson['pd_officers_recommendation'] == 3){//"Negative"; + $arrneg = array(); + foreach($processedJson['recommendation_negative'] as $neg){ + array_push($arrneg,$neg['reason_for_negative']); + } + $XL->getActiveSheet()->setCellValue('J'.$FI,implode(",",$arrneg));} + else if($processedJson['pd_officers_recommendation'] == 4){//"Refer to credit"; + $arrrc = array(); + foreach($processedJson['recommendation_refer_to_credit'] as $rc){ + array_push($arrrc,$rc['reason_for_refer_to_credit']); + } + $XL->getActiveSheet()->setCellValue('J'.$FI,implode(",",$arrrc));} + else if($processedJson['pd_officers_recommendation'] == 1){ + $XL->getActiveSheet()->setCellValue('J'.$FI,"-");} + else{$XL->getActiveSheet()->setCellValue('J'.$FI,"-");} + $XL->getActiveSheet()->setCellValue('K'.$FI,!empty($processedJson['final_form_remarks'])?$processedJson['final_form_remarks']:"-"); + $FI++; + } + ### Final Remarks Ends Here + ### '12', 'Employment Information', + if($processedJson['formid'] == 12){ + $XL->setActiveSheetIndex(11); + if($EI==0)$EI=3; + $XL->getActiveSheet()->setCellValue('A'.$EI,$processedJson['pdid']) + ->setCellValue('B'.$EI,$processedJson['employer_name']) + ->setCellValue('C'.$EI,$processedJson['employer_in_brief']) + ->setCellValue('D'.$EI,$processedJson['how_long_year']) + ->setCellValue('E'.$EI,$processedJson['how_long_month']) + ->setCellValue('F'.$EI,$processedJson['total_business_experience']) + ->setCellValue('G'.$EI,$processedJson['total_business_previous_experience']) + ->setCellValue('H'.$EI,$processedJson['was_met']) + ->setCellValue('I'.$EI,$processedJson['name_person_met']) + ->setCellValue('J'.$EI,$processedJson['designation_person_met']) + ->setCellValue('K'.$EI,$processedJson['others_person_met']) + ->setCellValue('L'.$EI,$processedJson['photo_id_card']) + ->setCellValue('M'.$EI,$processedJson['photo_id_others']) + ->setCellValue('N'.$EI,$processedJson['visiting_card']) + ->setCellValue('O'.$EI,$processedJson['confirm_salary']) + ->setCellValue('P'.$EI,$processedJson['sal_amount_was_not_confirmed']) + ->setCellValue('Q'.$EI,$processedJson['attendance_seen']) + ->setCellValue('R'.$EI,$processedJson['sal_reg_seen']) + ->setCellValue('S'.$EI,$processedJson['cash_voucher']) + ->setCellValue('T'.$EI,$processedJson['sal_certificate']) + ->setCellValue('U'.$EI,$processedJson['sal_slip']) + ->setCellValue('V'.$EI,$processedJson['other_doc']) + ->setCellValue('X'.$EI,implode(",",$processedJson['doc_not_available'])) + ->setCellValue('W'.$EI,$processedJson['other_doc_name']) + ->setCellValue('Y'.$EI,$processedJson['doc_not_available_specify']) + ->setCellValue('Z'.$EI,$processedJson['mode_of_getting_salary']) + ->setCellValue('AA'.$EI,$processedJson['from_date_the_salary_is_rcv']) + ->setCellValue('AB'.$EI,$processedJson['to_date_the_salary_is_rcv']) + ->setCellValue('AD'.$EI,$processedJson['reason_not_sal_pay']) + ->setCellValue('AE'.$EI,$processedJson['paid_amount']) + ->setCellValue('AC'.$EI,$processedJson['sal_paid_regularly']) + ->setCellValue('AF'.$EI,$processedJson['gross_monthly_salary']) + ->setCellValue('AG'.$EI,$processedJson['net_monthly_salary']) + ->setCellValue('AH'.$EI,$processedJson['bonus_incentive']) + ->setCellValue('AI'.$EI,$processedJson['bonus_frequency']) + ->setCellValue('AJ'.$EI,$processedJson['bonus_type']) + ->setCellValue('AK'.$EI,$processedJson['bonus_type_other']) + ->setCellValue('AL'.$EI,$processedJson['id_card_issued_company']) + ->setCellValue('AM'.$EI,$processedJson['why_company_id_proof_not_available']) + ->setCellValue('AN'.$EI,$processedJson['employment_remarks']); +// [check_validated] => +// [how_was_it_validated] => +// [why_was_it_not_validated] => +// [any_delays] => +// [name_board_img] => SAVED + $EI++; + } + ### Employement Info Ends Here + ### '13', 'Business Information', + if($processedJson['formid'] == 13){ + // // echo "Form ID".$processedJson['formid']; + // // + + $XL->setActiveSheetIndex(12); + if($BI==0)$BI=3; + $a=$BI;$b=$BI; + $m=$BI;$r=$BI;$w=$BI;$s=$BI; + // $XL->getActiveSheet()->setCellValue('A'.$BI,$processedJson['pdid']); + $partners = $processedJson['partners']; + for($j=0;$jgetActiveSheet()->setCellValue('B'.$a,!empty($partners[$j]['partner_name_master'])?$partners[$j]['partner_name_master']:"-") + ->setCellValue('C'.$a,!empty($partners[$j]['partner_other_name']) ? $partners[$j]['partner_other_name'] :"-") + ->setCellValue('D'.$a,!empty($partners[$j]['shareholding'])?$partners[$j]['shareholding']:"-") + ->setCellValue('E'.$a,!empty($partners[$j]['started_business'])?$partners[$j]['started_business']:"-") + ->setCellValue('F'.$a,!empty($partners[$j]['current_business_experiance_year'])?$partners[$j]['current_business_experiance_year']:"-") + ->setCellValue('G'.$a,!empty($partners[$j]['current_business_experiance_month'])?$partners[$j]['current_business_experiance_month']:"-") + ->setCellValue('H'.$a,!empty($partners[$j]['total_business_experiance'])?$partners[$j]['total_business_experiance']:"-"); + $a++; + } + $personswithrelationships = $processedJson['persons_with_relationships']; + for($j=0;$jgetActiveSheet()->setCellValue('I'.$b,!empty($personswithrelationships[$j]['family_member_salutation_master'])?$personswithrelationships[$j]['family_member_salutation_master']:"-") + ->setCellValue('J'.$b,!empty($personswithrelationships[$j]['family_member_name']) ? $personswithrelationships[$j]['family_member_name'] :"-") + ->setCellValue('K'.$b,!empty($personswithrelationships[$j]['other_family_relationship_id_master'])?$personswithrelationships[$j]['other_family_relationship_id_master']:"-") + ->setCellValue('L'.$b,!empty($personswithrelationships[$j]['relation_to_id_master'])?$personswithrelationships[$j]['relation_to_id_master']:"-") + ->setCellValue('M'.$b,!empty($personswithrelationships[$j]['relationship_with_company_id_master'])?$personswithrelationships[$j]['relationship_with_company_id_master']:"-") + ->setCellValue('N'.$b,!empty($personswithrelationships[$j]['started_business'])?$personswithrelationships[$j]['started_business']:"-"); + $b++; + } + $manufacturingactivitydetails = $processedJson['manufacturing_activity_details']; + // print_r($manufacturingactivitydetails); + for($j=0;$jgetActiveSheet()->setCellValue('O'.$m,!empty($manufacturingactivitydetails[$j]['main_products'])?$manufacturingactivitydetails[$j]['main_products']:"-") + ->setCellValue('P'.$m,!empty($manufacturingactivitydetails[$j]['area_of_sale']) ? $manufacturingactivitydetails[$j]['area_of_sale'] :"-") + ->setCellValue('X'.$m,!empty($manufacturingactivitydetails[$j]['description'])?$manufacturingactivitydetails[$j]['description']:"-"); + if($manufacturingactivitydetails[$j]['area_of_sale'] == "Both" ){ + $XL->getActiveSheet()->setCellValue('Q'.$m,!empty($manufacturingactivitydetails[$j]['pan_india_options'])?$manufacturingactivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $manufacturingactivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('R'.$m,implode(",",$state)) + ->setCellValue('S'.$m,implode(",",$city)); + } + $maxsalestate = $manufacturingactivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('T'.$m,$ss) + ->setCellValue('U'.$m,$cs); + } + $countries = $manufacturingactivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('V'.$m,implode(",",$cn)) + ->setCellValue('W'.$m,implode(",",$as)); + } + }else if($manufacturingactivitydetails[$j]['area_of_sale'] == "Export"){ + $countries = $manufacturingactivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('V'.$m,implode(",",$cn)) + ->setCellValue('W'.$m,implode(",",$as));} + }else{ + $XL->getActiveSheet()->setCellValue('Q'.$m,!empty($manufacturingactivitydetails[$j]['pan_india_options'])?$manufacturingactivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $manufacturingactivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('R'.$m,implode(",",$state)) + ->setCellValue('S'.$m,$city); + } + $maxsalestate = $manufacturingactivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('T'.$m,$ss) + ->setCellValue('U'.$m,$cs); + } + } + $m++; + } + $retailtradingactivitydetails = $processedJson['retail_trading_activity_details']; + for($j=0;$jgetActiveSheet()->setCellValue('Y'.$r,!empty($retailtradingactivitydetails[$j]['main_products'])?$retailtradingactivitydetails[$j]['main_products']:"-") + ->setCellValue('Z'.$r,!empty($retailtradingactivitydetails[$j]['area_of_sale']) ? $retailtradingactivitydetails[$j]['area_of_sale'] :"-") + ->setCellValue('AH'.$r,!empty($retailtradingactivitydetails[$j]['description'])?$retailtradingactivitydetails[$j]['description']:"-"); + if($retailtradingactivitydetails[$j]['area_of_sale'] == "Both" ){ + $XL->getActiveSheet()->setCellValue('AA'.$r,!empty($retailtradingactivitydetails[$j]['pan_india_options'])?$retailtradingactivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $retailtradingactivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('AB'.$r,implode(",",$state)) + ->setCellValue('AC'.$r,implode(",",$city)); + } + $maxsalestate = $retailtradingactivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('AD'.$r,$ss) + ->setCellValue('AE'.$r,$cs); + } + $countries = $retailtradingactivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('AF'.$r,implode(",",$cn)) + ->setCellValue('AG'.$r,implode(",",$as)); + } + }else if($retailtradingactivitydetails[$j]['area_of_sale'] == "Export"){ + $countries = $retailtradingactivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('AF'.$r,implode(",",$cn)) + ->setCellValue('AG'.$r,implode(",",$as));} + }else{ + $XL->getActiveSheet()->setCellValue('AA'.$r,!empty($retailtradingactivitydetails[$j]['pan_india_options'])?$retailtradingactivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $retailtradingactivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('AB'.$r,implode(",",$state)) + ->setCellValue('AC'.$r,$city); + } + $maxsalestate = $wholesaletradingactivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('AD'.$r,$ss) + ->setCellValue('AE'.$r,$cs); + } + } + $r++; + } + $wholesaletradingactivitydetails = $processedJson['wholesale_trading_activity_details']; + for($j=0;$jgetActiveSheet()->setCellValue('AS'.$w,!empty($wholesaletradingactivitydetails[$j]['main_products'])?$wholesaletradingactivitydetails[$j]['main_products']:"-") + ->setCellValue('AT'.$w,!empty($wholesaletradingactivitydetails[$j]['area_of_sale']) ? $wholesaletradingactivitydetails[$j]['area_of_sale'] :"-") + ->setCellValue('BB'.$w,!empty($wholesaletradingactivitydetails[$j]['description'])?$wholesaletradingactivitydetails[$j]['description']:"-"); + if($wholesaletradingactivitydetails[$j]['area_of_sale'] == "Both" ){ + $XL->getActiveSheet()->setCellValue('AU'.$w,!empty($wholesaletradingactivitydetails[$j]['pan_india_options'])?$wholesaletradingactivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $wholesaletradingactivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('AV'.$w,implode(",",$state)) + ->setCellValue('AW'.$w,implode(",",$city)); + } + $maxsalestate = $wholesaletradingactivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('AX'.$w,$ss) + ->setCellValue('AY'.$w,$cs); + } + $countries = $wholesaletradingactivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('AZ'.$w,implode(",",$cn)) + ->setCellValue('BA'.$w,implode(",",$as)); + } + }else if($wholesaletradingactivitydetails[$j]['area_of_sale'] == "Export"){ + $countries = $wholesaletradingactivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('AZ'.$w,implode(",",$cn)) + ->setCellValue('BA'.$w,implode(",",$as));} + }else{ + $XL->getActiveSheet()->setCellValue('AU'.$w,!empty($wholesaletradingactivitydetails[$j]['pan_india_options'])?$wholesaletradingactivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $wholesaletradingactivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('AV'.$w,implode(",",$state)) + ->setCellValue('AW'.$w,$city); + } + $maxsalestate = $wholesaletradingactivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('AX'.$w,$ss) + ->setCellValue('AY'.$w,$cs); + } + } + $w++; + } + $serviceprovideractivitydetails = $processedJson['service_provider_activity_details']; + for($j=0;$jgetActiveSheet()->setCellValue('AI'.$s,!empty($serviceprovideractivitydetails[$j]['main_products'])?$serviceprovideractivitydetails[$j]['main_products']:"-") + ->setCellValue('AJ'.$s,!empty($serviceprovideractivitydetails[$j]['area_of_sale']) ? $serviceprovideractivitydetails[$j]['area_of_sale'] :"-") + ->setCellValue('AR'.$s,!empty($serviceprovideractivitydetails[$j]['description'])?$serviceprovideractivitydetails[$j]['description']:"-"); + if($serviceprovideractivitydetails[$j]['area_of_sale'] == "Both" ){ + $XL->getActiveSheet()->setCellValue('AK'.$s,!empty($serviceprovideractivitydetails[$j]['pan_india_options'])?$serviceprovideractivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $serviceprovideractivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('AL'.$s,implode(",",$state)) + ->setCellValue('AM'.$s,implode(",",$city)); + } + $maxsalestate = $serviceprovideractivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('AN'.$s,$ss) + ->setCellValue('AO'.$s,$cs); + } + $countries = $serviceprovideractivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('AP'.$s,implode(",",$cn)) + ->setCellValue('AQ'.$s,implode(",",$as)); + } + }else if($serviceprovideractivitydetails[$j]['area_of_sale'] == "Export"){ + $countries = $serviceprovideractivitydetails[$j]['countries_where_export_done']; + if(!empty($countries)){ + for($k=0;$kgetActiveSheet()->setCellValue('AP'.$s,implode(",",$cn)) + ->setCellValue('AQ'.$s,implode(",",$as));} + }else{ + $XL->getActiveSheet()->setCellValue('AK'.$s,!empty($serviceprovideractivitydetails[$j]['pan_india_options'])?$serviceprovideractivitydetails[$j]['pan_india_options']:"-"); + $indiansales = $serviceprovideractivitydetails[$j]['india_where_sale_done']; + if(!empty($indiansales)){ + for($k=0;$kgetActiveSheet()->setCellValue('AL'.$s,implode(",",$state)) + ->setCellValue('AM'.$s,$city); + } + $maxsalestate = $serviceprovideractivitydetails[$j]['max_sale_state_name']; + if(!empty($maxsalestate)){ + for($k=0;$kgetActiveSheet()->setCellValue('AN'.$s,$ss) + ->setCellValue('AO'.$s,$cs); + } + } + $s++; + } + $XL->getActiveSheet()->setCellValue('BC'.$BI,$processedJson['export_sale_of_total_sales']); + $XL->getActiveSheet()->setCellValue('BD'.$BI,$processedJson['applicant_use_mobile_wallets']); + $XL->getActiveSheet()->setCellValue('BE'.$BI,$processedJson['applicant_use_pos_machines']); + $XL->getActiveSheet()->setCellValue('BF'.$BI,$processedJson['no_of_pos_machines']); + // print_r($processedJson['pos_machines_details']) + if(!empty($processedJson['pos_machines_details'])){ + $arrPOSD = array(); + $arrPOSTID = array(); + foreach($processedJson['pos_machines_details'] as $d){ + array_push($arrPOSD,$d['pos_machines_financial_institution_name']); + array_push($arrPOSTID,$d['tid_no_of_pos_machine']); + } + $XL->getActiveSheet()->setCellValue('BG'.$BI,implode(",",$arrPOSD)); + $XL->getActiveSheet()->setCellValue('BH'.$BI,implode(",",$arrPOSTID));} + else{$XL->getActiveSheet()->setCellValue('BG'.$BI,"-")->setCellValue('BH'.$BI,"-");} + $months = array('','January','February','March','April','May','June','July ','August','September','October','November','December'); + $XL->getActiveSheet()->setCellValue('BI'.$BI,$processedJson['seasonality']); + if(!empty($processedJson['peak_period_of_business'])){ + $arrMonth = array(); + for($l=0;$lgetActiveSheet()->setCellValue('BJ'.$BI,implode(",",$arrMonth)); + } + else{$XL->getActiveSheet()->setCellValue('BJ'.$BI,"-");} + $XL->getActiveSheet()->setCellValue('BK'.$BI,$processedJson['month_of_business_run']); + $XL->getActiveSheet()->setCellValue('BL'.$BI,$processedJson['employees_permanent']); + $XL->getActiveSheet()->setCellValue('BM'.$BI,$processedJson['employees_temporary']); + $XL->getActiveSheet()->setCellValue('BN'.$BI,$processedJson['employees_total']); + $XL->getActiveSheet()->setCellValue('BO'.$BI,$processedJson['employees_appx_salary']); + $XL->getActiveSheet()->setCellValue('BP'.$BI,$processedJson['officer_total']); + $XL->getActiveSheet()->setCellValue('BQ'.$BI,$processedJson['was_the_company_name_board_sighted']); + $XL->getActiveSheet()->setCellValue('BR'.$BI,$processedJson['shop_eat_act_cert']); + $XL->getActiveSheet()->setCellValue('BS'.$BI,$processedJson['gst_Regn_cert']); + $XL->getActiveSheet()->setCellValue('BT'.$BI,$processedJson['export_import_cert']); + $XL->getActiveSheet()->setCellValue('BU'.$BI,$processedJson['factory_cert']); + $XL->getActiveSheet()->setCellValue('BV'.$BI,$processedJson['practice_cert']); + $XL->getActiveSheet()->setCellValue('BW'.$BI,$processedJson['pf_regn']); + $XL->getActiveSheet()->setCellValue('BX'.$BI,$processedJson['esic_regn']); + $XL->getActiveSheet()->setCellValue('BY'.$BI,$processedJson['eb_bill']); + $XL->getActiveSheet()->setCellValue('BZ'.$BI,$processedJson['other_documents']); + if(!empty($processedJson['documents'])){ + $arrdoc = array(); + foreach($processedJson['documents'] as $doc){ + array_push($arrdoc,$doc['document']); + } + $XL->getActiveSheet()->setCellValue('CA'.$BI,implode(",",$arrdoc));} + else{$XL->getActiveSheet()->setCellValue('CA'.$BI,"-");} + $XL->getActiveSheet()->setCellValue('CB'.$BI,$processedJson['business_remarks']); + + // if(count($partners) >= count($personswithrelationships)){$max = count($partners);} + // else{$max = count($personswithrelationships);} + $max=max(count($partners),count($manufacturingactivitydetails),count($personswithrelationships),count($retailtradingactivitydetails),count($wholesaletradingactivitydetails),count($serviceprovideractivitydetails)); + if($max>0){ + for($x=$BI;$x<($BI+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $BI = $BI+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$BI,$processedJson['pdid']); + $BI++; + } + + } + ### Buiness Form Ends here + ### '21', 'Business Banking', + if($processedJson['formid'] == 21){ + // echo "Form ID".$processedJson['formid']; + // $XL->setActiveSheetIndex(1); + // if($BB==0)$BB=3; + // $XL->getActiveSheet()->setCellValue('A'.$BB,$processedJson['pdid']); + // $BB++; + $XL->setActiveSheetIndex(14); + if($BB==0){$BB=3;} + $XL->getActiveSheet()->setCellValue('A'.$BB,$processedJson['pdid'])->setCellValue('B'.$BB,!empty($processedJson['bank_info_available']) ? 'Yes' : 'NO')->setCellValue('L'.$BB,!empty($processedJson['banking_form_remark'])?$processedJson['banking_form_remark']:"-"); + + $a = $BB; + $bankingdetails = $processedJson['banking_details']; + if($processedJson['bank_info_available']){ + for($j=0;$jgetActiveSheet() + ->setCellValue('C'.$a,!empty($bankingdetails[$j]['applicant_name_master'])?$bankingdetails[$j]['applicant_name_master']:"-") + ->setCellValue('D'.$a,!empty($bankingdetails[$j]['other_applicant'])?$bankingdetails[$j]['other_applicant']:"-") + ->setCellValue('E'.$a,!empty($bankingdetails[$j]['bank_name_master'])?$bankingdetails[$j]['bank_name_master']:"-") + ->setCellValue('F'.$a,!empty($bankingdetails[$j]['other_bank'])?$bankingdetails[$j]['other_bank']:"-") + ->setCellValue('G'.$a,!empty($bankingdetails[$j]['account_type_master'])?$bankingdetails[$j]['account_type_master']:"-") + ->setCellValue('H'.$a,!empty($bankingdetails[$j]['limit'])?$bankingdetails[$j]['limit']:"-") + ->setCellValue('I'.$a,!empty($bankingdetails[$j]['is_main'])?$bankingdetails[$j]['is_main']:"-") + ->setCellValue('J'.$a,!empty($bankingdetails[$j]['vintage_year'])?$bankingdetails[$j]['vintage_year']:"-") + ->setCellValue('K'.$a,!empty($bankingdetails[$j]['vintage_month'])?$bankingdetails[$j]['vintage_month']:"-"); + $a++; + } + }else{ + $XL->getActiveSheet() + ->setCellValue('C'.$BB,"-") + ->setCellValue('D'.$BB,"-") + ->setCellValue('E'.$BB,"-") + ->setCellValue('F'.$BB,"-") + ->setCellValue('G'.$BB,"-") + ->setCellValue('H'.$BB,"-") + ->setCellValue('I'.$BB,"-") + ->setCellValue('J'.$BB,"-") + ->setCellValue('K'.$BB,"-"); + } + $max = count($bankingdetails); + for($x=$BB;$x<($BB+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $BB = $BB+$max; + } + ### Buiness Banking Ends Here + ### '22', 'Business Assets', + if($processedJson['formid'] == 22){ + // echo "Form ID".$processedJson['formid']; + // print_r($processedJson); + $XL->setActiveSheetIndex(13); + if($BA==0)$BA=3; + $a = $BA;$b = $BA; + + $XL->getActiveSheet() + ->setCellValue('Q'.$BA,!empty($processedJson['asset_info_available']) ? "Yes" : "No") + ->setCellValue('AI'.$BA,!empty($processedJson['business_assets_form_remark'])?$processedJson['business_assets_form_remark']:"-"); + + $buinessassetaddress = $processedJson['business_assets_for_address']; + for($j=0;$jgetActiveSheet() + ->setCellValue('B'.$a,!empty($buinessassetaddress[$j]['address_label'])?$buinessassetaddress[$j]['address_label']:"-") + ->setCellValue('C'.$a,!empty($buinessassetaddress[$j]['business_address_availability'])?$buinessassetaddress[$j]['business_address_availability']:"-") + ->setCellValue('D'.$a,!empty($buinessassetaddress[$j]['business_years'])?$buinessassetaddress[$j]['business_years']:"-") + ->setCellValue('E'.$a,!empty($buinessassetaddress[$j]['business_month'])?$buinessassetaddress[$j]['business_month']:"-") + ->setCellValue('F'.$a,!empty($buinessassetaddress[$j]['business_is_pd_visited'])?$buinessassetaddress[$j]['business_is_pd_visited']:"-") + ->setCellValue('G'.$a,!empty($buinessassetaddress[$j]['business_pd_visited_remark'])?$buinessassetaddress[$j]['business_pd_visited_remark']:"-") + ->setCellValue('H'.$a,!empty($buinessassetaddress[$j]['business_ownership_type'])?$buinessassetaddress[$j]['business_ownership_type']:"-") + ->setCellValue('I'.$a,!empty($buinessassetaddress[$j]['business_approximate_market_value'])?$buinessassetaddress[$j]['business_approximate_market_value']:"-") + ->setCellValue('P'.$a,!empty($buinessassetaddress[$j]['business_monthly_rented_amt'])?$buinessassetaddress[$j]['business_monthly_rented_amt']:"-") + ->setCellValue('J'.$a,!empty($buinessassetaddress[$j]['business_name_of_the_owner'])?$buinessassetaddress[$j]['business_name_of_the_owner']:"-") + ->setCellValue('K'.$a,!empty($buinessassetaddress[$j]['business_name_of_the_other_owner'])?$buinessassetaddress[$j]['business_name_of_the_other_owner']:"-") + ->setCellValue('L'.$a,!empty($buinessassetaddress[$j]['business_vintage'])?$buinessassetaddress[$j]['business_vintage']:"-") + ->setCellValue('M'.$a,!empty($buinessassetaddress[$j]['asset_months'])?$buinessassetaddress[$j]['asset_months']:"-") + ->setCellValue('N'.$a,!empty($buinessassetaddress[$j]['business_purchase_year'])?$buinessassetaddress[$j]['business_purchase_year']:"-") + ->setCellValue('O'.$a,!empty($buinessassetaddress[$j]['business_emi'])?$buinessassetaddress[$j]['business_emi']:"-"); + $a++; + } + $XL->getActiveSheet()->setCellValue('A'.$O,$processedJson['pdid'])->setCellValue('Y'.$O,$processedJson['assets_form_remark']); + $a = $O; + + if(!empty($processedJson['asset_info_available'])){ + $buinessassetdetails = $processedJson['business_assets_details']; + + for($j=0;$jgetActiveSheet() + // ->setCellValue('S'.$b,$buinessassetdetails[$j]['any_other_assets']); + // } + // if(!empty($buinessassetdetails[$j]['equipment_manufacturing_description'])){ + // $XL->getActiveSheet() + // ->setCellValue('S'.$b,$buinessassetdetails[$j]['equipment_manufacturing_description']); + // } + if(isset($subdetails[0]['any_other_assets'])){ + $XL->getActiveSheet()->setCellValue('S'.$b,$subdetails[0]['any_other_assets']); + }else if(isset($subdetails[0]['equipment_manufacturing_description'])){ + $XL->getActiveSheet()->setCellValue('S'.$b,$subdetails[0]['equipment_manufacturing_description']); + }else{$XL->getActiveSheet()->setCellValue('S'.$b,"-");} + if(isset($subdetails[0]['property_type_master'])){$XL->getActiveSheet()->setCellValue('T'.$b,$subdetails[0]['property_type_master']);} + else{$XL->getActiveSheet()->setCellValue('T'.$b,"-");} + if(isset($subdetails[0]['other_property_type'])){$XL->getActiveSheet()->setCellValue('U'.$b,$subdetails[0]['other_property_type']);} + else{$XL->getActiveSheet()->setCellValue('U'.$b,"-");} + if(isset($subdetails[0]['address_of_the_property'])){$XL->getActiveSheet()->setCellValue('V'.$b,$subdetails[0]['address_of_the_property']);} + else{$XL->getActiveSheet()->setCellValue('V'.$b,"-");} + + if(isset($subdetails[0]['describe_of_the_property_asset'])){$XL->getActiveSheet()->setCellValue('H'.$b,$subdetails[0]['describe_of_the_property_asset']);} + else{$XL->getActiveSheet()->setCellValue('H'.$b,"-");} + if(isset($subdetails[0]['area_covered_by_this_property'])){$XL->getActiveSheet()->setCellValue('I'.$b,$subdetails[0]['area_covered_by_this_property']);} + else{$XL->getActiveSheet()->setCellValue('I'.$b,"-");} + if(isset($subdetails[0]['uom_master'])){$XL->getActiveSheet()->setCellValue('J'.$b,$subdetails[0]['uom_master']);} + else{$XL->getActiveSheet()->setCellValue('J'.$b,"-");} + if(isset($subdetails[0]['other_uom'])){$XL->getActiveSheet()->setCellValue('K'.$b,$subdetails[0]['other_uom']);} + else{$XL->getActiveSheet()->setCellValue('K'.$b,"-");} + + if(isset($subdetails[0]['vehicle_type_master'])){$XL->getActiveSheet()->setCellValue('W'.$b,$subdetails[0]['vehicle_type_master']); + }else{$XL->getActiveSheet()->setCellValue('W'.$b,"-");} + if(isset($subdetails[0]['other_vehicle_type'])){$XL->getActiveSheet()->setCellValue('X'.$b,$subdetails[0]['other_vehicle_type']); + }else{$XL->getActiveSheet()->setCellValue('X'.$b,"-");} + if(isset($subdetails[0]['manufacturer_model_vehicle'])){$XL->getActiveSheet()->setCellValue('Y'.$b,$subdetails[0]['manufacturer_model_vehicle']);} + else{$XL->getActiveSheet()->setCellValue('Y'.$b,"-");} + $XL->getActiveSheet() + ->setCellValue('R'.$b,isset($buinessassetdetails[$j]['business_assets_mode_master'])?$buinessassetdetails[$j]['business_assets_mode_master']:"-") + ->setCellValue('Z'.$b,isset($buinessassetdetails[$j]['business_ownership_type'])?$buinessassetdetails[$j]['business_ownership_type']:"-") + ->setCellValue('AA'.$b,!empty($buinessassetdetails[$j]['business_approximate_market_value'])?$buinessassetdetails[$j]['business_approximate_market_value']:"-") + ->setCellValue('AB'.$b,!empty($buinessassetdetails[$j]['business_name_of_the_owner'])?implode(",",$nameowned):"-") + ->setCellValue('AC'.$b,!empty($buinessassetdetails[$j]['business_name_of_the_other_owner'])?$buinessassetdetails[$j]['business_name_of_the_other_owner']:"-") + ->setCellValue('AD'.$b,!empty($buinessassetdetails[$j]['business_vintage'])?$buinessassetdetails[$j]['business_vintage']:"-") + ->setCellValue('AE'.$b,!empty($buinessassetdetails[$j]['asset_months'])?$buinessassetdetails[$j]['asset_months']:"-") + ->setCellValue('AF'.$b,!empty($buinessassetdetails[$j]['business_purchase_year'])?$buinessassetdetails[$j]['business_purchase_year']:"-") + ->setCellValue('AG'.$b,!empty($buinessassetdetails[$j]['business_emi'])?$buinessassetdetails[$j]['business_emi']:"-") + ->setCellValue('AH'.$b,!empty($buinessassetdetails[$j]['business_monthly_rented_amt'])?$buinessassetdetails[$j]['business_monthly_rented_amt']:"-"); + $b++; + } + }else { + # code... + $XL->getActiveSheet() + ->setCellValue('R'.$BA,"-")->setCellValue('S'.$BA,"-")->setCellValue('T'.$BA,"-")->setCellValue('U'.$BA,"-")->setCellValue('V'.$BA,"-") + ->setCellValue('W'.$BA,"-")->setCellValue('X'.$BA,"-")->setCellValue('Y'.$BA,"-")->setCellValue('Z'.$BA,"-")->setCellValue('AA'.$BA,"-") + ->setCellValue('AB'.$BA,"-")->setCellValue('AC'.$BA,"-")->setCellValue('AD'.$BA,"-")->setCellValue('AE'.$BA,"-")->setCellValue('AF'.$BA,"-") + ->setCellValue('AG'.$BA,"-")->setCellValue('AH'.$BA,"-"); + } + + $max = max(count($buinessassetdetails),count($buinessassetaddress)); + if($max>0){ + for($x=$BA;$x<($BA+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $BA = $BA+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$BA,$processedJson['pdid']); + $BA++; + } + + } + ### Buiness Assets Ends Here + ### '14', 'Financial Information', + if($processedJson['formid'] == 14){ + // echo "Form ID".$processedJson['formid']; + $XL->setActiveSheetIndex(15); + if($F==0)$F=3; + $a=$F;$b=$F; + $XL->getActiveSheet()->setCellValue('B'.$F,!empty($processedJson['turnover_lastcomplete_year'])?$processedJson['turnover_lastcomplete_year']:"-"); + $XL->getActiveSheet()->setCellValue('C'.$F,!empty($processedJson['ytd_turnover'])?$processedJson['ytd_turnover']:"-"); + $XL->getActiveSheet()->setCellValue('D'.$F,!empty($processedJson['is_financial_statements'])?$processedJson['is_financial_statements']:"-"); + $XL->getActiveSheet()->setCellValue('E'.$F,!empty($processedJson['latest_year_financials_as_per_applicant_met'])?$processedJson['latest_year_financials_as_per_applicant_met']:"-"); + $XL->getActiveSheet()->setCellValue('F'.$F,!empty($processedJson['financial_starting_year'])?$processedJson['financial_starting_year']:"-"); + $XL->getActiveSheet()->setCellValue('G'.$F,!empty($processedJson['financial_no_of_year'])?$processedJson['financial_no_of_year']:"-"); + $XL->getActiveSheet()->setCellValue('R'.$F,!empty($processedJson['financial_reason'])?$processedJson['financial_reason']:"-"); + $XL->getActiveSheet()->setCellValue('S'.$F,!empty($processedJson['is_financial_customer'])?$processedJson['is_financial_customer']:"-"); + $date_per_financial = $processedJson['date_per_financial']; + if(!empty($date_per_financial)){ + for($j=0;$jgetActiveSheet()->setCellValue('H'.$a,!empty($date_per_financial[$j]['financial_year'])?$date_per_financial[$j]['financial_year']:"-"); + $XL->getActiveSheet()->setCellValue('I'.$a,!empty($date_per_financial[$j]['financial_annual_sale'])?$date_per_financial[$j]['financial_annual_sale']:"-"); + $XL->getActiveSheet()->setCellValue('J'.$a,!empty($date_per_financial[$j]['financial_annualsales_variation'])?$date_per_financial[$j]['financial_annualsales_variation']:"-"); + $XL->getActiveSheet()->setCellValue('K'.$a,($date_per_financial[$j]['finanical_profit_or_loss'] == 1) ? "Net Profit" : "Net Loss"); + $XL->getActiveSheet()->setCellValue('L'.$a,!empty($date_per_financial[$j]['financial_net_profit'])?$date_per_financial[$j]['financial_net_profit']:"-"); + $XL->getActiveSheet()->setCellValue('M'.$a,!empty($date_per_financial[$j]['financial_net_loss'])?$date_per_financial[$j]['financial_net_loss']:"-"); + $XL->getActiveSheet()->setCellValue('N'.$a,!empty($date_per_financial[$j]['financial_margin_of_profit'])?$date_per_financial[$j]['financial_margin_of_profit']:"-"); + $XL->getActiveSheet()->setCellValue('O'.$a,!empty($date_per_financial[$j]['financial_margin_of_loss'])?$date_per_financial[$j]['financial_margin_of_loss']:"-"); + $XL->getActiveSheet()->setCellValue('P'.$a,!empty($date_per_financial[$j]['financial_variation'])?$date_per_financial[$j]['financial_variation']:"-"); + $XL->getActiveSheet()->setCellValue('Q'.$a,!empty($date_per_financial[$j]['financial_annualsales_variation'])?$date_per_financial[$j]['financial_annualsales_variation']:"-"); + $a++; + }}else{ + $XL->getActiveSheet()->setCellValue('H'.$F,"-")->setCellValue('I'.$F,"-")->setCellValue('J'.$F,"-")->setCellValue('K'.$F,"-")->setCellValue('L'.$F,"-")->setCellValue('M'.$F,"-") + ->setCellValue('N'.$F,"-")->setCellValue('O'.$F,"-")->setCellValue('P'.$F,"-")->setCellValue('Q'.$F,"-"); + } + $estimated_value = $processedJson['estimated_value']; + if(!empty($estimated_value)){ + for($j=0;$jgetActiveSheet()->setCellValue('T'.$b,$estimated_value[$j]['estimate_sales_from']); + $XL->getActiveSheet()->setCellValue('U'.$b,$estimated_value[$j]['estimate_sales_to']); + $XL->getActiveSheet()->setCellValue('V'.$b,$estimated_value[$j]['estimate_sales_average']); + $XL->getActiveSheet()->setCellValue('W'.$b,($estimated_value[$j]['estimate_profit_or_loss'] == 1)?"Net Profit":"Net loss"); + $XL->getActiveSheet()->setCellValue('X'.$b,($estimated_value[$j]['estimate_net_margin_availablity'] == "")?"No":"Yes"); + $XL->getActiveSheet()->setCellValue('Y'.$b,$estimated_value[$j]['estimate_net_profit_from']); + $XL->getActiveSheet()->setCellValue('Z'.$b,$estimated_value[$j]['estimate_net_profit_to']); + $XL->getActiveSheet()->setCellValue('AA'.$b,$estimated_value[$j]['estimate_net_profit_percent']); + $XL->getActiveSheet()->setCellValue('AB'.$b,$estimated_value[$j]['estimate_net_profit']); + $XL->getActiveSheet()->setCellValue('AC'.$b,$estimated_value[$j]['estimate_profit_range_from']); + $XL->getActiveSheet()->setCellValue('AD'.$b,$estimated_value[$j]['estimate_profit_range_to']); + $XL->getActiveSheet()->setCellValue('AE'.$b,$estimated_value[$j]['estimate_profit_margin_percent']); + $XL->getActiveSheet()->setCellValue('AF'.$b,$estimated_value[$j]['estimate_profit_margin']); + $XL->getActiveSheet()->setCellValue('AG'.$b,$estimated_value[$j]['estimate_net_loss_from']); + $XL->getActiveSheet()->setCellValue('AH'.$b,$estimated_value[$j]['estimate_net_loss_to']); + $XL->getActiveSheet()->setCellValue('AI'.$b,$estimated_value[$j]['estimate_net_loss_percent']); + $XL->getActiveSheet()->setCellValue('AJ'.$b,$estimated_value[$j]['estimate_net_loss']); + $XL->getActiveSheet()->setCellValue('AK'.$b,$estimated_value[$j]['estimate_loss_range_from']); + $XL->getActiveSheet()->setCellValue('AL'.$b,$estimated_value[$j]['estimate_loss_range_to']); + $XL->getActiveSheet()->setCellValue('AM'.$b,$estimated_value[$j]['estimate_loss_margin_percent']); + $XL->getActiveSheet()->setCellValue('AN'.$b,$estimated_value[$j]['estimate_loss_margin']); + $XL->getActiveSheet()->setCellValue('AO'.$b,$estimated_value[$j]['estimate_reason_for_loss']); + // $XL->getActiveSheet()->setCellValue('T'.$b,$estimated_value[$j]['estimate_posmachine_or_cc_annual_sales] => + $b++; + } + }else{ + $XL->getActiveSheet()->setCellValue('T'.$F,"-")->setCellValue('U'.$F,"-") + ->setCellValue('V'.$F,"-")->setCellValue('W'.$F,"-")->setCellValue('X'.$F,"-") + ->setCellValue('Y'.$F,"-")->setCellValue('Z'.$F,"-")->setCellValue('AA'.$F,"-") + ->setCellValue('AB'.$F,"-")->setCellValue('AC'.$F,"-")->setCellValue('AD'.$F,"-") + ->setCellValue('AE'.$F,"-")->setCellValue('AF'.$F,"-")->setCellValue('AG'.$F,"-") + ->setCellValue('AH'.$F,"-")->setCellValue('AI'.$F,"-")->setCellValue('AJ'.$F,"-") + ->setCellValue('AK'.$F,"-")->setCellValue('AL'.$F,"-")->setCellValue('AM'.$F,"-") + ->setCellValue('AN'.$F,"-")->setCellValue('AO'.$F,"-"); + } + + + $XL->getActiveSheet()->setCellValue('AP'.$F,!empty($processedJson['kuccha_records_shown'])?$processedJson['kuccha_records_shown']:"-"); + $XL->getActiveSheet()->setCellValue('AQ'.$F,!empty($processedJson['customer_declared_turnover'])?$processedJson['customer_declared_turnover']:"-"); + $XL->getActiveSheet()->setCellValue('AR'.$F,!empty($processedJson['kuccha_bill_allowed'])?$processedJson['kuccha_bill_allowed']:"-"); + $XL->getActiveSheet()->setCellValue('AS'.$F,!empty($processedJson['receive_the_money_in_days'])?$processedJson['receive_the_money_in_days']:"-"); + $XL->getActiveSheet()->setCellValue('AT'.$F,!empty($processedJson['pay_the_money_in_days'])?$processedJson['pay_the_money_in_days']:"-"); + $XL->getActiveSheet()->setCellValue('AU'.$F,!empty($processedJson['unsold_stock_lies_in_days'])?$processedJson['unsold_stock_lies_in_days']:"-"); + $XL->getActiveSheet()->setCellValue('AV'.$F,!empty($processedJson['is_there_working_capital_available'])?$processedJson['is_there_working_capital_available']:"-"); + $XL->getActiveSheet()->setCellValue('AW'.$F,!empty($processedJson['letter_of_credit'])?$processedJson['letter_of_credit']:"-"); + $XL->getActiveSheet()->setCellValue('AX'.$F,!empty($processedJson['bank_guarantee'])?$processedJson['bank_guarantee']:"-"); + $XL->getActiveSheet()->setCellValue('AY'.$F,!empty($processedJson['cash_credit_limit'])?$processedJson['cash_credit_limit']:"-"); + $XL->getActiveSheet()->setCellValue('AZ'.$F,!empty($processedJson['od_limit'])?$processedJson['od_limit']:"-"); + $XL->getActiveSheet()->setCellValue('BA'.$F,!empty($processedJson['factoring'])?$processedJson['factoring']:"-"); + $XL->getActiveSheet()->setCellValue('BB'.$F,!empty($processedJson['forfaiting'])?$processedJson['forfaiting']:"-"); + $XL->getActiveSheet()->setCellValue('BC'.$F,!empty($processedJson['lender_name'])?$processedJson['lender_name']:"-"); + $XL->getActiveSheet()->setCellValue('BD'.$F,!empty($processedJson['loan_amount'])?$processedJson['loan_amount']:"-"); + $XL->getActiveSheet()->setCellValue('BE'.$F,!empty($processedJson['loan_type'])?$processedJson['loan_type']:"-"); + $XL->getActiveSheet()->setCellValue('BF'.$F,!empty($processedJson['loan_tenor'])?$processedJson['loan_tenor']:"-"); + $XL->getActiveSheet()->setCellValue('BG'.$F,!empty($processedJson['loan_start_date'])?$processedJson['loan_start_date']:"-"); + $XL->getActiveSheet()->setCellValue('BH'.$F,!empty($processedJson['monthly_emi'])?$processedJson['monthly_emi']:"-"); + $XL->getActiveSheet()->setCellValue('BI'.$F,!empty($processedJson['other_reason_for_working_capital_facilities_availed'])?$processedJson['other_reason_for_working_capital_facilities_availed']:"-"); + $XL->getActiveSheet()->setCellValue('BJ'.$F,!empty($processedJson['reason_for_working_capital_facilities_availed'])?$processedJson['reason_for_working_capital_facilities_availed']:"-"); + $XL->getActiveSheet()->setCellValue('BK'.$F,!empty($processedJson['financial_remarks'])?$processedJson['financial_remarks']:"-"); + + // $processedJson['date_per_financial']; + // $processedJson['estimated_value']; + // [deptor_collection_period] => + // [inventory_holding_period] => + // [creditor_payment_period] => + $max=max(count($date_per_financial),count($estimated_value)); + if($max>0){ + for($x=$F;$x<($F+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $F = $F+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$F,$processedJson['pdid']); + $F++; + } + + + } + ### 'Financial Info Ends Here + ### '1', 'Supplier Details', + if($processedJson['formid'] == 1){ + // echo "Form ID".$processedJson['formid']; + // echo "count".count($processedJson); + // print_r($processedJson); + $XL->setActiveSheetIndex(16); + if($SU==0)$SU=3; + $a=$SU;$b=$SU;$c=$SU; + $XL->getActiveSheet() + ->setCellValue('B'.$SU,$processedJson['supplier_info_available'] ? "Yes" : "No"); + if($processedJson['supplier_info_available']){ + $MD = $processedJson['manufacturing_details']; + $MDcount = 0; + if(!empty($MD)){ + // $MD['main_raw_materials_total_payments_percent_on_credit']; + $MD = $MD[0]['main_raw_materials']; + $MDcount = count($MD); + for($j=0;$j<$MDcount;$j++){ + $XL->getActiveSheet()->setCellValue('C'.$a,$MD[$j]['manufacturing_raw_material_name']); + $XL->getActiveSheet()->setCellValue('D'.$a,$MD[$j]['manufacturing_supplier_name']); + $XL->getActiveSheet()->setCellValue('E'.$a,$MD[$j]['person_title_name_master']); + $XL->getActiveSheet()->setCellValue('F'.$a,$MD[$j]['manufacturing_contact_person_name']); + $XL->getActiveSheet()->setCellValue('G'.$a,$MD[$j]['person_designation_master']); + $XL->getActiveSheet()->setCellValue('H'.$a,$MD[$j]['manufacturing_contact_person_mobile_number']); + $XL->getActiveSheet()->setCellValue('I'.$a,$MD[$j]['person_stdcode']); + $XL->getActiveSheet()->setCellValue('J'.$a,$MD[$j]['person_landline']); + // $XL->getActiveSheet()->setCellValue('A'.$a,$MD[$j]['other_person_designation']); => + $XL->getActiveSheet()->setCellValue('K'.$a,$MD[$j]['manufacturing_payment_type_master']); + $XL->getActiveSheet()->setCellValue('L'.$a,$MD[$j]['manufacturing_payment_mode']); + $XL->getActiveSheet()->setCellValue('M'.$a,$MD[$j]['manufacturing_credit_days_from']); + $XL->getActiveSheet()->setCellValue('N'.$a,$MD[$j]['manufacturing_credit_days_to']); + $XL->getActiveSheet()->setCellValue('O'.$a,$MD[$j]['manufacturing_contribution_total_purchase']); + // $XL->getActiveSheet()->setCellValue('A'.$a,$MD[$j]['manufacturing_frequency_of_purchase']); => + $a++; + } + }else{ + $XL->getActiveSheet()->setCellValue('C'.$SU,"-")->setCellValue('D'.$SU,"-")->setCellValue('E'.$SU,"-")->setCellValue('F'.$SU,"-") + ->setCellValue('G'.$SU,"-")->setCellValue('H'.$SU,"-")->setCellValue('I'.$SU,"-") + ->setCellValue('J'.$SU,"-")->setCellValue('K'.$SU,"-")->setCellValue('L'.$SU,"-") + ->setCellValue('M'.$SU,"-")->setCellValue('N'.$SU,"-")->setCellValue('O'.$SU,"-"); + } + + + + $TD = $processedJson['trade_details']; + $TDcount = 0; + if(!empty($TD)){ + $XL->getActiveSheet()->setCellValue('AB'.$b,$TD['trading_products_total_payments_percent_on_credit']); + $TD = $TD[0]['trading_products']; + $TDcount = count($TD); + for($j=0;$j<$TDcount;$j++){ + $XL->getActiveSheet()->setCellValue('P'.$b,$TD[$j]['trade_product_name']); + $XL->getActiveSheet()->setCellValue('Q'.$b,$TD[$j]['trade_supplier_name']); + $XL->getActiveSheet()->setCellValue('R'.$b,$TD[$j]['person_title_name_master']); + $XL->getActiveSheet()->setCellValue('S'.$b,$TD[$j]['trade_product_contact_person_name']); + $XL->getActiveSheet()->setCellValue('T'.$b,$TD[$j]['person_designation_master']); + // $XL->getActiveSheet()->setCellValue('C'.$b,$TD[$j]['other_person_designation']); + $XL->getActiveSheet()->setCellValue('U'.$b,$TD[$j]['trade_product_contact_person_mobile_number']); + $XL->getActiveSheet()->setCellValue('V'.$b,$TD[$j]['person_stdcode']); + $XL->getActiveSheet()->setCellValue('W'.$b,$TD[$j]['person_landline']); + $XL->getActiveSheet()->setCellValue('X'.$b,$TD[$j]['trade_product_payment_type_master']); + $XL->getActiveSheet()->setCellValue('Y'.$b,$TD[$j]['trade_product_payment_mode']); + $XL->getActiveSheet()->setCellValue('Z'.$b,$TD[$j]['trade_product_credit_days_from']); + $XL->getActiveSheet()->setCellValue('AA'.$b,$TD[$j]['trade_product_credit_days_to']); + // $XL->getActiveSheet()->setCellValue('C'.$b,$TD[$j]['trade_product_frequency_of_purchase] => + // $XL->getActiveSheet()->setCellValue('C'.$b,$TD[$j]['trade_product_contribution_total_purchase] => + $b++; + }}else{ + $XL->getActiveSheet()->setCellValue('P'.$SU,"-")->setCellValue('Q'.$SU,"-")->setCellValue('R'.$SU,"-")->setCellValue('S'.$SU,"-") + ->setCellValue('T'.$SU,"-")->setCellValue('U'.$SU,"-")->setCellValue('V'.$SU,"-") + ->setCellValue('W'.$SU,"-")->setCellValue('X'.$SU,"-")->setCellValue('Y'.$SU,"-") + ->setCellValue('Z'.$SU,"-")->setCellValue('AA'.$SU,"-")->setCellValue('AB'.$SU,"-"); + } + $SD = $processedJson['servicing_details']; + $SDcount = 0; + if(!empty($SD)){ + $XL->getActiveSheet()->setCellValue('AO'.$c,$SD['service_providers_total_payments_percent_on_credit']); + $SD = $SD[0]['service_providers']; + $SDcount = count($SD); + for($j=0;$j<$SDcount;$j++){ + + $XL->getActiveSheet()->setCellValue('AC'.$c,$SD[$j]['service_provider_name']); + $XL->getActiveSheet()->setCellValue('AD'.$c,$SD[$j]['service_provider_supplier_name']); + $XL->getActiveSheet()->setCellValue('AE'.$c,$SD[$j]['person_title_name_master']); + $XL->getActiveSheet()->setCellValue('AF'.$c,$SD[$j]['service_provider_contact_person_name']); + $XL->getActiveSheet()->setCellValue('AG'.$c,$SD[$j]['person_designation_master']); + // $XL->getActiveSheet()->setCellValue('AH'.$c,$SD[$j]['other_person_designation']); + $XL->getActiveSheet()->setCellValue('AH'.$c,$SD[$j]['service_provider_contact_person_mobile_number']); + $XL->getActiveSheet()->setCellValue('AI'.$c,$SD[$j]['person_stdcode']); + $XL->getActiveSheet()->setCellValue('AJ'.$c,$SD[$j]['person_landline']); + $XL->getActiveSheet()->setCellValue('AK'.$c,$SD[$j]['service_provider_payment_type_master']); + $XL->getActiveSheet()->setCellValue('AL'.$c,$SD[$j]['service_provider_payment_mode']); + $XL->getActiveSheet()->setCellValue('AM'.$c,$SD[$j]['service_provider_credit_days_from']); + $XL->getActiveSheet()->setCellValue('AN'.$c,$SD[$j]['service_provider_credit_days_to']); + // $XL->getActiveSheet()->setCellValue('C'.$c,$SD[$j]['service_provider_frequency_of_purchase] => + // $XL->getActiveSheet()->setCellValue('C'.$c,$SD[$j]['service_provider_contribution_total_purchase] => + $c++; + } + }else{ + $XL->getActiveSheet()->setCellValue('AC'.$SU,"-")->setCellValue('AD'.$SU,"-")->setCellValue('AE'.$SU,"-")->setCellValue('AF'.$SU,"-")->setCellValue('AG'.$SU,"-")->setCellValue('AH'.$SU,"-")->setCellValue('AI'.$SU,"-") + ->setCellValue('AJ'.$SU,"-")->setCellValue('AK'.$SU,"-")->setCellValue('AL'.$SU,"-")->setCellValue('AM'.$SU,"-")->setCellValue('AN'.$SU,"-")->setCellValue('AO'.$SU,"-"); + } + }else{ + $XL->getActiveSheet()->setCellValue('C'.$SU,"-")->setCellValue('D'.$SU,"-") + ->setCellValue('E'.$SU,"-")->setCellValue('F'.$SU,"-") + ->setCellValue('G'.$SU,"-")->setCellValue('H'.$SU,"-")->setCellValue('I'.$SU,"-") + ->setCellValue('J'.$SU,"-")->setCellValue('K'.$SU,"-")->setCellValue('L'.$SU,"-") + ->setCellValue('M'.$SU,"-")->setCellValue('N'.$SU,"-")->setCellValue('O'.$SU,"-") + ->setCellValue('P'.$SU,"-")->setCellValue('Q'.$SU,"-")->setCellValue('R'.$SU,"-") + ->setCellValue('S'.$SU,"-")->setCellValue('T'.$SU,"-")->setCellValue('U'.$SU,"-") + ->setCellValue('V'.$SU,"-")->setCellValue('W'.$SU,"-")->setCellValue('X'.$SU,"-") + ->setCellValue('Y'.$SU,"-")->setCellValue('Z'.$SU,"-")->setCellValue('AA'.$SU,"-") + ->setCellValue('AB'.$SU,"-")->setCellValue('AC'.$SU,"-")->setCellValue('AD'.$SU,"-")->setCellValue('AE'.$SU,"-")->setCellValue('AF'.$SU,"-")->setCellValue('AG'.$SU,"-")->setCellValue('AH'.$SU,"-")->setCellValue('AI'.$SU,"-") + ->setCellValue('AJ'.$SU,"-")->setCellValue('AK'.$SU,"-")->setCellValue('AL'.$SU,"-")->setCellValue('AM'.$SU,"-")->setCellValue('AN'.$SU,"-")->setCellValue('AO'.$SU,"-"); + } + $XL->getActiveSheet()->setCellValue('AP'.$SU,!empty($processedJson['bill_info'])?$processedJson['bill_info']:"-")->setCellValue('AQ'.$SU,!empty($processedJson['supplier_info_form_remark'])?$processedJson['supplier_info_form_remark']:"-"); + $max=max($MDcount,$TDcount,$SDcount); + + if($max>0){ + for($x=$SU;$x<($SU+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $SU = $SU+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$SU,$processedJson['pdid']); + $SU++; + } + } + ### Supplier Ends Here + ### '2', 'Client Details', + if($processedJson['formid'] == 2){ + // echo "Form ID".$processedJson['formid']; + $XL->setActiveSheetIndex(17); + if($CI==0)$CI=3; + $a=$CI;$b=$CI;$c=$CI; + $XL->getActiveSheet() + ->setCellValue('B'.$CI,$processedJson['client_info_available'] ? "Yes" : "No") + ->setCellValue('AQ'.$CI,!empty($processedJson['bill_info'])?$processedJson['bill_info']:"-") + ->setCellValue('AR'.$CI,!empty($processedJson['supplier_info_form_remark'])?$processedJson['supplier_info_form_remark']:"-"); + + if($processedJson['client_info_available']){ + $CMD = $processedJson['manufacturing_details']; + if(!empty($CMD)){ + $XL->getActiveSheet()->setCellValue('O'.$a,$CMD['main_raw_materials_total_payments_percent_on_credit']); + $CMD = $processedJson['manufacturing_details'][0]['main_raw_materials']; + $CMDcount = count($CMD); + + for($j=0;$j<$CMDcount;$j++){ + $XL->getActiveSheet()->setCellValue('C'.$a,$CMD[$j]['manufacturing_product_name']); + $XL->getActiveSheet()->setCellValue('D'.$a,$CMD[$j]['manufacturing_client_name']); + $XL->getActiveSheet()->setCellValue('E'.$a,$CMD[$j]['person_title_name_master']); + $XL->getActiveSheet()->setCellValue('F'.$a,$CMD[$j]['manufacturing_contact_person_name']); + $XL->getActiveSheet()->setCellValue('G'.$a,$CMD[$j]['person_designation_master']); + // $XL->getActiveSheet()->setCellValue('C'.$a,$CMD[$j]['other_person_designation']); + $XL->getActiveSheet()->setCellValue('H'.$a,$CMD[$j]['manufacturing_contact_person_mobile_number']); + $XL->getActiveSheet()->setCellValue('I'.$a,$CMD[$j]['person_stdcode']); + $XL->getActiveSheet()->setCellValue('J'.$a,$CMD[$j]['person_landline']); + $XL->getActiveSheet()->setCellValue('K'.$a,$CMD[$j]['manufacturing_payment_type_master']); + $XL->getActiveSheet()->setCellValue('L'.$a,$CMD[$j]['manufacturing_payment_mode']); + $XL->getActiveSheet()->setCellValue('M'.$a,$CMD[$j]['manufacturing_credit_days_from']); + $XL->getActiveSheet()->setCellValue('N'.$a,$CMD[$j]['manufacturing_credit_days_to']); + // $XL->getActiveSheet()->setCellValue('C'.$a,$CMD[$j]['manufacturing_credit_days] => + // $XL->getActiveSheet()->setCellValue('C'.$a,$CMD[$j]['manufacturing_contribution_total_turnover] => + $a++; + } + }else{ + $XL->getActiveSheet()->setCellValue('C'.$CI,"-")->setCellValue('D'.$CI,"-") + ->setCellValue('E'.$CI,"-")->setCellValue('F'.$CI,"-")->setCellValue('G'.$CI,"-")->setCellValue('H'.$CI,"-")->setCellValue('I'.$CI,"-") + ->setCellValue('J'.$CI,"-")->setCellValue('K'.$CI,"-")->setCellValue('L'.$CI,"-")->setCellValue('M'.$CI,"-")->setCellValue('N'.$CI,"-")->setCellValue('O'.$CI,"-"); + } + $CTD = $processedJson['trade_details']; + if(!empty($CTD)){ + $XL->getActiveSheet()->setCellValue('AB'.$b,$processedJson['trade_details']['trading_products_total_payments_percent_on_credit']); + $CTD = $processedJson['trade_details'][0]['trading_products']; + $CTDcount = count($CTD); + for($j=0;$j<$CTDcount;$j++){ + $XL->getActiveSheet()->setCellValue('P'.$b,$CTD[$j]['trade_product_name']); + $XL->getActiveSheet()->setCellValue('Q'.$b,$CTD[$j]['trade_client_name']); + $XL->getActiveSheet()->setCellValue('R'.$b,$CTD[$j]['person_title_name_master']); + $XL->getActiveSheet()->setCellValue('S'.$b,$CTD[$j]['trade_product_contact_person_name']); + $XL->getActiveSheet()->setCellValue('T'.$b,$CTD[$j]['person_designation_master']); + // $XL->getActiveSheet()->setCellValue('N'.$b,$CTD[$j]['other_person_designation] => + $XL->getActiveSheet()->setCellValue('U'.$b,$CTD[$j]['trade_product_contact_person_mobile_number']); + $XL->getActiveSheet()->setCellValue('V'.$b,$CTD[$j]['person_stdcode']); + $XL->getActiveSheet()->setCellValue('W'.$b,$CTD[$j]['person_landline']); + $XL->getActiveSheet()->setCellValue('X'.$b,$CTD[$j]['trade_product_payment_type_master']); + $XL->getActiveSheet()->setCellValue('Y'.$b,$CTD[$j]['trade_product_payment_mode']); + // $XL->getActiveSheet()->setCellValue('Z'.$b,$CTD[$j]['trade_product_frequency_of_purchase']); + $XL->getActiveSheet()->setCellValue('Z'.$b,$CTD[$j]['trade_product_credit_days_from']); + $XL->getActiveSheet()->setCellValue('AA'.$b,$CTD[$j]['trade_product_credit_days_to']); + // $XL->getActiveSheet()->setCellValue('N'.$b,$CTD[$j]['trade_product_contribution_total_turnover] => + $b++; + } + }else{ + $XL->getActiveSheet()->setCellValue('P'.$CI,"-")->setCellValue('Q'.$CI,"-")->setCellValue('R'.$CI,"-")->setCellValue('S'.$CI,"-") + ->setCellValue('T'.$CI,"-")->setCellValue('U'.$CI,"-")->setCellValue('V'.$CI,"-") + ->setCellValue('W'.$CI,"-")->setCellValue('X'.$CI,"-")->setCellValue('Y'.$CI,"-")->setCellValue('Z'.$CI,"-") + ->setCellValue('AA'.$CI,"-")->setCellValue('AB'.$CI,"-"); + } + + $CSD = $processedJson['service_provider_details']; + if(!empty($CSD)){ + $XL->getActiveSheet()->setCellValue('AP'.$c,$processedJson['service_provider_details']['service_products_total_payments_percent_on_credit']); + $CSD = $processedJson['service_provider_details'][0]['service_products']; + $CSDcount = count($CSD); + for($j=0;$j<$CSDcount;$j++){ + $XL->getActiveSheet()->setCellValue('AC'.$c,$CSD[$j]['service_provider_product_name']); + $XL->getActiveSheet()->setCellValue('AD'.$c,$CSD[$j]['service_provider_client_name']); + $XL->getActiveSheet()->setCellValue('AE'.$c,$CSD[$j]['person_title_name_master']); + $XL->getActiveSheet()->setCellValue('AF'.$c,$CSD[$j]['service_provider_product_contact_person_name']); + $XL->getActiveSheet()->setCellValue('AG'.$c,$CSD[$j]['person_designation_master']); + // [other_person_designation] => + $XL->getActiveSheet()->setCellValue('AH'.$c,$CSD[$j]['service_provider_product_contact_person_mobile_number']); + $XL->getActiveSheet()->setCellValue('AI'.$c,$CSD[$j]['person_stdcode']); + $XL->getActiveSheet()->setCellValue('AJ'.$c,$CSD[$j]['person_landline']); + $XL->getActiveSheet()->setCellValue('AK'.$c,$CSD[$j]['service_provider_product_payment_type_master']); + $XL->getActiveSheet()->setCellValue('AL'.$c,$CSD[$j]['service_provider_product_payment_mode']); + $XL->getActiveSheet()->setCellValue('AM'.$c,$CSD[$j]['service_provider_product_frequency_of_purchase']); + $XL->getActiveSheet()->setCellValue('AN'.$c,$CSD[$j]['service_provider_product_credit_days_from']); + $XL->getActiveSheet()->setCellValue('AO'.$c,$CSD[$j]['service_provider_product_credit_days_to']); + // [service_provider_contribution_total_turnover] => + $c++; + } + }else{ + $XL->getActiveSheet()->setCellValue('AC'.$CI,"-")->setCellValue('AD'.$CI,"-")->setCellValue('AE'.$CI,"-")->setCellValue('AF'.$CI,"-") + ->setCellValue('AG'.$CI,"-")->setCellValue('AH'.$CI,"-")->setCellValue('AI'.$CI,"-") + ->setCellValue('AJ'.$CI,"-")->setCellValue('AK'.$CI,"-")->setCellValue('AL'.$CI,"-")->setCellValue('AM'.$CI,"-")->setCellValue('AN'.$CI,"-")->setCellValue('AO'.$CI,"-")->setCellValue('AP'.$CI,"-"); + }}else{ + $XL->getActiveSheet()->setCellValue('C'.$CI,"-")->setCellValue('D'.$CI,"-") + ->setCellValue('E'.$CI,"-")->setCellValue('F'.$CI,"-")->setCellValue('G'.$CI,"-")->setCellValue('H'.$CI,"-")->setCellValue('I'.$CI,"-") + ->setCellValue('J'.$CI,"-")->setCellValue('K'.$CI,"-")->setCellValue('L'.$CI,"-")->setCellValue('M'.$CI,"-")->setCellValue('N'.$CI,"-") + ->setCellValue('O'.$CI,"-")->setCellValue('P'.$CI,"-")->setCellValue('Q'.$CI,"-")->setCellValue('R'.$CI,"-")->setCellValue('S'.$CI,"-") + ->setCellValue('T'.$CI,"-")->setCellValue('U'.$CI,"-")->setCellValue('V'.$CI,"-") + ->setCellValue('W'.$CI,"-")->setCellValue('X'.$CI,"-")->setCellValue('Y'.$CI,"-")->setCellValue('Z'.$CI,"-") + ->setCellValue('AA'.$CI,"-")->setCellValue('AB'.$CI,"-")->setCellValue('AC'.$CI,"-")->setCellValue('AD'.$CI,"-")->setCellValue('AE'.$CI,"-")->setCellValue('AF'.$CI,"-") + ->setCellValue('AG'.$CI,"-")->setCellValue('AH'.$CI,"-")->setCellValue('AI'.$CI,"-") + ->setCellValue('AJ'.$CI,"-")->setCellValue('AK'.$CI,"-")->setCellValue('AL'.$CI,"-")->setCellValue('AM'.$CI,"-")->setCellValue('AN'.$CI,"-")->setCellValue('AO'.$CI,"-")->setCellValue('AP'.$CI,"-"); + } + $max=max($CMDcount,$CTDcount,$CSDcount); + if($max>0){ + for($x=$CI;$x<($CI+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $CI = $CI+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$CI,$processedJson['pdid']); + $CI++; + } + + } + ### Client Ends Here + ### '11', 'Stock Details', + if($processedJson['formid'] == 11){ + // echo "Form ID".$processedJson['formid']; + $XL->setActiveSheetIndex(18); + if($S==0)$S=3; + // $XL->getActiveSheet()->setCellValue('A'.$S,$processedJson['pdid']); + $a=$S;$b=$S;$c=$S;$d=$S;$e=$S; + $SMD = $processedJson['manufacturing_details']; + $SMDcount1 = 0 ; + $SMDcount2 =0; + if(!empty($SMD)){ + $SMDsuddetails1 = $SMD[0]['manufacturing_raw_materials']; + $SMDcount1 =count($SMDsuddetails1); + for($j=0;$j<$SMDcount1;$j++){ + $XL->getActiveSheet()->setCellValue('B'.$a,$SMDsuddetails1[$j]['raw_name']); + $XL->getActiveSheet()->setCellValue('C'.$a,$SMDsuddetails1[$j]['stock_observed']); + $XL->getActiveSheet()->setCellValue('D'.$a,$SMDsuddetails1[$j]['raw_quantity']); + $XL->getActiveSheet()->setCellValue('E'.$a,$SMDsuddetails1[$j]['uom_master']); + $XL->getActiveSheet()->setCellValue('F'.$a,$SMDsuddetails1[$j]['other_uom']); + $XL->getActiveSheet()->setCellValue('G'.$a,$SMDsuddetails1[$j]['raw_value']); + $a++; + } + $XL->getActiveSheet()->setCellValue('H'.$S,$processedJson['is_sufficiant_raw']); + $XL->getActiveSheet()->setCellValue('I'.$S,$processedJson['rawmaterial_remarks']); + $SMDsuddetails2 = $SMD[0]['manufacturing_finished_goods']; + $SMDcount2 =count($SMDsuddetails1); + for($j=0;$j<$SMDcount2;$j++){ + $XL->getActiveSheet()->setCellValue('J'.$b,$SMDsuddetails2[$j]['goods_name']); + $XL->getActiveSheet()->setCellValue('K'.$b,$SMDsuddetails2[$j]['goods_observed']); + $XL->getActiveSheet()->setCellValue('L'.$b,$SMDsuddetails2[$j]['goods_quantity']); + $XL->getActiveSheet()->setCellValue('M'.$b,$SMDsuddetails2[$j]['goods_uom']); + $XL->getActiveSheet()->setCellValue('N'.$b,$SMDsuddetails2[$j]['goods_other_uom']); + $XL->getActiveSheet()->setCellValue('O'.$b,$SMDsuddetails2[$j]['goods_value']); + $b++; + } + }else{ + $XL->getActiveSheet()->setCellValue('B'.$S,"-")->setCellValue('C'.$S,"-") + ->setCellValue('D'.$S,"-")->setCellValue('E'.$S,"-")->setCellValue('F'.$S,"-") + ->setCellValue('G'.$S,"-")->setCellValue('H'.$S,"-")->setCellValue('I'.$S,"-") + ->setCellValue('J'.$S,"-")->setCellValue('K'.$S,"-")->setCellValue('L'.$S,"-") + ->setCellValue('M'.$S,"-")->setCellValue('N'.$S,"-")->setCellValue('O'.$S,"-"); + } + $SRD=$processedJson['retail_details']; + $SRDcount =0; + if(!empty($SRD)){ + $SRDsuddetails = $SRD[0]['retail_traded_goods']; + $SRDcount = count($SRDsuddetails); + for($j=0;$j<$SRDcount;$j++){ + $XL->getActiveSheet()->setCellValue('P'.$c,$SRDsuddetails[$j]['traded_goods_name']); + $XL->getActiveSheet()->setCellValue('Q'.$c,$SRDsuddetails[$j]['traded_goods_observed']); + $XL->getActiveSheet()->setCellValue('R'.$c,$SRDsuddetails[$j]['traded_goods_quantity']); + $XL->getActiveSheet()->setCellValue('S'.$c,$SRDsuddetails[$j]['uom_master']); + $XL->getActiveSheet()->setCellValue('T'.$c,$SRDsuddetails[$j]['traded_goods_other_uom']); + $XL->getActiveSheet()->setCellValue('U'.$c,$SRDsuddetails[$j]['estimated_traded_goods_value']); + $c++; + } + }else{ + $XL->getActiveSheet()->setCellValue('P'.$S,"-")->setCellValue('Q'.$S,"-") + ->setCellValue('R'.$S,"-")->setCellValue('S'.$S,"-")->setCellValue('T'.$S,"-") + ->setCellValue('U'.$S,"-"); + } + + $STD=$processedJson['trade_details']; + $STDcount = 0; + if(!empty($STD)){ + $STDsuddetails = $STD[0]['trading_traded_goods']; + $STDcount = count($STDsuddetails); + for($j=0;$j<$STDcount;$j++){ + $XL->getActiveSheet()->setCellValue('V'.$d,$STDsuddetails[$j]['traded_goods_name']); + $XL->getActiveSheet()->setCellValue('W'.$d,$STDsuddetails[$j]['traded_goods_observed']); + $XL->getActiveSheet()->setCellValue('X'.$d,$STDsuddetails[$j]['traded_goods_quantity']); + $XL->getActiveSheet()->setCellValue('Y'.$d,$STDsuddetails[$j]['uom_master']); + $XL->getActiveSheet()->setCellValue('Z'.$d,$STDsuddetails[$j]['traded_goods_other_uom']); + $XL->getActiveSheet()->setCellValue('AA'.$d,$STDsuddetails[$j]['estimated_traded_goods_value']); + $d++; + } + }else{ + $XL->getActiveSheet()->setCellValue('V'.$S,"-")->setCellValue('W'.$S,"-")->setCellValue('X'.$S,"-")->setCellValue('Y'.$S,"-") + ->setCellValue('Z'.$S,"-")->setCellValue('AA'.$S,"-"); + } + $XL->getActiveSheet()->setCellValue('AB'.$S,!empty($processedJson['is_sufficiant_finished_and_traded_goods'])?$processedJson['is_sufficiant_finished_and_traded_goods']:"-"); + $XL->getActiveSheet()->setCellValue('AC'.$S,!empty($processedJson['finished_and_traded_goods_remarks'])?$processedJson['finished_and_traded_goods_remarks']:"-"); + $SSD = $processedJson['servicing_details']; + $SSDcount=0; + if(!empty($SSD)){ + $SSDsubdeails = $SSD[0]['service_provider']; + $SSDcount=count($SSD); + for($j=0;$j<$SSDcount;$j++){ + $XL->getActiveSheet()->setCellValue('AD'.$e,$SSDsuddetails[$j]['service_provider_name']); + $XL->getActiveSheet()->setCellValue('AE'.$e,$SSDsuddetails[$j]['service_provider_observed']); + $XL->getActiveSheet()->setCellValue('AF'.$e,$SSDsuddetails[$j]['service_provider_quantity']); + $XL->getActiveSheet()->setCellValue('AG'.$e,$SSDsuddetails[$j]['uom_master']); + $XL->getActiveSheet()->setCellValue('AH'.$e,$SSDsuddetails[$j]['service_provider_other_uom']); + $XL->getActiveSheet()->setCellValue('AI'.$e,$SSDsuddetails[$j]['estimated_service_provider_value']); + $e++; + } + }else{ + $XL->getActiveSheet()->setCellValue('AD'.$S,"-")->setCellValue('AE'.$S,"-")->setCellValue('AF'.$S,"-")->setCellValue('AG'.$S,"-") + ->setCellValue('AH'.$S,"-")->setCellValue('AI'.$S,"-"); + } + $XL->getActiveSheet()->setCellValue('AJ'.$S,!empty($processedJson['is_sufficiant_service_goods'])?$processedJson['is_sufficiant_service_goods']:"-"); + $XL->getActiveSheet()->setCellValue('AK'.$S,!empty($processedJson['service_goods_remarks'])?$processedJson['service_goods_remarks']:"-"); + $XL->getActiveSheet()->setCellValue('AL'.$S,!empty($processedJson['stock_remarks'])?$processedJson['stock_remarks']:"-"); + $max=max($SMDcount1,$SMDcount1,$SRDcount,$STDcount,$SSDcount); + if($max>0){ + for($x=$S;$x<($S+$max);$x++){ + $XL->getActiveSheet()->setCellValue('A'.$x,$processedJson['pdid']); + } + $S = $S+$max; + }else{ + $XL->getActiveSheet()->setCellValue('A'.$S,$processedJson['pdid']); + $S++; + } + + } + + ### Stock Details Here + // Alagumari + // Iqbal Singh + // Vinod Kumar Pahuja + } + // echo "Finally Loop OUT"; + // die(); + $objWriter = PHPExcel_IOFactory::createWriter($XL, 'Excel2007'); + + $objWriter->save(APPPATH.'docs/DataDump.xls'); + // Encode the image string data into base64 + // $encode = base64_encode($objWriter->save('DataDump.xls')); + // Display the output + // echo $encode; + // $objWriter->save('php://output'); + }//closed }// Class Closed Here. \ No newline at end of file diff --git a/api/application/models/Data_Dump_Model.php b/api/application/models/Data_Dump_Model.php index dcce8f8d..099a4296 100755 --- a/api/application/models/Data_Dump_Model.php +++ b/api/application/models/Data_Dump_Model.php @@ -136,4 +136,51 @@ class Data_Dump_Model extends SPARQ_Model { } ### CSV-XLsheet Queries Ends Here + function getRequestForDataDump($arr){ + + + print_r($arr); + $fromd = isset($arr[0]['from_date'])?$arr[0]['from_date']:null; + $tod= isset($arr[0]['to_date'])?$arr[0]['to_date']:null; + $type = isset($arr[0]['fk_pd_type_id'])?$arr[0]['fk_pd_type_id']:null; + $prod = isset($arr[0]['fk_product_id'])?$arr[0]['fk_product_id']:null; + $lender = isset($arr[0]['fk_lender_id'])?$arr[0]['fk_lender_id']:null; + $cseg = isset($arr[0]['fk_customer_segment_id'])?$arr[0]['fk_customer_segment_id']:null; + $city = isset($arr[0]['fk_city_id'])?$arr[0]['fk_city_id']:null; + ### 2 tables t_pd_form_details_json and t_pd_triggered + $this->db->select('PDFORMDETAILSJSON.pd_form_detail_json_id, PDFORMDETAILSJSON.fk_pd_id, PDFORMDETAILSJSON.fk_form_id, PDFORMDETAILSJSON.isactive, PDFORMDETAILSJSON.json, DATE_FORMAT(PDFORMDETAILSJSON.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDFORMDETAILSJSON.processed_json, PDFORMDETAILSJSON.updatedon,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %H:%i:%s") as completed_on,PDTRIGGER.fk_product_id, PDTRIGGER.fk_customer_segment,PDTRIGGER.fk_pd_type,PDTRIGGER.pd_status,PDTRIGGER.createdon'); + $this->db->from(PDFORMDETAILSJSON.' as PDFORMDETAILSJSON'); + $this->db->join(PDTRIGGER.' as PDTRIGGER','PDTRIGGER.pd_id = PDFORMDETAILSJSON.fk_pd_id ','LEFT'); + if(($fromd != "" || $fromd != null) && ($tod != "" || $tod != null)) { + $this->db->where('PDTRIGGER.completed_on BETWEEN '. "'$fromd'". ' AND '. "'$tod'" ); + } + else if($fromd != "" && $fromd != null) { + $this->db->where("DATE_FORMAT(PDTRIGGER.completed_on,'%Y-%m-%d')",$fromd); + } + else if($tod != "" && $tod != null) { + $this->db->where("DATE_FORMAT(PDTRIGGER.completed_on,'%Y-%m-%d')",$tod); + } + if($prod != ""){ + $this->db->where('PDTRIGGER.fk_product_id',$prod); + } + if($type != ""){ + $this->db->where('PDTRIGGER.fk_pd_type',$type); + } + if($cseg != ""){ + $this->db->where('PDTRIGGER.fk_customer_segment',$cseg); + } + if($city != ""){ + $this->db->where('PDTRIGGER.fk_city',$city); + } + if($lender != ""){ + $this->db->where('PDTRIGGER.fk_lender_id',$lender); + } + $this->db->WHERE('PDFORMDETAILSJSON.isactive',1); + $this->db->order_by('PDFORMDETAILSJSON.pd_form_detail_json_id','desc'); + // $this->db->limit(5); + $result = $this->db->get()->result_array(); + // echo count($result);print_r($result);print_r($this->db->last_query());die(); + return $result; + + } } \ No newline at end of file diff --git a/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php b/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php index bae71519..9761e2a5 100644 --- a/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php +++ b/api/application/views/report_templates/JSONTOREPORT_FI_OV_DI.php @@ -339,7 +339,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '

' . 'The Field Visit was done at ' . $address_value['address_type_master'] . ' of the loan applicants. The ' . $address_value['address_type_master'] . ' is located in a ' . $address_value['locality_master'] . ' and the estimated area of the ' . $address_value['address_type_master'] . ' is ' .$address_value['estimated_area'].' '. $address_value['uom_master'] . '. The location was ' . $address_value['pd_location_master'] . '. As Per Officer, the ' . $address_value['address_type_master'] . ' is situated in a ' . $address_value['comment_locality_master'] . ' Locality. ' . '

'; } ?> -
+ @@ -348,26 +348,37 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '

VISIT DETAILS:

'; $Office_visit_data = json_decode($pd_processed_forms[29][0]['processed_json'], true); $ov_value = $Office_visit_data['json']; - - $business_activities_during_visit = implode(', ', $ov_value['Was_any_business_activities_observed_during_visit']); - $business_activities_during_visit = preg_replace("/_/i", ' ', $business_activities_during_visit); - $business_activities_during_visit = ucwords($business_activities_during_visit); + $business_activities_during_visit = ""; + if(strtoupper($ov_value['Was_any_business_activities_observed']) == 'YES'){ + $business_activities_during_visit = implode(', ', $ov_value['Was_any_business_activities_observed_during_visit']); + $business_activities_during_visit = preg_replace("/_/i", ' ', $business_activities_during_visit); + $business_activities_during_visit = ucwords($business_activities_during_visit); + if(isset($ov_value['specify_others']) && $ov_value['specify_others'] != "" && $ov_value['specify_others'] != null){ + $business_activities_during_visit = str_replace("Others",$ov_value['specify_others'],$business_activities_during_visit); + } + } + $company_name_sighted = strtoupper($ov_value['was_the_company_name_board_sighted']) == 'YES' ? 'seen' : 'not seen'; echo '
  • Brief of the Business / Service Model: ' . $ov_value['business_brief'] . '.
  • Visited address is of a ' . $ov_value['visited_address_is'] . '.
  • At the time of visit, the officer sighted ' . $ov_value['no_of_employees_sighted_by_PD_officer_during_visit'] . ' employees at the business premises.
  • The Business Name board was ' . $company_name_sighted . ' at the visited address.
  • '; - if (strtoupper($ov_value['do_you_want_to_add_other_documents']) == 'YES') { - echo '
  • ' . $ov_value['remarks_others'] . ' was sighted during visit and pictures are enclosed with the Report.
  • '; - } + $name_of_business_documents = array(); + if (strtoupper($ov_value['gst_documents_sighted']) == 'YES') { array_push($name_of_business_documents,"GST");} + if (strtoupper($ov_value['rent_agreement_documents_sighted']) == 'YES') {array_push($name_of_business_documents,"rent agreement");} + if (strtoupper($ov_value['do_you_want_to_add_other_documents']) == 'YES') {array_push($name_of_business_documents,$ov_value['remarks_others']);} + echo '
  • ' . implode(', ', $name_of_business_documents) . ' was sighted during visit and pictures are enclosed with the Report.
  • '; + if ($ov_value['Visited_address_is_rented'] != 'not disclosed ') { echo '
  • The ' . $ov_value['visited_address_is'] . ' is ' . $ov_value['Visited_address_is_rented'] . '.
  • '; } if ($ov_value['Visited_address_is_rented'] == 'not disclosed ') { echo '
  • The ' . $ov_value['visited_address_is'] . ' is Rented or Owned is Not Disclosed by the person met.
  • '; } - echo '
  • Business Activity was ' . $company_name_sighted . ' and ' . $business_activities_during_visit . '
  • '; + if($business_activities_during_visit != ""){ + echo '
  • Business Activity was ' . $company_name_sighted . ' and ' . $business_activities_during_visit . '
  • '; + } if (strtoupper($ov_value['stock_photograph']) == 'YES') { echo '
  • Stock was seen during visit and pictures are enclosed with the Report.
  • '; } @@ -376,7 +387,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); } echo '
'; ?> -
+ @@ -553,7 +564,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); -
+

VISITING OFFICER`S REMARKS

- '; if (!empty($distances['distance'])) { echo '

Distance to PD location : ' . $distances['distance']; } @@ -666,7 +678,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); if (count($pd_images['34'])) { $pd_images['common_images'] = array_values($pd_images['34']); $tot_rows = ceil(count($pd_images['common_images']) / 3); - echo '
'; + // echo '
'; echo '

VISIT PICTURES

'; echo '
Photograph`s

'; diff --git a/api/application/views/report_templates/JSONTOREPORT_FI_OV_SAL.php b/api/application/views/report_templates/JSONTOREPORT_FI_OV_SAL.php index 50678b98..d86bedbc 100644 --- a/api/application/views/report_templates/JSONTOREPORT_FI_OV_SAL.php +++ b/api/application/views/report_templates/JSONTOREPORT_FI_OV_SAL.php @@ -310,6 +310,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '

' . 'Applicant ('.$person.') was met at the visited address.' . '

'; } else if (strtoupper($value['is_person_met']) == 'NO') { $designation = str_replace(' of', '', $value['designation_person_met_master']); + if($value['Others_specify']){ $designation = $value['Others_specify']; } echo '

' . 'During PD (' . $value['Name_of_the_Person'] . ') (' . $designation . ') was met at the visited address during visit.' . '

'; } if (isset($general_form['general_remark']) && $general_form['general_remark'] != "") { @@ -339,7 +340,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '

' . 'The Field Visit was done at ' . $address_value['address_type_master'] . ' of the loan applicants.

'; } ?> -
+ @@ -502,7 +503,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); -
+

VISITING OFFICER`S REMARKS

'; if (!empty($distances['distance'])) { echo '

Distance to PD location : ' . $distances['distance']; } @@ -618,7 +620,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); if (count($pd_images['34'])) { $pd_images['common_images'] = array_values($pd_images['34']); $tot_rows = ceil(count($pd_images['common_images']) / 3); - echo '
'; + // echo '
'; echo '

VISIT PICTURES

'; echo '
Photograph`s

'; diff --git a/api/application/views/report_templates/JSONTOREPORT_FI_RV.php b/api/application/views/report_templates/JSONTOREPORT_FI_RV.php index a420a791..bb539a7c 100644 --- a/api/application/views/report_templates/JSONTOREPORT_FI_RV.php +++ b/api/application/views/report_templates/JSONTOREPORT_FI_RV.php @@ -310,8 +310,8 @@ defined('BASEPATH') or exit('No direct script access allowed'); $person = isset($value['Name_of_the_Person_met_master']) ? $value['Name_of_the_Person_met_master'] : $value['Name_of_the_Person_met']; echo '

' . 'Applicant ('.$person.') was met at the visited address.' . '

'; } else if (strtoupper($value['is_person_met']) == 'NO') { - $designation = str_replace(' of', '', $value['designation_person_met_master']); - echo '

' . '(' . $value['Name_of_the_Person'] . ') (' . $designation . ') was met at the visited address during visit.' . '

'; + $designation = isset($value['designation_person_met_master']) ? str_replace(' of', '', "(".$value['designation_person_met_master'].")") : ""; + echo '

' . '(' . $value['Name_of_the_Person'] . ') ' . $designation . ' was met at the visited address during visit.' . '

'; } if (isset($general_form['general_remark']) && $general_form['general_remark'] != "") { echo '

' . $general_form['general_remark'] . '

'; @@ -340,7 +340,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); echo '

' . 'The Field Visit was done at ' . $address_value['address_type_master'] . ' of the loan applicants. The ' . $address_value['address_type_master'] . ' is located in a ' . $address_value['locality_master'] . ' and the estimated area of the ' . $address_value['address_type_master'] . ' is ' .$address_value['estimated_area'].' '. $address_value['uom_master'] . '. The location was ' . $address_value['pd_location_master'] . '. As Per Officer, the ' . $address_value['address_type_master'] . ' is situated in a ' . $address_value['comment_locality_master'] . ' Locality. ' . '

'; } ?> -
+ @@ -375,7 +375,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); // } echo ''; ?> -
+ @@ -637,6 +637,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); '; if (!empty($distances['distance'])) { echo '

Distance to PD location : ' . $distances['distance']; } @@ -669,7 +670,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); if (count($pd_images['34'])) { $pd_images['common_images'] = array_values($pd_images['34']); $tot_rows = ceil(count($pd_images['common_images']) / 3); - echo '
'; + // echo '
'; echo '

VISIT PICTURES

'; echo '
Photograph`s

';