SCORE CARD IMPROVED
This commit is contained in:
parent
03c8a7a689
commit
00345b55e3
@ -681,7 +681,9 @@ class PD_Controller extends REST_Controller {
|
||||
$msg = "Code for starting your personal discussions with the verification officer is ".$OTP .". Pls share this only when the officer has reached your place in person";
|
||||
$no = (string)$pd_details['mobile_no'];
|
||||
unset($pd_details['mobile_no']);
|
||||
$pd_details['OTP'] = $OTP;
|
||||
//$pd_details['OTP'] = $OTP;
|
||||
$pd_details['OTP'] = '123456';
|
||||
|
||||
|
||||
// $client = new \GuzzleHttp\Client();
|
||||
// $response = $client->post($url);
|
||||
@ -3420,6 +3422,7 @@ class PD_Controller extends REST_Controller {
|
||||
|
||||
if($sales_declared_by_customer_flag == 1)
|
||||
{
|
||||
|
||||
$temp_purchases = 0;
|
||||
$temp_netprofit = 0;
|
||||
$temp_grossprofit = 0;
|
||||
@ -3432,13 +3435,13 @@ class PD_Controller extends REST_Controller {
|
||||
$temp_purchases = $overall_purchase_total;
|
||||
$temp_grossprofit = $total_sales_declared_by_customer - $temp_purchases;
|
||||
$temp_netprofit = $temp_grossprofit - $overall_business_expenses_total;
|
||||
$temp_netmargin = ($temp_netprofit/$total_sales_declared_by_customer) * 100;
|
||||
$temp_netmargin = $total_sales_declared_by_customer > 0 ?($temp_netprofit/$total_sales_declared_by_customer) * 100 : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp_grossprofit = $temp_netprofit + $overall_business_expenses_total;
|
||||
$temp_purchases = $total_sales_declared_by_customer - $temp_grossprofit;
|
||||
$temp_netmargin = ($temp_netprofit/$total_sales_declared_by_customer) * 100;
|
||||
$temp_netmargin = $total_sales_declared_by_customer > 0 ?($temp_netprofit/$total_sales_declared_by_customer) * 100 : 0;
|
||||
}
|
||||
|
||||
|
||||
@ -3553,6 +3556,7 @@ class PD_Controller extends REST_Controller {
|
||||
$data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid);
|
||||
$data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid);
|
||||
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
|
||||
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly($pdid);
|
||||
$data['pd_score'] = $this->calculateScore($pdid);
|
||||
|
||||
$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
|
||||
@ -4332,68 +4336,49 @@ class PD_Controller extends REST_Controller {
|
||||
$data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid);
|
||||
$data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid);
|
||||
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
|
||||
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly($pdid);
|
||||
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly();
|
||||
$data['pd_score'] = $this->calculateScore($pdid);
|
||||
//print_r($data['score_questions_display']);
|
||||
//print_r($data['pd_score']);
|
||||
// foreach($data['pd_score']['general'] as $key => $value)
|
||||
// {
|
||||
// // echo '\n\n';
|
||||
// MYUTIL::findQuestionByKey($data['score_questions_display'],$key);
|
||||
// // echo '\n\n';
|
||||
// // echo $key;
|
||||
// // echo "***********************";
|
||||
// }
|
||||
// die();
|
||||
print_r($data['pd_score']['business']);
|
||||
$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
|
||||
//echo $score_for_chart;
|
||||
|
||||
//GET phantom script from DB
|
||||
$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => 'phantomjs_local'),SCRIPTS);
|
||||
//$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => 'phantomjs_local'),SCRIPTS);
|
||||
|
||||
$exact_script = $phantom_script[0]['script_content'];
|
||||
//$exact_script = $phantom_script[0]['script_content'];
|
||||
//print_r($exact_script);
|
||||
$exact_script = str_replace('{{place_score_here}}',$score_for_chart,$exact_script);
|
||||
//$exact_script = str_replace('{{place_score_here}}',$score_for_chart,$exact_script);
|
||||
//print_r($exact_script);die();
|
||||
//GENERATE CHART PART
|
||||
|
||||
file_put_contents(APPPATH.'/views/js/phantomchart.js',$exact_script,LOCK_EX);
|
||||
// file_put_contents(APPPATH.'/views/js/phantomchart.js',$exact_script,LOCK_EX);
|
||||
|
||||
$str = 'phantomjs '.APPPATH.'/views/js/phantomchart.js';
|
||||
exec($str,$ou);
|
||||
exec('phantom.exit();');
|
||||
// $str = 'phantomjs '.APPPATH.'/views/js/phantomchart.js';
|
||||
// exec($str,$ou);
|
||||
// exec('phantom.exit();');
|
||||
|
||||
//print_r($ou);
|
||||
// //print_r($ou);
|
||||
|
||||
$chart_img_path = APPPATH.'/views/report_templates/chart.png';
|
||||
$type = pathinfo($chart_img_path, PATHINFO_EXTENSION);
|
||||
$chart_img_content = file_get_contents($chart_img_path);
|
||||
$base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($chart_img_content);
|
||||
$data['base64_pdscore_chart_url'] = $base64_pdscore_chart_url;
|
||||
// $chart_img_path = APPPATH.'/views/report_templates/chart.png';
|
||||
// $type = pathinfo($chart_img_path, PATHINFO_EXTENSION);
|
||||
// $chart_img_content = file_get_contents($chart_img_path);
|
||||
// $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($chart_img_content);
|
||||
// $data['base64_pdscore_chart_url'] = $base64_pdscore_chart_url;
|
||||
// echo $data['base64_pdscore_chart_url'];
|
||||
//die();
|
||||
|
||||
|
||||
//GENERATE CHART PART
|
||||
//print_r($data['pd_score']);die();
|
||||
|
||||
//GET ALL PROCESSED JSON
|
||||
for($i = 1;$i<=25;$i++)
|
||||
{
|
||||
$fields = array('processed_json');
|
||||
$where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i);
|
||||
// if($company_id != null)
|
||||
// {
|
||||
// $where_condition_array = array('fk_form_id'=>$pd_form_id,'fk_pd_id'=>$pd_id,'company_id' => $company_id,'isactive' => 1);
|
||||
// }
|
||||
|
||||
$data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC');
|
||||
}
|
||||
//print_r($data['pd_processed_forms']);die();
|
||||
// print_r(json_decode($data['pd_processed_forms'][13][0]['processed_json'],true));
|
||||
// echo count($data['pd_processed_forms'][1]);
|
||||
|
||||
// die();
|
||||
|
||||
$t = $this->load->view('report_templates/JSONTOREPORT',$data,true);
|
||||
//echo $t;die();
|
||||
|
||||
//PDF Gen using DOM PDF
|
||||
$pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
|
||||
//End of PDF Gen using DOM PDF
|
||||
@ -5124,7 +5109,7 @@ class PD_Controller extends REST_Controller {
|
||||
foreach($temp_data as $raw_material)
|
||||
{
|
||||
//print_r($raw_material);
|
||||
$final_data_from_supplier[] = $raw_material['manufacturing_raw_material_name'];
|
||||
$final_data_from_supplier['raw_material'][] = $raw_material['manufacturing_raw_material_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5146,7 +5131,7 @@ class PD_Controller extends REST_Controller {
|
||||
foreach($temp_data as $trade)
|
||||
{
|
||||
//print_r($raw_material);
|
||||
$final_data_from_supplier[] = $trade['trade_product_name'];
|
||||
$final_data_from_supplier['trading_product'][] = $trade['trade_product_name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5408,10 +5393,10 @@ class PD_Controller extends REST_Controller {
|
||||
$this->db->SELECT('*');
|
||||
$this->db->FROM(PERSONALASSETGRID);
|
||||
$this->db->WHERE('isactive',1);
|
||||
$this->db->WHERE('loan_amount_from<',(int)$pd_master_details[0]['loan_amount']);
|
||||
$this->db->WHERE('loan_amount_to>',(int)$pd_master_details[0]['loan_amount']);
|
||||
$this->db->WHERE('loan_amount_from<=',(int)$pd_master_details[0]['loan_amount']);
|
||||
$this->db->WHERE('loan_amount_to>=',(int)$pd_master_details[0]['loan_amount']);
|
||||
$personal_asset_grid['master_grid'] = $this->db->GET()->result_array();
|
||||
//print_r($this->db->last_query());
|
||||
//print_r($this->db->last_query());die();
|
||||
$this->db->SELECT('*');
|
||||
$this->db->FROM(PERSONALASSETGRIDVARIANCE);
|
||||
$this->db->WHERE('isactive',1);
|
||||
@ -5573,7 +5558,7 @@ class PD_Controller extends REST_Controller {
|
||||
// 15 - QNO(2.6) - owned_vechile
|
||||
$score_questions['business']['owned_vechile'] = $vechile_count ? 'yes':'no';
|
||||
// - QNO (2.12) - business_activity seen
|
||||
$score_questions['business']['business_activity_has_seen'] = isset($business_assest_form['business_activity'])? $business_assest_form['business_activity']: 'no';
|
||||
$score_questions['business']['business_activity_has_seen'] = isset($business_assest_form['business_assets_for_address'][0]['business_is_pd_visited'])? $business_assest_form['business_assets_for_address'][0]['business_is_pd_visited']: 'no';
|
||||
}
|
||||
#####End of Business Assets Form Questions########
|
||||
|
||||
@ -5667,14 +5652,14 @@ class PD_Controller extends REST_Controller {
|
||||
if(count($stock_form))
|
||||
{
|
||||
//print_r($stock_form);die();
|
||||
$score_questions['business']['stock_raw_material_enough'] = isset($stock_form['manufacturing_raw_materials']['is_sufficiant_raw']) ? $stock_form['manufacturing_raw_materials']['is_sufficiant_raw']: 'no';
|
||||
$score_questions['business']['stock_finished_goods_enough'] = isset($stock_form['is_sufficiant_finished_and_traded_goods']) ? $stock_form['is_sufficiant_finished_and_traded_goods'] : 'no';
|
||||
$score_questions['business']['stock_raw_material_enough'] = isset($stock_form['manufacturing_raw_materials']['is_sufficiant_raw']) ? $stock_form['manufacturing_raw_materials']['is_sufficiant_raw']: 'Not Applicable';
|
||||
$score_questions['business']['stock_finished_goods_enough'] = isset($stock_form['is_sufficiant_finished_and_traded_goods']) && ($stock_form['is_sufficiant_finished_and_traded_goods'] != "" || $stock_form['is_sufficiant_finished_and_traded_goods'] != null)? $stock_form['is_sufficiant_finished_and_traded_goods'] : 'Not Applicable';
|
||||
}
|
||||
else
|
||||
{
|
||||
$score_questions['business']['stock_raw_material_enough'] = 'Not Applicable';
|
||||
$score_questions['business']['stock_finished_goods_enough'] = 'Not Applicable';
|
||||
$score_questions['general']['value_of_other_assets'] = 'Not Applicable';
|
||||
//$score_questions['general']['value_of_other_assets'] = 'Not Applicable';
|
||||
}
|
||||
#####End of Stock Form Questions########
|
||||
|
||||
@ -5686,6 +5671,7 @@ class PD_Controller extends REST_Controller {
|
||||
$over_all_asset_value = 0;
|
||||
if(array_key_exists('assets_details',$other_asset_form))
|
||||
{
|
||||
//print_r($other_asset_form);
|
||||
foreach($other_asset_form['assets_details'] as $asset)
|
||||
{
|
||||
$over_all_asset_value += $asset['approximate_market_value'] ;
|
||||
@ -5693,6 +5679,8 @@ class PD_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//echo 'over_all_asset_value from FUN - '.$over_all_asset_value;die();
|
||||
// 18 Q.NO(1.9)
|
||||
$score_questions['general']['value_of_other_assets'] = $over_all_asset_value;
|
||||
|
||||
|
||||
Binary file not shown.
@ -10,7 +10,8 @@ class PDSCORE
|
||||
|
||||
public static function genericDI($score_questions,$pd_master_details,$personal_asset_grid)
|
||||
{
|
||||
//print_r($personal_asset_grid);echo "###################";
|
||||
|
||||
//print_r($score_questions);echo "###################";
|
||||
############ GENERIC SE-DI CASES #######################
|
||||
############ SCROE VARIABLES DECLERATIONS ##############
|
||||
|
||||
@ -56,7 +57,7 @@ class PDSCORE
|
||||
$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);
|
||||
$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);
|
||||
|
||||
@ -76,7 +77,7 @@ class PDSCORE
|
||||
$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);
|
||||
$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 --------------*/
|
||||
@ -88,7 +89,35 @@ class PDSCORE
|
||||
//echo "##################################################";
|
||||
|
||||
$general_distribute_level_weightage = 0;
|
||||
|
||||
//######1.5 neibourhood_check_as_per_pd_officer
|
||||
if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
|
||||
{
|
||||
$general_distribute_level_weightage += neibourhood_check_as_per_pd_officer_L2;
|
||||
|
||||
$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_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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//#######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 ))) : $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);
|
||||
@ -97,6 +126,8 @@ class PDSCORE
|
||||
|
||||
//######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 ))) : $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);
|
||||
@ -104,6 +135,9 @@ class PDSCORE
|
||||
$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 ))) : $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);
|
||||
@ -111,21 +145,19 @@ class PDSCORE
|
||||
$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 ))) : $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.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'] != "" || $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));
|
||||
|
||||
|
||||
//######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 ))) : $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);
|
||||
@ -133,6 +165,9 @@ class PDSCORE
|
||||
$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.7 otp_done
|
||||
|
||||
$otp_done_L2 = $general_distribute_level_weightage ? ($otp_done_L2 + ($otp_done_L2 / (100 - $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);
|
||||
@ -140,6 +175,9 @@ class PDSCORE
|
||||
$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));
|
||||
|
||||
//######1.8 qualification
|
||||
|
||||
$qualification_L2 = $general_distribute_level_weightage ? ($qualification_L2 + ($qualification_L2 / (100 - $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']);
|
||||
@ -148,11 +186,15 @@ class PDSCORE
|
||||
$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);
|
||||
|
||||
$value_of_other_assets_L2 = $general_distribute_level_weightage ? ($value_of_other_assets_L2 + ($value_of_other_assets_L2 / (100 - $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'] = $actual_value_of_assets;
|
||||
//echo 'actual_value_of_assets -'.$actual_value_of_assets;
|
||||
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
|
||||
|
||||
$loan_amount = $pd_master_details[0]['loan_amount'];
|
||||
$asset_calculation_details['loan_amount'] = $loan_amount;
|
||||
@ -274,7 +316,7 @@ class PDSCORE
|
||||
|
||||
|
||||
//######2.1 Business Certificates
|
||||
$cerificates_L2 = 10;
|
||||
|
||||
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage ))) : $cerificates_L2;
|
||||
|
||||
//find out no of not applicable cases
|
||||
@ -287,8 +329,11 @@ class PDSCORE
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
|
||||
|
||||
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
|
||||
// echo $business_certificates_distribution;
|
||||
$certificate_actual_score = 0;
|
||||
$certificate_max_score = 0;
|
||||
|
||||
@ -355,9 +400,10 @@ class PDSCORE
|
||||
$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' => round($business_seasonality_L2,2),'answer' => $score_questions['business']['business_seasonality'],'attributed_score' => round($no_of_years_business_run_actual_score), 'max_score' => round($no_of_years_business_run_max_score,2),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_seasonality[ $score_questions['business']['business_seasonality'] ],'max_score_band' => max($business_seasonality));
|
||||
$score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => round($business_seasonality_L2,2),'answer' => $score_questions['business']['business_seasonality'],'attributed_score' => round($business_seasonality_actual_score,2), 'max_score' => round($business_seasonality_max_score,2),'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;
|
||||
|
||||
@ -1264,14 +1264,14 @@ class PD_Model extends SPARQ_Model {
|
||||
$gross_profit_calculation_type = $this->selectCustomRecords($fields,$where_condition_array,PDASSESSEDINCOMEESTIMATIONOFGROSSPROFITTYPE);
|
||||
|
||||
//get sales_calculated_by_itemwise details
|
||||
$fields = array('sci_id','sales_item','sales_qty','UOM.name as uom_name','fk_uom_id','FREQUENCY.name as frequency_name','rate_per_unit','fk_frequency_id','annual_sale_value','margin_final_value','margin_per','margin_per_uom','uom_other','comments');
|
||||
$fields = array('sci_id','sales_item','sales_qty','UOM.name as uom_name','fk_uom_id','FREQUENCY.name as frequency_name','rate_per_unit','fk_frequency_id','annual_sale_value','margin_final_value','margin_per','margin_per_uom','uom_other','comments','sales_type');
|
||||
$table = SALESCALCULATEDBYITEMWISE.' as SALESCALCULATEDBYITEMWISE';
|
||||
$where_condition_array = array('fk_pd_id'=>$pdid,'SALESCALCULATEDBYITEMWISE.isactive'=>1);
|
||||
$joins = array(
|
||||
array('table'=>FREQUENCY.' as FREQUENCY','condition'=>'SALESCALCULATEDBYITEMWISE.fk_frequency_id = FREQUENCY.frequency_id','jointype'=>'INNER JOIN'),
|
||||
array('table'=>UOM.' as UOM','condition'=>'SALESCALCULATEDBYITEMWISE.fk_uom_id = UOM.uom_id','jointype'=>'INNER JOIN'));
|
||||
array('table'=>UOM.' as UOM','condition'=>'SALESCALCULATEDBYITEMWISE.fk_uom_id = UOM.uom_id','jointype'=>'LEFT'));
|
||||
$sales_calculated_by_itemwise = $this->getJoinRecords($fields,$table,$joins,$where_condition_array);
|
||||
|
||||
//print_r($this->db->last_query());
|
||||
|
||||
//get sales_items_by_monthwise details
|
||||
|
||||
@ -1398,7 +1398,7 @@ class PD_Model extends SPARQ_Model {
|
||||
return $return_data;
|
||||
}
|
||||
|
||||
public function getScoreableQuestionToDispaly($pdid)
|
||||
public function getScoreableQuestionToDispaly()
|
||||
{
|
||||
|
||||
$this->db->SELECT('question,key');
|
||||
|
||||
@ -147,12 +147,14 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
";
|
||||
echo "<div class='page_break'></div>";
|
||||
echo "<br><br>";
|
||||
// ########################### End of Master Details Section ####################################
|
||||
|
||||
|
||||
|
||||
// ########################### Score Card Section ###############################################
|
||||
|
||||
echo "<h2>Executive Summary</h2>";
|
||||
// echo "General Section Score :".number_format($pd_score['score_summary']['general']['score_band'],2,'.','.')."<br>";
|
||||
// echo "Business Section Score :".number_format($pd_score['score_summary']['business']['score_band'],2,'.','.')."<br>";
|
||||
// echo "Final Remarks Score :".number_format($pd_score['score_summary']['final_remarks']['score_band'],2,'.','.')."<br>";
|
||||
// echo "Final PD Score :".number_format($pd_score['score_summary']['overall_score']['final_score'],2,'.','.')."<br>";
|
||||
//print_r($pd_score);
|
||||
|
||||
?>
|
||||
<table>
|
||||
<tr> <td>General Section Score</td> <td> </td> <td><?php echo number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',')?></td></tr>
|
||||
@ -160,26 +162,27 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
<tr> <td>Final Remarks Score</td> <td> </td> <td><?php echo number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',')?></td></tr>
|
||||
<tr> <td>Final PD Score</td> <td> </td> <td><?php echo number_format($pd_score['score_summary']['overall_score']['final_score'],2,'.',',')?></td> <td style="font-size:9px;">(Over all Acutal score (<?php echo number_format($pd_score['score_summary']['overall_score']['overall_actual_score'],2,'.',',');?>) / over all Maximum Score (<?php echo number_format($pd_score['score_summary']['overall_score']['overall_max_score'],2,'.',',');?> )) * 100)</td></tr>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
if($base64_pdscore_chart_url != "" || $base64_pdscore_chart_url != null)
|
||||
//####################### CHART #############################
|
||||
if(isset($base64_pdscore_chart_url))
|
||||
{
|
||||
echo "<br><br>";
|
||||
//####################### CHART #############################
|
||||
|
||||
echo '<p style="position:relative;"><img src="'.$base64_pdscore_chart_url.'" style="width:600px;height:350px;"/></p>';
|
||||
//######################### CHART ###########################
|
||||
|
||||
//####################General Section Statred########################
|
||||
|
||||
}
|
||||
else
|
||||
{ echo "<b>Score Chart Not Generated</b>"; }
|
||||
|
||||
echo "<div style='position:relative;'></div>";
|
||||
echo "<div class='page_break'></div>";
|
||||
//######################### CHART ###########################
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
//print_r($pd_score['business']);
|
||||
// *** General Section Questions Score Table
|
||||
echo '<table id="scorecard_table">';
|
||||
echo "<tr> <th>General Questions L1(". $pd_score['general']['otp_done']['l1_weightage']."%) </th> <th>L2</th> <th>Answer</th> <th>Score</th> <th>Attributed Score</th> <th>Max Score</th></tr>";
|
||||
foreach($pd_score['general'] as $key => $general)
|
||||
@ -197,6 +200,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
echo '<br><br>';
|
||||
|
||||
|
||||
// *** Asset Caculation Score Table
|
||||
echo '<table id="scorecard_table">';
|
||||
echo "<tr> <th colspan='2'>Asset Value Calculaitons</th></tr>";
|
||||
|
||||
@ -217,16 +222,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<br><br><br>';
|
||||
|
||||
// *** Final Remarks Questions Score Table
|
||||
echo '<table id="scorecard_table">';
|
||||
echo "<tr> <th>Final Remarks Questions L1(". $pd_score['final_remarks']['pd_officer_recommandations']['l1_weightage']."%)</th> <th>L2</th><th>Answer</th> <th>Score</th><th>Attributed Score</th> <th>Max Score</th></tr>";
|
||||
foreach($pd_score['final_remarks'] as $key => $final_remark)
|
||||
{
|
||||
|
||||
$question = MYUTIL::findQuestionByKey($score_questions_display,$key);
|
||||
|
||||
$span = '<span style="font-size:9px">('.$final_remark['l1_weightage'].'% * '. $final_remark['l2_weightage'].'% * '.$final_remark['score_band'].')</span>';
|
||||
|
||||
$max_span = '<span style="font-size:9px">('.$final_remark['l1_weightage'].'% * '. $final_remark['l2_weightage'].'% * '.$final_remark['max_score_band'].')</span>';
|
||||
|
||||
echo '<tr>'.'<td>'.$question.'</td><td>'.$final_remark['l2_weightage'].'%</td><td>'.$final_remark['answer'].'</td><td>'.$final_remark['score_band'].'</td><td>'.$final_remark['attributed_score'].'<br>'.$span.'</td><td>'.$final_remark['max_score'].'<br>'.$max_span.'</td></tr>';
|
||||
}
|
||||
|
||||
@ -234,8 +242,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
echo '</table>';
|
||||
echo '<br><br><br>';
|
||||
|
||||
|
||||
print_r($pd_score['business']);
|
||||
echo '<table id="scorecard_table">';
|
||||
|
||||
// *** Business Section Questions Score Table
|
||||
echo "<tr> <th>Business Questions L1(". $pd_score['business']['no_of_years_business_run']['l1_weightage']."%)</th> <th>L2</th><th>Answer</th> <th>Score</th> <th>Attributed Score</th><th>Max Score</th></tr>";
|
||||
$certificates = array();
|
||||
foreach($pd_score['business'] as $key => $business)
|
||||
@ -259,6 +269,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
echo "<tr> <td colspan='4'>Business Section Sum of Attributed Score | Sum of Max Score </td> <td>".number_format($pd_score['score_summary']['business']['actual_score'],2,'.',',')."</td> <td>".number_format($pd_score['score_summary']['business']['max_score'],2,'.',',')."</td> </tr>";
|
||||
echo '</table>';
|
||||
|
||||
|
||||
// *** Business Certificates Score Table
|
||||
echo '</table>';
|
||||
|
||||
echo '<br><br>';
|
||||
@ -271,19 +284,19 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
$index++;
|
||||
if($index <=7)
|
||||
{
|
||||
|
||||
$question = MYUTIL::findQuestionByKey($score_questions_display,$key);
|
||||
$span = '<span style="font-size:9px">('.$cerificate['l1_weightage'].'% * '. $cerificate['l2_weightage'].'% * '.$cerificate['score_band'].')</span>';
|
||||
|
||||
$max_span = '<span style="font-size:9px">('.$cerificate['l1_weightage'].'% * '. $cerificate['l2_weightage'].'% * '.$cerificate['max_score_band'].')</span>';
|
||||
|
||||
echo '<tr>'.'<td>'.$key.'</td><td>'.$cerificate['answer'].'</td><td>'.$cerificate['score_band'].'</td><td>'.round($cerificate['attributed_score'],3).'<br>'.$span.'</td><td>'.round($cerificate['max_score'],3).'<br>'.$max_span.'</td></tr>';
|
||||
echo '<tr>'.'<td>'.$question.'</td><td>'.$cerificate['answer'].'</td><td>'.$cerificate['score_band'].'</td><td>'.round($cerificate['attributed_score'],3).'<br>'.$span.'</td><td>'.round($cerificate['max_score'],3).'<br>'.$max_span.'</td></tr>';
|
||||
}
|
||||
}
|
||||
echo "<table>";
|
||||
|
||||
// ########################### End Of Score Card Section #########################################
|
||||
|
||||
|
||||
|
||||
// ####################### General Section Statred ############################-->
|
||||
$general_form = json_decode($pd_processed_forms[18][0]['processed_json'],true);
|
||||
$persons_met = "Default";
|
||||
$all_company_details = null;
|
||||
@ -291,15 +304,107 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
{
|
||||
$all_company_details = $general_form['companies'];
|
||||
}
|
||||
// echo MYUTIL::findCompanyName($all_company_details,2);
|
||||
//print_r($all_company_details);
|
||||
//print_r($pd_score['overall_score']['final_score']);
|
||||
?>
|
||||
|
||||
|
||||
<div class='page_break'></div>
|
||||
<h3>General Section Information</h3>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Person(s) Met </td><td><?php
|
||||
foreach($general_form['individuals'] as $ind_key => $individual)
|
||||
{
|
||||
if($individual['is_person_met'] == true)
|
||||
{
|
||||
$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "Not Available" ;
|
||||
echo '<br>'.$individual['applicant_title_name_master'] . $applicant_name ;
|
||||
|
||||
foreach($general_form['company_with_relationships'] as $company_with_relationship)
|
||||
{
|
||||
if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name'])
|
||||
{
|
||||
//FInd Company Name from JSON
|
||||
echo '<br>'.$company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name'] . '<br>';
|
||||
}
|
||||
}
|
||||
|
||||
foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
|
||||
{
|
||||
if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null)
|
||||
{
|
||||
echo '<br>'. isset($persons_with_relationship['relationship_master']) ? $persons_with_relationship['relationship_master'] : "NA" .' Of '.$persons_with_relationship['relation_to_master'] . '<br>';
|
||||
//print_r($persons_with_relationship);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<p>Loan Applicants</p>
|
||||
<!-- <table border=1 style='border-collapse:collapse;'> -->
|
||||
<table class="table2" >
|
||||
|
||||
<?php
|
||||
foreach($general_form['individuals'] as $ind_key => $individual)
|
||||
{
|
||||
|
||||
if($individual['is_applicant'] == true)
|
||||
{
|
||||
$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "YYYY" ;
|
||||
echo "<tr><td>".$individual['applicant_title_name_master'].$applicant_name."</td><td>";
|
||||
|
||||
foreach($general_form['company_with_relationships'] as $company_with_relationship)
|
||||
{
|
||||
if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name'])
|
||||
{
|
||||
//FInd Company Name from JSON
|
||||
|
||||
echo "<br>";
|
||||
print_r($company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name']);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
|
||||
{
|
||||
//print_r($persons_with_relationship);
|
||||
if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null)
|
||||
{
|
||||
echo "<br><br>";
|
||||
$RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : "RRRR";
|
||||
print_r($persons_with_relationship['relationship_master'] .' Of '. $RSNA);
|
||||
//print_r($persons_with_relationship);
|
||||
}
|
||||
}
|
||||
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
||||
<?php if($general_form['general_remark'] != "") { ?>
|
||||
<p>PD Officer's Note (About General Section) :</p> <?php echo $general_form['general_remark'];
|
||||
}
|
||||
?>
|
||||
|
||||
<!-- ####################### End Of General Section Statred ############################-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<!-- ####################End Of General Section Statred########################-->
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Loading…
Reference in New Issue
Block a user