diff --git a/api/application/config/autoload.php b/api/application/config/autoload.php index 24025f75..8e50e9ea 100644 --- a/api/application/config/autoload.php +++ b/api/application/config/autoload.php @@ -89,7 +89,7 @@ $autoload['drivers'] = array(); | | $autoload['helper'] = array('url', 'file'); */ -$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup','assessedincome','rentalform','external_dir_check','applicantname_grabber','vendor_form','custom_encryption','readexceldata','loanform'); +$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myutil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform','sms_gupshup','assessedincome','rentalform','external_dir_check','applicantname_grabber','vendor_form','custom_encryption','readexceldata','loanform','requestdatadump'); /* | ------------------------------------------------------------------- diff --git a/api/application/config/routes.php b/api/application/config/routes.php index a77fd306..57a70717 100755 --- a/api/application/config/routes.php +++ b/api/application/config/routes.php @@ -324,10 +324,6 @@ $route['getCMUsers'] = 'SMC_Credit_PD_Controller/getCMUsers'; $route['smcCreditPDMisReport'] = 'SMC_Credit_PD_Controller/smcCreditPDMisReport'; $route['getCompanyListForSMCList'] = 'SMC_Credit_PD_Controller/getCompanyListForSMCList'; -$route['getRequestForDataDump'] = 'Request_DataDump_Controller/getRequestForDataDump'; -$route['getMasterForDataDump'] = 'Request_DataDump_Controller/getMasterForDataDump'; -$route['downloadDataDump'] = 'Request_DataDump_Controller/downloadDataDump2'; - $route['getSMCVendorList'] = 'SMC_Credit_PD_Controller/getStateWiseAgency'; $route['getSMCVendorPDOfficersList'] = 'SMC_Credit_PD_Controller/getSMCVendorPDOfficersList'; @@ -362,4 +358,7 @@ $route['compareFaces'] = 'Test/compareFaces'; $route['googleSheet'] = 'Data_Dump_Controller/googleSheet'; $route['getListPDOfficersForNotification'] = 'PD_Controller/getListPDOfficersForNotification'; -$route['sendNotificationToOfficers'] = 'PD_Controller/sendNotificationToOfficers'; \ No newline at end of file +$route['sendNotificationToOfficers'] = 'PD_Controller/sendNotificationToOfficers'; + +$route['getMasterForDataDump'] = 'Request_DataDump_Controller/getMasterForDataDump'; +$route['getRequestForDataDump'] = 'Request_DataDump_Controller/getRequestForDataDump'; \ No newline at end of file diff --git a/api/application/controllers/Request_DataDump_Controller.php b/api/application/controllers/Request_DataDump_Controller.php index 10e6ad15..e2abc8e0 100755 --- a/api/application/controllers/Request_DataDump_Controller.php +++ b/api/application/controllers/Request_DataDump_Controller.php @@ -12,6 +12,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); /** @noinspection PhpIncludeInspection */ require_once APPPATH . '/libraries/REST_Controller.php'; include_once APPPATH.'/vendor/autoload.php'; +require APPPATH.'/vendor/autoload.php'; /** * This is an example of a few basic user interaction methods you could use @@ -31,33 +32,61 @@ class Request_DataDump_Controller extends REST_Controller { parent::__construct(); $this->load->model('Data_Dump_Model','Data_Dump_Model'); - //$this->load->library('AWS_S3'); - $this->load->library('excel'); - $this->load->helper('download'); + $this->load->library('pdfgenerator'); + // $this->load->library('AWS_S3'); } - + + ### XL-Data-Dump master Details Filter + # PD-TYPE,PRODUCT,CUSTOMER-SEGMENT AND PD-SNO. + public function getMasterForDataDump_get(){ + log_message('ERROR','## XL-datadump Master Details inside Fns - '.date('Y-m-d H:i:s A')); + $result = $this->Data_Dump_Model->filtermasterfordatadumprequest(); + if(count($result) > 0) + { log_message('ERROR',"## XL-datadump Master Details : ".json_encode($result)); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['records'] = $result; + } + else + { log_message('ERROR',"## XL-datadump Master Details Error "); + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + } + $this->response($data,REST_Controller::HTTP_OK); + }//getMasterForDataDump closed here. + + ### Request the Details For XL-Data-Dump. public function getRequestForDataDump_post(){ - // {"type":null,"fd":null,"td":null,"pdid":[]} - // {"type":null,"fd":"2021-07-08","td":null,"pdid":[]} - // {"type":null,"fd":"2021-07-08","td":"2021-07-20","pdid":[]} - // {"product_id":null,"customer_segment_id":null,"pd_type_id":null,"from_date":null,"to_date":null,"pd_id":["2583"]} - // {"type":null,"fd":null,"td":null,"pdid":["6691"]} - // {"type":null,"fd":null,"td":null,"pdid":["6692","6691","6688"]} - // {"product":null"customer_segment":null,"type":null,"fd":null,"td":null,"pdid":["6692","6691","6688"]} + // echo XLPATH;die(); + log_message('ERROR','## Request For XL-datadump inside Fns - '.date('Y-m-d H:i:s A')); + ## Sample Params : {"product_id":1,"customer_segment_id":null,"pd_type_id":null,"from_date":null,"to_date":null,"pd_id":["2583","2606"]} $postarr = $this->post(); - // ### Requested Details - $requested_details = $this->Data_Dump_Model->getRequestForDataDump($postarr); - // echo "i am in controller"; print_r($requested_details); count($requested_details); - $file = APPPATH.'docs/RequestDataDump.xls'; - if (file_exists($file)){ - if (file_exists(APPPATH."docs/DataDump.xls")) { - unlink(APPPATH.'docs/DataDump.xls'); - } + log_message('ERROR','## Request For XL-datadump Parmas - '.json_encode($postarr)); + ## Gathering Data based on params. + $requested_details = $this->Data_Dump_Model->getRequestForDataDump($postarr); + log_message('ERROR','## Request For XL-datadump Requested-data count - '.count($requested_details)); + if (!empty($requested_details)){ + requestdatadump::Fns4($requested_details); + $data['dataStatus'] = true; + $data['status'] = REST_Controller::HTTP_OK; + $data['message'] = "Success"; + }// if closed 68; + else { + log_message('ERROR','## Request For XL-datadump file template Not Founded'); + $data['dataStatus'] = false; + $data['status'] = REST_Controller::HTTP_NO_CONTENT; + $data['message'] = "Fails"; + }//else closed + $this->response($data,REST_Controller::HTTP_OK); + // switch($role_id){} + } + public function getRequestForDataDump2_post(){ + + + // echo "\n The file $file exists"; // $pathinfo = pathinfo($file); print_r($pathinfo); - require_once APPPATH .'third_party/PHPExcel/Classes/PHPExcel/IOFactory.php'; - $reader= PHPExcel_IOFactory::createReaderForFile($file); - $XL = $reader->load($file); + // '3', 'Personal Details', // '15', 'Lender Representative', // '16', 'Assessed Income', @@ -1840,156 +1869,6 @@ class Request_DataDump_Controller extends REST_Controller { // Display the output // echo $encode; // $objWriter->save('php://output'); - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - // $data['message'] = "Success ( The file $file exists )"; - $this->response($data,REST_Controller::HTTP_OK); - } - else - { - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['message'] = "Fails ( The file $file does not exists )"; - $this->response($data,REST_Controller::HTTP_OK); - } - } - - public function check($ths_var){ - if (isset($the_var)) { - if (empty($the_var)) { - return "-"; - } else { return $the_var; } - } else { return "-"; } - - - } - public function getMasterForDataDump_get(){ - - $result = $this->Data_Dump_Model->filtermasterfordatadumprequest(); - - if(count($result) > 0) - { - $data['dataStatus'] = true; - $data['status'] = REST_Controller::HTTP_OK; - $data['records'] = $result; - $this->response($data,REST_Controller::HTTP_OK); - } - else - { - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $this->response($data,REST_Controller::HTTP_OK); - } - - - } - - public function downloadDataDump_get() - { - - - - - $fp = fopen (APPPATH.'docs/DataDump.xls', 'w+');//This is the file where we save the information - $headers = array('Content-type: application/json'); - $fp = fopen (dirname(__FILE__) . '/localfile.tmp', 'w+');//This is the file where we save the information - $curl = curl_init(DONWLOAD_REPORT); - curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); - curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curl, CURLOPT_POST, true); - curl_setopt($curl, CURLOPT_USERPWD, $api_key); - $file = curl_exec($curl); - - if ($file === false) - { - $info = curl_getinfo($curl); - curl_close($curl); - die('error occured during curl exec. Additioanl info: ' . var_export($info)); - } - - curl_close($curl); - - header('Content-type: ' . 'application/octet-stream'); - header('Content-Disposition: ' . 'attachment; filename=DataDump.xls'); - echo $file; - - } - - public function downloadDataDump1_get() - { - $content = trim(file_get_contents(APPPATH.'docs/DataDump.xls')); - return $content; - } - public function downloadDataDump2_post(){ - // $pth = file_get_contents(APPPATH."docs/DataDump.xls"); - // $nme = "sample_file.xls"; - // force_download($nme, $pth); - if (file_exists(APPPATH."docs/DataDump.xls")) { - header("Content-Type: application/x-binary"); - header("Content-Transfer-Encoding: Binary"); - header("Content-Length:".filesize($file)); - header("Content-Disposition: attachment; filename=".$name); - $file = read_file(APPPATH."docs/DataDump.xls"); // Use file helper to read the file's - $name = "DataDump".date('Y-m-d-H-i-s').'.xls'; - force_download($name, $file); - } else { - $data['dataStatus'] = false; - $data['status'] = REST_Controller::HTTP_NO_CONTENT; - $data['message'] = "The file does not exist"; - $this->response($data,REST_Controller::HTTP_OK); - } - // exit; - } - // public function getXL_get(){ - // $data = read_file(APPPATH."docs/DataDump.xls"); // Use file helper to read the file's - // $name = "DataDump".date('Y-m-d-H-i-s').'.xls'; - // force_download($name, $data); - // } - public function downloadDataDump5_get(){ - $temp_base64_string = "DataDump.xls"; - $title = "Request Data Dump"; - $output_file = APPPATH."docs/DataDump.xls"; - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < 5; $i++) { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - $temp_file_name = $randomString.date('Y-m-d-H-i-s').'.xls'; - $ifp = fopen( $output_file, 'wb' ); - $temp_data = explode( ',', $temp_base64_string ); - print_r($temp_data); - // fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) ); - // fclose( $ifp ); - // $tempdoc = $output_file; - // prit_r($tempdoc); - } - public function downloadDataDump3_get(){ - $temp_base64_string = "DataDump.xls"; - $title = "Request Data Dump"; - $output_file = APPPATH."docs/DataDump.xls"; - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < 5; $i++) { - $randomString .= $characters[rand(0, $charactersLength - 1)]; - } - $temp_file_name = $randomString.date('Y-m-d-H-i-s').'.xls'; - $ifp = fopen( $output_file, 'wb' ); - $temp_data = explode( ',', $temp_base64_string ); - fwrite( $ifp, base64_decode( $temp_data[ 1 ] ) ); - fclose( $ifp ); - $tempdoc = $output_file; - $tempdocname = $temp_file_name; - $bucketname = LENDER_BUCKET_NAME_PREFIX; - $key = 'docs/'.$tempdocname ; - $sourcefile = $tempdoc; - - $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); - $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); - - print_r($s3result); - - } - -} \ No newline at end of file + }//closed + +}// Class Closed Here. \ No newline at end of file diff --git a/api/application/helpers/requestdatadump_helper.php b/api/application/helpers/requestdatadump_helper.php new file mode 100644 index 00000000..4f7b48ee --- /dev/null +++ b/api/application/helpers/requestdatadump_helper.php @@ -0,0 +1,594 @@ +load->library('myspreadsheet'); + $spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $sheet = $spreadsheet->getActiveSheet(); + $sheet->setCellValue('A1', 'Second Hello World !'); + $sheet->setTitle('Address Form datas'); + $myWorkSheet = new \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet($spreadsheet, 'My Data'); + // Attach the "My Data" worksheet as the first worksheet in the Spreadsheet object + $spreadsheet->addSheet($myWorkSheet, 0); + + $writer = $CI->myspreadsheet->getXlsx($spreadsheet); + $writer->save(XLPATH.'/tmp/SecondTest.xls'); + } + + public static function Fns2($requested_details) + { + log_message('ERROR','####RequestDataDump Helper FNS1'); + log_message('ERROR','####Creating Test Excel'); + $CI =&get_instance(); + $CI->load->library('myspreadsheet'); + SELF::$current_spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $sheet = SELF::$current_spreadsheet->getActiveSheet(); + $sheet->setCellValue('A1', 'Second Hello World !'); + $sheet->setTitle('Address Form datas'); + SELF::$current_spreadsheet->setActiveSheetIndex(0)->setTitle('My Data'); + // Attach the "My Data" worksheet as the first worksheet in the Spreadsheet object + SELF::$current_spreadsheet->addSheet($myWorkSheet, 0); + $writer = $CI->myspreadsheet->getXlsx(SELF::$current_spreadsheet); + $writer->save(XLPATH.'/tmp/ThridTest.xls'); + } + + public static function multiple_spreadsheet($r) + { + $CI =&get_instance(); + $CI->load->library('myspreadsheet'); + + // header('Content-Type: application/vnd.ms-excel'); + // header('Content-Disposition: attachment;filename=myexcel.xlsx'); + + $spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $spreadsheet->setActiveSheetIndex(0)->setCellValue('A1','service worksheet'); + $spreadsheet->getActiveSheet()->setTitle('Service'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(1)->setCellValue('A1','New Worksheet'); + $spreadsheet->getActiveSheet()->setTitle('Product1'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(2)->setCellValue('A1','New Worksheeet'); + $spreadsheet->getActiveSheet()->setTitle('Product2'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(3)->setCellValue('A1','New Workshet'); + $spreadsheet->getActiveSheet()->setTitle('Product3'); + + $spreadsheet->createSheet(); + $spreadsheet->setActiveSheetIndex(4)->setCellValue('A1','New Workshheet'); + $spreadsheet->getActiveSheet()->setTitle('Product4'); + // $spreadsheet->setActiveSheetIndex(0); + + $writer = $CI->myspreadsheet->getXlsx($spreadsheet); + $writer->save(XLPATH.'/tmp/PDExportXL_f.xls'); + } + + public static function Fns4($requested_details) + { + log_message('ERROR','####RequestDataDump Helper FNS2'); + log_message('ERROR','####Creating Test Excel'); + $CI =&get_instance(); + $CI->load->library('myspreadsheet'); + SELF::$current_spreadsheet = $CI->myspreadsheet->getMySpreadSheet(); + $formid_arr = array(); + for($i=0;$i < count($requested_details);$i++){ + $processedJson = json_decode($requested_details[$i]['processed_json'],TRUE); + $formid = $processedJson['formid']; + // echo " ".$formid." "; + if (!in_array($formid, $formid_arr)){ + array_push($formid_arr,(int)$formid); + } + } + sort($formid_arr); + SELF::formHeadlines($formid_arr); + $writer = $CI->myspreadsheet->getXlsx(SELF::$current_spreadsheet); + $filename = "PDExportXL_".date('Y-m-d H:i:s A').".xls"; + $writer->save(XLPATH.'/tmp/'.$filename); + // $numbers = array(4, 6, 2, 22, 11);sort($numbers); + // print_r($numbers); + // print_r($formid_arr);die(); + + for($i=0;$i < count($requested_details);$i++){ + $processedJson = json_decode($requested_details[$i]['processed_json'],TRUE); + // print_r($processedJson);die(); + // echo "Don't Worry Be happy because i have JSON"; + $formid = $processedJson['formid']; + switch($formid) + { + // case 1: ## '1', 'Supplier Details' + // $details = SELF::gatheringSupplierForm($processedJson); + // // $sheet->setTitle('Supplier Details'); + // $sheet->setActiveSheetIndex(0)->setCellValue('A1','Supplier Details'); + // $sheet->getActiveSheet()->setTitle('Supplier Details'); + + // break; + // case 2: ## '2', 'Client Details' + // $details = SELF::gatheringClientForm($processedJson); + // $sheet->createSheet(); + // $sheet->setActiveSheetIndex(1)->setCellValue('A1', 'Client Details !'); + // $sheet->getActiveSheet()->setTitle('Client Details'); + + // break; + // case 3: ## '3', 'Personal Details' + // $details = SELF::gatheringPersonalForm($processedJson); + // $sheet->createSheet(); + // $sheet->setActiveSheetIndex(2)->setCellValue('A1', 'Personal Details !'); + // $sheet->getActiveSheet()->setTitle('Personal Details'); + // break; + // case 4: ## '4', 'Other Assets' + // $details = SELF::gatheringOtherAssetForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Other Assets'); + + // break; + // case 5: ## '5', 'Address Details' + // $details = SELF::gatheringAddressForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Address Details'); + + // break; + // case 6: ## '6', 'Family Details' + // $details = SELF::gatheringOtherFamilyDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Family Details'); + + // break; + // case 7: ## '7', 'Banking Details' + // $details = SELF::gatheringBankingInfoForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Banking Details'); + + // break; + // case 8: ## '8', 'Existing Loan Obligations' + // $details = SELF::gatheringExistingLoanDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Existing Loan Obligations'); + + // break; + // case 9: ## '9', 'Other Income Details' + // $details = SELF::gatheringOtherIncomeDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Other Income Details'); + + // break; + // case 10: ## '10', 'Loan Details' + // $details = SELF::gatheringLoanDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Loan Details'); + + // break; + // case 11: ## '11', 'Stock Details' + // $details = SELF::gatheringStockDetailsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Stock Details'); + + // break; + // case 12: ## '12', 'Employment Information' + // $details = SELF::gatheringEmploymetForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Employment Information'); + + // break; + // case 13: ## '13', 'Business Information' + // $details = SELF::gatheringBusinessForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Business Information'); + + // break; + // case 14: ## '14', 'Financial Information' + // $details = SELF::gatheringFinancialInfoForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Financial Information'); + + // break; + // case 15: ## '15', 'Lender Representative' + // $details = SELF::gatheringLenderRepresentativeForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Lender Representative'); + + // break; + // case 16: ## '16', 'Assessed Income' + // $details = SELF::gatheringAssessedIncomeForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Assessed Income'); + + // break; + // case 17: ## '17', 'Rental Verification' + // $details = SELF::gatheringRentalIncomeForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Rental Verification'); + + // break; + // case 18: ## '18', 'General Information' + // $details = SELF::gatheringGeneralInfoForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('General Information'); + + // break; + // case 19: ## '19', 'Neighbourhood / Reference Check' + // $details = SELF::gatheringNeighbourForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Neighbourhood and Ref Check'); + + // break; + // case 20: ## '20', 'Final Remarks Form' + // $details = SELF::gatheringFinalRemarksForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Final Remarks Form'); + + // break; + // case 21: ## '21', 'Business Banking' + // $details = SELF::gatheringBusinessBankingFormForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Business Banking'); + + // break; + // case 22: ## '22', 'Business Assets' + // $details = SELF::gatheringBusinessAssetsForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Business Assets'); + + // break; + // case 23: ## '23', 'Future Plan and Business Environment' + // $details = SELF::gatheringFuturePlanandBusinessEnvironmentForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Future Plan'); + + // break; + // case 24: ## '24', 'Credit Manager Queries' + // $details = SELF::gatheringCreditManagerQueriesForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Credit Manager Queries'); + + // break; + // case 25: ## '25', 'Vendor PD Form' + // $details = SELF::gatheringVendorPDForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Vendor PD Form'); + + // break; + // case 26: ## '26', 'Photograph' + // $details = SELF::gatheringPhotographForm($processedJson); + // SELF::$current_spreadsheet->setActiveSheetIndex($formid)->setTitle('Photograph'); + + // break; + // default: ## + // echo "Final - No Form ID";break; + }// Switch ends here + }// for loop ends here + $writer = $CI->myspreadsheet->getXlsx(SELF::$current_spreadsheet); + $filename = "PDExportXL_".date('Y-m-d H:i:s A').".xls"; + $writer->save(XLPATH.'/tmp/'.$filename); + }// fns2 ends here + public static function formHeadlines($formid_arr){ + $i=0; + $arr = sort($formid_arr); + $sheet = SELF::$current_spreadsheet; + foreach($formid_arr as $data) + { + switch($data){ + case 1: ## '1', 'Supplier Details' + $sheet->setActiveSheetIndex($i)->setCellValue('A1','Supplier Details'); + $sheet->getActiveSheet()->setTitle('Supplier Details'); + break; + case 2: ## '2', 'Client Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Client Details'); + break; + case 3: ## '3', 'Personal Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Personal Details !'); + $sheet->getActiveSheet()->setTitle('Personal Details'); + break; + case 4: ## '4', 'Other Assets' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Other Assets'); + + break; + case 5: ## '5', 'Address Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i) + ->setCellValue('A1', 'PDID') + ->setCellValue('B1', 'Address at which PD was initiated') + ->setCellValue('C1', 'City') + ->setCellValue('D1', 'State') + ->setCellValue('E1', 'Pincode') + ->setCellValue('F1', 'Specify other pincode') + ->setCellValue('G1', 'Is this the address where PD is done') + ->setCellValue('H1', 'Enter actual PD address') + ->setCellValue('I1', 'City') + ->setCellValue('J1', 'State') + ->setCellValue('K1', 'Pincode') + ->setCellValue('L1', 'Specify Other Pincode') + ->setCellValue('M1', 'Reason for change in PD visit address') + ->setCellValue('N1', 'Address Type') + ->setCellValue('O1', 'Specify Other Address Type') + ->setCellValue('P1', 'Locality') + ->setCellValue('Q1', 'Specify Other Locality') + ->setCellValue('R1', 'Approach to PD Location') + ->setCellValue('S1', 'Comment on locality') + ->setCellValue('T1', 'Estimated Area') + ->setCellValue('U1', 'Unit Of Measurement') + ->setCellValue('V1', 'Specify Other UOM') + ->setCellValue('W1', 'Remarks'); + $sheet->getActiveSheet()->setTitle('Address Details'); + + break; + case 6: ## '6', 'Family Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Family Details'); + + break; + case 7: ## '7', 'Banking Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Banking Details'); + + break; + case 8: ## '8', 'Existing Loan Obligations' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Existing Loan Obligations'); + + break; + case 9: ## '9', 'Other Income Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Other Income Details'); + + break; + case 10: ## '10', 'Loan Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i) + ->mergeCells('A1:A2')->setCellValue('A1', 'PDID') + ->mergeCells('B1:B2')->setCellValue('B1', 'Loan Amount Applied for ?') + ->mergeCells('C1:C2')->setCellValue('C1', 'Loan Tenure applied for ?') + ->mergeCells('D1:D2')->setCellValue('D1', 'Sub-Product') + ->mergeCells('E1:E2')->setCellValue('E1', 'What is the End Use') + ->mergeCells('F1:F2')->setCellValue('F1', 'Specify End Use') + ->mergeCells('G1:G2')->setCellValue('G1', 'Is there a balance transfer ?') + ->mergeCells('H1:H2')->setCellValue('H1', 'Amount of Own Contribution') + ->mergeCells('I1:I2')->setCellValue('I1', 'Source of Own Contribution') + ->mergeCells('J1:J2')->setCellValue('J1', 'Specify Other Sources') + ->mergeCells('K1:K2')->setCellValue('K1', 'What is the amount for Balance Transfer ?') + ->mergeCells('L1:L2')->setCellValue('L1', 'Lender from where balance transfer done') + ->mergeCells('M1:M2')->setCellValue('M1', 'Specify other Lender') + ->mergeCells('N1:N2')->setCellValue('N1', 'Topup Amount ') + ->mergeCells('O1:O2')->setCellValue('O1', 'What is the End Use of the Top Up ?') + ->mergeCells('P1:P2')->setCellValue('P1', 'Specify End Use Of TopUP') + ->mergeCells('Q1:Q2')->setCellValue('Q1', 'EMI Amount Comfortable Paying') + ->mergeCells('R1:AB1')->setCellValue('R1', 'Details of Property being Mortgaged') + ->setCellValue('R2', 'Type of property') + ->setCellValue('S2', 'Specify type of property') + ->setCellValue('T2', 'Name of the proposed owner') + ->setCellValue('U2', 'Status of Construction') + ->setCellValue('V2', 'Estimate Market Value as Per Customer') + ->setCellValue('W2', 'Name of current owner(s)/ Seller(s) of the property') + ->setCellValue('X2', 'Address of the proposed property') + ->setCellValue('Y2', 'State') + ->setCellValue('Z2', 'City') + ->setCellValue('AA2', 'Pincode') + ->setCellValue('AB2', 'Specify Other pincode') + ->mergeCells('AC1:AC2')->setCellValue('AC1', 'Remarks') + ->mergeCells('AD1:AD2')->setCellValue('AD1', 'Facility Amount Applied For ?') + ->mergeCells('AE1:AE2')->setCellValue('AE1', 'Name of the Anchor') + ->mergeCells('AF1:AI1')->setCellValue('AF1', 'applicant`s association vintage with the Anchor') + ->mergeCells('AJ1:AU1')->setCellValue('AJ1', 'Credit period with the Anchor (Days)') + ->setCellValue('AF2', 'Year') + ->setCellValue('AG2', 'Month') + ->setCellValue('AH2', 'Monthly business (sale/purchase) with the Anchor') + ->setCellValue('AI2', 'Business concentration with Anchor %') + ->setCellValue('AJ2', 'Number of days') + ->setCellValue('AK2', 'Payment Mechanism') + ->setCellValue('AL2', 'Average Invoice Value') + ->setCellValue('AM2', 'Are there peak seasons for the business with Anchor') + ->setCellValue('AN2', 'Months in which sales/service is low?') + ->setCellValue('AO2', 'Comments') + ->setCellValue('AP2', 'Are there debit/credit notes being issued to/by Anchor') + ->setCellValue('AQ2', 'Reason for such debit/credit notes') + ->setCellValue('AR2', 'Value of stock related to Anchor') + ->setCellValue('AS2', 'Observations on Sample Invoices') + ->setCellValue('AT2', 'reason for no sample invoices') + ->setCellValue('AU2', 'Details of invoice and lorry recipts like date, amount, Quantity, Vehicle number, Client and supplier name'); + + + + + + + + $sheet->getActiveSheet()->setTitle('Loan Details'); + + break; + case 11: ## '11', 'Stock Details' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Stock Details'); + + break; + case 12: ## '12', 'Employment Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Employment Information'); + + break; + case 13: ## '13', 'Business Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Business Information'); + + break; + case 14: ## '14', 'Financial Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Financial Information'); + + break; + case 15: ## '15', 'Lender Representative' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Lender Representative'); + + break; + case 16: ## '16', 'Assessed Income' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Assessed Income'); + + break; + case 17: ## '17', 'Rental Verification' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Rental Verification'); + + break; + case 18: ## '18', 'General Information' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i) + ->mergeCells('A1:A2')->setCellValue('A1', 'PDID') + ->mergeCells('B1:G1')->setCellValue('B1', 'Name of Person(s) Met and Individual Loan Applicant(s)') + ->mergeCells('H1:H2')->setCellValue('H1', 'Is the applicant name same as per KYC') + ->mergeCells('I1:I2')->setCellValue('I1', 'Capture the correct name as per the KYC?') + ->mergeCells('J1:O1')->setCellValue('J1', 'Company') + ->mergeCells('P1:R1')->setCellValue('P1', 'Relationship Between Individuals') + ->mergeCells('S1:U1')->setCellValue('S1', 'Relationship of Individuals to Company / Firm') + ->mergeCells('V1:V2')->setCellValue('V1', 'Remarks') + ->setCellValue('B2', 'Name')->setCellValue('C2', 'Person Contacted')->setCellValue('D2', 'Is Loan applicant') + ->setCellValue('E2', 'Age')->setCellValue('F2', 'Qualification')->setCellValue('G2', 'Specify Qualification') + ->setCellValue('J2', 'Company/Firm')->setCellValue('K2', 'Is applicant')->setCellValue('L2', 'Company/Firm Entity Type') + ->setCellValue('M2', 'Month (Number of Years For Which The Company/Firm Has Been Running)') + ->setCellValue('N2', 'Year (Number of Years For Which The Company/Firm Has Been Running)') + ->setCellValue('O2', 'Date of Formation (Number of Years For Which The Company/Firm Has Been Running)') + ->setCellValue('P2', 'Name')->setCellValue('Q2', 'Relation')->setCellValue('R2', 'Relationship To') + ->setCellValue('S2', 'Applicant')->setCellValue('T2', 'Relation')->setCellValue('U2', 'Company') + ->setTitle('General Information'); + // $conditional1 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); + // $conditional1->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); + // $conditional1->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_LESSTHAN); + // $conditional1->addCondition('0'); + // $conditional1->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_RED); + // $conditional1->getStyle()->getFont()->setBold(true); + + // $conditional2 = new \PhpOffice\PhpSpreadsheet\Style\Conditional(); + // $conditional2->setConditionType(\PhpOffice\PhpSpreadsheet\Style\Conditional::CONDITION_CELLIS); + // $conditional2->setOperatorType(\PhpOffice\PhpSpreadsheet\Style\Conditional::OPERATOR_GREATERTHANOREQUAL); + // $conditional2->addCondition('0'); + // $conditional2->getStyle()->getFont()->getColor()->setARGB(\PhpOffice\PhpSpreadsheet\Style\Color::COLOR_GREEN); + // $conditional2->getStyle()->getFont()->setBold(true); + + // $conditionalStyles = $sheet->getActiveSheet()->getStyle('B2')->getConditionalStyles(); + // $conditionalStyles[] = $conditional1; + // $conditionalStyles[] = $conditional2; + + // $sheet->getActiveSheet()->getStyle('B2')->setConditionalStyles($conditionalStyles); + + + break; + case 19: ## '19', 'Neighbourhood / Reference Check' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Neighbourhood and Ref Check'); + + break; + case 20: ## '20', 'Final Remarks Form' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Final Remarks Form'); + + break; + case 21: ## '21', 'Business Banking' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Business Banking'); + + break; + case 22: ## '22', 'Business Assets' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Business Assets'); + + break; + case 23: ## '23', 'Future Plan and Business Environment' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Future Plan'); + + break; + case 24: ## '24', 'Credit Manager Queries' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Credit Manager Queries'); + + break; + case 25: ## '25', 'Vendor PD Form' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Vendor PD Form'); + + break; + case 26: ## '26', 'Photograph' + $sheet->createSheet(); + $sheet->setActiveSheetIndex($i)->setCellValue('A1', 'Client Details !'); + $sheet->getActiveSheet()->setTitle('Photograph'); + + break; + default: ## + echo "Final - No Form ID";break; + }// Switch ends here + // $spreadsheet->setActiveSheetIndex(0) + // ->setCellValue('A'.$i, ) + // ->setCellValue('B'.$i, ) + // ->setCellValue('C'.$i, ) + // ->setCellValue('D'.$i, ); + $i++; + } + return $sheet; + + } + ## '1', 'Supplier Details' + static function gatheringSupplierForm($processedJson){ + + }// supplier ends here + ## '2', 'Client Details' + static function gatheringClientForm($processedJson){ } //client ends here + ## '3', 'Personal Details' + static function gatheringPersonalForm($processedJson){ }//personal ends here + ## '4', 'Other Assets' + static function gatheringOtherAssetForm($processedJson){ }// other asset ends here + ## '5', 'Address Details' + static function gatheringAddressForm($processedJson){ }//address ends here + ## '6', 'Family Details' + static function gatheringOtherFamilyDetailsForm($processedJson){ }// family ends here + ## '7', 'Banking Details' + static function gatheringBankingInfoForm($processedJson){}// banking ends here + ## '8', 'Existing Loan Obligations' + static function gatheringExistingLoanDetailsForm($processedJson){} //exist loan ends here + ## '9', 'Other Income Details' + static function gatheringOtherIncomeDetailsForm($processedJson){}// other Income ends here + ## '10', 'Loan Details' + static function gatheringLoanDetailsForm($processedJson){}// loan ends here + ## '11', 'Stock Details' + static function gatheringStockDetailsForm($processedJson){}// stock ends here + ## '12', 'Employment Information' + static function gatheringEmploymetForm($processedJson){}// employment INfoo ends here + ## '13', 'Business Information' + static function gatheringBusinessForm($processedJson){ }// buiness ends here + ## '14', 'Financial Information' + static function gatheringFinancialInfoForm($processedJson){ }//financial ends here + ## '15', 'Lender Representative' + static function gatheringLenderRepresentativeForm($processedJson){}//lender rep ends here + ## '16', 'Assessed Income' + static function gatheringAssessedIncomeForm($processedJson){ }// assess info ends here + ## '17', 'Rental Verification' + static function gatheringRentalIncomeForm($processedJson){ } //rental info ends here + ## '18', 'General Information' + static function gatheringGeneralInfoForm($processedJson){ }//general ends here + ## '19', 'Neighbourhood / Reference Check' + static function gatheringNeighbourForm($processedJson){ }// refer ends here + ## '20', 'Final Remarks Form' + static function gatheringFinalRemarksForm($processedJson){ }// final remarks ends here + ## '21', 'Business Banking' + static function gatheringBusinessBankingForm($processedJson){ }// buiness bank ends here + ## '22', 'Business Assets' + static function gatheringBusinessAssetsForm($processedJson){} //buiness asset ends here + ## '23', 'Future Plan and Business Environment' + static function gatheringFuturePlanandBusinessEnvironmentForm($processedJson){}//future plan ends here + ## '24', 'Credit Manager Queries' + static function gatheringCreditManagerQueriesForm($processedJson){}// CM quries ends here + ## '25', 'Vendor PD Form' + static function gatheringVendorPDForm($processedJson){} // pd vendor info ends here + ## '26', 'Photograph' + static function gatheringPhotographForm($processedJson){} //photograph ends here +} +?> \ No newline at end of file