From d1e409b1f832ff7361782971c0b9281cbe0981d8 Mon Sep 17 00:00:00 2001 From: Sanjeev Date: Thu, 25 Mar 2021 11:45:41 +0530 Subject: [PATCH] PDscorecard helper file : ps --- api/application/helpers/pdscore_helper.php | 46 ++++++++++++++++------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/api/application/helpers/pdscore_helper.php b/api/application/helpers/pdscore_helper.php index 4d030576..88970589 100644 --- a/api/application/helpers/pdscore_helper.php +++ b/api/application/helpers/pdscore_helper.php @@ -10,8 +10,7 @@ class PDSCORE //FULL PD SCORE CALCUALTIONS public static function genericDIPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details) { - //echo 'RRRRR';die(); - //print_r($personal_asset_grid);die();echo "###################"; + // print_r($personal_asset_grid);die();echo "###################"; ############ GENERIC SE-DI CASES ####################### ############ SCROE VARIABLES DECLERATIONS ############## @@ -104,6 +103,12 @@ class PDSCORE $general_distribute_level_weightage += $neibourhood_check_as_per_pd_officer_L2; } + //CFPL means have to distribute the other asset value to $general_distribute_level_weightage + if($pd_master_details[0]['lender_short_name'] == 'CFPL'){ + $general_distribute_level_weightage += $value_of_other_assets_L2; + } + + //End of General Section L2 Weightage Distribution section @@ -216,7 +221,7 @@ class PDSCORE //######1.9 value of assets as a % of Loan Amount //print_r($personal_asset_grid); - + if($pd_master_details[0]['lender_short_name'] != 'CFPL'){ $value_of_other_assets_L2 = $general_distribute_level_weightage ? ($value_of_other_assets_L2 + ($value_of_other_assets_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $value_of_other_assets_L2; $asset_calculation_details = array(); @@ -273,6 +278,7 @@ class PDSCORE // echo "final_asset_score--".$final_asset_score; // die(); $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'],'attributed_score' => ($final_asset_attributed_score), 'max_score' => ((($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10)),'score_band'=> $final_asset_score,'max_score_band' => 10); + } /*-----------END OF GENERAL SECTION -----------*/ @@ -584,8 +590,9 @@ class PDSCORE } $score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => (($overall_actual_score/$overall_max_score) * 100)); - + if($pd_master_details[0]['lender_short_name'] != 'CFPL'){ $score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details; + } //print_r($score_questions);die(); return ($score_questions); @@ -694,7 +701,9 @@ class PDSCORE } //End of General Section L2 Weightage Distribution section - + if($pd_master_details[0]['lender_short_name'] == 'CFPL'){ + $general_distribute_level_weightage += $value_of_other_assets_L2; + } //######1.7 otp_done if($pd_master_details[0]['is_otp_enabled'] == 1) @@ -805,7 +814,7 @@ class PDSCORE //######1.9 value of assets as a % of Loan Amount //print_r($personal_asset_grid); - + if($pd_master_details[0]['lender_short_name'] != 'CFPL'){ $value_of_other_assets_L2 = $general_distribute_level_weightage ? ($value_of_other_assets_L2 + ($value_of_other_assets_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $value_of_other_assets_L2; $asset_calculation_details = array(); @@ -863,7 +872,7 @@ class PDSCORE // die(); $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'],'attributed_score' => ($final_asset_attributed_score), 'max_score' => ((($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10)),'score_band'=> $final_asset_score,'max_score_band' => 10); - + } /*-----------END OF GENERAL SECTION -----------*/ /*-----------FINAL REMARKS SECTION -----------*/ @@ -1170,8 +1179,9 @@ class PDSCORE } $score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => (($overall_actual_score/$overall_max_score) * 100)); - + if($pd_master_details[0]['lender_short_name'] != 'CFPL'){ $score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details; + } //print_r($score_questions);die(); return ($score_questions); @@ -1284,6 +1294,11 @@ class PDSCORE // $general_distribute_level_weightage += $neibourhood_check_as_per_pd_officer_L2; // } + + if($pd_master_details[0]['lender_short_name'] == 'CFPL'){ + $general_distribute_level_weightage += $value_of_other_assets_L2; + } + //End of General Section L2 Weightage Distribution section @@ -1396,7 +1411,7 @@ class PDSCORE //######1.9 value of assets as a % of Loan Amount //print_r($personal_asset_grid); - + if($pd_master_details[0]['lender_short_name'] != 'CFPL'){ $value_of_other_assets_L2 = $general_distribute_level_weightage ? ($value_of_other_assets_L2 + ($value_of_other_assets_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $value_of_other_assets_L2; $asset_calculation_details = array(); @@ -1453,7 +1468,7 @@ class PDSCORE // echo "final_asset_score--".$final_asset_score; // die(); $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'],'attributed_score' => ($final_asset_attributed_score), 'max_score' => ((($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10)),'score_band'=> $final_asset_score,'max_score_band' => 10); - + } /*-----------END OF GENERAL SECTION -----------*/ @@ -1755,10 +1770,15 @@ class PDSCORE } $score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => (($overall_actual_score/$overall_max_score) * 100)); - + if($pd_master_details[0]['lender_short_name'] != 'CFPL'){ $score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details; - //print_r($score_questions);die(); - return ($score_questions); + } + //else{ + // unset($score_questions['general']['value_of_other_assets']); + // unset($score_questions['score_summary']['asset_calculation_details']); + // } + // print_r($score_questions);die(); + // return ($score_questions);