445 lines
29 KiB
PHP
445 lines
29 KiB
PHP
<?php
|
|
|
|
class PDSCORE
|
|
{
|
|
public static function calculatePDScore111()
|
|
{
|
|
echo "calculatePDScore111";
|
|
}
|
|
|
|
|
|
public static function genericDI($score_questions,$pd_master_details,$personal_asset_grid)
|
|
{
|
|
print_r($score_questions);
|
|
############ 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);
|
|
$was_the_company_name_board_sighted = array('Yes' => 10, 'No' => 0);
|
|
$supplir_client_answer_scores = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
|
|
|
$otp_done = array('Yes' => 10, 'No' => 0);
|
|
$qualification = array( 'name_score' => array('Completed Professinal Course' => 10,'Completed Post Graduation' => 8, 'Completed Graduation' => 6,'Completed Schooling' => 4,'Not Completed Schooling' => 2,'No Formal Education' => 0),
|
|
'id_score' => array('1' => 10,'2' => 8,'3' => 6,'4' => 4,'5' => 2,'6' => 0));
|
|
|
|
/*-------- BUSNIESS --------------*/
|
|
$no_of_years_business_run = array('100> to >=10' => 10,'5<= to <10' => 8,'3<= to <5' => 6,'1<= to <3' => 4,' 1> to >0' => 2);
|
|
$business_seasonality = array('yes' => 5, 'no major chnages in sales' => 10);
|
|
$employees_total = array('1000> to >50' => 10,'21<= to <50' => 8, '11<= to <20' => 6, '6<= to <10' =>4,'5>= to >0' => 2) ;
|
|
$cerificates = array('yes' => 10,'no' => 0, 'not applicable' => 0);
|
|
$owned_property = array('yes' => 10, 'no' => 0);
|
|
$owned_vechile = array('yes' => 10, 'no' => 0);
|
|
$minimum_supplier_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
|
$minimum_client_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
|
$stock_answer_scores = array('yes' => 10, 'no' => 0,'Not Applicable' => 0);
|
|
$stock_raw_material_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
|
$stock_finished_goods_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
|
$location_suited_for_busienss = array('well_suited' => 10 ,'fairly_suited' => 6,'not_suited' => 0);
|
|
$business_activity_has_seen = array('yes' => 10, 'no' => 0);
|
|
$vintage_of_business_account = array('100> to >=10' => 10,'7<= to <10' => 8,'5<= to <7' => 6,'3<= to <5' => 4,'3> to >0' => 2);
|
|
/*-------- FINAL --------------*/
|
|
$pd_officer_recommandations = array('Positive' => 10,'Negative' => 0,'Refer to Credit' => 5);
|
|
|
|
|
|
/*-----------CALCULATION PART -----------*/
|
|
/*-----------GENERAL SECTION -----------*/
|
|
echo "##################################################";
|
|
|
|
$general_distribute_level_weightage = 0;
|
|
//#######1.1 person_met_is_applicant
|
|
$person_met_is_applicant_actual_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * $person_met_is_applicant[$score_questions['general']['person_met_is_applicant']];
|
|
|
|
$person_met_is_applicant_max_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * max($person_met_is_applicant);
|
|
|
|
$score_questions['general']['person_met_is_applicant'] = array('l1_weightage' => $l1_general,'l2_weightage' => $person_met_is_applicant_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['person_met_is_applicant'],'actual_score' => $person_met_is_applicant_actual_score, 'max_score' => $person_met_is_applicant_max_score);
|
|
|
|
//######1.2 pd_location_approach
|
|
$pd_location_approach_actual_score = ($l1_general/100) * ($pd_location_approach_L2/100) * $pd_location_approach[$score_questions['general']['pd_location_approach']];
|
|
|
|
$pd_location_approach_max_score = ($l1_general/100) * ($pd_location_approach_L2/100) * max($pd_location_approach);
|
|
|
|
$score_questions['general']['pd_location_approach'] = array('l1_weightage' => $l1_general,'l2_weightage' => $pd_location_approach_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['pd_location_approach'],'actual_score' => $pd_location_approach_actual_score, 'max_score' => $pd_location_approach_max_score);
|
|
|
|
//######1.3 comment_locality
|
|
$comment_locality_actual_score = ($l1_general/100) * ($comment_locality_L2/100) * $comment_locality[$score_questions['general']['comment_locality']];
|
|
|
|
$comment_locality_max_score = ($l1_general/100) * ($comment_locality_L2/100) * max($comment_locality);
|
|
|
|
$score_questions['general']['comment_locality'] = array('l1_weightage' => $l1_general,'l2_weightage' => $comment_locality_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['comment_locality'],'actual_score' => $comment_locality_actual_score, 'max_score' => $comment_locality_max_score);
|
|
|
|
//######1.4 customer_behaviour
|
|
$customer_behaviour_actual_score = ($l1_general/100) * ($customer_behaviour_L2/100) * $customer_behaviour[$score_questions['general']['customer_behaviour']];
|
|
|
|
$customer_behaviour_max_score = ($l1_general/100) * ($customer_behaviour_L2/100) * max($customer_behaviour);
|
|
|
|
$score_questions['general']['customer_behaviour'] = array('l1_weightage' => $l1_general,'l2_weightage' => $customer_behaviour_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['customer_behaviour'],'actual_score' => $customer_behaviour_actual_score, 'max_score' => $customer_behaviour_max_score);
|
|
|
|
//######1.5 neibourhood_check_as_per_pd_officer
|
|
$neibourhood_check_as_per_pd_officer_actual_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * $neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer']];
|
|
|
|
$neibourhood_check_as_per_pd_officer_max_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * max($neibourhood_check_as_per_pd_officer);
|
|
|
|
$score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => $neibourhood_check_as_per_pd_officer_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'actual_score' => $neibourhood_check_as_per_pd_officer_actual_score, 'max_score' => $neibourhood_check_as_per_pd_officer_max_score);
|
|
|
|
//######1.6 was_the_company_name_board_sighted
|
|
$was_the_company_name_board_sighted_actual_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * $was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']];
|
|
|
|
$was_the_company_name_board_sighted_max_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * max($was_the_company_name_board_sighted);
|
|
|
|
$score_questions['general']['was_the_company_name_board_sighted'] = array('l1_weightage' => $l1_general,'l2_weightage' => $was_the_company_name_board_sighted_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['was_the_company_name_board_sighted'],'actual_score' => $was_the_company_name_board_sighted_actual_score, 'max_score' => $was_the_company_name_board_sighted_max_score);
|
|
|
|
//######1.7 otp_done
|
|
$otp_done_actual_score = ($l1_general/100) * ($otp_done_L2/100) * $otp_done[$score_questions['general']['otp_done']];
|
|
|
|
$otp_done_max_score = ($l1_general/100) * ($otp_done_L2/100) * max($otp_done);
|
|
|
|
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => $otp_done_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['otp_done'],'actual_score' => $otp_done_actual_score, 'max_score' => $otp_done_max_score);
|
|
|
|
//######1.8 qualification
|
|
$qualification_actual_score = ($l1_general/100) * ($qualification_L2/100) * $qualification['id_score'][$score_questions['general']['qualification']];
|
|
|
|
$qualification_max_score = ($l1_general/100) * ($qualification_L2/100) * max($qualification['id_score']);
|
|
$keys = array_keys($qualification['name_score']);
|
|
|
|
$score_questions['general']['qualification'] = array('l1_weightage' => $l1_general,'l2_weightage' => $qualification_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $keys[($score_questions['general']['qualification']-1)],'actual_score' => $qualification_actual_score, 'max_score' => $qualification_max_score);
|
|
|
|
//######1.9 value of assets as a % of Loan Amount
|
|
//$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
|
|
$actual_value_of_assets = 600000;
|
|
//$loan_amount = $pd_master_details[0]['loan_amount'];
|
|
$loan_amount = 2000000;
|
|
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
|
|
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
|
|
$actual_value_of_assets_percentage = ($actual_value_of_assets / $loan_amount) * 100;
|
|
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
|
|
|
|
|
|
$final_asset_score = 'DEFAULT';
|
|
foreach($personal_asset_grid['variance_grid'] as $grid)
|
|
{
|
|
//print_r($grid);
|
|
if($grid['variance_ ratio_from'] < $variance && $grid['variance_ration_to'] > $variance)
|
|
{
|
|
$final_asset_score = $grid['score'];
|
|
$final_asset_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
|
|
|
|
}
|
|
}
|
|
|
|
$score_questions['general']['value_of_other_assets'] = array('l1_weightage' => $l1_general,'l2_weightage' => $value_of_other_assets_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['value_of_other_assets'],'actual_score' => $final_asset_score, 'max_score' => (($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10));
|
|
/*-----------END OF GENERAL SECTION -----------*/
|
|
|
|
/*-----------FINAL REMARKS SECTION -----------*/
|
|
//###### 3.1 PD Officer Recommandation
|
|
|
|
$pd_officer_recommandations_actual_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * $pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ];
|
|
|
|
$pd_officer_recommandations_max_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * max($pd_officer_recommandations);
|
|
|
|
$score_questions['final_remarks']['pd_officer_recommandations'] = array('l1_weightage' => $l1_final,'l2_weightage' => $pd_officer_recommadations_L2,'distributed_weightage' => 0,'answer' => $score_questions['final_remarks']['pd_officer_recommandations'],'actual_score' => $pd_officer_recommandations_actual_score, 'max_score' => $pd_officer_recommandations_max_score);
|
|
/*-----------END OF FINAL REMARKS SECTION -----------*/
|
|
|
|
|
|
/*-----------BUSINESS SECTION -----------*/
|
|
|
|
|
|
/* First Calculate Shortfall Type Questions to get distribute level
|
|
From 2.7 to 2.10 Questions are shortfall type questions (REF :- SSA_ScoreCard_Ver_090219(2))
|
|
*/
|
|
|
|
$business_distribute_level_weightage = 0;
|
|
|
|
|
|
if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
|
|
{
|
|
$business_distribute_level_weightage += $minimum_supplier_info_L2;
|
|
}
|
|
if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
|
|
{
|
|
$business_distribute_level_weightage += $minimum_client_info_L2;
|
|
}
|
|
if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
|
|
{
|
|
$business_distribute_level_weightage += $stock_raw_material_enough_L2;
|
|
}
|
|
if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable'))
|
|
{
|
|
$business_distribute_level_weightage += $stock_finished_goods_enough_L2;
|
|
}
|
|
//echo $business_distribute_level_weightage;
|
|
|
|
//######2.7 atleast one supplier info provided
|
|
$minimum_supplier_info_L2 = $business_distribute_level_weightage ? ($minimum_supplier_info_L2 + ($minimum_supplier_info_L2 / (100 - $business_distribute_level_weightage ))) : $minimum_supplier_info_L2 ;
|
|
|
|
$minimum_supplier_info_actual_score = ($l1_business/100) * ($minimum_supplier_info_L2/100) * $minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ];
|
|
|
|
$minimum_supplier_info_max_score = strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_supplier_info_L2/100) * max($minimum_supplier_info) : 0;
|
|
|
|
$score_questions['business']['minimum_supplier_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => $minimum_supplier_info_L2,'answer' => $score_questions['business']['minimum_supplier_info'],'actual_score' => $minimum_supplier_info_actual_score, 'max_score' => $minimum_supplier_info_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.8 atleast one client info provided
|
|
$minimum_client_info_L2 = $business_distribute_level_weightage ? ($minimum_client_info_L2 + ($minimum_client_info_L2 / (100 - $business_distribute_level_weightage ))) : $minimum_client_info_L2 ;
|
|
|
|
$minimum_client_info_actual_score = ($l1_business/100) * ($minimum_client_info_L2/100) * $minimum_client_info [ $score_questions['business']['minimum_client_info'] ];
|
|
|
|
$minimum_client_info_max_score = strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_client_info_L2/100) * max($minimum_client_info) : 0;
|
|
|
|
$score_questions['business']['minimum_client_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => $minimum_client_info_L2,'answer' => $score_questions['business']['minimum_client_info'],'actual_score' => $minimum_client_info_actual_score, 'max_score' => $minimum_client_info_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.9 stock of raw material
|
|
$stock_raw_material_enough_L2 = $business_distribute_level_weightage ? ($stock_raw_material_enough_L2 + ($stock_raw_material_enough_L2 / (100 - $business_distribute_level_weightage ))) : $stock_raw_material_enough_L2 ;
|
|
|
|
$stock_raw_material_enough_actual_score = ($l1_business/100) * ($stock_raw_material_enough_L2/100) * $stock_answer_scores [ $score_questions['business']['stock_raw_material_enough'] ];
|
|
|
|
$stock_raw_material_enough_max_score = strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable')? ($l1_business/100) * ($stock_raw_material_enough_L2/100) * max($stock_answer_scores) : 0;
|
|
|
|
$score_questions['business']['stock_raw_material_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => $stock_raw_material_enough_L2,'answer' => $score_questions['business']['stock_raw_material_enough'],'actual_score' => $stock_raw_material_enough_actual_score, 'max_score' => $stock_raw_material_enough_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.10 stock_finished_goods_enough
|
|
$stock_finished_goods_enough_L2 = $business_distribute_level_weightage ? ($stock_finished_goods_enough_L2 + ($stock_finished_goods_enough_L2 / (100 - $business_distribute_level_weightage ))) : $stock_finished_goods_enough_L2 ;
|
|
|
|
$stock_finished_goods_enough_actual_score = ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * $stock_answer_scores [ $score_questions['business']['stock_finished_goods_enough'] ];
|
|
|
|
$stock_finished_goods_enough_max_score = strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable') ? ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * max($stock_answer_scores) : 0;
|
|
|
|
$score_questions['business']['stock_finished_goods_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => $stock_finished_goods_enough_L2,'answer' => $score_questions['business']['stock_finished_goods_enough'],'actual_score' => $stock_finished_goods_enough_actual_score, 'max_score' => $stock_finished_goods_enough_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
|
|
|
|
//######2.1 Business Certificates
|
|
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage ))) : $cerificates_L2;
|
|
|
|
//find out no of not applicable cases
|
|
$business_certificates_distribution_count = 0;
|
|
foreach($score_questions['business']['cerificates'] as $value)
|
|
{
|
|
if(strcasecmp($value,'not applicable'))
|
|
{
|
|
$business_certificates_distribution_count++;
|
|
|
|
}
|
|
}
|
|
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
|
|
|
|
$certificate_actual_score = 0;
|
|
$certificate_max_score = 0;
|
|
|
|
foreach($score_questions['business']['cerificates'] as $certificate_key => $certificate)
|
|
{
|
|
|
|
$acutal_score = 0;
|
|
$max_score = 0;
|
|
if(strcasecmp($certificate,'not applicable'))
|
|
{
|
|
$acutal_score = ($l1_business/100) * ($business_certificates_distribution/100) * $cerificates[$certificate];
|
|
$max_score = ($l1_business/100) * ($business_certificates_distribution/100) * max($cerificates);
|
|
|
|
}
|
|
$score_questions['business']['cerificates'][$certificate_key] = array('answer' => $certificate,'actual_score' => $acutal_score, 'max_score' => $max_score);
|
|
|
|
$certificate_actual_score += $acutal_score;
|
|
$certificate_max_score += $max_score;
|
|
}
|
|
|
|
$score_questions['business']['cerificates']['l1_weightage'] = $l1_business;
|
|
$score_questions['business']['cerificates']['l2_weightage'] = $business_certificates_distribution;
|
|
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
|
|
$score_questions['business']['cerificates']['max_score'] = $certificate_max_score;
|
|
$score_questions['business']['cerificates']['actual_score'] = $certificate_actual_score;
|
|
|
|
//echo $business_certificates_distribution;die();
|
|
//######2.1 no_of_years_business_run
|
|
|
|
$no_of_years_business_run_actual_score = 0;
|
|
foreach($no_of_years_business_run as $key => $value)
|
|
{
|
|
$exp = explode('to',$key);
|
|
//print_r($exp);
|
|
$left = $exp[0].$score_questions['business']['no_of_years_business_run'];
|
|
$right = $score_questions['business']['no_of_years_business_run'].$exp[1];
|
|
//echo $left.'````'.$right;echo "\n";
|
|
eval( '$left_exp = ' . $left . ';');
|
|
eval( '$right_exp = ' . $right . ';');
|
|
if($left_exp && $right_exp)
|
|
{
|
|
|
|
$no_of_years_business_run_L2 = $business_distribute_level_weightage ? ($no_of_years_business_run_L2 + ($no_of_years_business_run_L2 / (100 - $business_distribute_level_weightage ))) : $no_of_years_business_run_L2 ;
|
|
|
|
$no_of_years_business_run_actual_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * $value;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$no_of_years_business_run_max_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * max($no_of_years_business_run);
|
|
|
|
$score_questions['business']['no_of_years_business_run'] = array('l1_weightage' => $l1_business,'l2_weightage' => $no_of_years_business_run_L2,'answer' => $score_questions['business']['no_of_years_business_run'],'actual_score' => $no_of_years_business_run_actual_score, 'max_score' => $no_of_years_business_run_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
|
|
//######2.2 business seasonal
|
|
|
|
|
|
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage ))) : $business_seasonality_L2 ;
|
|
|
|
$business_seasonality_actual_score = ($l1_business/100) * ($business_seasonality_L2/100) * $business_seasonality[ $score_questions['business']['business_seasonality'] ];
|
|
$business_seasonality_max_score = ($l1_business/100) * ($business_seasonality_L2/100) * max($business_seasonality);
|
|
|
|
$score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_seasonality_L2,'answer' => $score_questions['business']['business_seasonality'],'actual_score' => $no_of_years_business_run_actual_score, 'max_score' => $no_of_years_business_run_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.3 employees_total
|
|
$employees_total_actual_score = 0;
|
|
|
|
$employees_total_L2 = $business_distribute_level_weightage ? ($employees_total_L2 + ($employees_total_L2 / (100 - $business_distribute_level_weightage ))) : $employees_total_L2 ;
|
|
|
|
foreach($employees_total as $key => $value)
|
|
{
|
|
$exp = explode('to',$key);
|
|
//print_r($exp);
|
|
$left = $exp[0].$score_questions['business']['employees_total'];
|
|
$right = $score_questions['business']['employees_total'].$exp[1];
|
|
//echo $left.'````'.$right;echo "\n";
|
|
eval( '$left_exp = ' . $left . ';');
|
|
eval( '$right_exp = ' . $right . ';');
|
|
if($left_exp && $right_exp)
|
|
{
|
|
$employees_total_actual_score = ($l1_business/100) * ($employees_total_L2/100) * $value;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$employees_total_max_score = ($l1_business/100) * ($employees_total_L2/100) * max($employees_total);
|
|
|
|
$score_questions['business']['employees_total'] = array('l1_weightage' => $l1_business,'l2_weightage' => $employees_total_L2,'answer' => $score_questions['business']['employees_total'],'actual_score' => $employees_total_actual_score, 'max_score' => $employees_total_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
|
|
//######2.5 owned_property
|
|
|
|
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage ))) : $owned_property_L2 ;
|
|
|
|
$owned_property_actual_score = ($l1_business/100) * ($owned_property_L2/100) * $owned_property[ $score_questions['business']['owned_property'] ];
|
|
$owned_property_max_score = ($l1_business/100) * ($owned_property_L2/100) * max($owned_property);
|
|
|
|
$score_questions['business']['owned_property'] = array('l1_weightage' => $l1_business,'l2_weightage' => $owned_property_L2,'answer' => $score_questions['business']['owned_property'],'actual_score' => $owned_property_actual_score, 'max_score' => $owned_property_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.6 owned_vechile
|
|
$owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage ))) : $owned_vechile_L2 ;
|
|
|
|
$owned_vechile_actual_score = ($l1_business/100) * ($owned_vechile_L2/100) * $owned_vechile[ $score_questions['business']['owned_vechile'] ];
|
|
$owned_vechile_max_score = ($l1_business/100) * ($owned_vechile_L2/100) * max($owned_vechile);
|
|
|
|
$score_questions['business']['owned_vechile'] = array('l1_weightage' => $l1_business,'l2_weightage' => $owned_vechile_L2,'answer' => $score_questions['business']['owned_vechile'],'actual_score' => $owned_vechile_actual_score, 'max_score' => $owned_vechile_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.11 location_suited_for_busienss
|
|
|
|
$location_suited_for_busienss_L2 = $business_distribute_level_weightage ? ($location_suited_for_busienss_L2 + ($location_suited_for_busienss_L2 / (100 - $business_distribute_level_weightage ))) : $location_suited_for_busienss_L2 ;
|
|
|
|
$location_suited_for_busienss_actual_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ];
|
|
$location_suited_for_busienss_max_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * max($location_suited_for_busienss);
|
|
|
|
$score_questions['business']['location_suited_for_busienss'] = array('l1_weightage' => $l1_business,'l2_weightage' => $location_suited_for_busienss_L2,'answer' => $score_questions['business']['location_suited_for_busienss'],'actual_score' => $location_suited_for_busienss_actual_score, 'max_score' => $location_suited_for_busienss_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.11 business_activity_has_seen
|
|
|
|
$business_activity_has_seen_L2 = $business_distribute_level_weightage ? ($business_activity_has_seen_L2 + ($business_activity_has_seen_L2 / (100 - $business_distribute_level_weightage ))) : $business_activity_has_seen_L2 ;
|
|
|
|
$business_activity_has_seen_actual_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ];
|
|
$business_activity_has_seen_max_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * max($business_activity_has_seen);
|
|
|
|
$score_questions['business']['business_activity_has_seen'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_activity_has_seen_L2,'answer' => $score_questions['business']['business_activity_has_seen'],'actual_score' => $business_activity_has_seen_actual_score, 'max_score' => $business_activity_has_seen_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
|
|
//######2.13 vintage business banking
|
|
|
|
$vintage_of_business_account_L2 = $business_distribute_level_weightage ? ($vintage_of_business_account_L2 + ($vintage_of_business_account_L2 / (100 - $business_distribute_level_weightage ))) : $vintage_of_business_account_L2 ;
|
|
|
|
$vintage_of_business_account_actual_score = 0;
|
|
foreach($vintage_of_business_account as $key => $value)
|
|
{
|
|
$exp = explode('to',$key);
|
|
//print_r($exp);
|
|
$left = $exp[0].$score_questions['business']['vintage_of_business_account'];
|
|
$right = $score_questions['business']['vintage_of_business_account'].$exp[1];
|
|
//echo $left.'````'.$right;echo "\n";
|
|
eval( '$left_exp = ' . $left . ';');
|
|
eval( '$right_exp = ' . $right . ';');
|
|
if($left_exp && $right_exp)
|
|
{
|
|
$vintage_of_business_account_actual_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * $value;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account);
|
|
|
|
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_activity_has_seen_L2,'answer' => $score_questions['business']['vintage_of_business_account'],'actual_score' => $vintage_of_business_account_actual_score, 'max_score' => $vintage_of_business_account_max_score,'distributed_weightage' => $business_distribute_level_weightage);
|
|
/*-----------END OF BUSINESS SECTION -----------*/
|
|
|
|
|
|
|
|
/* Calculate Overall Total*/
|
|
$overall_max_score = 0;
|
|
$overall_actual_score = 0;
|
|
foreach($score_questions as $key => $value)
|
|
{
|
|
foreach($value as $v_key => $f_value)
|
|
{
|
|
$overall_max_score += $f_value['max_score'];
|
|
$overall_actual_score += $f_value['actual_score'];
|
|
}
|
|
}
|
|
$score_questions['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => ($overall_actual_score/$overall_max_score) * 100);
|
|
print_r($score_questions);
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
?>
|