sparqapi/api/application/helpers/pdscore_helper.php

1793 lines
124 KiB
PHP

<?php
class PDSCORE
{
public static function calculatePDScore111()
{
echo "calculatePDScore111";
}
//FULL PD SCORE CALCUALTIONS
public static function genericDIPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details)
{
// print_r($personal_asset_grid);die();echo "###################";
############ GENERIC SE-DI CASES #######################
############ SCROE VARIABLES DECLERATIONS ##############
// LEVEL 1 WEIGHTAGES
$l1_general = 25;
$l1_business = 50;
$l1_final = 25;
// LEVEL2 WEIGHTAGES - Questions Weightages
/*-------- GENERAL --------------*/
$person_met_is_applicant_L2 = 15;
$pd_location_approach_L2 = 10;
$comment_locality_L2 = 10;
$customer_behaviour_L2 = 10;
$neibourhood_check_as_per_pd_officer_L2 = 10;
$was_the_company_name_board_sighted_L2 = 10;
$otp_done_L2 = 10;
$qualification_L2 = 10;
$value_of_other_assets_L2 = 15;
/*-------- BUSNIESS --------------*/
$no_of_years_business_run_L2 = 10;
$business_seasonality_L2 = 10;
$employees_total_L2 = 10;
$cerificates_L2 = 10;
$owned_property_L2 = 7;
$owned_vechile_L2 = 3;
$minimum_supplier_info_L2 = 5;
$minimum_client_info_L2 = 5;
$stock_raw_material_enough_L2 = 5;
$stock_finished_goods_enough_L2 = 5;
$location_suited_for_busienss_L2 = 10;
$business_activity_has_seen_L2 = 10;
$vintage_of_business_account_L2 = 10;
/*-------- FINAL --------------*/
$pd_officer_recommadations_L2 = 100;
//LEVEL3 SCORES - ANSWER SCORES
/*-------- GENERAL --------------*/
$person_met_is_applicant = array('yes' => 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,'Could not verify' => 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 Professional 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 changes 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,'Others' => 0);
/*-----------CALCULATION PART -----------*/
/*-----------GENERAL SECTION -----------*/
//echo "##################################################";
$over_all_general_l2 = 0;
$over_all_general_round_l2 = 0;
$general_distribute_level_weightage = 0;
//General Section L2 Weightage Distribution section
if($pd_master_details[0]['is_otp_enabled'] != 1)
{
$general_distribute_level_weightage += $otp_done_L2;
}
if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
{
//echo "Yes could not";
$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
//######1.7 otp_done
if($pd_master_details[0]['is_otp_enabled'] == 1)
{
$otp_done_L2 = $general_distribute_level_weightage ? ($otp_done_L2 + ($otp_done_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $otp_done_L2;
$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'],'attributed_score' => ($otp_done_actual_score), 'max_score' => ($otp_done_max_score),'score_band'=>$otp_done[$score_questions['general']['otp_done']],'max_score_band' => max($otp_done));
}
else
{
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => 'Not Applicable','attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$otp_done[ $score_questions['general']['otp_done'] != "" || $score_questions['general']['otp_done'] != null ?$score_questions['general']['otp_done']: "No" ],'max_score_band' => 0);
}
//######1.5 neibourhood_check_as_per_pd_officer
if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
{
$score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => 0);
}
else
{
$neibourhood_check_as_per_pd_officer_L2 = $general_distribute_level_weightage ? ($neibourhood_check_as_per_pd_officer_L2 + ($neibourhood_check_as_per_pd_officer_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $neibourhood_check_as_per_pd_officer_L2;
$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'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ];
$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'],'attributed_score' => ($neibourhood_check_as_per_pd_officer_actual_score), 'max_score' => ($neibourhood_check_as_per_pd_officer_max_score),'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => max($neibourhood_check_as_per_pd_officer));
}
//echo $general_distribute_level_weightage = round($general_distribute_level_weightage,2);die();
//echo $general_distribute_level_weightage;
//#######1.1 person_met_is_applicant
$person_met_is_applicant_L2 = $general_distribute_level_weightage ? ($person_met_is_applicant_L2 + ($person_met_is_applicant_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $person_met_is_applicant_L2 ;
$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);
//echo $person_met_is_applicant_L2;
//echo $person_met_is_applicant_max_score;
$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'],'attributed_score' => ($person_met_is_applicant_actual_score), 'max_score' => ($person_met_is_applicant_max_score),'score_band'=>($person_met_is_applicant[$score_questions['general']['person_met_is_applicant']]),'max_score_band' => max($person_met_is_applicant));
//######1.2 pd_location_approach
$pd_location_approach_L2 = $general_distribute_level_weightage ? ($pd_location_approach_L2 + ($pd_location_approach_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $pd_location_approach_L2 ;
$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'],'attributed_score' => ($pd_location_approach_actual_score), 'max_score' => ($pd_location_approach_max_score),'score_band'=>$pd_location_approach[$score_questions['general']['pd_location_approach']],'max_score_band' => max($pd_location_approach));
//######1.3 comment_locality
$comment_locality_L2 = $general_distribute_level_weightage ? ($comment_locality_L2 + ($comment_locality_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $comment_locality_L2;
$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'],'attributed_score' => ($comment_locality_actual_score), 'max_score' => ($comment_locality_max_score),'score_band'=>$comment_locality[$score_questions['general']['comment_locality']],'max_score_band' => max($comment_locality));
//######1.4 customer_behaviour
$customer_behaviour_L2 = $general_distribute_level_weightage ? ($customer_behaviour_L2 + ($customer_behaviour_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $customer_behaviour_L2;
$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'],'attributed_score' => ($customer_behaviour_actual_score), 'max_score' => ($customer_behaviour_max_score),'score_band'=>$customer_behaviour[$score_questions['general']['customer_behaviour']],'max_score_band' => max($customer_behaviour));
//######1.6 was_the_company_name_board_sighted
$was_the_company_name_board_sighted_L2 = $general_distribute_level_weightage ? ($was_the_company_name_board_sighted_L2 + ($was_the_company_name_board_sighted_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $was_the_company_name_board_sighted_L2;
$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'],'attributed_score' => ($was_the_company_name_board_sighted_actual_score), 'max_score' => ($was_the_company_name_board_sighted_max_score),'score_band'=>$was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']],'max_score_band' => max($was_the_company_name_board_sighted));
//######1.8 qualification
$qualification_L2 = $general_distribute_level_weightage ? ($qualification_L2 + ($qualification_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $qualification_L2;
$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)],'attributed_score' => ($qualification_actual_score), 'max_score' => ($qualification_max_score),'score_band'=>$qualification['id_score'][$score_questions['general']['qualification']],'max_score_band' => max($qualification['id_score']));
//######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();
$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
$asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2);
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
//print_r($loan_amt_from_loam_form);die();
$loan_amount = (int)$loan_amt_from_loam_form;
$asset_calculation_details['loan_amount'] = $loan_amount;
//echo 'loan_amount - '.$loan_amount;
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
//print_r($personal_asset_grid);
//echo $avg_expected_value_of_assets;
$asset_calculation_details['avg_expected_value_of_assets'] = round($avg_expected_value_of_assets,2);
//echo "avg_expected_value_of_assets - ".$avg_expected_value_of_assets;
//$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $loan_amount;
$asset_calculation_details['expected_value_of_assets'] = round($expected_value_of_assets,2);
//echo 'expected_value_of_assets--'.$expected_value_of_assets;
$actual_value_of_assets_percentage = $actual_value_of_assets ? ($actual_value_of_assets / $loan_amount) * 100 : 0;
$asset_calculation_details['actual_value_of_assets_percentage'] =
round($actual_value_of_assets_percentage,2);
//echo 'actual_value_of_assets_percentage--'.$actual_value_of_assets_percentage;
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
//echo 'varience--'.$variance;
//die();
$asset_calculation_details['variance'] = round($variance,2);
$final_asset_attributed_score = 0;
$final_asset_score = 0;
if($actual_value_of_assets > 0 )
{
foreach($personal_asset_grid['variance_grid'] as $grid)
{
//print_r($grid['score']);
if($grid['variance_ ratio_from'] <= $variance && $grid['variance_ration_to'] > $variance)
{
$final_asset_score = $grid['score'];
$final_asset_attributed_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
}
}
}
$asset_calculation_details['score'] = $final_asset_score;
// 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 -----------*/
/*-----------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'],'attributed_score' => round($pd_officer_recommandations_actual_score,2), 'max_score' => $pd_officer_recommandations_max_score,'score_band'=>$pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ],'max_score_band' => max($pd_officer_recommandations));
/*-----------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;
//echo $score_questions['business']['minimum_supplier_info'];die();
if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_supplier_info_L2;
$minimum_supplier_info_L2 = 0;
}
if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_client_info_L2;
$minimum_client_info_L2 = 0;
}
if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_raw_material_enough_L2;
$stock_raw_material_enough_L2 = 0;
}
if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_finished_goods_enough_L2;$stock_finished_goods_enough_L2 = 0;
}
//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 )) * $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'],'attributed_score' => ($minimum_supplier_info_actual_score), 'max_score' => ($minimum_supplier_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ],'max_score_band' => max($minimum_supplier_info));
//######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 )) * $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'],'attributed_score' => ($minimum_client_info_actual_score), 'max_score' => ($minimum_client_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_client_info [ $score_questions['business']['minimum_client_info'] ],'max_score_band' => max($minimum_client_info));
//######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 )) * $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 [ strtolower($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'],'attributed_score' => ($stock_raw_material_enough_actual_score), 'max_score' => ($stock_raw_material_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ strtolower($score_questions['business']['stock_raw_material_enough']) ],'max_score_band' =>max($stock_answer_scores) );
//######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 )) * $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'] != "" || $score_questions['business']['stock_finished_goods_enough'] != null ? strtolower($score_questions['business']['stock_finished_goods_enough']) : "no" ];
$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;
$temp_stock_finished_goods_enough = strtolower($score_questions['business']['stock_finished_goods_enough']);
$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'],'attributed_score' => ($stock_finished_goods_enough_actual_score), 'max_score' => ($stock_finished_goods_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ $temp_stock_finished_goods_enough != "" || $temp_stock_finished_goods_enough != null ? $temp_stock_finished_goods_enough : "no" ],'max_score_band' => max($stock_answer_scores));
//######2.1 Business Certificates
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage )) * $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++;
//echo $value;
}
}
$business_certificates_distribution_count;
$business_certificates_distribution = $business_certificates_distribution_count ? $cerificates_L2 / $business_certificates_distribution_count : 0;
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
// echo $business_certificates_distribution;die();
$certificate_actual_score = 0;
$certificate_max_score = 0;
//print_r($score_questions['business']['cerificates']);
foreach($score_questions['business']['cerificates'] as $certificate_key => $certificate)
{
//print_r($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,'attributed_score' => ($acutal_score), 'max_score' => ($max_score),'score_band' => $cerificates[$certificate],'max_score_band'=> max($cerificates),'l1_weightage' =>($l1_business),'l2_weightage'=> ($business_certificates_distribution));
$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 * $business_certificates_distribution_count));
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
$score_questions['business']['cerificates']['max_score'] = ($certificate_max_score);
$score_questions['business']['cerificates']['attributed_score'] = ($certificate_actual_score);
$score_questions['business']['cerificates']['score_band'] = 'Derived';
$score_questions['business']['cerificates']['max_score_band'] = 'Derived';
//print_r($score_questions['business']['cerificates']);die();
//######2.1 no_of_years_business_run
$no_of_years_business_run_actual_score = 0;
$score_band = 0;
if($score_questions['business']['no_of_years_business_run'])
{
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";die();
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 )) * $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;
$score_band = $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'],'attributed_score' => ($no_of_years_business_run_actual_score), 'max_score' => ($no_of_years_business_run_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
//######2.2 business seasonal
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($business_seasonality_actual_score), 'max_score' =>($business_seasonality_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_seasonality[ $score_questions['business']['business_seasonality'] ],'max_score_band' => max($business_seasonality));
//######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 )) * $business_distribute_level_weightage) : $employees_total_L2 ;
$score_band = 0;
if($score_questions['business']['employees_total'])
{
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;
$score_band = $value;
}
}
}
// echo $score_band;
// die();
$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'],'attributed_score' => ($employees_total_actual_score), 'max_score' => ($employees_total_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' =>$score_band,'max_score_band' => max($employees_total));
//######2.5 owned_property
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($owned_property_actual_score), 'max_score' => ($owned_property_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_property[ $score_questions['business']['owned_property'] ],'max_score_band' => max($owned_property));
//######2.6 owned_vechile
$owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($owned_vechile_actual_score), 'max_score' => ($owned_vechile_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_vechile[ $score_questions['business']['owned_vechile'] ],'max_score_band' => max($owned_vechile));
//######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 )) * $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'],'attributed_score' => ($location_suited_for_busienss_actual_score), 'max_score' => ($location_suited_for_busienss_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ],'max_score_band' => max($location_suited_for_busienss));
//######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_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'],'attributed_score' => ($business_activity_has_seen_actual_score), 'max_score' => ($business_activity_has_seen_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ], 'max_score_band' => max($business_activity_has_seen));
//######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 )) * $business_distribute_level_weightage) : $vintage_of_business_account_L2 ;
$vintage_of_business_account_actual_score = 0;
$score_band = 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;
$score_band = $value;
}
}
$vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account);
$vintage_of_business_account_for_display = explode('.',($score_questions['business']['vintage_of_business_account']));
$vintage_of_business_account_for_display = ($vintage_of_business_account_for_display[0] != 0 ? $vintage_of_business_account_for_display[0].' Yrs ' : '') . (isset($vintage_of_business_account_for_display[1]) && $vintage_of_business_account_for_display[1] != 0 ? $vintage_of_business_account_for_display[1].' Mns ' : '');
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($vintage_of_business_account_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
/*-----------END OF BUSINESS SECTION -----------*/
/* Calculate Overall Total*/
$overall_max_score = 0;
$overall_actual_score = 0;
foreach($score_questions as $key => $value)
{
$current_max_score = 0;
$current_actual_score = 0;
foreach($value as $v_key => $f_value)
{
$overall_max_score += $f_value['max_score'];
$overall_actual_score += $f_value['attributed_score'];
$current_max_score += $f_value['max_score'];
$current_actual_score += $f_value['attributed_score'];
}
$score_questions['score_summary'][$key] = array('actual_score' => $current_actual_score,'max_score' => $current_max_score,'score_per' => (($current_actual_score/$current_max_score) * 100));
}
$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);
}
//SMART PD SCORE CALCULATIONS
public static function genericDISmartPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details)
{
//echo 'RRRRR';die();
//print_r($personal_asset_grid);die();echo "###################";
############ GENERIC SE-DI CASES #######################
############ SCROE VARIABLES DECLERATIONS ##############
// LEVEL 1 WEIGHTAGES
$l1_general = 25;
$l1_business = 50;
$l1_final = 25;
// LEVEL2 WEIGHTAGES - Questions Weightages
/*-------- GENERAL --------------*/
$person_met_is_applicant_L2 = 15;
$pd_location_approach_L2 = 10;
$comment_locality_L2 = 10;
$customer_behaviour_L2 = 10;
$neibourhood_check_as_per_pd_officer_L2 = 10;
$was_the_company_name_board_sighted_L2 = 10;
$otp_done_L2 = 10;
$qualification_L2 = 10;
$value_of_other_assets_L2 = 15;
/*-------- BUSNIESS --------------*/
$no_of_years_business_run_L2 = 10;
$business_seasonality_L2 = 10;
$employees_total_L2 = 10;
$cerificates_L2 = 10;
$owned_property_L2 = 7;
$owned_vechile_L2 = 3;
$minimum_supplier_info_L2 = 5;
$minimum_client_info_L2 = 5;
$stock_raw_material_enough_L2 = 5;
$stock_finished_goods_enough_L2 = 5;
$location_suited_for_busienss_L2 = 10;
$business_activity_has_seen_L2 = 10;
$vintage_of_business_account_L2 = 10;
/*-------- FINAL --------------*/
$pd_officer_recommadations_L2 = 100;
//LEVEL3 SCORES - ANSWER SCORES
/*-------- GENERAL --------------*/
$person_met_is_applicant = array('yes' => 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,'Could not verify' => 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 Professional 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 changes 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,'Others' => 0);
/*-----------CALCULATION PART -----------*/
/*-----------GENERAL SECTION -----------*/
//echo "##################################################";
$over_all_general_l2 = 0;
$over_all_general_round_l2 = 0;
$general_distribute_level_weightage = 0;
//General Section L2 Weightage Distribution section
if($pd_master_details[0]['is_otp_enabled'] != 1)
{
$general_distribute_level_weightage += $otp_done_L2;
}
if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
{
//echo "Yes could not";
$general_distribute_level_weightage += $neibourhood_check_as_per_pd_officer_L2;
}
//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)
{
$otp_done_L2 = $general_distribute_level_weightage ? ($otp_done_L2 + ($otp_done_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $otp_done_L2;
$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'],'attributed_score' => ($otp_done_actual_score), 'max_score' => ($otp_done_max_score),'score_band'=>$otp_done[$score_questions['general']['otp_done']],'max_score_band' => max($otp_done));
}
else
{
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => 'Not Applicable','attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$otp_done[ $score_questions['general']['otp_done'] != "" || $score_questions['general']['otp_done'] != null ?$score_questions['general']['otp_done']: "No" ],'max_score_band' => 0);
}
//######1.5 neibourhood_check_as_per_pd_officer
if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
{
$score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => 0);
}
else
{
$neibourhood_check_as_per_pd_officer_L2 = $general_distribute_level_weightage ? ($neibourhood_check_as_per_pd_officer_L2 + ($neibourhood_check_as_per_pd_officer_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $neibourhood_check_as_per_pd_officer_L2;
$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'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ];
$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'],'attributed_score' => ($neibourhood_check_as_per_pd_officer_actual_score), 'max_score' => ($neibourhood_check_as_per_pd_officer_max_score),'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => max($neibourhood_check_as_per_pd_officer));
}
//echo $general_distribute_level_weightage = round($general_distribute_level_weightage,2);die();
//echo $general_distribute_level_weightage;
//#######1.1 person_met_is_applicant
$person_met_is_applicant_L2 = $general_distribute_level_weightage ? ($person_met_is_applicant_L2 + ($person_met_is_applicant_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $person_met_is_applicant_L2 ;
$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);
//echo $person_met_is_applicant_L2;
//echo $person_met_is_applicant_max_score;
$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'],'attributed_score' => ($person_met_is_applicant_actual_score), 'max_score' => ($person_met_is_applicant_max_score),'score_band'=>($person_met_is_applicant[$score_questions['general']['person_met_is_applicant']]),'max_score_band' => max($person_met_is_applicant));
//######1.2 pd_location_approach
$pd_location_approach_L2 = $general_distribute_level_weightage ? ($pd_location_approach_L2 + ($pd_location_approach_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $pd_location_approach_L2 ;
$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'],'attributed_score' => ($pd_location_approach_actual_score), 'max_score' => ($pd_location_approach_max_score),'score_band'=>$pd_location_approach[$score_questions['general']['pd_location_approach']],'max_score_band' => max($pd_location_approach));
//######1.3 comment_locality
$comment_locality_L2 = $general_distribute_level_weightage ? ($comment_locality_L2 + ($comment_locality_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $comment_locality_L2;
$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'],'attributed_score' => ($comment_locality_actual_score), 'max_score' => ($comment_locality_max_score),'score_band'=>$comment_locality[$score_questions['general']['comment_locality']],'max_score_band' => max($comment_locality));
//######1.4 customer_behaviour
$customer_behaviour_L2 = $general_distribute_level_weightage ? ($customer_behaviour_L2 + ($customer_behaviour_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $customer_behaviour_L2;
$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'],'attributed_score' => ($customer_behaviour_actual_score), 'max_score' => ($customer_behaviour_max_score),'score_band'=>$customer_behaviour[$score_questions['general']['customer_behaviour']],'max_score_band' => max($customer_behaviour));
//######1.6 was_the_company_name_board_sighted
$was_the_company_name_board_sighted_L2 = $general_distribute_level_weightage ? ($was_the_company_name_board_sighted_L2 + ($was_the_company_name_board_sighted_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $was_the_company_name_board_sighted_L2;
$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'],'attributed_score' => ($was_the_company_name_board_sighted_actual_score), 'max_score' => ($was_the_company_name_board_sighted_max_score),'score_band'=>$was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']],'max_score_band' => max($was_the_company_name_board_sighted));
//######1.8 qualification
$qualification_L2 = $general_distribute_level_weightage ? ($qualification_L2 + ($qualification_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $qualification_L2;
$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)],'attributed_score' => ($qualification_actual_score), 'max_score' => ($qualification_max_score),'score_band'=>$qualification['id_score'][$score_questions['general']['qualification']],'max_score_band' => max($qualification['id_score']));
//######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();
$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
$asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2);
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
//print_r($loan_amt_from_loam_form);die();
$loan_amount = (int)$loan_amt_from_loam_form;
$asset_calculation_details['loan_amount'] = $loan_amount;
//echo 'loan_amount - '.$loan_amount;
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
//print_r($personal_asset_grid);
//echo $avg_expected_value_of_assets;
$asset_calculation_details['avg_expected_value_of_assets'] = round($avg_expected_value_of_assets,2);
//echo "avg_expected_value_of_assets - ".$avg_expected_value_of_assets;
//$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $loan_amount;
$asset_calculation_details['expected_value_of_assets'] = round($expected_value_of_assets,2);
//echo 'expected_value_of_assets--'.$expected_value_of_assets;
$actual_value_of_assets_percentage = $actual_value_of_assets ? ($actual_value_of_assets / $loan_amount) * 100 : 0;
$asset_calculation_details['actual_value_of_assets_percentage'] =
round($actual_value_of_assets_percentage,2);
//echo 'actual_value_of_assets_percentage--'.$actual_value_of_assets_percentage;
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
//echo 'varience--'.$variance;
//die();
$asset_calculation_details['variance'] = round($variance,2);
$final_asset_attributed_score = 0;
$final_asset_score = 0;
if($actual_value_of_assets > 0 )
{
foreach($personal_asset_grid['variance_grid'] as $grid)
{
//print_r($grid['score']);
if($grid['variance_ ratio_from'] <= $variance && $grid['variance_ration_to'] > $variance)
{
$final_asset_score = $grid['score'];
$final_asset_attributed_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
}
}
}
$asset_calculation_details['score'] = $final_asset_score;
// 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 -----------*/
/*-----------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'],'attributed_score' => round($pd_officer_recommandations_actual_score,2), 'max_score' => $pd_officer_recommandations_max_score,'score_band'=>$pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ],'max_score_band' => max($pd_officer_recommandations));
/*-----------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;
//echo $score_questions['business']['minimum_supplier_info'];die();
if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_supplier_info_L2;
$minimum_supplier_info_L2 = 0;
}
if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_client_info_L2;
$minimum_client_info_L2 = 0;
}
if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_raw_material_enough_L2;
$stock_raw_material_enough_L2 = 0;
}
if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_finished_goods_enough_L2;$stock_finished_goods_enough_L2 = 0;
}
//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 )) * $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'],'attributed_score' => ($minimum_supplier_info_actual_score), 'max_score' => ($minimum_supplier_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ],'max_score_band' => max($minimum_supplier_info));
//######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 )) * $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'],'attributed_score' => ($minimum_client_info_actual_score), 'max_score' => ($minimum_client_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_client_info [ $score_questions['business']['minimum_client_info'] ],'max_score_band' => max($minimum_client_info));
//######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 )) * $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 [ strtolower($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'],'attributed_score' => ($stock_raw_material_enough_actual_score), 'max_score' => ($stock_raw_material_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ strtolower($score_questions['business']['stock_raw_material_enough']) ],'max_score_band' =>max($stock_answer_scores) );
//######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 )) * $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'] != "" || $score_questions['business']['stock_finished_goods_enough'] != null ? strtolower($score_questions['business']['stock_finished_goods_enough']) : "no" ];
$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;
$temp_stock_finished_goods_enough = strtolower($score_questions['business']['stock_finished_goods_enough']);
$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'],'attributed_score' => ($stock_finished_goods_enough_actual_score), 'max_score' => ($stock_finished_goods_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ $temp_stock_finished_goods_enough != "" || $temp_stock_finished_goods_enough != null ? $temp_stock_finished_goods_enough : "no" ],'max_score_band' => max($stock_answer_scores));
//######2.1 Business Certificates
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage )) * $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++;
//echo $value;
}
}
$business_certificates_distribution_count;
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
// echo $business_certificates_distribution;die();
$certificate_actual_score = 0;
$certificate_max_score = 0;
//print_r($score_questions['business']['cerificates']);
foreach($score_questions['business']['cerificates'] as $certificate_key => $certificate)
{
//print_r($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,'attributed_score' => ($acutal_score), 'max_score' => ($max_score),'score_band' => $cerificates[$certificate],'max_score_band'=> max($cerificates),'l1_weightage' =>($l1_business),'l2_weightage'=> ($business_certificates_distribution));
$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 * $business_certificates_distribution_count));
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
$score_questions['business']['cerificates']['max_score'] = ($certificate_max_score);
$score_questions['business']['cerificates']['attributed_score'] = ($certificate_actual_score);
$score_questions['business']['cerificates']['score_band'] = 'Derived';
$score_questions['business']['cerificates']['max_score_band'] = 'Derived';
//print_r($score_questions['business']['cerificates']);die();
//######2.1 no_of_years_business_run
//echo $score_questions['business']['no_of_years_business_run'];die();
$no_of_years_business_run_actual_score = 0;
$score_band = 0;
if($score_questions['business']['no_of_years_business_run'])
{
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";die();
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 )) * $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;
$score_band = $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'],'attributed_score' => ($no_of_years_business_run_actual_score), 'max_score' => ($no_of_years_business_run_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
//######2.2 business seasonal
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($business_seasonality_actual_score), 'max_score' =>($business_seasonality_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_seasonality[ $score_questions['business']['business_seasonality'] ],'max_score_band' => max($business_seasonality));
//######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 )) * $business_distribute_level_weightage) : $employees_total_L2 ;
$score_band = 0;
if($score_questions['business']['employees_total'])
{
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;
$score_band = $value;
}
}
}
// echo $score_band;
// die();
$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'],'attributed_score' => ($employees_total_actual_score), 'max_score' => ($employees_total_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' =>$score_band,'max_score_band' => max($employees_total));
//######2.5 owned_property
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($owned_property_actual_score), 'max_score' => ($owned_property_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_property[ $score_questions['business']['owned_property'] ],'max_score_band' => max($owned_property));
//######2.6 owned_vechile
$owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($owned_vechile_actual_score), 'max_score' => ($owned_vechile_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_vechile[ $score_questions['business']['owned_vechile'] ],'max_score_band' => max($owned_vechile));
//######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 )) * $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'],'attributed_score' => ($location_suited_for_busienss_actual_score), 'max_score' => ($location_suited_for_busienss_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ],'max_score_band' => max($location_suited_for_busienss));
//######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_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'],'attributed_score' => ($business_activity_has_seen_actual_score), 'max_score' => ($business_activity_has_seen_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ], 'max_score_band' => max($business_activity_has_seen));
//######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 )) * $business_distribute_level_weightage) : $vintage_of_business_account_L2 ;
$vintage_of_business_account_actual_score = 0;
$score_band = 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;
$score_band = $value;
}
}
$vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account);
$vintage_of_business_account_for_display = explode('.',($score_questions['business']['vintage_of_business_account']));
$vintage_of_business_account_for_display = ($vintage_of_business_account_for_display[0] != 0 ? $vintage_of_business_account_for_display[0].' Yrs ' : '') . (isset($vintage_of_business_account_for_display[1]) && $vintage_of_business_account_for_display[1] != 0 ? $vintage_of_business_account_for_display[1].' Mns ' : '');
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($vintage_of_business_account_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
/*-----------END OF BUSINESS SECTION -----------*/
/* Calculate Overall Total*/
$overall_max_score = 0;
$overall_actual_score = 0;
foreach($score_questions as $key => $value)
{
$current_max_score = 0;
$current_actual_score = 0;
foreach($value as $v_key => $f_value)
{
$overall_max_score += $f_value['max_score'];
$overall_actual_score += $f_value['attributed_score'];
$current_max_score += $f_value['max_score'];
$current_actual_score += $f_value['attributed_score'];
}
$score_questions['score_summary'][$key] = array('actual_score' => $current_actual_score,'max_score' => $current_max_score,'score_per' => (($current_actual_score/$current_max_score) * 100));
}
$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);
}
// TELE PD SCORE CALCUALTIONS
public static function genericTelePDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details)
{
//echo 'RRRRR';die();
//print_r($personal_asset_grid);die();echo "###################";
############ GENERIC SE-DI CASES #######################
############ SCROE VARIABLES DECLERATIONS ##############
// LEVEL 1 WEIGHTAGES
$l1_general = 25;
$l1_business = 50;
$l1_final = 25;
// LEVEL2 WEIGHTAGES - Questions Weightages
/*-------- GENERAL --------------*/
// $person_met_is_applicant_L2 = 15;
// $pd_location_approach_L2 = 10;
// $comment_locality_L2 = 10;
// $neibourhood_check_as_per_pd_officer_L2 = 10;
#### the above four prams distributed to below params
$customer_behaviour_L2 =18.18181818181818;
$was_the_company_name_board_sighted_L2 = 18.18181818181818;
$otp_done_L2 = 18.18181818181818;
$qualification_L2 = 18.18181818181818;
$value_of_other_assets_L2 = 27.27272727272727;
/*-------- BUSNIESS --------------*/
// $employees_total_L2 = 10;
// $business_activity_has_seen_L2 = 10;
// $location_suited_for_busienss_L2 = 10;
$no_of_years_business_run_L2 = 14.285714285714;
$business_seasonality_L2 = 14.285714285714;
$cerificates_L2 = 14.285714285714;
$owned_property_L2 = 10;
$owned_vechile_L2 = 4.2857142857143;
$minimum_supplier_info_L2 = 7.1428571428571;
$minimum_client_info_L2 = 7.1428571428571;
$stock_raw_material_enough_L2 = 7.1428571428571;
$stock_finished_goods_enough_L2 = 7.1428571428571;
$vintage_of_business_account_L2 = 14.285714285714;
/*-------- FINAL --------------*/
$pd_officer_recommadations_L2 = 100;
//LEVEL3 SCORES - ANSWER SCORES
/*-------- GENERAL --------------*/
$person_met_is_applicant = array('yes' => 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,'Could not verify' => 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 Professional 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 changes 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,'Others' => 0);
/*-----------CALCULATION PART -----------*/
/*-----------GENERAL SECTION -----------*/
//echo "##################################################";
$over_all_general_l2 = 0;
$over_all_general_round_l2 = 0;
$general_distribute_level_weightage = 0;
//General Section L2 Weightage Distribution section
if($pd_master_details[0]['is_otp_enabled'] != 1)
{
$general_distribute_level_weightage += $otp_done_L2;
}
// if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
// {
// //echo "Yes could not";
// $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
//######1.7 otp_done
if($pd_master_details[0]['is_otp_enabled'] == 1)
{
$otp_done_L2 = $general_distribute_level_weightage ? ($otp_done_L2 + ($otp_done_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $otp_done_L2;
$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'],'attributed_score' => ($otp_done_actual_score), 'max_score' => ($otp_done_max_score),'score_band'=>$otp_done[$score_questions['general']['otp_done']],'max_score_band' => max($otp_done));
}
else
{
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => 'Not Applicable','attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$otp_done[ $score_questions['general']['otp_done'] != "" || $score_questions['general']['otp_done'] != null ?$score_questions['general']['otp_done']: "No" ],'max_score_band' => 0);
}
//######1.5 neibourhood_check_as_per_pd_officer
// if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
// {
// $score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => 0);
// }
// else
// {
// $neibourhood_check_as_per_pd_officer_L2 = $general_distribute_level_weightage ? ($neibourhood_check_as_per_pd_officer_L2 + ($neibourhood_check_as_per_pd_officer_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $neibourhood_check_as_per_pd_officer_L2;
// $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'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ];
// $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'],'attributed_score' => ($neibourhood_check_as_per_pd_officer_actual_score), 'max_score' => ($neibourhood_check_as_per_pd_officer_max_score),'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => max($neibourhood_check_as_per_pd_officer));
// }
//echo $general_distribute_level_weightage = round($general_distribute_level_weightage,2);die();
//echo $general_distribute_level_weightage;
//#######1.1 person_met_is_applicant
// $person_met_is_applicant_L2 = $general_distribute_level_weightage ? ($person_met_is_applicant_L2 + ($person_met_is_applicant_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $person_met_is_applicant_L2 ;
// $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);
// //echo $person_met_is_applicant_L2;
// //echo $person_met_is_applicant_max_score;
// $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'],'attributed_score' => ($person_met_is_applicant_actual_score), 'max_score' => ($person_met_is_applicant_max_score),'score_band'=>($person_met_is_applicant[$score_questions['general']['person_met_is_applicant']]),'max_score_band' => max($person_met_is_applicant));
//######1.2 pd_location_approach
// $pd_location_approach_L2 = $general_distribute_level_weightage ? ($pd_location_approach_L2 + ($pd_location_approach_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $pd_location_approach_L2 ;
// $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'],'attributed_score' => ($pd_location_approach_actual_score), 'max_score' => ($pd_location_approach_max_score),'score_band'=>$pd_location_approach[$score_questions['general']['pd_location_approach']],'max_score_band' => max($pd_location_approach));
//######1.3 comment_locality
// $comment_locality_L2 = $general_distribute_level_weightage ? ($comment_locality_L2 + ($comment_locality_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $comment_locality_L2;
// $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'],'attributed_score' => ($comment_locality_actual_score), 'max_score' => ($comment_locality_max_score),'score_band'=>$comment_locality[$score_questions['general']['comment_locality']],'max_score_band' => max($comment_locality));
//######1.4 customer_behaviour
$customer_behaviour_L2 = $general_distribute_level_weightage ? ($customer_behaviour_L2 + ($customer_behaviour_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $customer_behaviour_L2;
$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'],'attributed_score' => ($customer_behaviour_actual_score), 'max_score' => ($customer_behaviour_max_score),'score_band'=>$customer_behaviour[$score_questions['general']['customer_behaviour']],'max_score_band' => max($customer_behaviour));
//######1.6 was_the_company_name_board_sighted
$was_the_company_name_board_sighted_L2 = $general_distribute_level_weightage ? ($was_the_company_name_board_sighted_L2 + ($was_the_company_name_board_sighted_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $was_the_company_name_board_sighted_L2;
$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'],'attributed_score' => ($was_the_company_name_board_sighted_actual_score), 'max_score' => ($was_the_company_name_board_sighted_max_score),'score_band'=>$was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']],'max_score_band' => max($was_the_company_name_board_sighted));
//######1.8 qualification
$qualification_L2 = $general_distribute_level_weightage ? ($qualification_L2 + ($qualification_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $qualification_L2;
$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)],'attributed_score' => ($qualification_actual_score), 'max_score' => ($qualification_max_score),'score_band'=>$qualification['id_score'][$score_questions['general']['qualification']],'max_score_band' => max($qualification['id_score']));
//######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();
$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
$asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2);
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
//print_r($loan_amt_from_loam_form);die();
$loan_amount = (int)$loan_amt_from_loam_form;
$asset_calculation_details['loan_amount'] = $loan_amount;
//echo 'loan_amount - '.$loan_amount;
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
//print_r($personal_asset_grid);
//echo $avg_expected_value_of_assets;
$asset_calculation_details['avg_expected_value_of_assets'] = round($avg_expected_value_of_assets,2);
//echo "avg_expected_value_of_assets - ".$avg_expected_value_of_assets;
//$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $loan_amount;
$asset_calculation_details['expected_value_of_assets'] = round($expected_value_of_assets,2);
//echo 'expected_value_of_assets--'.$expected_value_of_assets;
$actual_value_of_assets_percentage = ($actual_value_of_assets / $loan_amount) * 100;
$asset_calculation_details['actual_value_of_assets_percentage'] =
round($actual_value_of_assets_percentage,2);
//echo 'actual_value_of_assets_percentage--'.$actual_value_of_assets_percentage;
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
//echo 'varience--'.$variance;
//die();
$asset_calculation_details['variance'] = round($variance,2);
$final_asset_attributed_score = 0;
$final_asset_score = 0;
if($actual_value_of_assets > 0 )
{
foreach($personal_asset_grid['variance_grid'] as $grid)
{
//print_r($grid['score']);
if($grid['variance_ ratio_from'] <= $variance && $grid['variance_ration_to'] > $variance)
{
$final_asset_score = $grid['score'];
$final_asset_attributed_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
}
}
}
$asset_calculation_details['score'] = $final_asset_score;
// 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 -----------*/
/*-----------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'],'attributed_score' => round($pd_officer_recommandations_actual_score,2), 'max_score' => $pd_officer_recommandations_max_score,'score_band'=>$pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ],'max_score_band' => max($pd_officer_recommandations));
/*-----------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;
//echo $score_questions['business']['minimum_supplier_info'];die();
if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_supplier_info_L2;
$minimum_supplier_info_L2 = 0;
}
if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_client_info_L2;
$minimum_client_info_L2 = 0;
}
if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_raw_material_enough_L2;
$stock_raw_material_enough_L2 = 0;
}
if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_finished_goods_enough_L2;$stock_finished_goods_enough_L2 = 0;
}
//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 )) * $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'],'attributed_score' => ($minimum_supplier_info_actual_score), 'max_score' => ($minimum_supplier_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ],'max_score_band' => max($minimum_supplier_info));
//######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 )) * $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'],'attributed_score' => ($minimum_client_info_actual_score), 'max_score' => ($minimum_client_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_client_info [ $score_questions['business']['minimum_client_info'] ],'max_score_band' => max($minimum_client_info));
//######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 )) * $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 [ strtolower($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'],'attributed_score' => ($stock_raw_material_enough_actual_score), 'max_score' => ($stock_raw_material_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ strtolower($score_questions['business']['stock_raw_material_enough']) ],'max_score_band' =>max($stock_answer_scores) );
//######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 )) * $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'] != "" || $score_questions['business']['stock_finished_goods_enough'] != null ? strtolower($score_questions['business']['stock_finished_goods_enough']) : "no" ];
$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;
$temp_stock_finished_goods_enough = strtolower($score_questions['business']['stock_finished_goods_enough']);
$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'],'attributed_score' => ($stock_finished_goods_enough_actual_score), 'max_score' => ($stock_finished_goods_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ $temp_stock_finished_goods_enough != "" || $temp_stock_finished_goods_enough != null ? $temp_stock_finished_goods_enough : "no" ],'max_score_band' => max($stock_answer_scores));
//######2.1 Business Certificates
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage )) * $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++;
//echo $value;
}
}
$business_certificates_distribution_count;
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
// echo $business_certificates_distribution;die();
$certificate_actual_score = 0;
$certificate_max_score = 0;
//print_r($score_questions['business']['cerificates']);
foreach($score_questions['business']['cerificates'] as $certificate_key => $certificate)
{
//print_r($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,'attributed_score' => ($acutal_score), 'max_score' => ($max_score),'score_band' => $cerificates[$certificate],'max_score_band'=> max($cerificates),'l1_weightage' =>($l1_business),'l2_weightage'=> ($business_certificates_distribution));
$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 * $business_certificates_distribution_count));
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
$score_questions['business']['cerificates']['max_score'] = ($certificate_max_score);
$score_questions['business']['cerificates']['attributed_score'] = ($certificate_actual_score);
$score_questions['business']['cerificates']['score_band'] = 'Derived';
$score_questions['business']['cerificates']['max_score_band'] = 'Derived';
//print_r($score_questions['business']['cerificates']);die();
//######2.1 no_of_years_business_run
$no_of_years_business_run_actual_score = 0;
$score_band = 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 )) * $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;
$score_band = $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'],'attributed_score' => ($no_of_years_business_run_actual_score), 'max_score' => ($no_of_years_business_run_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
//######2.2 business seasonal
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($business_seasonality_actual_score), 'max_score' =>($business_seasonality_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_seasonality[ $score_questions['business']['business_seasonality'] ],'max_score_band' => max($business_seasonality));
//######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 )) * $business_distribute_level_weightage) : $employees_total_L2 ;
// $score_band = 0;
// 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;
// $score_band = $value;
// }
// }
// // echo $score_band;
// // die();
// $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'],'attributed_score' => ($employees_total_actual_score), 'max_score' => ($employees_total_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' =>$score_band,'max_score_band' => max($employees_total));
//######2.5 owned_property
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($owned_property_actual_score), 'max_score' => ($owned_property_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_property[ $score_questions['business']['owned_property'] ],'max_score_band' => max($owned_property));
//######2.6 owned_vechile
$owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage )) * $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'],'attributed_score' => ($owned_vechile_actual_score), 'max_score' => ($owned_vechile_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_vechile[ $score_questions['business']['owned_vechile'] ],'max_score_band' => max($owned_vechile));
//######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 )) * $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'],'attributed_score' => ($location_suited_for_busienss_actual_score), 'max_score' => ($location_suited_for_busienss_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ],'max_score_band' => max($location_suited_for_busienss));
// //######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_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'],'attributed_score' => ($business_activity_has_seen_actual_score), 'max_score' => ($business_activity_has_seen_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ], 'max_score_band' => max($business_activity_has_seen));
//######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 )) * $business_distribute_level_weightage) : $vintage_of_business_account_L2 ;
$vintage_of_business_account_actual_score = 0;
$score_band = 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;
$score_band = $value;
}
}
$vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account);
$vintage_of_business_account_for_display = explode('.',($score_questions['business']['vintage_of_business_account']));
$vintage_of_business_account_for_display = ($vintage_of_business_account_for_display[0] != 0 ? $vintage_of_business_account_for_display[0].' Yrs ' : '') . (isset($vintage_of_business_account_for_display[1]) && $vintage_of_business_account_for_display[1] != 0 ? $vintage_of_business_account_for_display[1].' Mns ' : '');
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($vintage_of_business_account_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
/*-----------END OF BUSINESS SECTION -----------*/
/* Calculate Overall Total*/
$overall_max_score = 0;
$overall_actual_score = 0;
foreach($score_questions as $key => $value)
{
$current_max_score = 0;
$current_actual_score = 0;
foreach($value as $v_key => $f_value)
{
$overall_max_score += $f_value['max_score'];
$overall_actual_score += $f_value['attributed_score'];
$current_max_score += $f_value['max_score'];
$current_actual_score += $f_value['attributed_score'];
}
$score_questions['score_summary'][$key] = array('actual_score' => $current_actual_score,'max_score' => $current_max_score,'score_per' => (($current_actual_score/$current_max_score) * 100));
}
$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;
}
//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);
}
}
?>