From 326bae3fc7e191424e552b24ac58318e7a432515 Mon Sep 17 00:00:00 2001 From: velz Date: Tue, 26 Feb 2019 17:51:18 +0530 Subject: [PATCH] PD REPORTS --- api/application/config/autoload.php | 2 +- api/application/config/constants.php | 24 +- .../Entity_Management_Controller.php | 5 +- api/application/controllers/PD_Controller.php | 443 ++++- api/application/docs/sample.pdf | Bin 17082 -> 86703 bytes api/application/helpers/assetsform_helper.php | 191 +++ .../helpers/bankingform_helper.php | 49 + .../helpers/businessform_helper.php | 426 +++++ .../helpers/financialform_helper.php | 113 ++ .../helpers/getprocessedjson_helper.php | 2 + api/application/helpers/myuitil_helper.php | 26 +- .../neighbourreferencecheckform_helper.php | 78 + .../helpers/otherfamilyform_helper.php | 38 + .../helpers/otherincomeform_helper.php | 16 + api/application/helpers/pdscore_helper.php | 445 +++++ api/application/helpers/stockform_helper.php | 81 + api/application/models/PD_Model.php | 36 +- .../views/report_templates/JSONTOREPORT.php | 1224 +++++++++++++- .../JSONTOREPORT_karthick.php | 1433 +++++++++++++++++ 19 files changed, 4530 insertions(+), 102 deletions(-) create mode 100644 api/application/helpers/assetsform_helper.php create mode 100644 api/application/helpers/bankingform_helper.php create mode 100644 api/application/helpers/businessform_helper.php create mode 100644 api/application/helpers/financialform_helper.php create mode 100644 api/application/helpers/neighbourreferencecheckform_helper.php create mode 100644 api/application/helpers/otherfamilyform_helper.php create mode 100644 api/application/helpers/otherincomeform_helper.php create mode 100644 api/application/helpers/pdscore_helper.php create mode 100644 api/application/helpers/stockform_helper.php create mode 100644 api/application/views/report_templates/JSONTOREPORT_karthick.php diff --git a/api/application/config/autoload.php b/api/application/config/autoload.php index 71c7fb73..0e6e34a2 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','myuitil','myhttpclient'); +$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myuitil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform'); /* | ------------------------------------------------------------------- diff --git a/api/application/config/constants.php b/api/application/config/constants.php index 1805f452..c37d62ee 100644 --- a/api/application/config/constants.php +++ b/api/application/config/constants.php @@ -97,7 +97,7 @@ defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','lend defined('LOGTOBOT') OR define('LOGTOBOT',1); defined('LOGTOSYS') OR define('LOGTOSYS',1); -defined('PROCESSJSON') OR define('PROCESSJSON',0); +defined('PROCESSJSON') OR define('PROCESSJSON',1); defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=467975ee8e33abf1549803925eaace0f'); /*******************Constants PD status*********************************/ @@ -496,6 +496,28 @@ defined('PDOFFICERRECOMMENDATIONSID') OR define('PDOFFICERRECOMMENDATIONSID','pd defined('PRICINGINFO') OR define('PRICINGINFO','m_pricing_info'); defined('PRICINGINFOID') OR define('PRICINGINFOSID','pricing_info_id'); +defined('SCORECARD') OR define('SCORECARD','m_scorecard'); +defined('SCORECARDID') OR define('SCORECARDID','scorecard_id'); + +defined('LEVEL1') OR define('LEVEL1','m_level1'); +defined('LEVEL1ID') OR define('LEVEL1ID','level1_id'); + +defined('LEVEL2') OR define('LEVEL2','m_level2'); +defined('LEVEL2ID') OR define('LEVEL2ID','level2_id'); + +defined('LEVEL3') OR define('LEVEL3','m_level3'); +defined('LEVEL3ID') OR define('LEVEL3ID','level3_id'); + +defined('PLCCOMBINATION') OR define('PLCCOMBINATION','m_plc_combination'); +defined('PLCCOMBINATIONID') OR define('PLCCOMBINATIONID','plc_combination_id'); + +defined('PERSONALASSETGRID') OR define('PERSONALASSETGRID','m_personal_asset_grid'); +defined('PERSONALASSETGRIDID') OR define('PERSONALASSETGRIDID','personal_asset_grid_id'); + +defined('PERSONALASSETGRIDVARIANCE') OR define('PERSONALASSETGRIDVARIANCE','m_personal_asset_grid_variance'); +defined('PERSONALASSETGRIDVARIANCEID') OR define('PERSONALASSETGRIDVARIANCEID','m_personal_asset_grid_variance'); + + diff --git a/api/application/controllers/Entity_Management_Controller.php b/api/application/controllers/Entity_Management_Controller.php index ccd5f703..38b14c82 100644 --- a/api/application/controllers/Entity_Management_Controller.php +++ b/api/application/controllers/Entity_Management_Controller.php @@ -798,7 +798,10 @@ class Entity_Management_Controller extends REST_Controller { public function listEntityPricingInfo_post() { $records = $this->post('records'); - + echo 'called'; + $logger = MYLOG::logFunction(); + $logger->info("CUSTOM SPECIFIC TEMPLATE ",array('PDID' => "sdfkhs")); + die(); $columns = array('ENTITY.short_name as lender_name', 'pricing_info_id', 'fk_lender_id', 'slab_name', 'from', 'to', 'full_pd_di', 'full_pd_ai', 'smart_pd', 'tele_pd', 'PRICINGINFO.isactive', 'PRICINGINFO.createdon', 'PRICINGINFO.updateon', 'PRICINGINFO.fk_createdby',' PRICINGINFO.fk_updatedby'); $table = PRICINGINFO.' as PRICINGINFO'; diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 14dcd44d..32cdbecd 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -255,11 +255,13 @@ class PD_Controller extends REST_Controller { { foreach($result_data as $key => $res) { - $fields = array('city_id','name as city_name'); - $where_condition_array = array('isactive' => 1,'fk_state_id' => $res['state_id']); - $cities = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,CITY); + // $fields = array('city_id','name as city_name'); + // $where_condition_array = array('isactive' => 1,'fk_state_id' => $res['state_id']); + // $cities = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,CITY); //array_push($result_data[$key],$cities); + $cities = $this->db->DISTINCT()->SELECT('city_id,name as city_name')->FROM(CITY)->WHERE('fk_state_id',$res['state_id'])->OR_WHERE('fk_state_id is null')->ORDER_BY('fk_state_id,city_name')->GET()->result_array(); $result_data[$key]['cities'] = $cities; + //print_r($this->db->last_query()); // $fields = array('pincode_id','pincode'); // $where_condition_array = array('isactive' => 1,'fk_state_id' => $stateid); @@ -645,8 +647,8 @@ class PD_Controller extends REST_Controller { $OTP = substr($string2,0,6); $msg = "Code for starting your personal discussions with the verification officer is ".$OTP .". Pls share this only when the officer has reached your place in person"; $no = (string)$pd_details['mobile_no']; - unset($pd_details['mobile_no']); - $pd_details['OTP'] = $OTP; + unset($pd_details['mobile_no']); + $pd_details['OTP'] = $OTP; $this->aws_sns->sendSMS($msg,$no); } @@ -726,7 +728,7 @@ class PD_Controller extends REST_Controller { - $dataToBot = array('Task Name'=>'PD Template Assign','Template Catagory'=>'GENERIC TEMPLATE ID - '.$pd_details['pd_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster'); + $dataToBot = array('Task Name'=>'PD Template Assign','Template Catagory'=>'GENERIC TEMPLATE ID - '.$pd_details['fk_pd_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster'); MYHTTPCLIENT::sendPOST($dataToBot); @@ -2280,7 +2282,11 @@ class PD_Controller extends REST_Controller { $processed_json = GETPROCESSEDJSON::convertNeighbourDetailsForm($records,$formid); break; case 20: - $processed_json = $processed_json = GETPROCESSEDJSON::convertFinalRemarksForm($records,$formid); + $processed_json = GETPROCESSEDJSON::convertFinalRemarksForm($records,$formid); + break; + + case 21: + $processed_json = GETPROCESSEDJSON::convertBankingInfoDetailsForm($records,$formid); break; case 22: @@ -2300,10 +2306,13 @@ class PD_Controller extends REST_Controller { unset($records['fk_createdby']); unset($records['company_id']); $records = json_encode($records); + if($processed_json != null) + { + $processed_json = json_encode($processed_json); + } - - $temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => json_encode($processed_json)); + $temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => $processed_json); $id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILSJSON); if($id != "" || $id != null) { @@ -3354,57 +3363,31 @@ class PD_Controller extends REST_Controller { $is_regenerate = 1; } - $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); + $data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid); + $data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid); + $data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid); + //$data['score'] = $this->calculateScore($pdid); + //GET ALL PROCESSED JSON + for($i = 1;$i<=25;$i++) + { + $fields = array('processed_json'); + $where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i); + $data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC'); + } - //Get PD Report orginal blob - $fields = array('report_template_id', 'fk_template_id','content'); - $where_condition_array = array('fk_template_id'=>$pd_master_details[0]['fk_pd_template_id'],'isactive'=>1); - $result_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,REPORTTEMPLATES); - $original_template = $result_array[0]['content']; - // //CHeck if already pd original version created - - if(count($result_array)) - { - preg_match_all("/{{(.*?)}}/",$result_array[0]['content'],$keys_from_template); - //print_r($keys_from_template); - $pd_form_raw_data = $this->PD_Model->getPDFormDetails($pdid); - //print_r($pd_form_raw_data); - foreach($keys_from_template[1] as $key_from_template => $template_key) - { - - foreach($pd_form_raw_data as $pd_form_raw_data_key => $pd_form_raw) - - { - if($temp_key = array_search($template_key,$pd_form_raw)) - - { - //echo $pd_form_raw_data[$pd_form_raw_data_key]['column_value'].'---'.$pd_form_raw_data[$pd_form_raw_data_key]['column_name']; - //echo "\n\n"; - $result_array[0]['content'] = str_replace($keys_from_template[0][$key_from_template],$pd_form_raw_data[$pd_form_raw_data_key]['column_value'],$result_array[0]['content']); - - } - } - } - } + $temp = $this->load->view('report_templates/JSONTOREPORT',$data,true); + //PDF Gen using DOM PDF + $pdf_doc = $this->pdfgenerator->generate($temp, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); + //End of PDF Gen using DOM PDF + $output_file2 = APPPATH."/docs/sample.pdf"; + $bytes = file_put_contents($output_file2, $pdf_doc); - $output_file = APPPATH."/docs/temp.html"; - $ifp = fopen( $output_file, 'wb' ); - //fwrite( $ifp, $original_template ); - fwrite( $ifp, $result_array[0]['content'] ); - fclose( $ifp ); - //print_r($output_file); - $file= file_get_contents($output_file); - $pdf_doc = $this->pdfgenerator->generate($file, $filename='original_version', $stream=false, $paper = 'A4', $orientation = "portrait"); - //print_r($pdf_doc); - - - $output_file2 = APPPATH."/docs/sample.pdf"; if(file_put_contents($output_file2, $pdf_doc)) { - $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; - $main_applicant_name = $pd_master_details[0]['main_applicant']; + $bucketname = LENDER_BUCKET_NAME_PREFIX.$data['pd_master_details'][0]['fk_lender_id']; + $main_applicant_name = $data['pd_master_details'][0]['main_applicant']; $key = ""; if($is_regenerate == 0) { @@ -3412,31 +3395,35 @@ class PD_Controller extends REST_Controller { } else { - $latest_version = $pd_master_details[0]['pd_report_latest_version'] + 1; + $latest_version = $data['pd_master_details'][0]['pd_report_latest_version'] + 1; $key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'.version'.$latest_version.'.pdf'; } $sourcefile = $output_file2; - + // print_r($sourcefile); + // die(); $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile); $s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data); //print_r($s3result); if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) { - + //$result_array[0]['content'] $where_condition_array = array("pd_id" => $pdid); - $temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>$result_array[0]['content'],'pd_report_latest_version' => 0); + $temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>null,'pd_report_latest_version' => 0); if($is_regenerate != 0) { - $temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>$result_array[0]['content'],'pd_report_latest_version'=>$pd_master_details[0]['pd_report_latest_version'] + 1); + //$result_array[0]['content'] + $temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>null,'pd_report_latest_version'=>$data['pd_master_details'][0]['pd_report_latest_version'] + 1); } $id = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array); $latest_version = 0; - if($is_regenerate != 0){ $latest_version = $pd_master_details[0]['pd_report_latest_version'] + 1; } - $blob_table_temp_array = array('version_no' => $latest_version,'content' => $result_array[0]['content'],'fk_pd_id' => $pdid,'fk_createdby' => $fk_createdby); + if($is_regenerate != 0){ $latest_version = $data['pd_master_details'][0]['pd_report_latest_version'] + 1; } + + //$result_array[0]['content'] + $blob_table_temp_array = array('version_no' => $latest_version,'content' => null,'fk_pd_id' => $pdid,'fk_createdby' => $fk_createdby); $id = $this->PD_Model->saveRecords($blob_table_temp_array,PDREPORTSVERSIONBLOB); @@ -4114,7 +4101,8 @@ class PD_Controller extends REST_Controller { $records = $this->post('records'); $pdid = $records['pd_id']; $fk_createdby = $records['fk_createdby']; - + // $this->calculateScore($pdid); + // die(); $is_regenerate = 0; if(isset($records['regenerate'])) { @@ -4136,13 +4124,13 @@ class PD_Controller extends REST_Controller { // } $data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC'); } - print_r($data['pd_processed_forms']);die(); + //print_r($data['pd_processed_forms']);die(); // print_r(json_decode($data['pd_processed_forms'][13][0]['processed_json'],true)); // echo count($data['pd_processed_forms'][1]); // die(); $t = $this->load->view('report_templates/JSONTOREPORT',$data,true); - //print_r($t);die(); + //PDF Gen using DOM PDF $pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF @@ -4275,6 +4263,7 @@ class PD_Controller extends REST_Controller { array('form_id' => 22,'form_name' => 'Business Assets'), array('form_id' => 21,'form_name' => 'Business Banking'), array('form_id' => 14,'form_name' => 'Financial Information'), + array('form_id' => 16,'form_name' => 'Assessed Income'), array('form_id' => 1,'form_name' => 'Supplier Details'), array('form_id' => 2,'form_name' => 'Client Details'), array('form_id' => 11,'form_name' => 'Stock Details'), @@ -4288,6 +4277,7 @@ class PD_Controller extends REST_Controller { array('form_id' => 13,'form_name' => 'About Business'), array('form_id' => 22,'form_name' => 'Business Assets'), array('form_id' => 21,'form_name' => 'Business Banking'), + array('form_id' => 14,'form_name' => 'Financial Information'), array('form_id' => 16,'form_name' => 'Assessed Income'), array('form_id' => 1,'form_name' => 'Supplier Details'), array('form_id' => 2,'form_name' => 'Client Details'), @@ -4627,6 +4617,8 @@ class PD_Controller extends REST_Controller { { foreach($json['business_assets_details'] as $asset_key => $business_asset) { + + //print_r($business_asset); if(!strcmp($business_asset['business_emi'],'yes')) { $business_assets_mode_name = ""; @@ -4651,7 +4643,7 @@ class PD_Controller extends REST_Controller { } } - $business_assest_data[] = array('business_assets_mode'=>$business_asset['business_assets_mode'],'business_assets_mode_name'=>$business_assets_mode_name,'business_details'=>$business_asset['business_details'],'business_name_of_the_owner'=>$business_asset['business_name_of_the_owner']['name']); + $business_assest_data[] = array('business_assets_mode'=>$business_asset['business_assets_mode'],'business_assets_mode_name'=>$business_assets_mode_name,'business_details'=>$business_asset['business_details'],'business_name_of_the_owner'=>$business_asset['business_name_of_the_owner']); } } @@ -5053,4 +5045,325 @@ class PD_Controller extends REST_Controller { return $result; } + public function calculateScore($pdid) + { + //GET JSON FORM DATA + $pd_master_details = $this->PD_Model->getPDMasterDetails($pdid); + //print_r($pd_master_details); + $form_data = $this->PD_Model->getScorablePDFormDetailsJSON($pdid); + //print_r($form_data); + + + //seperate PD Scorable quesitons from JSON + $score_questions = $this->seperateScoreQuestions($form_data,$pd_master_details[0]['is_otp_done']); + //Get Pesrsonal Assets Grid Masters Details + $this->db->SELECT('*'); + $this->db->FROM(PERSONALASSETGRID); + $this->db->WHERE('isactive',1); + $this->db->WHERE('loan_amount_from<',$pd_master_details[0]['loan_amount']); + $this->db->WHERE('loan_amount_to>',$pd_master_details[0]['loan_amount']); + $personal_asset_grid['master_grid'] = $this->db->GET()->result_array(); + + $this->db->SELECT('*'); + $this->db->FROM(PERSONALASSETGRIDVARIANCE); + $this->db->WHERE('isactive',1); + $personal_asset_grid['variance_grid'] = $this->db->GET()->result_array(); + + + + // Call PD score functions + $combination = $pd_master_details[0]['fk_lender_id'].$pd_master_details[0]['fk_product_id'].$pd_master_details[0]['fk_customer_segment']; + + switch($combination) + { + case 1111: + PDSCORE::calculatePDScore111($score_questions,$pd_master_details,$personal_asset_grid); + break; + + default: + switch($pd_master_details[0]['fk_customer_segment']) + { + case 1: + PDSCORE::genericDI($score_questions,$pd_master_details,$personal_asset_grid); + break; + } + } + + + + + } + + + //Get All Scorable Question from various PD Forms - 3 Questions Pending + public function seperateScoreQuestions($form_data,$OTP) + { + $score_questions = array(); + + #####General Form Questions######## + $general_form = (json_decode($form_data[18][0]['processed_json'],true)); + //print_r($form_data); + + // - QNO (1.7) OTP AUTHENDICATION DONE + + $score_questions['general']['otp_done'] = $OTP ? 'Yes': 'No'; + // 1 - QNO(1.1) - Is Person Met, One Of the Applicant's + $qualification_temp_array = array(); + foreach($general_form['individuals'] as $person) + { + array_merge($qualification_temp_array,array($person['qualification'])); + if($person['is_applicant'] == true && $person['is_person_met'] == true) + { + $score_questions['general']['person_met_is_applicant'] = 'yes'; + } + + } + $min = count($qualification_temp_array) ? min($qualification_temp_array) : 6; + + // 2 - QNO(1.8) - Qualification + $score_questions['general']['qualification'] = $min; + + // 3 - QNO(2.1) - No of Years Business Run + if(array_key_exists('companies',$general_form)) + { + $score_questions['business']['no_of_years_business_run'] = $general_form['companies'][0]['business_years']; + } + #####End of General Form Questions######## + + + #####Address Form Questions######## + $address_form = (json_decode($form_data[5][0]['processed_json'],true)); + + // 4 - QNO(1.2) - Comment on locality + $score_questions['general']['comment_locality'] = $address_form['comment_locality_master']; + // 5 - QNO(1.3) - pd location approach + $score_questions['general']['pd_location_approach'] = $address_form['pd_location_master']; + + + #####ENd Of Address Form Questions######## + + + #####Final Remarks Form Questions######## + $final_remarks_form = (json_decode($form_data[20][0]['processed_json'],true)); + //print_r($final_remarks_form); + // 6 - QNO(1.4) - customer behaviour + $score_questions['general']['customer_behaviour'] = $final_remarks_form['final_custormer_remark_type_master']; + + // 7 - QNO(3.1) - pd_officer_recommadations + $score_questions['final_remarks']['pd_officer_recommandations'] = $final_remarks_form['pd_officers_recommendation_master']; + // 8 - QNO(2.11) - pd location approach + $score_questions['business']['location_suited_for_busienss'] = $final_remarks_form['is_service_provided']; + + #####End of Final Remarks Form Questions######## + + + #####Neighbourhood Form Questions######## + $neighbourhood_form = (json_decode($form_data[19][0]['processed_json'],true)); + //print_r($neighbourhood_form); + + // 9 - QNO(1.5) - neibourhood_check_as_per_pd_officer + $score_questions['general']['neibourhood_check_as_per_pd_officer'] = isset($neighbourhood_form['neighbourhood_status']) ? $neighbourhood_form['neighbourhood_status'] : 'Negative'; + #####End of Neighbourhood Form Questions######## + + + #####Business Form Questions######## + $business_form = (json_decode($form_data[13][0]['processed_json'],true)); + //print_r($business_form); + + // 10 - QNO(1.6) - was_the_company_name_board_sighted + $score_questions['general']['was_the_company_name_board_sighted'] = isset($business_form['was_the_company_name_board_sighted']) ? $business_form['was_the_company_name_board_sighted'] : 'No'; + + // 11 - QNO(2.2) - seasonality + $score_questions['business']['business_seasonality'] = $business_form['seasonality']; + + // 12 - QNO(2.3) - employees_total + $score_questions['business']['employees_total'] = $business_form['employees_total']; + + + // 13 - QNO(2.4) - all business certificate + $temp = array(); + $temp['shop_eat_act_cert'] = $business_form['shop_eat_act_cert']; + $temp['gst_Regn_cert'] = $business_form['gst_Regn_cert']; + $temp['pf_regn'] = $business_form['pf_regn']; + $temp['esic_regn'] = $business_form['esic_regn']; + $temp['export_import_cert'] = $business_form['export_import_cert']; + $temp['factory_cert'] = $business_form['factory_cert']; + $temp['cert_of_practice'] = isset($business_form['cert_of_practice']) ? $business_form['cert_of_practice']: 'not applicable'; + $score_questions['business']['cerificates'] = $temp; + #####End of Business Form Questions######## + + + #####Business Assets Form Questions######## + $business_assest_form = (json_decode($form_data[22][1]['processed_json'],true)); + //print_r($business_assest_form);die(); + if(array_key_exists('business_assets_details',$business_assest_form)) + { + $property_count = 0; + $vechile_count = 0; + foreach($business_assest_form['business_assets_details'] as $value) + { + if($value['business_assets_mode'] == 2) + { + $property_count++; + } + if($value['business_assets_mode'] == 3) + { + $vechile_count++; + } + } + + // 14 - QNO(2.5) - owned_property + $score_questions['business']['owned_property'] = $property_count ? 'yes':'no'; + // 15 - QNO(2.6) - owned_vechile + $score_questions['business']['owned_vechile'] = $vechile_count ? 'yes':'no'; + // - QNO (2.12) - business_activity seen + $score_questions['business']['business_activity_has_seen'] = $business_assest_form['business_activity']; + } + #####End of Business Assets Form Questions######## + + + #####supplier Form Questions######## + $supplier_form = (json_decode($form_data[1][0]['processed_json'],true)); + //print_r($supplier_form); + if(count($supplier_form)) + { + + $supplier_count = 0; + if(array_key_exists('manufacturing_details',$supplier_form)) + { + foreach($supplier_form['manufacturing_details'] as $manufacturing_details) + { + + $supplier_count = count($manufacturing_details['main_raw_materials']) ? ++$supplier_count: $supplier_count; + + } + } + + if(array_key_exists('trade_details',$supplier_form)) + { + foreach($supplier_form['trade_details'] as $trade_details) + { + + $supplier_count = count($supplier_form['trade_details']) ? ++$supplier_count: $supplier_count; + + } + } + + // 16 - QNO(2.7) - atleast one supplier + $score_questions['business']['minimum_supplier_info'] = $supplier_count ? 'Provided':'Not Provided'; + } + else + { + $score_questions['business']['minimum_supplier_info'] = 'Not Applicable'; + } + #####End of supplier Form Questions######## + + + #####client Form Questions######## + $client_form = (json_decode($form_data[2][0]['processed_json'],true)); + //print_r($client_form);die(); + if(count($client_form)) + { + + $client_count = 0; + if(array_key_exists('manufacturing_details',$client_form)) + { + foreach($client_form['manufacturing_details'] as $manufacturing_details) + { + + $client_count = count($manufacturing_details['main_raw_materials']) ? ++$client_count: $client_count; + + } + } + + if(array_key_exists('trade_details',$client_form)) + { + foreach($client_form['trade_details'] as $trade_details) + { + + $client_count = count($client_form['trade_details']) ? ++$client_count: $client_count; + + } + } + + if(array_key_exists('service_provider_details',$client_form)) + { + foreach($client_form['service_provider_details'] as $service_provider_details) + { + + $client_count = count($client_form['service_provider_details']) ? ++$client_count: $client_count; + + } + } + + // 17 - QNO(2.8) - atleast one client + $score_questions['business']['minimum_client_info'] = $client_count ? 'Provided':'Not Provided'; + } + else + { + $score_questions['business']['minimum_client_info'] = 'Not Applicable'; + } + #####End of client Form Questions######## + + #####Stock Form Questions######## + $stock_form = (json_decode($form_data[11][0]['processed_json'],true)); + //print_r($stock_form); + if(count($stock_form)) + { + //print_r($stock_form);die(); + $score_questions['business']['stock_raw_material_enough'] = isset($stock_form['manufacturing_raw_materials']['is_sufficiant_raw']) ? $stock_form['manufacturing_raw_materials']['is_sufficiant_raw']: 'no'; + $score_questions['business']['stock_finished_goods_enough'] = isset($stock_form['is_sufficiant_finished_and_traded_goods']) ? $stock_form['is_sufficiant_finished_and_traded_goods'] : 'no'; + } + else + { + $score_questions['general']['value_of_other_assets'] = 'Not Applicable'; + } + #####End of Stock Form Questions######## + + + #####Other Assest Form Questions######## + $other_asset_form = (json_decode($form_data[4][0]['processed_json'],true)); + //print_r($other_asset_form); + + $over_all_asset_value = 0; + if(array_key_exists('assets_details',$other_asset_form)) + { + foreach($other_asset_form['assets_details'] as $asset) + { + $over_all_asset_value += $asset['approximate_market_value'] ; + + } + } + + // 18 Q.NO(1.9) + $score_questions['general']['value_of_other_assets'] = $over_all_asset_value; + + + #####End of Other Assest Form Questions######## + + ######Business Banking ############## + $business_bank_form = (json_decode($form_data[21][0]['processed_json'],true)); + //print_r($business_bank_form); + + $vintage = array(); + if(array_key_exists('banking_details',$business_bank_form)) + { + foreach($business_bank_form['banking_details'] as $banking) + { + $year = $banking['vintage_year'] ? $banking['vintage_year'] : 0 ; + $month = $banking['vintage_month'] ? $banking['vintage_month'] : 0; + $temp = $year.'.'.$month; + $vintage = array_merge($vintage,array($temp)); + } + } + + + $score_questions['business']['vintage_of_business_account'] = count($vintage)? max($vintage) : 0; + ######End of Business Banking ############## + return $score_questions; + + + } + + } \ No newline at end of file diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index e5d991a6af0f3c4a0dee452691aec173e101b36a..a2286ab30ff79c7b724be73063286c4d02872798 100644 GIT binary patch delta 18792 zcmajH1z1$u_dX5?5(3iQ-3&9sFf`IB-QCh4k^+OYbV+xKbfzs9Vyz8v}?!8w_Fk)pPN^B_%2%!Pcs9}HrzfRy^C+J@%F!0yu zmkRGM72aPeyuVZ+zf>T)4evjO zfdCrbe+&b8Xn6lI3T%*l#wPDNMNRO4 zj~M|9rL4FYf;_3255~m@--o)Gt}%G>oMteo;o z$ft=qx~FyNju%sUWt-d^GwWF8ZrZ$1cH7mTA2Kp4aY ze<)VZ?k8GOHPx2zQ&?(@=v^e@nG?k#TaKjZ+|z?^a;xRbQ9gzC0*O&HNNertUUg3) z=osVcUmMlm;|qnsx*4R`taaqskU{w%FZgzP-z6@?lVjz3f7U-;LGy5V4$FKb8 zA+MyN&Sn%_w2V&G#I_?~*II~+HnmL4PiD>2=Xt2=pk4RUvE_!taivg4@OI9G+s;ev zu!9P0;SO5rZfYv^H)MX2UhG~A#EvIPo-F~ZVLdcw?RO}*%2xZevJYADVGw?v-%wJo zx%6}kfaCj3dxTz=eeUW0@@f--`$w)9OR_>H1gX=BVPN#97~9`c!G(#l`*|~YveBUL z8L9jtKTcV46T3e@D{3>`+Nm2@M`y|CBJAXS%G5NpWGMBTyMeeS79fN0HXuyQA4epY z3xy98ZJ-hM5pYP^zy6#Kr}tcVlSWqP)g3zOXB>?0oSieP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;y?b^oI4CVl+R8~ zN8$H8JF<;f;yTqG({B&Rr<|od`%nh~wB^}`>1eGq4VId60E3WW<#FrsxkjuN#jp2| zv4i;r+9i7`qQOR)VS7mi&NXiJ_R;oRm#tE&uj%}K{49wEp9fg)2h$0SFNhBRnr=16s=M#>6jEtk^`#tJtoRN4bEldtu$fk zTKd#ww*`k2HBSybdTnli%5W4)1T(f{3(0wm0eqx0+4pK6pP)s9jXgsm&@ zNhA5$t4cRB_wFeL%p&u+%U?((SVo||q37jKv2x#DR1zCBy|4Jcq1q3`_brMWHqX9& z5Rjl_sHd1yJ#b>qUF_R%Svh5Fk9=QzrAfy3fk1IQx?fB=V!;oM6CIZ85MtJEDkj=E~zf6O-Im^}(u@%?aH=`u=97aCX-s1C(ciV5&^9kH3+P1llVwMDqot9>8Y=gX?4qE5%2anJQ%N$Hsz@M6E~h-SBa{4?zgT^a_9*`;Bz_}?`EgV^N*u*h9J0Ehay zmicR80FQzH4n)9zJbk}y5CI_mhlbl#7=b|T){t=IFT5Z1e*_u@-(|!gG1y;>KYbV! z7V*1=#R0!}2f*>b?^6W;+^%T>0G^3M{RRXONYpMM8io1==;K9oaiw{Ibag>mB$sP6 zC;|i0vh?uqfdWuC)Domcbfp mM&YR!_5P3LKMs4)&o4UF%g4`)Mh5{H6dVsyRW&j@3HlcYHYTM2 diff --git a/api/application/helpers/assetsform_helper.php b/api/application/helpers/assetsform_helper.php new file mode 100644 index 00000000..13671e87 --- /dev/null +++ b/api/application/helpers/assetsform_helper.php @@ -0,0 +1,191 @@ + \ No newline at end of file diff --git a/api/application/helpers/bankingform_helper.php b/api/application/helpers/bankingform_helper.php new file mode 100644 index 00000000..0f8377b8 --- /dev/null +++ b/api/application/helpers/bankingform_helper.php @@ -0,0 +1,49 @@ +0){ + $values = array_map(function($tag) { + $count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :""; + $count_vintage .= ($tag['vintage_year'] == 1) ? " Year" : (($tag['vintage_year'] > 1) ? " Years" : ""); + $count_vintage.=' '; + $count_vintage .=$tag['vintage_month'] >0 ? $tag['vintage_month'] : ""; + $count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : ""); + return array( + 'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : $tag['applicant_name']['name'], + 'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name'], + 'account_type' => $tag['account_type'], + 'main_business' => $tag['salary'], + 'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : ''), + 'vintage' => $count_vintage, + ); + }, $values); + } + return $values; +} + +// get individual banking +public static function getIndividualBankingDetails($values){ + if(count($values)>0){ + $values = array_map(function($tag) { + $count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :""; + $count_vintage .= ($tag['vintage_year'] == 1) ? " Year" : (($tag['vintage_year'] > 1) ? " Years" : ""); + $count_vintage.=' '; + $count_vintage .=$tag['vintage_month'] >0 ? $tag['vintage_month'] : ""; + $count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : ""); + return array( + 'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : $tag['applicant_name']['name'], + 'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name'], + 'account_type' => $tag['account_type'], + 'main_business' => $tag['salary'], + 'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : ''), + 'vintage' => $count_vintage, + ); + }, $values); + } + return $values; +} +} +?> \ No newline at end of file diff --git a/api/application/helpers/businessform_helper.php b/api/application/helpers/businessform_helper.php new file mode 100644 index 00000000..27c76d4c --- /dev/null +++ b/api/application/helpers/businessform_helper.php @@ -0,0 +1,426 @@ +0 ? $tag['current_business_experiance_year'] :""; + $con_business_run .= ($tag['current_business_experiance_year'] == 1) ? "Year" : (($tag['current_business_experiance_year'] > 1) ? "Years" : ""); + $con_business_run.=' '; + $con_business_run .=$tag['current_business_experiance_month'] >0 ? $tag['current_business_experiance_month'] : ""; + $con_business_run .=($tag['current_business_experiance_month'] == 1) ? "Month" : (($tag['current_business_experiance_month'] > 1) ? "Months" : ""); + return array( + 'name' => array_key_exists('partner_other_name',$tag) ? $tag['partner_other_name'] : $tag['partner_name_master'], + 'share_holding' => $tag['shareholding'].'%', + 'no_years_business' => $con_business_run, + 'total_experience' => $tag['total_business_experiance'], + 'previous_experience' => array_key_exists('total_business_previous_experience',$tag) ? $tag['total_business_previous_experience'] : '', + + ); + }, $values); + + } + return $getPartner; +} +//get family members details +public static function getFamilyMemberDetails($values){ + $getFamilyMembers=array(); + foreach($values as $parRow){ + $getFamilyMembers = array_map(function($tag) { + return array( + 'name' => $tag['family_member_salutation_master'].' '.$tag['family_member_name'], + 'relation' => $tag['other_family_relationship_id_master'] .' of '.$tag['relation_to_id_master'], + 'designation' => $tag['relationship_with_company_id_master'], + 'started_business' => $tag['started_business'], + + ); + }, $values); +} +return $getFamilyMembers; +} +// get business activity details +public static function getActivityDetails($values,$type){ + $getRow=array(); + if($type==1 || $type==2 || $type==3){ + foreach($values as $busManuRowkey=>$busManuRow){ + $getEachProducts=array(); + $getEachProducts['products']=$busManuRow['main_products']; + $getEachProducts['area_of_sale']=$busManuRow['area_of_sale']; + + // check area of sales + $mergeStatesCities=''; + if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='NO'){ + // states + foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){ + $mergeStatesCities=$mergeStatesCities; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ","); + foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){ + $mergeStatesCities = $mergeStatesCities; + $mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ","); + $mergeStatesCities .=$childCityRow; + } + $mergeStatesCities .=' of '; + $mergeStatesCities .=$childRow['state_name']; + $mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : ""); + } + $getEachProducts['sales_done']=$mergeStatesCities; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ","); + foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + //$mergeMaxStatesCities .=' of '; + //$mergeMaxStatesCities .=$childMRow['state_name']; + //$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : ""); + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + // area of sales with yes options + else if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='YES'){ + // pan india + $getEachProducts['sales_done']='Pan India.'; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + if(!empty($childMRow['state_name'])){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + + } + + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + // check area of sale export + else if(strtoupper($busManuRow['area_of_sale'])=='EXPORT'){ + $mergeMaxStatesCities=''; + // countries_where_export_done + foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){ + $mergeStatesCities=$mergeStatesCities; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ","); + + $mergeStatesCities .=' '.$childRow['approx_sale']; + $mergeStatesCities .='% sales done in '; + $mergeStatesCities .=$childRow['country_name']; + //$mergeStatesCities .= ($chilKey==count($busManuRow['countries_where_export_done'])-1 ? "." : ""); + } + $mergeStatesCities.='.'; + $getEachProducts['sales_done']=$mergeStatesCities; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + // check area of sale both + else if(strtoupper($busManuRow['area_of_sale'])=='BOTH'){ + //print_r($busManuRow);die(); + if(strtoupper($busManuRow['pan_india_options'])=='NO'){ + // states + foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){ + $mergeStatesCities=$mergeStatesCities; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ","); + foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){ + $mergeStatesCities = $mergeStatesCities; + $mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ","); + $mergeStatesCities .=$childCityRow; + } + $mergeStatesCities .=' of '; + $mergeStatesCities .=$childRow['state_name']; + $mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : ""); + } + $getEachProducts['sales_done']=$mergeStatesCities; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ","); + foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + //$mergeMaxStatesCities .=' of '; + //$mergeMaxStatesCities .=$childMRow['state_name']; + //$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : ""); + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + else if(strtoupper($busManuRow['pan_india_options'])=='YES'){ + // pan india + $getEachProducts['sales_done']='Pan India.'; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + if(!empty($childMRow['state_name'])){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + + } + + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + else{ + $getEachProducts['sales_done']=""; + $getEachProducts['max_sales_done']=""; + } + // countries_where_export_done + if(array_key_exists('countries_where_export_done',$busManuRow)){ + $mergeBothStates=''; + foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){ + $mergeBothStates=$mergeBothStates; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ","); + + $mergeBothStates .=' '.$childRow['approx_sale']; + $mergeBothStates .='% sales done in '; + $mergeBothStates .=$childRow['country_name']; + } + $mergeBothStates.='.'; + $getEachProducts['both_sales_done']=$mergeBothStates; + } + + } + array_push($getRow,$getEachProducts); + + } + } + else if($type==4) { + foreach($values as $busManuRowkey=>$busManuRow){ + $getEachProducts=array(); + $getEachProducts['products']=$busManuRow['main_products']; + $getEachProducts['area_of_sale']=$busManuRow['area_of_sale']; + + // check area of sales + $mergeStatesCities=''; + if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='NO'){ + // states + foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){ + $mergeStatesCities=$mergeStatesCities; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ","); + foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){ + $mergeStatesCities = $mergeStatesCities; + $mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ","); + $mergeStatesCities .=$childCityRow; + } + $mergeStatesCities .=' of '; + $mergeStatesCities .=$childRow['state_name']; + $mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : ""); + } + $getEachProducts['sales_done']=$mergeStatesCities; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ","); + foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + //$mergeMaxStatesCities .=' of '; + //$mergeMaxStatesCities .=$childMRow['state_name']; + //$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : ""); + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + // area of sales with yes options + else if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='YES'){ + // pan india + $getEachProducts['sales_done']='Pan India.'; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + if(!empty($childMRow['state_name'])){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + + } + + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + // check area of sale export + else if(strtoupper($busManuRow['area_of_sale'])=='EXPORT'){ + $mergeMaxStatesCities=''; + // countries_where_export_done + foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){ + $mergeStatesCities=$mergeStatesCities; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ","); + + $mergeStatesCities .=' '.$childRow['approx_sale']; + $mergeStatesCities .='% revenue from '; + $mergeStatesCities .=$childRow['country_name']; + //$mergeStatesCities .= ($chilKey==count($busManuRow['countries_where_export_done'])-1 ? "." : ""); + } + $mergeStatesCities.='.'; + $getEachProducts['sales_done']=$mergeStatesCities; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + // check area of sale both + else if(strtoupper($busManuRow['area_of_sale'])=='BOTH'){ + //print_r($busManuRow);die(); + if(strtoupper($busManuRow['pan_india_options'])=='NO'){ + // states + foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){ + $mergeStatesCities=$mergeStatesCities; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ","); + foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){ + $mergeStatesCities = $mergeStatesCities; + $mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ","); + $mergeStatesCities .=$childCityRow; + } + $mergeStatesCities .=' of '; + $mergeStatesCities .=$childRow['state_name']; + $mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : ""); + } + $getEachProducts['sales_done']=$mergeStatesCities; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ","); + foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + //$mergeMaxStatesCities .=' of '; + //$mergeMaxStatesCities .=$childMRow['state_name']; + //$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : ""); + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + else if(strtoupper($busManuRow['pan_india_options'])=='YES'){ + // pan india + $getEachProducts['sales_done']='Pan India.'; + // max sales done + $mergeMaxStatesCities=''; + foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){ + if(!empty($childMRow['state_name'])){ + $mergeMaxStatesCities=$mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){ + $mergeMaxStatesCities = $mergeMaxStatesCities; + $mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ","); + $mergeMaxStatesCities .=$childMCityRow; + } + + } + + } + $mergeMaxStatesCities.='.'; + $getEachProducts['max_sales_done']=$mergeMaxStatesCities; + } + else{ + $getEachProducts['sales_done']=""; + $getEachProducts['max_sales_done']=""; + } + // countries_where_export_done + if(array_key_exists('countries_where_export_done',$busManuRow)){ + $mergeBothStates=''; + foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){ + $mergeBothStates=$mergeBothStates; + $mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ","); + + $mergeBothStates .=' '.$childRow['approx_sale']; + $mergeBothStates .='% revenue from '; + $mergeBothStates .=$childRow['country_name']; + } + $mergeBothStates.='.'; + $getEachProducts['both_sales_done']=$mergeBothStates; + } + + } + array_push($getRow,$getEachProducts); + + } + } + else if($type==5){ + foreach($values as $busManuRowkey=>$busManuRow){ + $getEachProducts=array(); + $getEachProducts['products']=$busManuRow['others_details']; + array_push($getRow,$getEachProducts); + + } + } + return $getRow; +} + +// get business peak period details +public static function getBusinessPeakDetails($details){ + $getRow='The Business has major changes,'; + $getRow.= count($details) >1 ?' the periods of ' :' the period of '; + foreach($details as $key=>$value){ + $getRow=$getRow; + $getRow .= ($key==0) ? "":($key==count($details)-1 ? ' and ' : ","); + switch($value) { + case 1: + $getRow .='February'; + break; + case 2: + $getRow .='January'; + break; + case 3: + $getRow .='March'; + break; + case 4: + $getRow .='April'; + break; + case 5: + $getRow .='May'; + break; + case 6: + $getRow .='June'; + break; + case 7: + $getRow .='July'; + break; + case 8: + $getRow .='August'; + break; + case 9: + $getRow .='September'; + break; + case 10: + $getRow .='October'; + break; + case 11: + $getRow .='November'; + break; + case 12: + $getRow .='December'; + break; + } + } + $getRow .=' maximum sales/services done.'; + return $getRow; + } +} +?> \ No newline at end of file diff --git a/api/application/helpers/financialform_helper.php b/api/application/helpers/financialform_helper.php new file mode 100644 index 00000000..4189a54d --- /dev/null +++ b/api/application/helpers/financialform_helper.php @@ -0,0 +1,113 @@ + $tag['loan_type']==1 ? $tag['others_loan_type'] : $tag['loan_type_master'], + 'loan_amount' => $tag['loan_amount'], + 'frequency' => $tag['frequency']==1 ? $tag['other_frequency'] : $tag['frequency_master'], + 'lender' => $tag['lender']==1 ? $tag['others_lender'] : $tag['lender_master'], + 'original_tenure' => $tag['original_tenure'], + 'current_balance_tenure' => $tag['current_balance_tenure'], + 'elapsed_tenure' => $tag['elapsed_tenure'], + 'emi' => $tag['emi'].$setFrequencyType, + 'loan_taken_by' => $loanTaken['id']==0 ? $tag['others_loan_taken'] : $loanTaken['name'], + ); + }, $values); + return $values; +} + +// business financial details +public static function getBusinessFinancialDetails($values){ + $values = array_map(function($tag) { + return array( + 'financial_year' => $tag['financial_year'], + 'financial_annual_sale' => 'Rs.'.$tag['financial_annual_sale'], + 'financial_net_profit' => $tag['finanical_profit_or_loss']==1 ? 'Rs.'.$tag['financial_net_profit'] : '', + 'financial_margin_of_profit' => $tag['finanical_profit_or_loss']==1 ? $tag['financial_margin_of_profit'] : '', + 'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? 'Rs.'.$tag['financial_net_loss'] : '', + 'financial_margin_of_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_margin_of_loss'] : '', + 'profit_variation' => $tag['financial_variation'], + 'sale_variation' => $tag['financial_profit_to_sale_variation'], + ); + }, $values); + return $values; +} +// get customer financial +public static function getBusinessCustomerFinancialDetails($values) { + $values = array_map(function($tag) { + if($tag['estimate_profit_or_loss']==1){ + return array( + 'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'], + 'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'], + 'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')', + 'estimate_sales_to' => 'Rs.'.$tag['estimate_sales_to'], + 'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'], + 'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_profit_margin'] : 'Rs.'.$tag['estimate_net_profit'], + 'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_profit_from'].', Rs.'.$tag['estimate_net_profit_to'].')' : '', + 'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_profit_percent'] : $tag['estimate_profit_margin_percent'], + 'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '( '.$tag['estimate_profit_range_from'].', '.$tag['estimate_profit_range_to'].')', + ); + } + else if($tag['estimate_profit_or_loss']==2){ + return array( + 'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'], + 'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'], + 'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')', + 'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'], + 'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_net_loss'] : 'Rs.'.$tag['estimate_loss_margin'], + 'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_loss_from'].', Rs.'.$tag['estimate_net_loss_to'].')' : '', + 'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_loss_percent'] : $tag['estimate_loss_margin_percent'], + 'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '('.$tag['estimate_loss_range_from'].', '.$tag['estimate_loss_range_to'].')', + ); + } + + }, $values); + return $values; +} + +// get customer header +public static function getBusinessCustomerHeader($values){ + if(count($values)>0 && $values[0]['estimate_profit_or_loss']==1){ + return array("Sales","Net Profit","Net Margin %"); + } + else if(count($values)>0 && $values[0]['estimate_profit_or_loss']==2){ + return array("Sales","Net Loss","Net Margin %"); + } + else { + return array(); + } +} +} +?> \ No newline at end of file diff --git a/api/application/helpers/getprocessedjson_helper.php b/api/application/helpers/getprocessedjson_helper.php index 6854128c..e8a8ee91 100644 --- a/api/application/helpers/getprocessedjson_helper.php +++ b/api/application/helpers/getprocessedjson_helper.php @@ -1857,6 +1857,8 @@ class GETPROCESSEDJSON /*****************########## FINAL REMARKS FORM DETAILS ##########**************/ public static function convertFinalRemarksForm($raw_json,$formid) { + + echo "FEPJ called"; $CI =& get_instance(); $master_tables_field_names = $CI->config->item('master_tables_field_names'); $master_tables_pkid = $CI->config->item('master_tables_pkid'); diff --git a/api/application/helpers/myuitil_helper.php b/api/application/helpers/myuitil_helper.php index 0f712d9a..7a76aa68 100644 --- a/api/application/helpers/myuitil_helper.php +++ b/api/application/helpers/myuitil_helper.php @@ -56,17 +56,37 @@ class MYUITIL } - public static function findCompanyName($array,$companyid) + public static function findCompanyName($array,$companyid,$type) { - if($array != null) + if($array != null && $type==1) { foreach($array as $key => $value) { + if($companyid == $value['company_order_id']) { return $value['company_name']; } - + } + } + if($array != null && $type==2) + { + foreach($array as $key => $value) + { + //print_r($value);die(); + // echo date("d-m-Y", strtotime($value['business_date_object']) ); + // die(); + if($companyid == $value['company_order_id']) + { + $getSentense = $value['company_name']; + $getSentense .=' is a '; + $getSentense .=$value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master']; + $getSentense .=' ,formed on '; + $getSentense .=$value['business_date_object'] ? date("d-m-Y", strtotime($value['business_date_object'])) : ''; + $getSentense .='.'; + return $getSentense; + //return $value['company_name'].' is a '.$value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master'] .' formed on '.date("d-m-Y", strtotime($value['business_date_object'])); + } } } else diff --git a/api/application/helpers/neighbourreferencecheckform_helper.php b/api/application/helpers/neighbourreferencecheckform_helper.php new file mode 100644 index 00000000..0c9131cc --- /dev/null +++ b/api/application/helpers/neighbourreferencecheckform_helper.php @@ -0,0 +1,78 @@ + 1) ? $tag['how_long_do_know_in_year']." years" : ""); + $makeSentense.=' and he/she is '; + $makeSentense.=(strtoupper($tag['is_applicant_owner']) == 'YES') ? "owner of the business." : ((strtoupper($tag['is_applicant_owner']) == 'NO') ? "not owner of the business." : ""); + } + else if(strtoupper($tag['do_know'])=='NO'){ + $makeSentense.="does not know ".$applicantName.'.'; + } + return $makeSentense; + }, $values); + return $values; +} +public static function getReferenceDetails($values,$pdMasterValue) { + $applicantName=$pdMasterValue['main_applicant']; + $values = array_map(function($tag) use ($applicantName) { + $makeSentense=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : ""); + $makeSentense.= ' '.$tag['reference_name'].' of SineEdge was contacted over phone at '; + $makeSentense.=$tag['mobile'].'. '; + $makeSentense.='He is related to this business since last '; + $makeSentense.=($tag['year_relation_applicant'] == 1) ? $tag['year_relation_applicant']." year" : (($tag['year_relation_applicant'] > 1) ? $tag['year_relation_applicant']." years" : ""); + $makeSentense.=" is doing a business of Rs.".$tag['business_volume_amount']; + switch($tag['business_volume_unit']) { + case 1: + $makeSentense .= ' per '.$tag['others_unit'].'.'; + break; + case 2: + $makeSentense .= ' per annum.'; + break; + case 3: + $makeSentense .= ' per halfyearly.'; + break; + case 4: + $makeSentense .= ' per fortnightly.'; + break; + case 5: + $makeSentense .= ' per daily.'; + break; + case 6: + $makeSentense .= ' per quarterly.'; + break; + case 7: + $makeSentense .= ' per month.'; + break; + default: + $makeSentense .= '. '; + } + if($tag['reference_final_remarks']==3){ + $makeSentense .=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : ""); + $makeSentense .=' did not provide sufficient information to validate the business credentials.'; + } + else if($tag['reference_final_remarks']==2) { + $makeSentense .=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : ""); + $makeSentense .=' reference check was negative.'; + } + else if($tag['reference_final_remarks']==1) { + $makeSentense .=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : ""); + $makeSentense .=' reference check was positive.'; + } + + return $makeSentense; + }, $values); + return $values; +} + +} +?> \ No newline at end of file diff --git a/api/application/helpers/otherfamilyform_helper.php b/api/application/helpers/otherfamilyform_helper.php new file mode 100644 index 00000000..18825be2 --- /dev/null +++ b/api/application/helpers/otherfamilyform_helper.php @@ -0,0 +1,38 @@ + 1) ? $fetchVal['residence_pin'] : ""); + //$storeValue['residency_address'] .='.'; + $storeValue['residence_No_of_years']=($fetchVal['residence_No_of_years'] == 1) ? $fetchVal['residence_No_of_years'].' year' :(($fetchVal['residence_No_of_years'] > 1) ? $fetchVal['residence_No_of_years'].' years' : ""); + $storeValue['residence_ownership']=($fetchVal['residence_ownership'] == 1) ? $fetchVal['ownershipOther'] :(($fetchVal['residence_ownership'] == 3) ? $fetchVal['residence_ownership_master'].' @ Rs.'.$fetchVal['rent'].' per month' : $fetchVal['residence_ownership_master']); + $storeValue['no_family_members']= count($fetchVal['family_members_details']) > 0 ? count($fetchVal['family_members_details']) : '0'; + $storeValue['family_members_details'] = array_map(function($tag) { + $getFamilyEarning=''; + if($tag['family_member_earning_status']==1){ + $getFamilyEarning= 'Earning '; + $getFamilyEarning .= $tag['earning_segment_master']==1 ? $tag['earning_if_others_segment'].' with '.$tag['earning_name_of_the_employer_or_business'].' since '.$tag['earning_number_of_years_in_employment_or_business'].' years earning Rs.'.$tag['earning_gross_income_per_month'].' per month ' : $tag['earning_segment_master'].' with '.$tag['earning_name_of_the_employer_or_business'].' since '.$tag['earning_number_of_years_in_employment_or_business'].' years earning Rs.'.$tag['earning_gross_income_per_month'].' per month '; + } + else if($tag['family_member_earning_status']==2){ + $getFamilyEarning= 'Non-Earning '.$tag['non_earning_occupation_master']; + } + return array( + 'name' => $tag['family_member_name'], + 'family_member_relationship' => $tag['family_member_relationship_master'], + 'family_member_age' => $tag['family_member_age'], + 'family_member_earning' => $getFamilyEarning, + ); + }, $fetchVal['family_members_details']); + array_push($mergeResult,$storeValue); + } + + return $mergeResult; +} +} +?> \ No newline at end of file diff --git a/api/application/helpers/otherincomeform_helper.php b/api/application/helpers/otherincomeform_helper.php new file mode 100644 index 00000000..b144cd2f --- /dev/null +++ b/api/application/helpers/otherincomeform_helper.php @@ -0,0 +1,16 @@ + $tag['source']==1 ? $tag['others_source'] : $tag['source_master'], + 'amount' => 'Rs.'.$tag['amount'], + 'frequency' => $tag['frequency']==1 ? $tag['others_frequency'] : $tag['frequency_master'], + ); + }, $values); + return $values; +} +} +?> \ No newline at end of file diff --git a/api/application/helpers/pdscore_helper.php b/api/application/helpers/pdscore_helper.php new file mode 100644 index 00000000..10716b0c --- /dev/null +++ b/api/application/helpers/pdscore_helper.php @@ -0,0 +1,445 @@ + 10, 'no' => 0); + $pd_location_approach = array('Very Easy to Locate & Reach' => 10,'Easy to locate & Reach' => 7,'Difficult to locate & Reach' => 4,'Very Difficult to locate & Reach' => 2); + $comment_locality = array('Excellent' => 10,'Good' => 7,'Poor' => 5,'Very Poor' => 2); + $customer_behaviour = array('Rude' => 0,'Polite' => 10,'Others' => 0); + $neibourhood_check_as_per_pd_officer = array( 'Positive' => 10, 'Negative' => 0); + $was_the_company_name_board_sighted = array('Yes' => 10, 'No' => 0); + $supplir_client_answer_scores = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); + + $otp_done = array('Yes' => 10, 'No' => 0); + $qualification = array( 'name_score' => array('Completed Professinal Course' => 10,'Completed Post Graduation' => 8, 'Completed Graduation' => 6,'Completed Schooling' => 4,'Not Completed Schooling' => 2,'No Formal Education' => 0), + 'id_score' => array('1' => 10,'2' => 8,'3' => 6,'4' => 4,'5' => 2,'6' => 0)); + + /*-------- BUSNIESS --------------*/ + $no_of_years_business_run = array('100> to >=10' => 10,'5<= to <10' => 8,'3<= to <5' => 6,'1<= to <3' => 4,' 1> to >0' => 2); + $business_seasonality = array('yes' => 5, 'no major chnages in sales' => 10); + $employees_total = array('1000> to >50' => 10,'21<= to <50' => 8, '11<= to <20' => 6, '6<= to <10' =>4,'5>= to >0' => 2) ; + $cerificates = array('yes' => 10,'no' => 0, 'not applicable' => 0); + $owned_property = array('yes' => 10, 'no' => 0); + $owned_vechile = array('yes' => 10, 'no' => 0); + $minimum_supplier_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); + $minimum_client_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); + $stock_answer_scores = array('yes' => 10, 'no' => 0,'Not Applicable' => 0); + $stock_raw_material_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); + $stock_finished_goods_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0); + $location_suited_for_busienss = array('well_suited' => 10 ,'fairly_suited' => 6,'not_suited' => 0); + $business_activity_has_seen = array('yes' => 10, 'no' => 0); + $vintage_of_business_account = array('100> to >=10' => 10,'7<= to <10' => 8,'5<= to <7' => 6,'3<= to <5' => 4,'3> to >0' => 2); + /*-------- FINAL --------------*/ + $pd_officer_recommandations = array('Positive' => 10,'Negative' => 0,'Refer to Credit' => 5); + + + /*-----------CALCULATION PART -----------*/ + /*-----------GENERAL SECTION -----------*/ + echo "##################################################"; + + $general_distribute_level_weightage = 0; + //#######1.1 person_met_is_applicant + $person_met_is_applicant_actual_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * $person_met_is_applicant[$score_questions['general']['person_met_is_applicant']]; + + $person_met_is_applicant_max_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * max($person_met_is_applicant); + + $score_questions['general']['person_met_is_applicant'] = array('l1_weightage' => $l1_general,'l2_weightage' => $person_met_is_applicant_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['person_met_is_applicant'],'actual_score' => $person_met_is_applicant_actual_score, 'max_score' => $person_met_is_applicant_max_score); + + //######1.2 pd_location_approach + $pd_location_approach_actual_score = ($l1_general/100) * ($pd_location_approach_L2/100) * $pd_location_approach[$score_questions['general']['pd_location_approach']]; + + $pd_location_approach_max_score = ($l1_general/100) * ($pd_location_approach_L2/100) * max($pd_location_approach); + + $score_questions['general']['pd_location_approach'] = array('l1_weightage' => $l1_general,'l2_weightage' => $pd_location_approach_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['pd_location_approach'],'actual_score' => $pd_location_approach_actual_score, 'max_score' => $pd_location_approach_max_score); + + //######1.3 comment_locality + $comment_locality_actual_score = ($l1_general/100) * ($comment_locality_L2/100) * $comment_locality[$score_questions['general']['comment_locality']]; + + $comment_locality_max_score = ($l1_general/100) * ($comment_locality_L2/100) * max($comment_locality); + + $score_questions['general']['comment_locality'] = array('l1_weightage' => $l1_general,'l2_weightage' => $comment_locality_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['comment_locality'],'actual_score' => $comment_locality_actual_score, 'max_score' => $comment_locality_max_score); + + //######1.4 customer_behaviour + $customer_behaviour_actual_score = ($l1_general/100) * ($customer_behaviour_L2/100) * $customer_behaviour[$score_questions['general']['customer_behaviour']]; + + $customer_behaviour_max_score = ($l1_general/100) * ($customer_behaviour_L2/100) * max($customer_behaviour); + + $score_questions['general']['customer_behaviour'] = array('l1_weightage' => $l1_general,'l2_weightage' => $customer_behaviour_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['customer_behaviour'],'actual_score' => $customer_behaviour_actual_score, 'max_score' => $customer_behaviour_max_score); + + //######1.5 neibourhood_check_as_per_pd_officer + $neibourhood_check_as_per_pd_officer_actual_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * $neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer']]; + + $neibourhood_check_as_per_pd_officer_max_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * max($neibourhood_check_as_per_pd_officer); + + $score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => $neibourhood_check_as_per_pd_officer_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'actual_score' => $neibourhood_check_as_per_pd_officer_actual_score, 'max_score' => $neibourhood_check_as_per_pd_officer_max_score); + + //######1.6 was_the_company_name_board_sighted + $was_the_company_name_board_sighted_actual_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * $was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']]; + + $was_the_company_name_board_sighted_max_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * max($was_the_company_name_board_sighted); + + $score_questions['general']['was_the_company_name_board_sighted'] = array('l1_weightage' => $l1_general,'l2_weightage' => $was_the_company_name_board_sighted_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['was_the_company_name_board_sighted'],'actual_score' => $was_the_company_name_board_sighted_actual_score, 'max_score' => $was_the_company_name_board_sighted_max_score); + + //######1.7 otp_done + $otp_done_actual_score = ($l1_general/100) * ($otp_done_L2/100) * $otp_done[$score_questions['general']['otp_done']]; + + $otp_done_max_score = ($l1_general/100) * ($otp_done_L2/100) * max($otp_done); + + $score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => $otp_done_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['otp_done'],'actual_score' => $otp_done_actual_score, 'max_score' => $otp_done_max_score); + + //######1.8 qualification + $qualification_actual_score = ($l1_general/100) * ($qualification_L2/100) * $qualification['id_score'][$score_questions['general']['qualification']]; + + $qualification_max_score = ($l1_general/100) * ($qualification_L2/100) * max($qualification['id_score']); + $keys = array_keys($qualification['name_score']); + + $score_questions['general']['qualification'] = array('l1_weightage' => $l1_general,'l2_weightage' => $qualification_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $keys[($score_questions['general']['qualification']-1)],'actual_score' => $qualification_actual_score, 'max_score' => $qualification_max_score); + + //######1.9 value of assets as a % of Loan Amount + //$actual_value_of_assets = $score_questions['general']['value_of_other_assets']; + $actual_value_of_assets = 600000; + //$loan_amount = $pd_master_details[0]['loan_amount']; + $loan_amount = 2000000; + $avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets']; + $expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to']; + $actual_value_of_assets_percentage = ($actual_value_of_assets / $loan_amount) * 100; + $variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ; + + + $final_asset_score = 'DEFAULT'; + foreach($personal_asset_grid['variance_grid'] as $grid) + { + //print_r($grid); + if($grid['variance_ ratio_from'] < $variance && $grid['variance_ration_to'] > $variance) + { + $final_asset_score = $grid['score']; + $final_asset_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score; + + } + } + + $score_questions['general']['value_of_other_assets'] = array('l1_weightage' => $l1_general,'l2_weightage' => $value_of_other_assets_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['value_of_other_assets'],'actual_score' => $final_asset_score, 'max_score' => (($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10)); + /*-----------END OF GENERAL SECTION -----------*/ + + /*-----------FINAL REMARKS SECTION -----------*/ + //###### 3.1 PD Officer Recommandation + + $pd_officer_recommandations_actual_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * $pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ]; + + $pd_officer_recommandations_max_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * max($pd_officer_recommandations); + + $score_questions['final_remarks']['pd_officer_recommandations'] = array('l1_weightage' => $l1_final,'l2_weightage' => $pd_officer_recommadations_L2,'distributed_weightage' => 0,'answer' => $score_questions['final_remarks']['pd_officer_recommandations'],'actual_score' => $pd_officer_recommandations_actual_score, 'max_score' => $pd_officer_recommandations_max_score); + /*-----------END OF FINAL REMARKS SECTION -----------*/ + + + /*-----------BUSINESS SECTION -----------*/ + + + /* First Calculate Shortfall Type Questions to get distribute level + From 2.7 to 2.10 Questions are shortfall type questions (REF :- SSA_ScoreCard_Ver_090219(2)) + */ + + $business_distribute_level_weightage = 0; + + + if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable')) + { + $business_distribute_level_weightage += $minimum_supplier_info_L2; + } + if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable')) + { + $business_distribute_level_weightage += $minimum_client_info_L2; + } + if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable')) + { + $business_distribute_level_weightage += $stock_raw_material_enough_L2; + } + if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable')) + { + $business_distribute_level_weightage += $stock_finished_goods_enough_L2; + } + //echo $business_distribute_level_weightage; + + //######2.7 atleast one supplier info provided + $minimum_supplier_info_L2 = $business_distribute_level_weightage ? ($minimum_supplier_info_L2 + ($minimum_supplier_info_L2 / (100 - $business_distribute_level_weightage ))) : $minimum_supplier_info_L2 ; + + $minimum_supplier_info_actual_score = ($l1_business/100) * ($minimum_supplier_info_L2/100) * $minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ]; + + $minimum_supplier_info_max_score = strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_supplier_info_L2/100) * max($minimum_supplier_info) : 0; + + $score_questions['business']['minimum_supplier_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => $minimum_supplier_info_L2,'answer' => $score_questions['business']['minimum_supplier_info'],'actual_score' => $minimum_supplier_info_actual_score, 'max_score' => $minimum_supplier_info_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.8 atleast one client info provided + $minimum_client_info_L2 = $business_distribute_level_weightage ? ($minimum_client_info_L2 + ($minimum_client_info_L2 / (100 - $business_distribute_level_weightage ))) : $minimum_client_info_L2 ; + + $minimum_client_info_actual_score = ($l1_business/100) * ($minimum_client_info_L2/100) * $minimum_client_info [ $score_questions['business']['minimum_client_info'] ]; + + $minimum_client_info_max_score = strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_client_info_L2/100) * max($minimum_client_info) : 0; + + $score_questions['business']['minimum_client_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => $minimum_client_info_L2,'answer' => $score_questions['business']['minimum_client_info'],'actual_score' => $minimum_client_info_actual_score, 'max_score' => $minimum_client_info_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.9 stock of raw material + $stock_raw_material_enough_L2 = $business_distribute_level_weightage ? ($stock_raw_material_enough_L2 + ($stock_raw_material_enough_L2 / (100 - $business_distribute_level_weightage ))) : $stock_raw_material_enough_L2 ; + + $stock_raw_material_enough_actual_score = ($l1_business/100) * ($stock_raw_material_enough_L2/100) * $stock_answer_scores [ $score_questions['business']['stock_raw_material_enough'] ]; + + $stock_raw_material_enough_max_score = strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable')? ($l1_business/100) * ($stock_raw_material_enough_L2/100) * max($stock_answer_scores) : 0; + + $score_questions['business']['stock_raw_material_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => $stock_raw_material_enough_L2,'answer' => $score_questions['business']['stock_raw_material_enough'],'actual_score' => $stock_raw_material_enough_actual_score, 'max_score' => $stock_raw_material_enough_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.10 stock_finished_goods_enough + $stock_finished_goods_enough_L2 = $business_distribute_level_weightage ? ($stock_finished_goods_enough_L2 + ($stock_finished_goods_enough_L2 / (100 - $business_distribute_level_weightage ))) : $stock_finished_goods_enough_L2 ; + + $stock_finished_goods_enough_actual_score = ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * $stock_answer_scores [ $score_questions['business']['stock_finished_goods_enough'] ]; + + $stock_finished_goods_enough_max_score = strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable') ? ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * max($stock_answer_scores) : 0; + + $score_questions['business']['stock_finished_goods_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => $stock_finished_goods_enough_L2,'answer' => $score_questions['business']['stock_finished_goods_enough'],'actual_score' => $stock_finished_goods_enough_actual_score, 'max_score' => $stock_finished_goods_enough_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + + + //######2.1 Business Certificates + $cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage ))) : $cerificates_L2; + + //find out no of not applicable cases + $business_certificates_distribution_count = 0; + foreach($score_questions['business']['cerificates'] as $value) + { + if(strcasecmp($value,'not applicable')) + { + $business_certificates_distribution_count++; + + } + } + $business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count; + + $certificate_actual_score = 0; + $certificate_max_score = 0; + + foreach($score_questions['business']['cerificates'] as $certificate_key => $certificate) + { + + $acutal_score = 0; + $max_score = 0; + if(strcasecmp($certificate,'not applicable')) + { + $acutal_score = ($l1_business/100) * ($business_certificates_distribution/100) * $cerificates[$certificate]; + $max_score = ($l1_business/100) * ($business_certificates_distribution/100) * max($cerificates); + + } + $score_questions['business']['cerificates'][$certificate_key] = array('answer' => $certificate,'actual_score' => $acutal_score, 'max_score' => $max_score); + + $certificate_actual_score += $acutal_score; + $certificate_max_score += $max_score; + } + + $score_questions['business']['cerificates']['l1_weightage'] = $l1_business; + $score_questions['business']['cerificates']['l2_weightage'] = $business_certificates_distribution; + $score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage; + $score_questions['business']['cerificates']['max_score'] = $certificate_max_score; + $score_questions['business']['cerificates']['actual_score'] = $certificate_actual_score; + + //echo $business_certificates_distribution;die(); + //######2.1 no_of_years_business_run + + $no_of_years_business_run_actual_score = 0; + foreach($no_of_years_business_run as $key => $value) + { + $exp = explode('to',$key); + //print_r($exp); + $left = $exp[0].$score_questions['business']['no_of_years_business_run']; + $right = $score_questions['business']['no_of_years_business_run'].$exp[1]; + //echo $left.'````'.$right;echo "\n"; + eval( '$left_exp = ' . $left . ';'); + eval( '$right_exp = ' . $right . ';'); + if($left_exp && $right_exp) + { + + $no_of_years_business_run_L2 = $business_distribute_level_weightage ? ($no_of_years_business_run_L2 + ($no_of_years_business_run_L2 / (100 - $business_distribute_level_weightage ))) : $no_of_years_business_run_L2 ; + + $no_of_years_business_run_actual_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * $value; + } + + } + + + + $no_of_years_business_run_max_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * max($no_of_years_business_run); + + $score_questions['business']['no_of_years_business_run'] = array('l1_weightage' => $l1_business,'l2_weightage' => $no_of_years_business_run_L2,'answer' => $score_questions['business']['no_of_years_business_run'],'actual_score' => $no_of_years_business_run_actual_score, 'max_score' => $no_of_years_business_run_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + + //######2.2 business seasonal + + + $business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage ))) : $business_seasonality_L2 ; + + $business_seasonality_actual_score = ($l1_business/100) * ($business_seasonality_L2/100) * $business_seasonality[ $score_questions['business']['business_seasonality'] ]; + $business_seasonality_max_score = ($l1_business/100) * ($business_seasonality_L2/100) * max($business_seasonality); + + $score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_seasonality_L2,'answer' => $score_questions['business']['business_seasonality'],'actual_score' => $no_of_years_business_run_actual_score, 'max_score' => $no_of_years_business_run_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.3 employees_total + $employees_total_actual_score = 0; + + $employees_total_L2 = $business_distribute_level_weightage ? ($employees_total_L2 + ($employees_total_L2 / (100 - $business_distribute_level_weightage ))) : $employees_total_L2 ; + + foreach($employees_total as $key => $value) + { + $exp = explode('to',$key); + //print_r($exp); + $left = $exp[0].$score_questions['business']['employees_total']; + $right = $score_questions['business']['employees_total'].$exp[1]; + //echo $left.'````'.$right;echo "\n"; + eval( '$left_exp = ' . $left . ';'); + eval( '$right_exp = ' . $right . ';'); + if($left_exp && $right_exp) + { + $employees_total_actual_score = ($l1_business/100) * ($employees_total_L2/100) * $value; + } + + } + + + + $employees_total_max_score = ($l1_business/100) * ($employees_total_L2/100) * max($employees_total); + + $score_questions['business']['employees_total'] = array('l1_weightage' => $l1_business,'l2_weightage' => $employees_total_L2,'answer' => $score_questions['business']['employees_total'],'actual_score' => $employees_total_actual_score, 'max_score' => $employees_total_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + + //######2.5 owned_property + + $owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage ))) : $owned_property_L2 ; + + $owned_property_actual_score = ($l1_business/100) * ($owned_property_L2/100) * $owned_property[ $score_questions['business']['owned_property'] ]; + $owned_property_max_score = ($l1_business/100) * ($owned_property_L2/100) * max($owned_property); + + $score_questions['business']['owned_property'] = array('l1_weightage' => $l1_business,'l2_weightage' => $owned_property_L2,'answer' => $score_questions['business']['owned_property'],'actual_score' => $owned_property_actual_score, 'max_score' => $owned_property_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.6 owned_vechile + $owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage ))) : $owned_vechile_L2 ; + + $owned_vechile_actual_score = ($l1_business/100) * ($owned_vechile_L2/100) * $owned_vechile[ $score_questions['business']['owned_vechile'] ]; + $owned_vechile_max_score = ($l1_business/100) * ($owned_vechile_L2/100) * max($owned_vechile); + + $score_questions['business']['owned_vechile'] = array('l1_weightage' => $l1_business,'l2_weightage' => $owned_vechile_L2,'answer' => $score_questions['business']['owned_vechile'],'actual_score' => $owned_vechile_actual_score, 'max_score' => $owned_vechile_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.11 location_suited_for_busienss + + $location_suited_for_busienss_L2 = $business_distribute_level_weightage ? ($location_suited_for_busienss_L2 + ($location_suited_for_busienss_L2 / (100 - $business_distribute_level_weightage ))) : $location_suited_for_busienss_L2 ; + + $location_suited_for_busienss_actual_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ]; + $location_suited_for_busienss_max_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * max($location_suited_for_busienss); + + $score_questions['business']['location_suited_for_busienss'] = array('l1_weightage' => $l1_business,'l2_weightage' => $location_suited_for_busienss_L2,'answer' => $score_questions['business']['location_suited_for_busienss'],'actual_score' => $location_suited_for_busienss_actual_score, 'max_score' => $location_suited_for_busienss_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.11 business_activity_has_seen + + $business_activity_has_seen_L2 = $business_distribute_level_weightage ? ($business_activity_has_seen_L2 + ($business_activity_has_seen_L2 / (100 - $business_distribute_level_weightage ))) : $business_activity_has_seen_L2 ; + + $business_activity_has_seen_actual_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ]; + $business_activity_has_seen_max_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * max($business_activity_has_seen); + + $score_questions['business']['business_activity_has_seen'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_activity_has_seen_L2,'answer' => $score_questions['business']['business_activity_has_seen'],'actual_score' => $business_activity_has_seen_actual_score, 'max_score' => $business_activity_has_seen_max_score,'distributed_weightage' => $business_distribute_level_weightage); + + //######2.13 vintage business banking + + $vintage_of_business_account_L2 = $business_distribute_level_weightage ? ($vintage_of_business_account_L2 + ($vintage_of_business_account_L2 / (100 - $business_distribute_level_weightage ))) : $vintage_of_business_account_L2 ; + + $vintage_of_business_account_actual_score = 0; + foreach($vintage_of_business_account as $key => $value) + { + $exp = explode('to',$key); + //print_r($exp); + $left = $exp[0].$score_questions['business']['vintage_of_business_account']; + $right = $score_questions['business']['vintage_of_business_account'].$exp[1]; + //echo $left.'````'.$right;echo "\n"; + eval( '$left_exp = ' . $left . ';'); + eval( '$right_exp = ' . $right . ';'); + if($left_exp && $right_exp) + { + $vintage_of_business_account_actual_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * $value; + } + + } + + + + $vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account); + + $score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_activity_has_seen_L2,'answer' => $score_questions['business']['vintage_of_business_account'],'actual_score' => $vintage_of_business_account_actual_score, 'max_score' => $vintage_of_business_account_max_score,'distributed_weightage' => $business_distribute_level_weightage); + /*-----------END OF BUSINESS SECTION -----------*/ + + + + /* Calculate Overall Total*/ + $overall_max_score = 0; + $overall_actual_score = 0; + foreach($score_questions as $key => $value) + { + foreach($value as $v_key => $f_value) + { + $overall_max_score += $f_value['max_score']; + $overall_actual_score += $f_value['actual_score']; + } + } + $score_questions['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => ($overall_actual_score/$overall_max_score) * 100); + print_r($score_questions); + + + + + } +} + +?> \ No newline at end of file diff --git a/api/application/helpers/stockform_helper.php b/api/application/helpers/stockform_helper.php new file mode 100644 index 00000000..55d2f332 --- /dev/null +++ b/api/application/helpers/stockform_helper.php @@ -0,0 +1,81 @@ +0){ + $getRawMaterial = array_map(function($tag) { + $getUom= $tag['raw_uom']==1 ? $tag['other_uom'] : $tag['raw_uom']; + $getSufficient= (strtoupper($tag['stock_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_raw']) =='YES') ? 'Yes, the stock of raw materials observed and sufficient considering the size of operations' : 'No, the stock of raw materials observed and sufficient considering the size of operations because of '.$tag['rawmaterial_remarks']); + + return array( + 'type' => 'Raw Material', + 'name' => $tag['raw_name'], + 'quantity' => strtoupper($tag['stock_observed'])=='YES' ? $tag['raw_quantity'] : '', + 'uom' => strtoupper($tag['stock_observed'])=='YES' ? $getUom : '', + 'value' => strtoupper($tag['stock_observed'])=='YES' ? 'Rs.'.$tag['raw_value'] : '', + 'is_sufficiant' => (strtoupper($tag['stock_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['stock_observed'])=='NO') ? $getSufficient : ''), + ); + }, $rawMaterial); + } + // goods + if(count($goods)>0){ + $getGoods = array_map(function($tag) { + $getGUom= $tag['goods_uom']==1 ? $tag['goods_other_uom'] : $tag['goods_uom']; + $getGSufficient= (strtoupper($tag['goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_goods']) =='YES') ? 'Yes, the stock of finished goods observed and sufficient considering the size of operations' : 'No, the stock of finished goods observed and sufficient considering the size of operations because of '.$tag['finishedgoods_remarks']); + return array( + 'type' => 'Finished Goods', + 'name' => $tag['goods_name'], + 'quantity' => strtoupper($tag['goods_observed'])=='YES' ? $tag['goods_quantity'] : '', + 'uom' => strtoupper($tag['goods_observed'])=='YES' ? $getGUom : '', + 'value' => strtoupper($tag['goods_observed'])=='YES' ? 'Rs.'.$tag['goods_value'] : '', + 'is_sufficiant' => (strtoupper($tag['goods_observed'])=='YES') ? $getGSufficient : ((strtoupper($tag['goods_observed'])=='NO') ? $getGSufficient : ''), + ); + }, $goods); + } + return array_merge($getRawMaterial,$getGoods); +} + +//get retail +public static function getStockRetailDetails($goods){ + // goods + if(count($goods)>0){ + $goods = array_map(function($tag) { + $getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : $tag['traded_goods_uom']; + $getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']); + return array( + 'name' => $tag['traded_goods_name'], + 'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '', + 'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '', + 'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$tag['estimated_traded_goods_value'] : '', + 'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''), + ); + }, $goods); + } + return $goods; +} + +// get wholesale +public static function getStockWholesaleDetails($goods){ + // goods + if(count($goods)>0){ + $goods = array_map(function($tag) { + $getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : $tag['traded_goods_uom']; + $getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']); + return array( + 'name' => $tag['traded_goods_name'], + 'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '', + 'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '', + 'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$tag['estimated_traded_goods_value'] : '', + 'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''), + ); + }, $goods); + } + return $goods; +} +} +?> \ No newline at end of file diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index e9fee14b..64f38f07 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -14,7 +14,7 @@ class PD_Model extends SPARQ_Model { public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status)// $page represents mysql offset { //echo $status;die(); - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id','LEFT'); $this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT'); @@ -126,7 +126,7 @@ class PD_Model extends SPARQ_Model { public function PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref) { - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id','LEFT'); $this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT'); @@ -643,7 +643,7 @@ class PD_Model extends SPARQ_Model { */ public function getPDMasterDetails($pdid) { - $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode'); + $this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done'); $this->db->FROM(PDTRIGGER.' as PDTRIGGER'); $this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT'); $this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT'); @@ -1024,6 +1024,10 @@ class PD_Model extends SPARQ_Model { { if($result->OTP == $pddata['OTP']) { + $fields = ('is_otp_done'); + $where_condition_array = array('pd_id' => $pdotp['pd_id']); + $this->PD_Model->updateRecords($fields,PDTRIGGER,$where_condition_array); + $result = true; }else { @@ -1327,4 +1331,30 @@ class PD_Model extends SPARQ_Model { return $assessed_income; } + + + public function getScorablePDFormDetailsJSON($pdid) + { + $array = array(1,2,4,5,11,13,18,19,20,21,22); + $return_data = array(); + foreach($array as $key => $value) + { + $this->db->SELECT('processed_json'); + $this->db->FROM(PDFORMDETAILSJSON); + $this->db->WHERE('isactive','1'); + $this->db->WHERE('fk_pd_id',$pdid); + $this->db->WHERE('fk_form_id',$value); + $data = $this->db->GET()->result_array(); + + if(count($data)) + { + //echo $value; + $return_data[$value] = $data; + } + } + // print_r($return_data);die(); + return $return_data; + } + + } \ No newline at end of file diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 00721c83..2ca2e064 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -81,6 +81,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); +







"; setlocale(LC_MONETARY, 'en_IN'); @@ -113,7 +115,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); As Per PD Initiation As Per Loan Applicants during PD - Rs " . number_format($pd_master_details[0]['loan_amount'],2). ". #### + Rs " . number_format($pd_master_details[0]['loan_amount'],2). ". ". number_format($loan_form['loan_amount'],2). "

"; @@ -141,7 +143,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { if($individual['is_person_met'] == true) { - echo ($individual['applicant_title_name_master'] .$individual['pd_co_applicant_id_master']); + $applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "AAAA" ; + echo '
'.$individual['applicant_title_name_master'] . $applicant_name ; foreach($general_form['company_with_relationships'] as $company_with_relationship) { @@ -150,7 +153,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); //FInd Company Name from JSON - echo '
'.$company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name']; + echo '
'.$company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name'] . '
'; } } @@ -158,7 +161,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null) { - echo '
'.$persons_with_relationship['relationship_master'] .' Of '.$persons_with_relationship['relation_to_master']; + echo '
'. isset($persons_with_relationship['relationship_master']) ? $persons_with_relationship['relationship_master'] : "NA" .' Of '.$persons_with_relationship['relation_to_master'] . '
'; //print_r($persons_with_relationship); } } @@ -183,7 +186,8 @@ defined('BASEPATH') OR exit('No direct script access allowed'); if($individual['is_applicant'] == true) { - echo "".$individual['applicant_title_name_master'].$individual['pd_co_applicant_id_master'].""; + $applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "YYYY" ; + echo "".$individual['applicant_title_name_master'].$applicant_name.""; foreach($general_form['company_with_relationships'] as $company_with_relationship) { @@ -191,17 +195,19 @@ defined('BASEPATH') OR exit('No direct script access allowed'); { //FInd Company Name from JSON - + echo "
"; print_r($company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name']); } } foreach($general_form['persons_with_relationships'] as $persons_with_relationship) { + //print_r($persons_with_relationship); if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null) { echo "

"; - print_r($persons_with_relationship['relationship_master'] .' Of '.$persons_with_relationship['relation_to_master']); + $RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : "RRRR"; + print_r($persons_with_relationship['relationship_master'] .' Of '. $RSNA); //print_r($persons_with_relationship); } } @@ -213,17 +219,30 @@ defined('BASEPATH') OR exit('No direct script access allowed'); -

PD Officer's Note (About General Section) :

+ +

PD Officer's Note (About General Section) :

Location Details :

-

-

PD Officer's Note (About Location Details) :

+

+

PD Officer's Note (About Location Details) :

+ -

Loan Details :

"; - echo "

Business Related Information

"; - echo "count-".count($pd_processed_forms[13]); - if(count($pd_processed_forms[13])) - { + // echo "
"; + // echo "

Business Related Information

"; + // echo "count-".count($pd_processed_forms[13]); + // if(count($pd_processed_forms[13])) + // { - foreach($pd_processed_forms[13] as $pd_processed_form_key => $pd_processed_form) - { + // foreach($pd_processed_forms[13] as $pd_processed_form_key => $pd_processed_form) + // { - //print_r($pd_processed_form['processed_json']); - $pd_processed_form = json_decode($pd_processed_form['processed_json'],true); - //print_r($pd_processed_form); - if($pd_processed_form != null || $pd_processed_form != "") - { - $name_of_the_business_entity = MYUITIL::findCompanyName($all_company_details,($pd_processed_form_key + 1)); - echo "Name of the Business Entity : $name_of_the_business_entity"; - } + // //print_r($pd_processed_form['processed_json']); + // $pd_processed_form = json_decode($pd_processed_form['processed_json'],true); + // //print_r($pd_processed_form); + // if($pd_processed_form != null || $pd_processed_form != "") + // { + // $name_of_the_business_entity = MYUITIL::findCompanyName($all_company_details,($pd_processed_form_key + 1)); + // echo "Name of the Business Entity : $name_of_the_business_entity"; + // } + // } + // } + ?> + + + $bRow) { + $businessRow = json_decode($bRow['processed_json'],true); + $companyList = MYUITIL::findCompanyName($all_company_details,$businessRow['company_id'],2); + //$companyList .=' The director details are as under :'; + $bindEachResult["company_name"]=$companyList; + // this is for partner details + if(array_key_exists('partners',$businessRow)){ + $bindEachResult["partner"]=Businessform::getPartnerDetails($businessRow['partners']); } + else { + $getPartner=array(); + $bindEachResult["partner"]=$getPartner; + } + // this is for person with relationship + if(array_key_exists('persons_with_relationships',$businessRow)){ + $bindEachResult["family_members_involved"]=Businessform::getFamilyMemberDetails($businessRow['persons_with_relationships']); + } + else { + $getFamilyMembers=array(); + $bindEachResult["family_members_involved"]=$getFamilyMembers; + } + // this is for manufacturing activities + + if(array_key_exists('manufacturing_activity_details',$businessRow)){ + $bindEachResult['manufacturing'] = Businessform::getActivityDetails($businessRow['manufacturing_activity_details'],1); + } + else{ + $getManufacturingRow=array(); + $bindEachResult['manufacturing']=$getManufacturingRow; + } + // this is for retail activites + if(array_key_exists('retail_trading_activity_details',$businessRow)){ + $bindEachResult['retail'] = Businessform::getActivityDetails($businessRow['retail_trading_activity_details'],2); + } + else{ + $getRetailRow=array(); + $bindEachResult['retail']=$getRetailRow; + } + // this is for whole sale activites + if(array_key_exists('wholesale_trading_activity_details',$businessRow)){ + $bindEachResult['wholesale'] = Businessform::getActivityDetails($businessRow['wholesale_trading_activity_details'],3); + } + else{ + $getWholesaleRow=array(); + $bindEachResult['wholesale']=$getWholesaleRow; + } + + // this is for service provider + if(array_key_exists('service_provider_activity_details',$businessRow)){ + $bindEachResult['serviceprovider']=Businessform::getActivityDetails($businessRow['service_provider_activity_details'],4); + } + else{ + $getServiceproviderRow=array(); + $bindEachResult['serviceprovider']=$getServiceproviderRow; + } + // this is for other activity details + if(array_key_exists('others_activity_details',$businessRow)){ + $bindEachResult['otheractivity']=Businessform::getActivityDetails($businessRow['others_activity_details'],5); + } + else{ + $getOtheractivityRow=array(); + $bindEachResult['otheractivity']=$getOtheractivityRow; + } + // this if for get business peak period + if(strtoupper($businessRow['seasonality'])=='YES' && array_key_exists('peak_period_of_business',$businessRow)){ + $bindEachResult['business_peak_details']=Businessform::getBusinessPeakDetails($businessRow['peak_period_of_business']); + } + else{ + $bindEachResult['business_peak_details']='The Business has no major changes in sales across season.'; + } + // this is for no of employess details + $bindEachResult['company_empployees']='As per person met there are '.$businessRow['employees_permanent'].' permanent and '.$businessRow['employees_temporary'].' temporary employees with company.'; + $bindEachResult['officer_visit_company_empployees']='The PD Officer could notice approximately '.$businessRow['officer_total'] .' employees during the visit.'; + //this is documents visited + $getDocuments=array(); + if(array_key_exists('shop_eat_act_cert',$businessRow) && strtoupper($businessRow['shop_eat_act_cert'])=='YES'){ + array_push($getDocuments,'Shop/Est act Certificate.'); + } + if(array_key_exists('gst_Regn_cert',$businessRow) && strtoupper($businessRow['gst_Regn_cert'])=='YES'){ + array_push($getDocuments,'GST Registration.'); + } + if(array_key_exists('pf_regn',$businessRow) && strtoupper($businessRow['pf_regn'])=='YES'){ + array_push($getDocuments,'PF Registration.'); + } + if(array_key_exists('esic_regn',$businessRow) && strtoupper($businessRow['esic_regn'])=='YES'){ + array_push($getDocuments,'ESIC Registration.'); + } + if(array_key_exists('export_import_cert',$businessRow) && strtoupper($businessRow['export_import_cert'])=='YES'){ + array_push($getDocuments,'Export/Import Certificate.'); + } + if(array_key_exists('factory_cert',$businessRow) && strtoupper($businessRow['factory_cert'])=='YES'){ + array_push($getDocuments,'Factory Certificate.'); + } + if(strtoupper($businessRow['other_documents'])=='YES' && array_key_exists('documents',$businessRow)){ + foreach($businessRow['documents'] as $docValue){ + array_push($getDocuments,$docValue['document'].'.'); + } + } + $bindEachResult['visit_documents']=$getDocuments; + array_push($businessResult,$bindEachResult); + } + ?> +

Business Details

+ $fetchRow){ + ?> +

About Company :

+ +

The director details are as under :

+ + + + + + + + + + + + + + + + + + + + + + +
NameShare HoldingNo.of Years in Current BusinessTotal Work ExperiencePrevious Experience
+ + 0){ ?> +
+

Besides the above, the below family members are also involved in the business :

+
+ + + + + + + + + + + + + + + + + + + + +
NameRelationDesignationStarted Business
+ + + + + + + 0){ ?> +
+

The Manufacturing details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ProductsArea of SaleSales DoneMax Sales Done
+ +
+ + +
+ + + + + + + 0){ ?> +
+

The Retail Trading details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ProductsArea of SaleSales DoneMax Sales Done
+ +
+ + +
+ + + + + + + 0){ ?> +
+

The Service Provider details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ServicesArea of SaleServices AtMax Revenue From
+ +
+ + +
+ + + + + + + 0){ ?> +
+

The Wholesale Trading details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ProductsArea of SaleSales DoneMax Sales Done
+ +
+ + +
+ + + + + + 0){ ?> +
+

Other activity details are as under :

+
+ + + + + + + + + + + + + + +
Other Business Activity
+ + + + + +

+ + + + +

+

+ + + + +

The below documents were sighted during the visit :

+
    + +
  1. + +
+ + + + + + + + + + + + $baRow) { + $businessFinancialRow = json_decode($baRow['processed_json'],true); + // statement + if(strtoupper($businessFinancialRow['is_financial_statements'])=='YES' && count($businessFinancialRow['date_per_financial'])>0){ + $bindBusinessFinancial["company_name"] =MYUITIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1); + $bindBusinessFinancial["company_name"] .= count($businessFinancialRow['date_per_financial'])>1 ? ' provided with last '.count($businessFinancialRow['date_per_financial']).' years of financial statements and the snapshot is as below :' : ' we were provided with last '.count($businessFinancialRow['date_per_financial']).' year of financial statements and the snapshot is as below :'; + $bindBusinessFinancial['statements']=FINANCIALFORM::getBusinessFinancialDetails($businessFinancialRow['date_per_financial']); + } + else { + $bindBusinessFinancial["company_name"] =MYUITIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1); + $bindBusinessFinancial["company_name"] .=' not provided the financial statements :'; + $bindBusinessFinancial['statements']=array(); + } + // customer + if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && count($businessFinancialRow['estimated_value'])==0){ + $bindBusinessFinancial["financial_customer"] ="As per customers, the financials are as below :"; + $bindBusinessFinancial['customer_statements']=array(); + $bindBusinessFinancial['customer_statements_header']=array(); + } + else if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && count($businessFinancialRow['estimated_value'])>0){ + $bindBusinessFinancial["financial_customer"] ="As per customers, the financials are as below :"; + $bindBusinessFinancial['customer_statements']=FINANCIALFORM::getBusinessCustomerFinancialDetails($businessFinancialRow['estimated_value']); + $bindBusinessFinancial['customer_statements_header']=FINANCIALFORM::getBusinessCustomerHeader($businessFinancialRow['estimated_value']); + } + else { + $bindBusinessFinancial["financial_customer"] ="As per customers, the financials are same as financial statement."; + $bindBusinessFinancial['customer_statements']=array(); + $bindBusinessFinancial['customer_statements_header']=array(); + } + array_push($businessFinancialResult,$bindBusinessFinancial); + } + ?> +

Financial Information

+ 0){ ?> + +

+ 0){ ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
YearSalesNet ProfitNet Profit to Sales %Net LossNet Loss to Sales %% Variation in PY Sales% Variation in PY Profit
+ + +

+ 0){ ?> + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+ + + + + +

Financial information is not available.

+ + + + + $cRow) { + $clientRow = json_decode($cRow['processed_json'],true); + + $bindEachResult["company_name"]=MYUITIL::findCompanyName($all_company_details,$clientRow['company_id'],1); + $getmanufacturing = array(); + $getTrading=array(); + $getService=array(); + $getTotalPaymentsPercentonCredit=array(); + if(array_key_exists('manufacturing_details',$clientRow)){ + foreach($clientRow['manufacturing_details'] as $manuRow){ + if(isset($manuRow['main_raw_materials'])){ + $getmanufacturing = array_map(function($tag) { + return array( + 'product' => $tag['manufacturing_product_name'], + 'client_name' => $tag['manufacturing_client_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['manufacturing_contact_person_name'], + 'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('manufacturing_payment_type_master',$tag) ? $tag['manufacturing_payment_type_master'] : '', + + ); + }, $manuRow['main_raw_materials']); + array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']); + + } + } + } + // this is for trading + if(array_key_exists('trade_details',$clientRow)){ + foreach($clientRow['trade_details'] as $tradeRow){ + + if(isset($tradeRow['trading_products'])){ + + $getTrading = array_map(function($tag) { + return array( + 'product' => $tag['trade_product_name'], + 'client_name' => $tag['trade_client_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['trade_product_contact_person_name'], + 'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'', + + ); + }, $tradeRow['trading_products']); + array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']); + + } + } } - ?> + //this is for service + if(array_key_exists('service_provider_details',$clientRow)){ + foreach($clientRow['service_provider_details'] as $serviceRow){ + + if(isset($serviceRow['service_products'])){ + + $getService = array_map(function($tag) { + return array( + 'product' => $tag['service_provider_product_name'], + 'client_name' => $tag['service_provider_client_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['service_provider_product_contact_person_name'], + 'contact_person_mobile_number' => $tag['service_provider_product_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('service_provider_product_payment_type_master',$tag) ? $tag['service_provider_product_payment_type_master'] :'', + + ); + }, $serviceRow['service_products']); + array_push($getTotalPaymentsPercentonCredit,$serviceRow['service_products_total_payments_percent_on_credit']); + + } + } + } + $bindEachResult["details"]=array_merge($getmanufacturing,$getTrading,$getService); + $bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit; + array_push($clientResult,$bindEachResult); + + } + + ?> +

Client Details

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Product/ServiceClientContactPayment
+
+
+
+ + + + + + $row) { + $clientRow = json_decode($row['processed_json'],true); + $bindEachResult["company_name"]=MYUITIL::findCompanyName($all_company_details,$clientRow['company_id'],1); + $getmanufacturing = array(); + $getTrading=array(); + $getTotalPaymentsPercentonCredit=array(); + foreach($clientRow['manufacturing_details'] as $manuRow){ + + if(isset($manuRow['main_raw_materials'])){ + $getmanufacturing = array_map(function($tag) { + return array( + 'product' => $tag['manufacturing_raw_material_name'], + 'supplier_name' => $tag['manufacturing_supplier_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['manufacturing_contact_person_name'], + 'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'], + 'payment_type_master' => $tag['manufacturing_payment_type_master'], + + ); + }, $manuRow['main_raw_materials']); + array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']); + + } + } + // this is for trading + foreach($clientRow['trade_details'] as $tradeRow){ + + if(isset($tradeRow['trading_products'])){ + + $getTrading = array_map(function($tag) { + return array( + 'product' => $tag['trade_product_name'], + 'supplier_name' => $tag['trade_supplier_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['trade_product_contact_person_name'], + 'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'', + + ); + }, $tradeRow['trading_products']); + array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']); + + } + } + $bindEachResult["details"]=array_merge($getmanufacturing,$getTrading); + $bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit; + array_push($supplierResult,$bindEachResult); + } + ?> +

Supplier Details

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Raw Material/TradingSupplierContactPayment
+
+
+
+ + + + + $stRow) { + $stockRow = json_decode($stRow['processed_json'],true); + $bindStockResult["company_name"]=MYUITIL::findCompanyName($all_company_details,$stockRow['company_id'],1); + // this is for stock manufacturing details + if(count($stockRow['manufacturing_details'][0]['manufacturing_raw_materials']) > 0 || count($stockRow['manufacturing_details'][0]['manufacturing_finished_goods']) > 0){ + $bindStockResult["manufacturing"]=Stockform::getStockManufacturingDetails($stockRow['manufacturing_details'][0]['manufacturing_raw_materials'], $stockRow['manufacturing_details'][0]['manufacturing_finished_goods']); + } + else { + $bindStockResult["manufacturing"]=array(); + } + // this is for stock retail details + if(count($stockRow['retail_details'][0]['retail_traded_goods']) > 0){ + $bindStockResult["retail"]=Stockform::getStockRetailDetails($stockRow['retail_details'][0]['retail_traded_goods']); + } + else { + $bindStockResult["retail"]=array(); + } + // this is for stock whole sale details + if(count($stockRow['trade_details'][0]['trading_traded_goods']) > 0){ + $bindStockResult["wholesale"]=Stockform::getStockWholesaleDetails($stockRow['trade_details'][0]['trading_traded_goods']); + } + else { + $bindStockResult["wholesale"]=array(); + } + array_push($stockResult,$bindStockResult); + } + ?> +

Stock Details

+ 0){ ?> + +

+ + 0) { ?> +

The Manufacturing stock details are as under :

+ + + + + + + + + + + + + + + + + + + + + + + +
TypeNameQtyUOMValueDetails
+ + + 0) { ?> +

The Retail trading stock details are as under :

+ + + + + + + + + + + + + + + + + + + + + +
NameQtyUOMValueDetails
+ + + 0) { ?> +

The Wholesale trading stock details are as under :

+ + + + + + + + + + + + + + + + + + + + + +
NameQtyUOMValueDetails
+ + + + +

Stock details is not available.

+ + + + + $baRow) { + $businessAssetRow = json_decode($baRow['processed_json'],true); + $bindBusinessAsset["company_name"] ='Assets used for '; + $bindBusinessAsset["company_name"] .=MYUITIL::findCompanyName($all_company_details,$businessAssetRow['company_id'],1); + $bindBusinessAsset["company_name"] .=' Business :'; + if(count($businessAssetRow['business_assets_details'])>0){ + $bindBusinessAsset['details']=ASSETSFORM::getBusinessAssetsDetails($businessAssetRow['business_assets_details']); + } + array_push($businessAssetResult,$bindBusinessAsset); + } + ?> +

Asset Details

+ 0){ ?> + +

+ + + + + + + + + + + + + + + + + + + +
AssetOwned ByDetailsMarket Value
+ + + +

Business asset is not available.

+ + + + + $oaRow) { + $otherAssetRow = json_decode($oaRow['processed_json'],true); + if(count($otherAssetRow['assets_details'])>0){ + $otherAssetResult=ASSETSFORM::getOthersAssetsDetails($otherAssetRow['assets_details']); + } + } + ?> +

Personal Assets

+ 0){ ?> + + + + + + + + + + + + + + + + + + + +
AssetOwned ByDetailsMarket Value
+ +

Personal asset is not available.

+ + + + + $iRow) { + $otherIcomeRow = json_decode($iRow['processed_json'],true); + if(strtoupper($otherIcomeRow['other_income'])=='YES' && count($otherIcomeRow['income_details'])>0){ + $otherIncomeResult=OTHERINCOMEFORM::getIncomeDetails($otherIcomeRow['income_details']); + } + } + ?> +

Other Income Details

+ 0){ ?> +

The below mentioned other source of income were shared :

+ + + + + + + + + + + + + + + + + +
Income TypeAmountFrequency
+ +

Other source of income is not available.

+ + + + + + $ibRow) { + $individualBankRow = json_decode($ibRow['processed_json'],true); + if(count($individualBankRow['banking_details'])>0){ + $getIndividualEachValues=BANKINGFORM::getIndividualBankingDetails($individualBankRow['banking_details']); + $bankingResult = array_merge($bankingResult,$getIndividualEachValues); + + } + } + // business banking + foreach($pd_processed_forms[21] as $rowKey=> $bbRow) { + $businessBankRow = json_decode($bbRow['processed_json'],true); + if(count($businessBankRow['banking_details'])>0){ + $getEachValues=BANKINGFORM::getBusinessBankingDetails($businessBankRow['banking_details']); + $bankingResult = array_merge($bankingResult,$getEachValues); + + } + } + ?> +

Banking Details

+ 0){ ?> +

Below bank account details were shared :

+ + + + + + + + + + + + + + + + + + + + + + + +
Account NameBank NameAccount TypeMain Business AccountOD / CC LimitVintage
+ +

Bank account details is not available.

+ + + + + + $elRow) { + $otherLoanRow = json_decode($elRow['processed_json'],true); + if(strtoupper($otherLoanRow['existing_loan'])=='YES' && count($otherLoanRow['loan_details'])>0){ + $existLoanResult=FINANCIALFORM::getOtherLoanDetails($otherLoanRow['loan_details']); + } + } + ?> +

Other Financial Information

+ 0){ ?> +

The below current loan obligations were shared :

+ + + + + + + + + + + + + + + + + + + + + + + +
Loan TypeAmountLoan Taken FromInstallment +
Tenure
+
(Original - Current = Elapsed)
+
Loan taken by
+ +
+ +

Current loan obligations is not available.

+ + + + + $fRow) { + $familyRow = json_decode($fRow['processed_json'],true); + if(array_key_exists('family_details',$familyRow) && count($familyRow['family_details'])>0){ + $familyResult=OTHERFAMILYFORM::getFamilyDetails($familyRow['family_details']); + } + } + ?> +

Other Family Details

+ 0){ ?> + $fmValue) { ?> +

+ + + + + + + + + + + + + + + + + + + +
Address of Residence
No.of Years Residing here
Ownership
No.of Family Members
+

Family of

+ + + + + + + + + + + + + + + + + + + +
NameRelationAgeEarning Status
+ + +

Other Family Members is not available.

+ + + + + $nrcRow) { + $neighbourRefRow = json_decode($nrcRow['processed_json'],true); + if(strtoupper($neighbourRefRow['check_type'])==0 && count($neighbourRefRow['neighbourhood_list'])>0){ + $existNeighRefCheck=NEIGHBOURREFERENCECHECKFORM::getNeighbourhoodDetails($neighbourRefRow['neighbourhood_list'],$pd_master_details[0]); + } + else if(strtoupper($neighbourRefRow['check_type'])==1 && count($neighbourRefRow['referencecheck_list'])>0){ + $existNeighRefCheck=NEIGHBOURREFERENCECHECKFORM::getReferenceDetails($neighbourRefRow['referencecheck_list'],$pd_master_details[0]); + } + } + ?> +

Neighbourhood / Reference Check

+ 0){ ?> +
    + +
  1. + +
+ +

Neighbourhood / Reference Check is not available.

+ + + + + \ No newline at end of file diff --git a/api/application/views/report_templates/JSONTOREPORT_karthick.php b/api/application/views/report_templates/JSONTOREPORT_karthick.php new file mode 100644 index 00000000..3263a816 --- /dev/null +++ b/api/application/views/report_templates/JSONTOREPORT_karthick.php @@ -0,0 +1,1433 @@ + + + + + + + + + + + + + + + + +
+
+
+
+ + + + +







"; + echo "
"; + echo "

PERSONAL DISCUSSION REPORT

"; + echo "
for the case of
"; + + echo "

".$pd_master_details[0]['title_name'].$pd_master_details[0]['main_applicant']."

"; + echo "
"; + echo "



"; + ?> + + + "; + echo ""; + echo ""; + echo ""; + echo ""; + echo ""; + ?> + +
PD Report Date ".$pd_master_details[0]['updatedon']."
PD Vist Date ".$pd_master_details[0]['scheduled_on']."
PD Initiated by ".$pd_master_details[0]['branch_name']." Branch
Loan Applicant ID ".$pd_master_details[0]['lender_applicant_id']."
Product ".$pd_master_details[0]['product_name']."
Customer Segment ".$pd_master_details[0]['customer_segment_name']."
+ + Loan Amount Applied For

"; + + echo "

+ + + + + + +
As Per PD Initiation As Per Loan Applicants during PD
Rs " . number_format($pd_master_details[0]['loan_amount']). ". ####
+

"; + echo "
"; + + + //####################General Section Statred######################## + $general_form = json_decode($pd_processed_forms[18][0]['processed_json'],true); + $persons_met = "Default"; + $all_company_details = null; + if(array_key_exists('companies',$general_form)) + { + $all_company_details = $general_form['companies']; + } + //echo MYUITIL::findCompanyName($all_company_details,2,1); + ?> +

General Section Information

+ + + + + +
Person(s) Met              $individual) + { + if($individual['is_person_met'] == true) + { + echo ($individual['applicant_title_name_master'] .$individual['pd_co_applicant_id_master']); + + foreach($general_form['company_with_relationships'] as $company_with_relationship) + { + if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name']) + { + //FInd Company Name from JSON + + + echo '
'.$company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name']; + } + } + + foreach($general_form['persons_with_relationships'] as $persons_with_relationship) + { + if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null) + { + echo '
'.$persons_with_relationship['relationship_master'] .' Of '.$persons_with_relationship['relation_to_master']; + //print_r($persons_with_relationship); + } + } + + + + } + } + ?> +
+ + +

Loan Applicants

+ + + + $individual) + { + + if($individual['is_applicant'] == true) + { + echo ""; + } + } + ?> + +
".$individual['applicant_title_name_master'].$individual['pd_co_applicant_id_master'].""; + + foreach($general_form['company_with_relationships'] as $company_with_relationship) + { + if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name']) + { + //FInd Company Name from JSON + + + print_r($company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name']); + } + } + + foreach($general_form['persons_with_relationships'] as $persons_with_relationship) + { + if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null) + { + echo "

"; + print_r($persons_with_relationship['relationship_master'] .' Of '.$persons_with_relationship['relation_to_master']); + //print_r($persons_with_relationship); + } + } + + echo "
+ +

PD Officer's Note (About General Section) :

+ + +

Location Details :

+ +

+

PD Officer's Note (About Location Details) :

+ + +
+

Loan Details :

+ +
+

PD Officer's Note (About Loan Details) :

+ + + + + $bRow) { + $businessRow = json_decode($bRow['processed_json'],true); + $companyList = MYUITIL::findCompanyName($all_company_details,$businessRow['company_id'],2); + //$companyList .=' The director details are as under :'; + $bindEachResult["company_name"]=$companyList; + // this is for partner details + if(array_key_exists('partners',$businessRow)){ + $bindEachResult["partner"]=Businessform::getPartnerDetails($businessRow['partners']); + } + else { + $getPartner=array(); + $bindEachResult["partner"]=$getPartner; + } + // this is for person with relationship + if(array_key_exists('persons_with_relationships',$businessRow)){ + $bindEachResult["family_members_involved"]=Businessform::getFamilyMemberDetails($businessRow['persons_with_relationships']); + } + else { + $getFamilyMembers=array(); + $bindEachResult["family_members_involved"]=$getFamilyMembers; + } + // this is for manufacturing activities + + if(array_key_exists('manufacturing_activity_details',$businessRow)){ + $bindEachResult['manufacturing'] = Businessform::getActivityDetails($businessRow['manufacturing_activity_details'],1); + } + else{ + $getManufacturingRow=array(); + $bindEachResult['manufacturing']=$getManufacturingRow; + } + // this is for retail activites + if(array_key_exists('retail_trading_activity_details',$businessRow)){ + $bindEachResult['retail'] = Businessform::getActivityDetails($businessRow['retail_trading_activity_details'],2); + } + else{ + $getRetailRow=array(); + $bindEachResult['retail']=$getRetailRow; + } + // this is for whole sale activites + if(array_key_exists('wholesale_trading_activity_details',$businessRow)){ + $bindEachResult['wholesale'] = Businessform::getActivityDetails($businessRow['wholesale_trading_activity_details'],3); + } + else{ + $getWholesaleRow=array(); + $bindEachResult['wholesale']=$getWholesaleRow; + } + + // this is for service provider + if(array_key_exists('service_provider_activity_details',$businessRow)){ + $bindEachResult['serviceprovider']=Businessform::getActivityDetails($businessRow['service_provider_activity_details'],4); + } + else{ + $getServiceproviderRow=array(); + $bindEachResult['serviceprovider']=$getServiceproviderRow; + } + // this is for other activity details + if(array_key_exists('others_activity_details',$businessRow)){ + $bindEachResult['otheractivity']=Businessform::getActivityDetails($businessRow['others_activity_details'],5); + } + else{ + $getOtheractivityRow=array(); + $bindEachResult['otheractivity']=$getOtheractivityRow; + } + // this if for get business peak period + if(strtoupper($businessRow['seasonality'])=='YES' && array_key_exists('peak_period_of_business',$businessRow)){ + $bindEachResult['business_peak_details']=Businessform::getBusinessPeakDetails($businessRow['peak_period_of_business']); + } + else{ + $bindEachResult['business_peak_details']='The Business has no major changes in sales across season.'; + } + // this is for no of employess details + $bindEachResult['company_empployees']='As per person met there are '.$businessRow['employees_permanent'].' permanent and '.$businessRow['employees_temporary'].' temporary employees with company.'; + $bindEachResult['officer_visit_company_empployees']='The PD Officer could notice approximately '.$businessRow['officer_total'] .' employees during the visit.'; + //this is documents visited + $getDocuments=array(); + if(array_key_exists('shop_eat_act_cert',$businessRow) && strtoupper($businessRow['shop_eat_act_cert'])=='YES'){ + array_push($getDocuments,'Shop/Est act Certificate.'); + } + if(array_key_exists('gst_Regn_cert',$businessRow) && strtoupper($businessRow['gst_Regn_cert'])=='YES'){ + array_push($getDocuments,'GST Registration.'); + } + if(array_key_exists('pf_regn',$businessRow) && strtoupper($businessRow['pf_regn'])=='YES'){ + array_push($getDocuments,'PF Registration.'); + } + if(array_key_exists('esic_regn',$businessRow) && strtoupper($businessRow['esic_regn'])=='YES'){ + array_push($getDocuments,'ESIC Registration.'); + } + if(array_key_exists('export_import_cert',$businessRow) && strtoupper($businessRow['export_import_cert'])=='YES'){ + array_push($getDocuments,'Export/Import Certificate.'); + } + if(array_key_exists('factory_cert',$businessRow) && strtoupper($businessRow['factory_cert'])=='YES'){ + array_push($getDocuments,'Factory Certificate.'); + } + if(strtoupper($businessRow['other_documents'])=='YES' && array_key_exists('documents',$businessRow)){ + foreach($businessRow['documents'] as $docValue){ + array_push($getDocuments,$docValue['document'].'.'); + } + } + $bindEachResult['visit_documents']=$getDocuments; + array_push($businessResult,$bindEachResult); + } + ?> +

Business Details

+ $fetchRow){ + ?> +

About Company :

+ +

The director details are as under :

+ + + + + + + + + + + + + + + + + + + + + + +
NameShare HoldingNo.of Years in Current BusinessTotal Work ExperiencePrevious Experience
+ + 0){ ?> +
+

Besides the above, the below family members are also involved in the business :

+
+ + + + + + + + + + + + + + + + + + + + +
NameRelationDesignationStarted Business
+ + + + + + + 0){ ?> +
+

The Manufacturing details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ProductsArea of SaleSales DoneMax Sales Done
+ +
+ + +
+ + + + + + + 0){ ?> +
+

The Retail Trading details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ProductsArea of SaleSales DoneMax Sales Done
+ +
+ + +
+ + + + + + + 0){ ?> +
+

The Service Provider details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ServicesArea of SaleServices AtMax Revenue From
+ +
+ + +
+ + + + + + + 0){ ?> +
+

The Wholesale Trading details are as under :

+
+ + + + + + + + + + + + + + + + + + + + +
ProductsArea of SaleSales DoneMax Sales Done
+ +
+ + +
+ + + + + + 0){ ?> +
+

Other activity details are as under :

+
+ + + + + + + + + + + + + + +
Other Business Activity
+ + + + + +

+ + + + +

+

+ + + + +

The below documents were sighted during the visit :

+
    + +
  1. + +
+ + + + + + + + + + + $baRow) { + $businessFinancialRow = json_decode($baRow['processed_json'],true); + // statement + if(strtoupper($businessFinancialRow['is_financial_statements'])=='YES' && count($businessFinancialRow['date_per_financial'])>0){ + $bindBusinessFinancial["company_name"] =MYUITIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1); + $bindBusinessFinancial["company_name"] .= count($businessFinancialRow['date_per_financial'])>1 ? ' provided with last '.count($businessFinancialRow['date_per_financial']).' years of financial statements and the snapshot is as below :' : ' we were provided with last '.count($businessFinancialRow['date_per_financial']).' year of financial statements and the snapshot is as below :'; + $bindBusinessFinancial['statements']=FINANCIALFORM::getBusinessFinancialDetails($businessFinancialRow['date_per_financial']); + } + else { + $bindBusinessFinancial["company_name"] =MYUITIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1); + $bindBusinessFinancial["company_name"] .=' not provided the financial statements :'; + $bindBusinessFinancial['statements']=array(); + } + // customer + if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && count($businessFinancialRow['estimated_value'])==0){ + $bindBusinessFinancial["financial_customer"] ="As per customers, the financials are as below :"; + $bindBusinessFinancial['customer_statements']=array(); + $bindBusinessFinancial['customer_statements_header']=array(); + } + else if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && count($businessFinancialRow['estimated_value'])>0){ + $bindBusinessFinancial["financial_customer"] ="As per customers, the financials are as below :"; + $bindBusinessFinancial['customer_statements']=FINANCIALFORM::getBusinessCustomerFinancialDetails($businessFinancialRow['estimated_value']); + $bindBusinessFinancial['customer_statements_header']=FINANCIALFORM::getBusinessCustomerHeader($businessFinancialRow['estimated_value']); + } + else { + $bindBusinessFinancial["financial_customer"] ="As per customers, the financials are same as financial statement."; + $bindBusinessFinancial['customer_statements']=array(); + $bindBusinessFinancial['customer_statements_header']=array(); + } + array_push($businessFinancialResult,$bindBusinessFinancial); + } + ?> +

Financial Information

+ 0){ ?> + +

+ 0){ ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + +
YearSalesNet ProfitNet Profit to Sales %Net LossNet Loss to Sales %% Variation in PY Sales% Variation in PY Profit
+ + +

+ 0){ ?> + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
+
+ + + + + +

Financial information is not available.

+ + + + + $cRow) { + $clientRow = json_decode($cRow['processed_json'],true); + + $bindEachResult["company_name"]=MYUITIL::findCompanyName($all_company_details,$clientRow['company_id'],1); + $getmanufacturing = array(); + $getTrading=array(); + $getService=array(); + $getTotalPaymentsPercentonCredit=array(); + if(array_key_exists('manufacturing_details',$clientRow)){ + foreach($clientRow['manufacturing_details'] as $manuRow){ + if(isset($manuRow['main_raw_materials'])){ + $getmanufacturing = array_map(function($tag) { + return array( + 'product' => $tag['manufacturing_product_name'], + 'client_name' => $tag['manufacturing_client_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['manufacturing_contact_person_name'], + 'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('manufacturing_payment_type_master',$tag) ? $tag['manufacturing_payment_type_master'] : '', + + ); + }, $manuRow['main_raw_materials']); + array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']); + + } + } + } + // this is for trading + if(array_key_exists('trade_details',$clientRow)){ + foreach($clientRow['trade_details'] as $tradeRow){ + + if(isset($tradeRow['trading_products'])){ + + $getTrading = array_map(function($tag) { + return array( + 'product' => $tag['trade_product_name'], + 'client_name' => $tag['trade_client_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['trade_product_contact_person_name'], + 'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'', + + ); + }, $tradeRow['trading_products']); + array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']); + + } + } + } + + //this is for service + if(array_key_exists('service_provider_details',$clientRow)){ + foreach($clientRow['service_provider_details'] as $serviceRow){ + + if(isset($serviceRow['service_products'])){ + + $getService = array_map(function($tag) { + return array( + 'product' => $tag['service_provider_product_name'], + 'client_name' => $tag['service_provider_client_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['service_provider_product_contact_person_name'], + 'contact_person_mobile_number' => $tag['service_provider_product_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('service_provider_product_payment_type_master',$tag) ? $tag['service_provider_product_payment_type_master'] :'', + + ); + }, $serviceRow['service_products']); + array_push($getTotalPaymentsPercentonCredit,$serviceRow['service_products_total_payments_percent_on_credit']); + + } + } + } + $bindEachResult["details"]=array_merge($getmanufacturing,$getTrading,$getService); + $bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit; + array_push($clientResult,$bindEachResult); + + } + + ?> +

Client Details

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Product/ServiceClientContactPayment
+
+
+
+ + + + + + $row) { + $clientRow = json_decode($row['processed_json'],true); + $bindEachResult["company_name"]=MYUITIL::findCompanyName($all_company_details,$clientRow['company_id'],1); + $getmanufacturing = array(); + $getTrading=array(); + $getTotalPaymentsPercentonCredit=array(); + foreach($clientRow['manufacturing_details'] as $manuRow){ + + if(isset($manuRow['main_raw_materials'])){ + $getmanufacturing = array_map(function($tag) { + return array( + 'product' => $tag['manufacturing_raw_material_name'], + 'supplier_name' => $tag['manufacturing_supplier_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['manufacturing_contact_person_name'], + 'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'], + 'payment_type_master' => $tag['manufacturing_payment_type_master'], + + ); + }, $manuRow['main_raw_materials']); + array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']); + + } + } + // this is for trading + foreach($clientRow['trade_details'] as $tradeRow){ + + if(isset($tradeRow['trading_products'])){ + + $getTrading = array_map(function($tag) { + return array( + 'product' => $tag['trade_product_name'], + 'supplier_name' => $tag['trade_supplier_name'], + 'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '', + 'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''), + 'contact_person_name' => $tag['trade_product_contact_person_name'], + 'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'], + 'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'', + + ); + }, $tradeRow['trading_products']); + array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']); + + } + } + $bindEachResult["details"]=array_merge($getmanufacturing,$getTrading); + $bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit; + array_push($supplierResult,$bindEachResult); + } + ?> +

Supplier Details

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Raw Material/TradingSupplierContactPayment
+
+
+
+ + + + + $stRow) { + $stockRow = json_decode($stRow['processed_json'],true); + $bindStockResult["company_name"]=MYUITIL::findCompanyName($all_company_details,$stockRow['company_id'],1); + // this is for stock manufacturing details + if(count($stockRow['manufacturing_details'][0]['manufacturing_raw_materials']) > 0 || count($stockRow['manufacturing_details'][0]['manufacturing_finished_goods']) > 0){ + $bindStockResult["manufacturing"]=Stockform::getStockManufacturingDetails($stockRow['manufacturing_details'][0]['manufacturing_raw_materials'], $stockRow['manufacturing_details'][0]['manufacturing_finished_goods']); + } + else { + $bindStockResult["manufacturing"]=array(); + } + // this is for stock retail details + if(count($stockRow['retail_details'][0]['retail_traded_goods']) > 0){ + $bindStockResult["retail"]=Stockform::getStockRetailDetails($stockRow['retail_details'][0]['retail_traded_goods']); + } + else { + $bindStockResult["retail"]=array(); + } + // this is for stock whole sale details + if(count($stockRow['trade_details'][0]['trading_traded_goods']) > 0){ + $bindStockResult["wholesale"]=Stockform::getStockWholesaleDetails($stockRow['trade_details'][0]['trading_traded_goods']); + } + else { + $bindStockResult["wholesale"]=array(); + } + array_push($stockResult,$bindStockResult); + } + ?> +

Stock Details

+ 0){ ?> + +

+ + 0) { ?> +

The Manufacturing stock details are as under :

+ + + + + + + + + + + + + + + + + + + + + + + +
TypeNameQtyUOMValueDetails
+ + + 0) { ?> +

The Retail trading stock details are as under :

+ + + + + + + + + + + + + + + + + + + + + +
NameQtyUOMValueDetails
+ + + 0) { ?> +

The Wholesale trading stock details are as under :

+ + + + + + + + + + + + + + + + + + + + + +
NameQtyUOMValueDetails
+ + + + +

Stock details is not available.

+ + + + + $baRow) { + $businessAssetRow = json_decode($baRow['processed_json'],true); + $bindBusinessAsset["company_name"] ='Assets used for '; + $bindBusinessAsset["company_name"] .=MYUITIL::findCompanyName($all_company_details,$businessAssetRow['company_id'],1); + $bindBusinessAsset["company_name"] .=' Business :'; + if(count($businessAssetRow['business_assets_details'])>0){ + $bindBusinessAsset['details']=ASSETSFORM::getBusinessAssetsDetails($businessAssetRow['business_assets_details']); + } + array_push($businessAssetResult,$bindBusinessAsset); + } + ?> +

Asset Details

+ 0){ ?> + +

+ + + + + + + + + + + + + + + + + + + +
AssetOwned ByDetailsMarket Value
+ + + +

Business asset is not available.

+ + + + + $oaRow) { + $otherAssetRow = json_decode($oaRow['processed_json'],true); + if(count($otherAssetRow['assets_details'])>0){ + $otherAssetResult=ASSETSFORM::getOthersAssetsDetails($otherAssetRow['assets_details']); + } + } + ?> +

Personal Assets

+ 0){ ?> + + + + + + + + + + + + + + + + + + + +
AssetOwned ByDetailsMarket Value
+ +

Personal asset is not available.

+ + + + + $iRow) { + $otherIcomeRow = json_decode($iRow['processed_json'],true); + if(strtoupper($otherIcomeRow['other_income'])=='YES' && count($otherIcomeRow['income_details'])>0){ + $otherIncomeResult=OTHERINCOMEFORM::getIncomeDetails($otherIcomeRow['income_details']); + } + } + ?> +

Other Income Details

+ 0){ ?> +

The below mentioned other source of income were shared :

+ + + + + + + + + + + + + + + + + +
Income TypeAmountFrequency
+ +

Other source of income is not available.

+ + + + + + $ibRow) { + $individualBankRow = json_decode($ibRow['processed_json'],true); + if(count($individualBankRow['banking_details'])>0){ + $getIndividualEachValues=BANKINGFORM::getIndividualBankingDetails($individualBankRow['banking_details']); + $bankingResult = array_merge($bankingResult,$getIndividualEachValues); + + } + } + // business banking + foreach($pd_processed_forms[21] as $rowKey=> $bbRow) { + $businessBankRow = json_decode($bbRow['processed_json'],true); + if(count($businessBankRow['banking_details'])>0){ + $getEachValues=BANKINGFORM::getBusinessBankingDetails($businessBankRow['banking_details']); + $bankingResult = array_merge($bankingResult,$getEachValues); + + } + } + ?> +

Banking Details

+ 0){ ?> +

Below bank account details were shared :

+ + + + + + + + + + + + + + + + + + + + + + + +
Account NameBank NameAccount TypeMain Business AccountOD / CC LimitVintage
+ +

Bank account details is not available.

+ + + + + + $elRow) { + $otherLoanRow = json_decode($elRow['processed_json'],true); + if(strtoupper($otherLoanRow['existing_loan'])=='YES' && count($otherLoanRow['loan_details'])>0){ + $existLoanResult=FINANCIALFORM::getOtherLoanDetails($otherLoanRow['loan_details']); + } + } + ?> +

Other Financial Information

+ 0){ ?> +

The below current loan obligations were shared :

+ + + + + + + + + + + + + + + + + + + + + + + +
Loan TypeAmountLoan Taken FromInstallment +
Tenure
+
(Original - Current = Elapsed)
+
Loan taken by
+ +
+ +

Current loan obligations is not available.

+ + + + + $fRow) { + $familyRow = json_decode($fRow['processed_json'],true); + if(array_key_exists('family_details',$familyRow) && count($familyRow['family_details'])>0){ + $familyResult=OTHERFAMILYFORM::getFamilyDetails($familyRow['family_details']); + } + } + ?> +

Other Family Details

+ 0){ ?> + $fmValue) { ?> +

+ + + + + + + + + + + + + + + + + + + +
Address of Residence
No.of Years Residing here
Ownership
No.of Family Members
+

Family of

+ + + + + + + + + + + + + + + + + + + +
NameRelationAgeEarning Status
+ + +

Other Family Members is not available.

+ + + + + $nrcRow) { + $neighbourRefRow = json_decode($nrcRow['processed_json'],true); + if(strtoupper($neighbourRefRow['check_type'])==0 && count($neighbourRefRow['neighbourhood_list'])>0){ + $existNeighRefCheck=NEIGHBOURREFERENCECHECKFORM::getNeighbourhoodDetails($neighbourRefRow['neighbourhood_list'],$pd_master_details[0]); + } + else if(strtoupper($neighbourRefRow['check_type'])==1 && count($neighbourRefRow['referencecheck_list'])>0){ + $existNeighRefCheck=NEIGHBOURREFERENCECHECKFORM::getReferenceDetails($neighbourRefRow['referencecheck_list'],$pd_master_details[0]); + } + } + ?> +

Neighbourhood / Reference Check

+ 0){ ?> +
    + +
  1. + +
+ +

Neighbourhood / Reference Check is not available.

+ + + + + + + + + \ No newline at end of file