From 8255acfab203351e85c3418ca46590145a952643 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Wed, 18 Nov 2020 13:51:38 +0530 Subject: [PATCH] SMC REPORT FIRST FULL --- .../controllers/SMC_Credit_PD_Controller.php | 6 +- .../helpers/smc_creditpd_helper.php | 203 ++++++++++++++- .../views/smc_creditpd_reports/MWISE.php | 242 ++++++++++++++++++ 3 files changed, 435 insertions(+), 16 deletions(-) diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index 75f3aedd..4d1b3908 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1438,7 +1438,7 @@ public function filterSalesPDList_post() { $view_data['applicant_details'] = $this->PD_Model->getApplicantsDetails($records['pd_id']); $pd_section_data = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,'fk_pd_id' => $records['pd_id']),SMC_CREDIT_PD_SECTION_DATA,array(),'','fk_form_id','ASC'); // print_r ($view_data['pd_master_details']);die(); - + // print_r($pd_section_data[12]);die(); if(count($pd_section_data)) { foreach ($pd_section_data as $key => $value) @@ -1448,7 +1448,7 @@ public function filterSalesPDList_post() { //die(); } } - // print_r($view_data['pd_section_data'][11]);die(); + // print_r($view_data['pd_section_data'][18]);die(); $html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true); // echo $html_content;die(); @@ -1457,7 +1457,7 @@ public function filterSalesPDList_post() { //End of PDF Gen using DOM PDF $output_file = $this->external_path ."/pd_reports/" . $records['pd_id'] . "/temp.pdf"; $bytes = file_put_contents($output_file, $pdf_doc); - + // echo $bytes;die(); $bucket_name = LENDER_BUCKET_NAME_PREFIX.(ENVIRONMENT == 'production' ? 7 : 35); $key = 'pd'.$records['pd_id'].'/pd_reports/'.$pdf_name.'.pdf'; $bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$output_file); diff --git a/api/application/helpers/smc_creditpd_helper.php b/api/application/helpers/smc_creditpd_helper.php index 1fcbf0f1..47558d1e 100644 --- a/api/application/helpers/smc_creditpd_helper.php +++ b/api/application/helpers/smc_creditpd_helper.php @@ -20,19 +20,37 @@ class smc_creditpd case 5://Key Stakeholders case 6://bbusiness brief case 7://emp strength + case 9://banking case 10://finance - - case 12://client + case 14://future case 16://other family + case 18://credit + + case 19://final remarks $return_data = json_decode($section['json'],true); break; case 8://assest $return_data = SELF::getAssestSectionData($section); break; - // case 11://supplier - // $return_data = SELF::getSupplierSectionData($section); - // break; + case 11://supplier + $return_data = SELF::getSupplierSectionData($section); + break; + case 12://client + $return_data = SELF::getClientSectionData($section); + break; + + case 13://stock + $return_data = SELF::getStockSectionData($section); + break; + + case 15://existing loan + $return_data = SELF::getExistingLoanSectionData($section); + break; + + case 17://neighborhood + $return_data = SELF::getNeibourSectionData($section); + break; } return $return_data; @@ -102,6 +120,8 @@ class smc_creditpd static function getSupplierSectionData($section) { $json = json_decode($section['json'],true); + $payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided'); + // print_r($json);//die(); $header_row = ''.' Particulars '; $first_row = ''.' Item Purchased '; $second_row = ''.' Contact Person '; @@ -110,17 +130,18 @@ class smc_creditpd $five_row = ''.' Payment Terms '; $siz_row = ''.' Payment Mode '; $seven_row = ''.' No of days credit '; - foreach ($json['business_assets_details'] as $key => $value) + foreach ($json['supplier_details'] as $key => $value) { - $header_row .= ''.$value['supplier_name'].''; + + $header_row .= 'Supplier '.$value['supplier_name'].''; $first_row .= ''. $value['provider_name'] .''; $second_row .= ''. $value['contact_person_name'] .''; - $third_row .= ' '. $value['business_ownership_type'] .' '; - $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA'); - $fourth_row .= ' '. $value['contact_person_mobile_no'] .' '; - $five_row .= ' '. (isset($value['person_landline']) ? $value['person_landline'] : 'NA') .' '; - $siz_row .= ' '. (isset($value['payment_type']) ? $value['payment_type'] : 'NA') .' '; - $seven_row .= ' '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' '; + $third_row .= ' '. $value['contact_person_mobile_no'] .' '; + // $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA'); + $fourth_row .= ' '. $value['person_stdcode'].' - '.$value['person_landline'] .' '; + $five_row .= ' '. (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: 'NA') .' '; + $siz_row .= ' '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' '; + $seven_row .= ' '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' '; } $header_row .= ''; $first_row .= ''; @@ -129,8 +150,164 @@ class smc_creditpd $fourth_row .= ''; $five_row .= ''; $siz_row .= ''; + $seven_row .= ''; $json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row); + return $json; + } + + + static function getClientSectionData($section) + { + $json = json_decode($section['json'],true); + $payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided'); + // print_r($json);die(); + $header_row = ''.' Particulars '; + $first_row = ''.' Product/ Service '; + $second_row = ''.' Contact Person '; + $third_row = ''.' Mobile Number '; + $fourth_row = ''.' Landline No '; + $five_row = ''.' Payment Terms '; + $siz_row = ''.' Payment Mode '; + $seven_row = ''.' No of days credit '; + foreach ($json['client_details'] as $key => $value) + { + + $header_row .= 'Client '.$value['client_name'].''; + $first_row .= ''. $value['provider_name'] .''; + $second_row .= ''. $value['contact_person_name'] .''; + $third_row .= ' '. $value['contact_person_mobile_no'] .' '; + // $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA'); + $fourth_row .= ' '. $value['person_stdcode'].' - '.$value['person_landline'] .' '; + $five_row .= ' '. (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: 'NA') .' '; + $siz_row .= ' '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' '; + $seven_row .= ' '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' '; + } + $header_row .= ''; + $first_row .= ''; + $second_row .= ''; + $third_row .= ''; + $fourth_row .= ''; + $five_row .= ''; + $siz_row .= ''; + $seven_row .= ''; + + $json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row); + return $json; + } + + + static function getStockSectionData($section) + { + + $json = json_decode($section['json'],true); + $CI =&get_instance(); + $CI->load->model('PD_Model'); + $uom_master = $CI->PD_Model->selectCustomRecords(array('*'),array('isactive' => 1),UOM); + // print_r($json);die(); + + foreach ($json['stock_details'] as $key => $value) + { + if(isset($value['estimated_uom'])) + { + //echo $value['estimated_uom'];die(); + foreach ($uom_master as $m_key => $mvalue) + { + if($value['estimated_uom'] == $mvalue['uom_id']) + { $json['stock_details'][$key]['estimated_uom'] = $mvalue['name'];break; } + } + } + } + //echo 'asfter'; + // print_r($json);die(); + return $json; + } + + static function getExistingLoanSectionData($section) + { + $json = json_decode($section['json'],true); + $payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided'); + // print_r($json);die(); + $header_row = ''.' Particulars '; + $first_row = ''.' Loan Type '; + $second_row = ''.' Loan Amount '; + $third_row = ''.' Availed From '; + $fourth_row = ''.' Borrower`s Name '; + $five_row = ''.' Instalment Amount (Rs) '; + $siz_row = ''.' Original Tenure (Mnts) '; + $seven_row = ''.' Elapsed Tenure (Mnts) '; + $eight_row = ''.' Balance Tenure (Mnts) '; + foreach ($json['existing_loan_details'] as $key => $value) + { + + $header_row .= 'Loan '.($key + 1).''; + $first_row .= ''. $value['loan_type'] .''; + $second_row .= ''. $value['loan_amount'] .''; + $third_row .= ' '. $value['loan_taken_by'] .' '; + // $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA'); + $fourth_row .= ' '. $value['lender_name'] .' '; + $five_row .= ' '. (isset($value['instalment_amount']) ? $value['instalment_amount'] : 'NA') .' '; + $siz_row .= ' '. (isset($value['original_tenure_months']) ? $value['original_tenure_months'] : 'NA') .' '; + $seven_row .= ' '. (isset($value['elapsed_tenure_months']) ? $value['elapsed_tenure_months'] : 'NA') .' '; + $eight_row .= ' '. (isset($value['current_tenure_months']) ? $value['current_tenure_months'] : 'NA') .' '; + } + $header_row .= ''; + $first_row .= ''; + $second_row .= ''; + $third_row .= ''; + $fourth_row .= ''; + $five_row .= ''; + $siz_row .= ''; + $seven_row .= ''; + $eight_row .= ''; + + $json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row,'eight_row' => $eight_row); + return $json; + } + + static function getNeibourSectionData($section) + { + $json = json_decode($section['json'],true); + $payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided'); + // print_r($json);die(); + // $header_row = ''.' Particulars '; + $first_row = ''.' Name & brief of Person
with whom check done '; + $second_row = ''.' Does the person met
know who operates this business? +(Yes / NO) '; + $third_row = ''.' As per person met, how long has the applicants`
business been running from this location '; + $fourth_row = ''.' Any other remarks '; + $five_row = ''.' Neighbourhood Check
Positive / Negative / Could not verify '; + // $siz_row = ''.' Payment Mode '; + // $seven_row = ''.' No of days credit '; + $colspan = 0; + foreach ($json['neighbourhood_list'] as $key => $value) + { + + // $header_row .= 'Client '.$value['client_name'].''; + $first_row .= ''. $value['neighbourhood_name'] .''; + $second_row .= ''. ucfirst($value['know_business_operation']) .''; + $time = isset($value['how_long_do_know_in_year']) ? $value['how_long_do_know_in_year'].'Yr(s)' : '';$time .= (isset($value['how_long_do_know_in_month']) && $value['how_long_do_know_in_month'] != 0 ? (' & '.$value['how_long_do_know_in_month'].' Mnt(s)'): ''); + $time = empty($time) ? '-' : $time; + $third_row .= ' '. $time .' '; + $colspan++; + // $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA'); + // $fourth_row .= ' '. $value['how_long_do_know_in_year'].' - '.$value['how_long_do_know_in_month'] .' '; + // $five_row .= ' '. (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: 'NA') .' '; + // $siz_row .= ' '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' '; + // $seven_row .= ' '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' '; + } + // $header_row .= ''; + $first_row .= ''; + $second_row .= ''; + $third_row .= ''; + $fourth_row .= ''.$json['neighbourhood_status'].''.''; + $five_row .= ''.$json['neighbourhood_remarks'].''.''; + + // $siz_row .= ''; + // $seven_row .= ''; + + $json['display_data'] = array('first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row); + return $json; } diff --git a/api/application/views/smc_creditpd_reports/MWISE.php b/api/application/views/smc_creditpd_reports/MWISE.php index 4d4455d4..4b08ef18 100644 --- a/api/application/views/smc_creditpd_reports/MWISE.php +++ b/api/application/views/smc_creditpd_reports/MWISE.php @@ -550,8 +550,250 @@ defined('BASEPATH') OR exit('No direct script access allowed'); --> + + +
Supplier Details
+ + + + + + + + + + + + + + + + + +
+
+ + +
Client Details
+ + + + + + + + + + + + + + + + + +

+ + + + + + + + + + + + + + $section13_value) + { + echo ''. + // ''. + ''. + ''. + ''.''; + + + } + if(isset($pd_section_data[13]['estimated_uom'])) + { + + echo ''; + echo ''; + } + } + + ?> +
Details of Stock Sighted during the PD visit
Sr. No.Stock ItemApprox Stock Value (Rs)Approx Stock Quantity
'.($section13_key + 1) .''.$section13_value['provider_name'].''.$section13_value['provider_name'].''.(isset($section13_value['estimated_stock_value']) ? $section13_value['estimated_stock_value'] : 'NA').''.(isset($section13_value['estimated_quantity']) ? $section13_value['estimated_quantity'].' '.$section13_value['estimated_uom'] : 'NA').'
Does stock sighted justify the business operations ? (Yes / No)'.( ucfirst($pd_section_data[13]['estimated_uom']) ) .'
+
+ + + + + + + + + + +
Future Plans & Business Environment
USP of the business (How applicant’s business is different from others in the business)
Future plan for business expansion
Key competitors in the business
Succession Plan for business
Brief of other group concerns/ +Business run by the applicant
+
+ + + + + + + + + + + + + + $section9_value) + { + $vintage = $section9_value['vintage_year'].'Yr(s)'; + $vintage .= (isset($section9_value['vintage_month']) && $section9_value['vintage_month'] != 0 ? (' & '.$section9_value['vintage_month'].'Mt(s)') : ''); + echo ''. + // ''. + ''. + ''. + ''. + // ''. + ''.''; + + + } + // if(isset($pd_section_data[13]['estimated_uom'])) + // { + + // echo ''; + // echo ''; + // } + } + + ?> +
Business Banking & Personal Banking
Sr. No.Account Holder's NameBank NameAccount TypeVintage
'.($section9_key + 1) .''.$section13_value['provider_name'].''.$section9_value['applicant_name'].''.(isset($section9_value['bank_name']) ? $section9_value['bank_name'] : 'NA').''.(isset($section9_value['account_type']) ? $section9_value['account_type'] : 'NA').''.(isset($section14_value['estimated_quantity']) ? $section14_value['estimated_quantity'].' '.$section14_value['estimated_uom'] : 'NA').''.$vintage.'
Does stock sighted justify the business operations ? (Yes / No)'.( ucfirst($pd_section_data[13]['estimated_uom']) ) .'
+
+ + +
Existing Loan Obligations
+
+ + + + + + + + + + + + + + + + + + +
+
+ + +
Neighbour Details
+ + + + + + + + + + + + + +
+
+ + + + + + + + + + $section18_value) + { + + + echo ''. + // ''. + ''.''; + + + } + // if(isset($pd_section_data[13]['estimated_uom'])) + // { + + // echo ''; + // echo ''; + // } + } + + ?> +
Credit Manager Specific Queries
QuestionAnswer
'.$section18_value['question'] .''.$section13_value['provider_name'].''.$section18_value['answer'].'
Does stock sighted justify the business operations ? (Yes / No)'.( ucfirst($pd_section_data[13]['estimated_uom']) ) .'
+
+ + + + + + 'Others','2' => 'Rude','3' => 'Polite'); +$over_all = array('2' => 'Positive','3' => 'Negative'); +?> + + + + + + $val) + { $reason .= ($key + 1).' '.$val['reason'].'
'; } + ?> + + +
Final Remarks of PD officer
Customer Behaviour +[Polite / Rude / Others (Please specify)]
Suitability of Business Location +[Well Suited / Fairly Suited / Not Suited]
PD Officer's overall assessment +(Positive / Negative)
PD Officer's key points considered while arriving at the +aforementioned status