From 05c01a552e556d4482e57a8e5a3838134e4dacfd Mon Sep 17 00:00:00 2001 From: Sanjeev Date: Thu, 11 Mar 2021 12:03:14 +0530 Subject: [PATCH] NBFC/MFI report changes : ps --- .../controllers/SMC_Credit_PD_Controller.php | 12 +- .../helpers/smc_creditpd_helper.php | 27 + .../models/SMC_Credit_PD_Model.php | 2 +- .../views/smc_creditpd_reports/MWISE2.php | 685 ++++++++++++++++++ 4 files changed, 721 insertions(+), 5 deletions(-) create mode 100644 api/application/views/smc_creditpd_reports/MWISE2.php diff --git a/api/application/controllers/SMC_Credit_PD_Controller.php b/api/application/controllers/SMC_Credit_PD_Controller.php index f361d9e2..0309b7f1 100644 --- a/api/application/controllers/SMC_Credit_PD_Controller.php +++ b/api/application/controllers/SMC_Credit_PD_Controller.php @@ -1464,7 +1464,6 @@ public function filterSalesPDList_post() { $records = $this->post('records'); $this->load->helper('smc_creditpd'); $this->load->helper('smcpdscore'); - // print_r($records); $view_data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($records['pd_id']); $view_data['applicant_details'] = $this->PD_Model->getApplicantsDetails($records['pd_id']); @@ -1477,7 +1476,6 @@ public function filterSalesPDList_post() { { foreach ($pd_section_data as $key => $value) { - if(isset($value['json']) && $value['json'] != '') { $value['json'] = smc_creditpd::getSMCCreditPDReportContent($value,$records['pd_id']); @@ -1536,8 +1534,14 @@ public function filterSalesPDList_post() { // echo $base64_pdscore_chart_url; // die(); //score card part - $html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true); - //echo $html_content;die(); + // print_r($view_data); + if($view_data['pd_master_details'][0]['fk_product_id'] == 25){ + $html_content = $this->load->view('smc_creditpd_reports/MWISE2',$view_data,true); + }else{ + $html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true); + } + + // echo $html_content;exit(); $pdf_name = $view_data['pd_master_details'][0]['main_applicant']; $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF diff --git a/api/application/helpers/smc_creditpd_helper.php b/api/application/helpers/smc_creditpd_helper.php index 45813168..1cd57ee0 100644 --- a/api/application/helpers/smc_creditpd_helper.php +++ b/api/application/helpers/smc_creditpd_helper.php @@ -58,6 +58,33 @@ class smc_creditpd $return_data = SELF::getNeibourSectionData($section); break; + case 21://General Section + $return_data = json_decode($section['json'],true); + break; + case 22://Profile + $return_data = json_decode($section['json'],true); + break; + case 23://Size and Geographical Reach + $return_data = json_decode($section['json'],true); + break; + case 24://Product and Process + $return_data = json_decode($section['json'],true); + break; + case 25://Portfolio Health + $return_data = json_decode($section['json'],true); + break; + case 26://Total Overall Debt/Equity Profile + $return_data = json_decode($section['json'],true); + break; + case 27://Financial Analysis + $return_data = json_decode($section['json'],true); + break; + case 28://Overall Plan of Action + $return_data = json_decode($section['json'],true); + break; + case 29://Validation Points vide Systems and Books at HQ & Branches + $return_data = json_decode($section['json'],true); + break; } // print_r($return_data);die(); diff --git a/api/application/models/SMC_Credit_PD_Model.php b/api/application/models/SMC_Credit_PD_Model.php index da6667bf..d98767d2 100644 --- a/api/application/models/SMC_Credit_PD_Model.php +++ b/api/application/models/SMC_Credit_PD_Model.php @@ -88,7 +88,7 @@ class SMC_Credit_PD_Model extends SPARQ_Model { } $joins = array( array('table'=>SMC_CREDIT_PD_SECTION_DATA." as SMC_CREDIT_PD_SECTION_DATA",'condition'=>"SMC_CREDIT_PD_SECTION_DATA.fk_form_id = SMC_PRODUCT_WISE_FORM_MAPPING.fk_form_id AND SMC_PRODUCT_WISE_FORM_MAPPING.fk_product_id = $product_id AND SMC_CREDIT_PD_SECTION_DATA.fk_pd_id = $pd_id and SMC_CREDIT_PD_SECTION_DATA.isactive = 1 " ,'jointype'=>'LEFT'), - array('table'=>SMC_CREDIT_PD_FORMS." as SMC_CREDIT_PD_FORMS",'condition'=>"SMC_PRODUCT_WISE_FORM_MAPPING.fk_form_id = SMC_CREDIT_PD_FORMS.form_id" ,'jointype'=>'INNER JOIN') + array('table'=>SMC_CREDIT_PD_FORMS." as SMC_CREDIT_PD_FORMS",'condition'=>"SMC_PRODUCT_WISE_FORM_MAPPING.fk_form_id = SMC_CREDIT_PD_FORMS.form_id AND SMC_CREDIT_PD_FORMS.isactive = 1 " ,'jointype'=>'INNER JOIN') ); $where_condition_array = array('SMC_PRODUCT_WISE_FORM_MAPPING.isactive' => 1,'SMC_PRODUCT_WISE_FORM_MAPPING.fk_product_id' => $product_id); return diff --git a/api/application/views/smc_creditpd_reports/MWISE2.php b/api/application/views/smc_creditpd_reports/MWISE2.php new file mode 100644 index 00000000..5e137a54 --- /dev/null +++ b/api/application/views/smc_creditpd_reports/MWISE2.php @@ -0,0 +1,685 @@ +↑'; + $downarrow = ''; + $dash = ' '; + // $product_name = $master[0]['abbr']; + $rupee_symbol = ""; + //print_r($master[0]['abbr']);die(); +?> + + + + + + + + + + + + + +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + '; + } + + $ownership_type = ''; + if( isset($pd_section_data[8]['business_ownership_type']) && (strtolower($pd_section_data[8]['business_ownership_type'])) == 'owned') + { + $ownership_type = '( Owned )'; + } + else if(isset($pd_section_data[8]['business_ownership_type']) && (strtolower($pd_section_data[8]['business_ownership_type'])) == 'rented') + { + $ownership_type = ' ( Rented ) - Rent paid '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pd_section_data[8]['business_monthly_rented_amt']); + } + + echo ''; + if(isset($pd_section_data[8]['is_business_address']) && strtolower($pd_section_data[8]['is_business_address']) == 'yes') + { + echo ''; + } + echo ''; + echo ''; + echo ''; + echo ''; + } + ?> + + +
Personal Discussion Sheet -
Application ID
Name of the Company/Firm
Name of Person Met During Visit and Contact Number
CityStatePIN
Actual PD Address '.$pd_section_data[2]['alternative_address'].'
Address Type / Ownership '.$pd_section_data[2]['address_type']['address_type'].$ownership_type.'
Period for which business has been
in operation from this address
'.($pd_section_data[8]['business_years'].' Year(s)'.(isset($pd_section_data[8]['business_months']) && $pd_section_data[8]['business_months'] != '' ? ' & ' . $pd_section_data[8]['business_months'] .' Month(s)': '')).'
PD locality '.$pd_section_data[2]['pd_locality']['locality_name'].'
Location Approach '.$pd_section_data[2]['pd_location']['description'].'
Comment On Locality '.$pd_section_data[2]['comment_locality']['rating'].'
Estimated Area of Business Premise '.$pd_section_data[2]['business_estimated_area'].' '.$pd_section_data[2]['uom'].'
+ + +

+
Satellite Image of PD Location

+

GPS Coordinates of location where PD Visit was done :

+ + PD Visted Location Satellite Image + Due to location access not provided by loan applicant Geo coordinates on photographs and Satellite image of PD location is not shown

';} + ?> +
+ +
+ + + + + + + + + + '; + } + else { + echo ''; + } + ?> + + +
General Section
NameLoan AmountProductLocation
'.$pd_section_data['21']['name'].''.$pd_section_data['21']['loan_amount'].''.$pd_section_data['21']['product'].''.$pd_section_data['21']['location'].'
General Section Not Available
+

+
+ + + + + + + + + + + + + + '; + } + else { + echo ''; + } + + ?> + +
Profile
History &  Vintage and  Lineage Primary shareholding , promoters  and major   equity  partnersThe  capital  structure and details of  the  various  investments vehicles
'.$pd_section_data['22']['history_vintage'].''.$pd_section_data['22']['primary_partners'].''.$pd_section_data['22']['capital_details'].'
Profile Not Available
+

+
+ + + + + + + + + + + + '; + ?> + + + + + + + + + + + + '; + } + else { + echo ''; + } + ?> + + +
Size and Geographical Reach
AUM  (  off book  &  on book  ) &e. Trend of Disbursement in last 2 quartersStates  and geographical  regions & Branches  &  geographical  customer base
'.$pd_section_data['23']['aum_book'].''.$pd_section_data['23']['geographical_details'].'
Branches /employees / structurePortfolio concentration and Cuts to be discussedWho are the competitors to the businessEstimated Market Size of the Business& Market share
'.$pd_section_data['23']['branches_employees'].''.$pd_section_data['23']['portfolio_concentration'].''.$pd_section_data['23']['business_competitors'].''.$pd_section_data['23']['estimated_market'].'
Size and Geographical Reach Not Available
+ + +
+ + + + + + + + + + + + + + + + + '; + ?> + + + + + + + + + + + + '; + } + else { + echo ''; + } + + ?> + +
Product  &  Processes
ProductsPoliciesCredit  appraisal mechanismTechnology and  usage  for    acquisition and  credit
'.$pd_section_data['24']['products'].''.$pd_section_data['24']['policies'].''.$pd_section_data['24']['credit_appraisal'].''.$pd_section_data['24']['technology_credit'].'
Collection policy and   mechanism -Collection efficiency trends in last 12 months (CC/CD, TC/CD,TC/TD) any deviation to be discussed in detail Provisioning policy Restructuring policy Covid  impact and policy
'.$pd_section_data['24']['collection_policy'].''.$pd_section_data['24']['provisioning_policy'].''.$pd_section_data['24']['restructuring_policy'].''.$pd_section_data['24']['covid_policy'].'
Product  &  Processes Not Available
+ +
+
+ + + + + + + + + + + + + + + + + + + + + '; + } + else { + echo ''; + } + + ?> + +
Portfolio Health
Par  own book /Par off  book -dNPAs/Provisioning & resolution strategyStrategy to manage flow as well as  post moratorium stressStrategy  for non-paying customersPAR (Productwise)/Net NPAs/Write offs Movement of Bucket ,PAR 90+
'.$pd_section_data['25']['par_book'].''.$pd_section_data['25']['provisioning_resolution'].''.$pd_section_data['25']['post_morotorium'].''.$pd_section_data['25'][' non-paying_customers'].''.$pd_section_data['25']['par'].'
Portfolio Health Not Available
+ +
+
+ + + + + + + + + + + + + + + + + '; + } + else { + echo ''; + } + + ?> + +
Total Overall Debt/Equity Profile
Types of debt structures and  major debt providersFuture plan for additional funding Funding received during covid times including liquidity  support  from  DFIs & BanksFresh sanctions lined up in the  present month and coming quarters
'.$pd_section_data['26']['dept_structures'].''.$pd_section_data['26']['future_plan'].''.$pd_section_data['26']['dfi_banks'].''.$pd_section_data['26']['fresh_sanctions'].'
Total Overall Debt/Equity Profile Not Available
+ +
+
+ + + + + + + + + + + + + + + + + + + + ';?> + + + + + + + + + + + + + + + '; + } + else { + echo ''; + } + + ?> + +
Financial  analysis
CAR (Tier-1)/CAR (Tier-1 + Tier-2)Leverage (D/E) (excluding Managed)ALMOpexNIM (%) - as per Audited B/SOpex (% of Avg. Book)
'.$pd_section_data['27']['car_type'].''.$pd_section_data['27']['leverage'].''.$pd_section_data['27']['alm'].''.$pd_section_data['27']['opex'].''.$pd_section_data['27']['nim'].''.$pd_section_data['27']['opex_average'].'
Opex (% of NII)Return on AssetsReturn on EquityIRR (Derived)Avg. Borrowing Cost (Derived)Spread (Derived)
'.$pd_section_data['27']['opex_nii'].''.$pd_section_data['27']['return_asset'].''.$pd_section_data['27']['return_equity'].''.$pd_section_data['27']['irr'].''.$pd_section_data['27']['avg_borrowing'].''.$pd_section_data['27']['spread'].'
Financial  analysis Not Available
+
+
+ + + + + + + + + + '; + } + else { + echo ''; + } + ?> + +
Overall Plan of Action
Future plan on  expansion  geographies wise , products and regions . Equity  and debt structuring as well as  dilution in future. Target book for the present quarter and  YOY   projections
'.$pd_section_data['28']['future_plan'].'
Overall Plan of Action Not Available
+ +
+
+ + + + + + + + + + + + + + + + + + + + ';?> + + + + + + + + + + + + + + + + + '; + } + else { + echo ''; + } + ?> + +
Validation Points vide Systems and Books at HQ & Branches
Stock to be validated from systemCollateral coverage for existing borrowing ( System Mapping to be checked)Collection efficiency and system flagging to be counterchecked and same with PAR cutsSample check of loan dox, application form along with PAN for Active loan accountsDisbursement no to be checked from systemTop 20 exposure to be checked with data submitted
'.$pd_section_data['29']['stock_validated'].''.$pd_section_data['29']['collateral_coverage'].''.$pd_section_data['29']['collection_efficiency'].''.$pd_section_data['29']['loan_dox'].''.$pd_section_data['29']['disbursement'].''.$pd_section_data['29']['top20_exposure'].'
Sample Sanction letters to validate collateral cover stipulated for existing BorrowingProvisioning /Write-off/NPA flagging to be counter checkedRestructuring of Loans in system on sample basisEMI cycle date in systemCash and Bank ledger to be checkedFree FD details to be taken and validated from Accounting systemApplication/Systems used for Boarding /Loan management
'.$pd_section_data['29']['sanction_letters'].''.$pd_section_data['29']['provisioning'].''.$pd_section_data['29']['restructuring_loan'].''.$pd_section_data['29']['emi_date'].''.$pd_section_data['29']['cash_checked'].''.$pd_section_data['29']['fd_details'].''.$pd_section_data['29']['loan_management'].'
Validation Points vide Systems and Books at HQ & Branches Not Available
+
+ + + + + + 'Others','2' => 'Rude','3' => 'Polite'); + $over_all = array('2' => 'Positive','3' => 'Negative'); + ?> + + + + $val) + { $reason .= ($key + 1).' '.$val['reason'].'
'; } + ?> + + '; + + } } else{ + echo ''; + }?> +
Final Remarks of PD officer
Customer Behaviour + [Polite / Rude / Others (Please specify)]
PD Officer's overall assessment + (Positive / Negative)
PD Officer's key points considered while arriving at the aforementioned status
Remarks'.$pd_section_data[19]['final_form_remarks'] .'
Final Remarks of PD officer Not Available
+ 'Selfie with person met','person_met_id_proof' => 'Person met ID Proof','approach_to_pd_location' => 'Approach to pd location','name_board_seen' => 'Name board seen', 'stock_image' => 'Stock image','supplier_image' => 'Supplier Bills','client_image' => 'Client Bills','machinary_image' => 'Machinary Image'); + // if($master[0]['sales_pd_type'] == 2){ $photo_names['selfie_with_person_met'] = 'Selfie of the person contacted';} + // echo count($smc_images);die(); + //print_r(array_keys($section9));die(); + $tot_rows = ceil(count($smc_images) / 3); +if(count($smc_images)) + { + echo '
'; + echo '
Photograph`s

'; + + $add_factor = 0; + for($row = 0;$row < $tot_rows; $row++) + { + echo ''; + + $from = $row == 0 ? $row : ($row+$add_factor); + $to = ($from + 2); + $add_factor = $add_factor + 2; + for($i = $from ; $i <= $to; $i++) + { + + if(isset($smc_images[$i])) + { + + echo ''; + } + + //unset($p_key); + } + echo ''; + } + echo '
'.$smc_images[$i]['img_name'].'
'.$photo_names [ $smc_images[$i]['img_name'] ].'
'; + }?> + + + +

+ + + + + + + + + + + + + +
Name of Credit Manager
Date of PD Visit
+ + + + + + \ No newline at end of file