diff --git a/api/application/docs/sample.pdf b/api/application/docs/sample.pdf index ee98cd04..c5dec943 100644 Binary files a/api/application/docs/sample.pdf and b/api/application/docs/sample.pdf differ diff --git a/api/application/helpers/pdscore_helper.php b/api/application/helpers/pdscore_helper.php index 9009e7aa..03d6361c 100644 --- a/api/application/helpers/pdscore_helper.php +++ b/api/application/helpers/pdscore_helper.php @@ -10,7 +10,7 @@ class PDSCORE public static function genericDI($score_questions,$pd_master_details,$personal_asset_grid) { - //print_r($score_questions);echo "###################"; + //print_r($personal_asset_grid);echo "###################"; ############ GENERIC SE-DI CASES ####################### ############ SCROE VARIABLES DECLERATIONS ############## @@ -93,7 +93,7 @@ class PDSCORE $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); + $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']])); //######1.2 pd_location_approach @@ -101,21 +101,21 @@ class PDSCORE $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); + $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']]); //######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); + $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']]); //######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); + $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']]); //######1.5 neibourhood_check_as_per_pd_officer @@ -123,21 +123,21 @@ class PDSCORE $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); + $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" ]); //######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); + $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']]); //######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); + $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']]); //######1.8 qualification $qualification_actual_score = ($l1_general/100) * ($qualification_L2/100) * $qualification['id_score'][$score_questions['general']['qualification']]; @@ -145,20 +145,20 @@ class PDSCORE $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); + $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']]); //######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; + $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'; + $final_asset_score = 'No Asset'; foreach($personal_asset_grid['variance_grid'] as $grid) { //print_r($grid); @@ -170,7 +170,7 @@ class PDSCORE } } - $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)); + $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_score, 'max_score' => (($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10),'score_band'=> 'As Per Grid'); /*-----------END OF GENERAL SECTION -----------*/ /*-----------FINAL REMARKS SECTION -----------*/ @@ -180,7 +180,7 @@ class PDSCORE $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); + $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' => $pd_officer_recommandations_actual_score, 'max_score' => $pd_officer_recommandations_max_score,'score_band'=>$pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ]); /*-----------END OF FINAL REMARKS SECTION -----------*/ @@ -219,7 +219,7 @@ class PDSCORE $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); + $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'] ]); //######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 ; @@ -228,7 +228,7 @@ class PDSCORE $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); + $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'] ]); //######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 ; @@ -237,7 +237,7 @@ class PDSCORE $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); + $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 [ $score_questions['business']['stock_raw_material_enough'] ]); //######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 ; @@ -246,7 +246,7 @@ class PDSCORE $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); + $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 [ $score_questions['business']['stock_finished_goods_enough'] != "" || $score_questions['business']['stock_finished_goods_enough'] != null ? $score_questions['business']['stock_finished_goods_enough'] : "no" ]); @@ -279,7 +279,7 @@ class PDSCORE $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); + $score_questions['business']['cerificates'][$certificate_key] = array('answer' => $certificate,'attributed_score' => $acutal_score, 'max_score' => $max_score); $certificate_actual_score += $acutal_score; $certificate_max_score += $max_score; @@ -289,12 +289,14 @@ class PDSCORE $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; + $score_questions['business']['cerificates']['attributed_score'] = $certificate_actual_score; + $score_questions['business']['cerificates']['score_band'] = 'Derived'; //echo $business_certificates_distribution;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); @@ -310,6 +312,7 @@ class PDSCORE $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; + $score_band = $value; } } @@ -318,7 +321,7 @@ class PDSCORE $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); + $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); //######2.2 business seasonal @@ -329,13 +332,13 @@ class PDSCORE $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); + $score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_seasonality_L2,'answer' => $score_questions['business']['business_seasonality'],'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' => $business_seasonality[ $score_questions['business']['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 ))) : $employees_total_L2 ; - + $score_band = 0; foreach($employees_total as $key => $value) { $exp = explode('to',$key); @@ -348,6 +351,7 @@ class PDSCORE if($left_exp && $right_exp) { $employees_total_actual_score = ($l1_business/100) * ($employees_total_L2/100) * $value; + $score_band = $value; } } @@ -356,7 +360,7 @@ class PDSCORE $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); + $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); //######2.5 owned_property @@ -366,7 +370,7 @@ class PDSCORE $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); + $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'] ]); //######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 ; @@ -374,7 +378,7 @@ class PDSCORE $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); + $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'] ]); //######2.11 location_suited_for_busienss @@ -383,7 +387,7 @@ class PDSCORE $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); + $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'] ]); //######2.11 business_activity_has_seen @@ -392,13 +396,14 @@ class PDSCORE $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); + $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'] ]); //######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; + $score_band = 0; foreach($vintage_of_business_account as $key => $value) { $exp = explode('to',$key); @@ -411,6 +416,7 @@ class PDSCORE if($left_exp && $right_exp) { $vintage_of_business_account_actual_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * $value; + $score_band = $value; } } @@ -419,7 +425,7 @@ class PDSCORE $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); + $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'],'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); /*-----------END OF BUSINESS SECTION -----------*/ @@ -435,17 +441,17 @@ class PDSCORE foreach($value as $v_key => $f_value) { $overall_max_score += $f_value['max_score']; - $overall_actual_score += $f_value['actual_score']; + $overall_actual_score += $f_value['attributed_score']; $current_max_score += $f_value['max_score']; - $current_actual_score += $f_value['actual_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_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); - + //print_r($score_questions); return ($score_questions); diff --git a/api/application/views/js/phantomchart.js b/api/application/views/js/phantomchart.js index a8604f45..dbdd489c 100644 --- a/api/application/views/js/phantomchart.js +++ b/api/application/views/js/phantomchart.js @@ -1 +1 @@ -var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 51;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);}); \ No newline at end of file +var page = require('webpage').create();page.viewportSize = { width: 600, height: 350 };page.clipRect = { top: 0, left: 0, width: 600, height: 350 };var score = 69;var url = 'http://localhost:9999/AWSEC2/sparqapi/api?'+score;var image_url = 'C:/5.6/xampp/htdocs/AWSEC2/sparqapi/api/application/views/report_templates/chart.png' ;page.open(url,function() {setTimeout(function() {page.render(image_url);phantom.exit();}, 500);}); \ No newline at end of file diff --git a/api/application/views/report_templates/JSONTOREPORT.php b/api/application/views/report_templates/JSONTOREPORT.php index 2a56ff0f..b2547ce7 100644 --- a/api/application/views/report_templates/JSONTOREPORT.php +++ b/api/application/views/report_templates/JSONTOREPORT.php @@ -63,20 +63,31 @@ defined('BASEPATH') OR exit('No direct script access allowed'); tfoot{ color:#e00201; } - /* metert gauge css */ - + /* #########Score Card Table Styles######### */ + #customers { + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + border-collapse: collapse; + width: 100%; +} -.sc-gauge { width:200px; height:200px; margin:200px auto; } -.sc-background { position:relative; height:100px; margin-bottom:10px; background-color:#fff; border-radius:150px 150px 0 0; overflow:hidden; text-align:center; } -.sc-mask { position:absolute; top:20px; right:20px; left:20px; height:80px; background-color:#555888; border-radius:150px 150px 0 0 } -.sc-percentage { position:absolute; top:100px; left:-200%; width:400%; height:400%; margin-left:100px; background-color:#00aeef; } -.sc-percentage { transform:rotate(158deg); transform-origin:top center; } -.sc-min { float:left; } -.sc-max { float:right; } -.sc-value { position:absolute; top:50%; left:0; width:100%; font-size:48px; font-weight:700 } - - /* metert gauge css */ +#customers td, #customers th { + border: 1px solid #ddd; + padding: 8px; +} + +#customers tr:nth-child(even){background-color: #f2f2f2;} + +#customers tr:hover {background-color: #ddd;} + +#customers th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #4CAF50; + color: white; +} + /* #########Score Card Table Styles######### */ @@ -117,7 +128,7 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo "PD Report Date ".$pd_master_details[0]['updatedon'].""; echo "PD Vist Date ".$pd_master_details[0]['scheduled_on'].""; echo "PD Initiated by ".$pd_master_details[0]['branch_name']." Branch"; - echo "Loan Applicant ID ".$pd_master_details[0]['lender_applicant_id'].""; + echo "Loan Application ID ".$pd_master_details[0]['lender_applicant_id'].""; echo "Product ".$pd_master_details[0]['product_name'].""; echo "Customer Segment ".$pd_master_details[0]['customer_segment_name'].""; ?> @@ -134,32 +145,99 @@ defined('BASEPATH') OR exit('No direct script access allowed'); echo "
"; echo "

"; echo "

Executive Summary

"; - // echo "General Section Score :".number_format($pd_score['score_summary']['general']['actual_score'],2,'.','.')."
"; - // echo "Business Section Score :".number_format($pd_score['score_summary']['business']['actual_score'],2,'.','.')."
"; - // echo "Final Remarks Score :".number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.','.')."
"; + // echo "General Section Score :".number_format($pd_score['score_summary']['general']['score_band'],2,'.','.')."
"; + // echo "Business Section Score :".number_format($pd_score['score_summary']['business']['score_band'],2,'.','.')."
"; + // echo "Final Remarks Score :".number_format($pd_score['score_summary']['final_remarks']['score_band'],2,'.','.')."
"; // echo "Final PD Score :".number_format($pd_score['score_summary']['overall_score']['final_score'],2,'.','.')."
"; + //print_r($pd_score); ?> - +
General Section Score
Business Section Score
Final Remarks Score
Final PD Score
Final PD Score (Over all Acutal score () / over all Maximum Score ( )) * 100)

"; //####################### CHART ############################# - echo '

'; + echo '

'; //######################### CHART ########################### - - + //####################General Section Statred######################## } else { echo "Score Chart Not Generated"; } + + echo "
"; + echo "
"; + ?> + + '; + echo " General Question (". $pd_score['general']['otp_done']['l1_weightage']."%) Answer Score Band Attributed Score Max Score"; + foreach($pd_score['general'] as $key => $general) + { + + $span = '('.$general['l1_weightage'].'% * '. $general['l2_weightage'].'% * '.$general['score_band'].')'; + echo ''.''.$key.' ('.$general['l2_weightage'].'%)'.$general['answer']. + ''.$general['score_band'].''.$general['attributed_score'].'
'.$span.''.$general['max_score'].''; + } + echo ''; + + echo '

'; + + echo ''; + echo ""; + foreach($pd_score['final_remarks'] as $key => $final_remark) + { + $span = '('.$final_remark['l1_weightage'].'% * '. $final_remark['l2_weightage'].'% * '.$final_remark['score_band'].')'; + echo ''.''; + } + echo '
Final Remarks Question (". $pd_score['final_remarks']['pd_officer_recommandations']['l1_weightage']."%) Answer Score BandAttributed Score Max Score
'.$key.' ('.$final_remark['l2_weightage'].'%)'.$final_remark['answer'].''.$final_remark['score_band'].''.$final_remark['attributed_score'].'
'.$span.'
'.$final_remark['max_score'].'
'; + + echo '

'; + + echo ''; + echo ""; + $certificates = array(); + foreach($pd_score['business'] as $key => $business) + { + $span = '('.$business['l1_weightage'].'% * '. $business['l2_weightage'].'% * '.$business['score_band'].')'; + if($key != 'cerificates') + { + echo ''.''; + } + + if($key == 'cerificates') + { + $certificates = $business; + echo ''.''; + } + + } + echo '
Business Question(". $pd_score['business']['no_of_years_business_run']['l1_weightage']."%) Answer Score Band Attributed ScoreMax Score
'.$key.' ('.$business['l2_weightage'].'%)'.$business['answer'].''.$business['score_band'].''.$business['attributed_score'].'
'.$span.'
'.$business['max_score'].'
'.$key.' ('.$business['l2_weightage'].'%)'.'Certificates'.''.$business['score_band'].''.$business['attributed_score'].''.$general['max_score'].'
'; + + echo '

'; + + echo ''; + echo ""; + $index = 0; + foreach($certificates as $key => $cerificate) + { + $index++; + if($index <=7) + { + echo ''.''; + } + } + echo "
Business Certificates Answer Score Max Score
'.$key.''.$cerificate['answer'].''.round($cerificate['attributed_score'],3).''.round($cerificate['max_score'],3).'
"; + - + $general_form = json_decode($pd_processed_forms[18][0]['processed_json'],true); $persons_met = "Default"; diff --git a/api/application/views/report_templates/chart.png b/api/application/views/report_templates/chart.png index c582fd1f..b288448c 100644 Binary files a/api/application/views/report_templates/chart.png and b/api/application/views/report_templates/chart.png differ diff --git a/api/index.php b/api/index.php index ff5d1e16..9db76a6a 100644 --- a/api/index.php +++ b/api/index.php @@ -75,7 +75,7 @@ switch (ENVIRONMENT) case 'testing': error_reporting(-1); - ini_set('display_errors', 1); + ini_set('display_errors', 0); break; case 'production': ini_set('display_errors', 0);