SMC SCORE CARD

This commit is contained in:
Velz2020 2020-12-11 14:38:04 +05:30
parent 5ee924ae10
commit 920333ab86
6 changed files with 622 additions and 8 deletions

View File

@ -659,6 +659,8 @@ defined('SMC_EXCEL_FILELIST') OR define('SMC_EXCEL_FILELIST','t_smc_excel_fileli
defined('EXCEL_COLUMN_REF_NAME') OR define('EXCEL_COLUMN_REF_NAME','t_excel_column_ref_name');
defined('SMC_CREDIT_PD_FORMS') OR define('SMC_CREDIT_PD_FORMS','m_smc_credit_pd_forms');
defined('SMC_CREDITPD_IMGS') OR define('SMC_CREDITPD_IMGS','m_smc_creditpd_imgs');
defined('SALESVENDORLIST') OR define('SALESVENDORLIST','m_smcvendorlist');
defined('SALESEQUIPMENTLIST') OR define('SALESEQUIPMENTLIST','m_smc_equipmentlist');

View File

@ -115,9 +115,9 @@ $config['sms_api_pwd'] = getenv('TEST.SMS_API_PWD');
$config['sms_gupshup_url'] = 'http://enterprise.smsgupshup.com/GatewayAPI/rest?method=SendMessage&send_to={{send_to_mobile_no}}&msg={{send_msg}}&msg_type=TEXT&userid={{sms_api_user_id}}&auth_scheme=plain&password={{sms_api_pwd}}=1.1&format=text';
$config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name','UOM' => 'name','OCCUPATIONMEMBERS' => 'name','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'name','RELATIONSHIPS' => 'name','FREQUENCY' => 'name', 'CUSTOMERBEHAVIOUR' => 'description', 'CUSTOMERSEGMENT' => 'name','DESIGNATION' => 'designation', 'EARNINGMEMBERSSTATUS' => 'earning_member_status','EDUQUALIFICATION' => 'qualification_name','ADDRESSTYPE' => 'address_type','LOCALITY' => 'locality_name','ASSETTYPE' => 'name','PROPERTIES' => 'name','INVESTMENTTYPE' => 'name','INSURANCETYPE' => 'name','PERSONSMET' => 'person_met_name','RESIDENCEOWNERSHIP' => 'name','PAYMENTMODE' => 'name','ACCOUNTTYPE' => 'name','SOURCEOFOTHERINCOME' => 'name','MORTAGEPROPERTYTYPE' => 'name','ENDUSEOFLOAN' => 'enduse_of_loan','SOURCEOFBALANCETRANSFER' => 'name', 'STATUSOFCONSTRUCTION' => 'name','BTLENDERLIST'=>'lender_name','MORTAGEPROPERTIES'=>'property_name','EXISTINGLOANTYPES'=>'loan_type_name','PDAPPLICANTSDETAILS'=>'applicant_name','RELATIONWITHBUSINESS'=>'relation_with_business_name','BUSINESSENTITYTYPE'=>'business_entity_type_name','COMPANYRELATIONSHIPS'=>'name','STATE'=>'name','CITY'=>'name','COUNTRY'=>'country_name','BOUNCEMASTER'=>'bounce_reason_name','BUSINESSEXPENSES'=>'expense_item','BUSINESSINCOME'=>'business_income_item','COMMENTSONLOCALITY'=>'rating','COMPANY'=>'company_id','LOCALITY'=>'locality_name','NONINDIVIDUALENTITIES'=>'non_individual_entity_name','PDFORMS'=>'pd_form_name','PDLOCATIONAPPROACH'=>'description','PDTYPE'=>'type_name','PDNOTIFICATION'=>'pd_status','QUESTIONCATEGORY'=>'category_name','ROLES'=>'role_name','SUBPRODUCTS'=>'name','TITLES'=>'name','PINCODE'=>'pincode','PRODUCTS'=>'name','ENTITYTYPE'=>'name','PDTEAM'=>'team_name','ENTITY'=>'short_name','PDSTATUS'=>'pd_status_name','LISTOFMASTERS'=>'master_name','OTPREJECTION'=>'rejection_reason','ENDUSEOFTOPUP'=>'end_use_of_topup','VEHICLETYPE'=>'vehicle_type_name','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation','REGIONS'=>'name','PRICINGINFO'=>'pricing_info_id');
$config['master_tables_field_names'] = array('INDUSTRYCLASSIFICATION' => 'name','UOM' => 'name','OCCUPATIONMEMBERS' => 'name','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'name','RELATIONSHIPS' => 'name','FREQUENCY' => 'name', 'CUSTOMERBEHAVIOUR' => 'description', 'CUSTOMERSEGMENT' => 'name','DESIGNATION' => 'designation', 'EARNINGMEMBERSSTATUS' => 'earning_member_status','EDUQUALIFICATION' => 'qualification_name','ADDRESSTYPE' => 'address_type','LOCALITY' => 'locality_name','ASSETTYPE' => 'name','PROPERTIES' => 'name','INVESTMENTTYPE' => 'name','INSURANCETYPE' => 'name','PERSONSMET' => 'person_met_name','RESIDENCEOWNERSHIP' => 'name','PAYMENTMODE' => 'name','ACCOUNTTYPE' => 'name','SOURCEOFOTHERINCOME' => 'name','MORTAGEPROPERTYTYPE' => 'name','ENDUSEOFLOAN' => 'enduse_of_loan','SOURCEOFBALANCETRANSFER' => 'name', 'STATUSOFCONSTRUCTION' => 'name','BTLENDERLIST'=>'lender_name','MORTAGEPROPERTIES'=>'property_name','EXISTINGLOANTYPES'=>'loan_type_name','PDAPPLICANTSDETAILS'=>'applicant_name','RELATIONWITHBUSINESS'=>'relation_with_business_name','BUSINESSENTITYTYPE'=>'business_entity_type_name','COMPANYRELATIONSHIPS'=>'name','STATE'=>'name','CITY'=>'name','COUNTRY'=>'country_name','BOUNCEMASTER'=>'bounce_reason_name','BUSINESSEXPENSES'=>'expense_item','BUSINESSINCOME'=>'business_income_item','COMMENTSONLOCALITY'=>'rating','COMPANY'=>'company_id','LOCALITY'=>'locality_name','NONINDIVIDUALENTITIES'=>'non_individual_entity_name','PDFORMS'=>'pd_form_name','PDLOCATIONAPPROACH'=>'description','PDTYPE'=>'type_name','PDNOTIFICATION'=>'pd_status','QUESTIONCATEGORY'=>'category_name','ROLES'=>'role_name','SUBPRODUCTS'=>'name','TITLES'=>'name','PINCODE'=>'pincode','PRODUCTS'=>'name','ENTITYTYPE'=>'name','PDTEAM'=>'team_name','ENTITY'=>'short_name','PDSTATUS'=>'pd_status_name','LISTOFMASTERS'=>'master_name','OTPREJECTION'=>'rejection_reason','ENDUSEOFTOPUP'=>'end_use_of_topup','VEHICLETYPE'=>'vehicle_type_name','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation','REGIONS'=>'name','PRICINGINFO'=>'pricing_info_id','SALESVENDORLIST' => 'vendor','SALESEQUIPMENTLIST' => 'equipment');
$config['master_tables_pkid'] = array('INDUSTRYCLASSIFICATION' => 'industry_classification_id','UOM' => 'uom_id','OCCUPATIONMEMBERS' => 'occupation_non_earning_member_id','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'type_of_activity_id','RELATIONSHIPS' => 'relationship_id','FREQUENCY' => 'frequency_id', 'CUSTOMERBEHAVIOUR' => 'customer_behaviour_id', 'CUSTOMERSEGMENT' => 'customer_segment_id','DESIGNATION' => 'designation_id', 'EARNINGMEMBERSSTATUS' => 'earning_member_status_id','EDUQUALIFICATION' => 'qualification_id','ADDRESSTYPE' => 'address_type_id','LOCALITY' => 'locality_id','ASSETTYPE' => 'id','PROPERTIES' => 'id','INVESTMENTTYPE' => 'id','INSURANCETYPE' => 'id','PERSONSMET' => 'person_met_id','RESIDENCEOWNERSHIP' => 'id','PAYMENTMODE' => 'id','ACCOUNTTYPE' => 'id','SOURCEOFOTHERINCOME' => 'id','MORTAGEPROPERTYTYPE' => 'id','ENDUSEOFLOAN' => 'enduse_of_loan_id','SOURCEOFBALANCETRANSFER' => 'id', 'STATUSOFCONSTRUCTION' => 'id','MORTAGEPROPERTIES' => 'mortage_property_id','BTLENDERLIST'=>'bt_lender_list_id','EXISTINGLOANTYPES'=>'existing_loan_type_id','PDAPPLICANTSDETAILS'=>'pd_co_applicant_id','RELATIONWITHBUSINESS'=>'relation_with_business_id','BUSINESSENTITYTYPE'=>'business_entity_type_id','COMPANYRELATIONSHIPS'=>'company_relationship_id','STATE'=>'state_id','CITY'=>'city_id','COUNTRY'=>'country_id','BOUNCEMASTER'=>'bounce_id','BUSINESSEXPENSES'=>'expense_item_id','BUSINESSINCOME'=>'business_income_id','COMMENTSONLOCALITY'=>'comments_on_locality_id','COMPANY'=>'name','LOCALITY'=>'locality_id','NONINDIVIDUALENTITIES'=>'non_individual_entity_id','PDFORMS'=>'form_id','PDLOCATIONAPPROACH'=>'pd_location_approach_id','PDTYPE'=>'pd_type_id','PDNOTIFICATION'=>'pdnotification_id','QUESTIONCATEGORY'=>'question_category_id','ROLES'=>'role_id','SUBPRODUCTS'=>'subproduct_id','TITLES'=>'title_id','PINCODE'=>'pincode_id','PRODUCTS'=>'product_id','ENTITYTYPE'=>'entity_type_id','PDTEAM'=>'pdteam_id','ENTITY'=>'entity_id','PDSTATUS'=>'pd_status_id','LISTOFMASTERS'=>'master_id','OTPREJECTION'=>'otp_rejection_id','ENDUSEOFTOPUP'=>'end_use_of_topup_id','VEHICLETYPE'=>'vehicle_type_id','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation_id','REGIONS'=>'region_id','PRICINGINFO'=>'pricing_info_id');
$config['master_tables_pkid'] = array('INDUSTRYCLASSIFICATION' => 'industry_classification_id','UOM' => 'uom_id','OCCUPATIONMEMBERS' => 'occupation_non_earning_member_id','EDUQUALIFICATION' => 'qualification_name', 'TYPEOFACTIVITY' => 'type_of_activity_id','RELATIONSHIPS' => 'relationship_id','FREQUENCY' => 'frequency_id', 'CUSTOMERBEHAVIOUR' => 'customer_behaviour_id', 'CUSTOMERSEGMENT' => 'customer_segment_id','DESIGNATION' => 'designation_id', 'EARNINGMEMBERSSTATUS' => 'earning_member_status_id','EDUQUALIFICATION' => 'qualification_id','ADDRESSTYPE' => 'address_type_id','LOCALITY' => 'locality_id','ASSETTYPE' => 'id','PROPERTIES' => 'id','INVESTMENTTYPE' => 'id','INSURANCETYPE' => 'id','PERSONSMET' => 'person_met_id','RESIDENCEOWNERSHIP' => 'id','PAYMENTMODE' => 'id','ACCOUNTTYPE' => 'id','SOURCEOFOTHERINCOME' => 'id','MORTAGEPROPERTYTYPE' => 'id','ENDUSEOFLOAN' => 'enduse_of_loan_id','SOURCEOFBALANCETRANSFER' => 'id', 'STATUSOFCONSTRUCTION' => 'id','MORTAGEPROPERTIES' => 'mortage_property_id','BTLENDERLIST'=>'bt_lender_list_id','EXISTINGLOANTYPES'=>'existing_loan_type_id','PDAPPLICANTSDETAILS'=>'pd_co_applicant_id','RELATIONWITHBUSINESS'=>'relation_with_business_id','BUSINESSENTITYTYPE'=>'business_entity_type_id','COMPANYRELATIONSHIPS'=>'company_relationship_id','STATE'=>'state_id','CITY'=>'city_id','COUNTRY'=>'country_id','BOUNCEMASTER'=>'bounce_id','BUSINESSEXPENSES'=>'expense_item_id','BUSINESSINCOME'=>'business_income_id','COMMENTSONLOCALITY'=>'comments_on_locality_id','COMPANY'=>'name','LOCALITY'=>'locality_id','NONINDIVIDUALENTITIES'=>'non_individual_entity_id','PDFORMS'=>'form_id','PDLOCATIONAPPROACH'=>'pd_location_approach_id','PDTYPE'=>'pd_type_id','PDNOTIFICATION'=>'pdnotification_id','QUESTIONCATEGORY'=>'question_category_id','ROLES'=>'role_id','SUBPRODUCTS'=>'subproduct_id','TITLES'=>'title_id','PINCODE'=>'pincode_id','PRODUCTS'=>'product_id','ENTITYTYPE'=>'entity_type_id','PDTEAM'=>'pdteam_id','ENTITY'=>'entity_id','PDSTATUS'=>'pd_status_id','LISTOFMASTERS'=>'master_id','OTPREJECTION'=>'otp_rejection_id','ENDUSEOFTOPUP'=>'end_use_of_topup_id','VEHICLETYPE'=>'vehicle_type_id','PDOFFICERRECOMMENDATIONS'=>'pdofficer_recommendation_id','REGIONS'=>'region_id','PRICINGINFO'=>'pricing_info_id','SALESVENDORLIST' => 'id','SALESEQUIPMENTLIST' => 'id');
$config['parent_forms'] = array(0,10,7,4,6,8,9,20);// 0 added for dummy

View File

@ -857,7 +857,13 @@ class SMC_Credit_PD_Controller extends REST_Controller {
$product_id = $return_data['pdmaster_details'][0]['fk_product_id'];
$return_data['template_details'] = $this->SMC_Credit_PD_Model->getSMCTemplateForPD($pd_id,$product_id,$client,$random_string,$api);
$return_data['pdapplicants_detials'] = $this->PD_Model->getApplicantsDetails($pd_id);
//print_r($return_data['template_details']);die();
$photo_count = $this->SMC_Credit_PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,'fk_smc_credit_pd_id' => $pd_id),SMC_CREDIT_PD_DOCS);
if(is_array($photo_count) && count($photo_count))
{
$return_data['template_details'][ (count($return_data['template_details'])-1) ]['is_answered'] = 1;
}
// print_r($return_data['template_details']);die();
if(count($return_data['template_details']))
{
$data['dataStatus'] = true;
@ -1301,6 +1307,7 @@ public function filterSalesPDList_post() {
{
$records = $this->post('records');
$pd_master_data = $this->PD_Model->getPDMasterDetails($records['pd_id'],$records['random_string']);
$cur_section_data = array();
// print_r($pd_master_data);die();
// echo $records['form_id'];die();
//check excel file in local, otherwise get it from s3 and store locallly
@ -1317,11 +1324,12 @@ public function filterSalesPDList_post() {
$singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$key,'+5 minutes');
//echo $singed_uri;
$sucess = file_put_contents($filename, file_get_contents($singed_uri));
//echo '*'.$sucess;
}
// die();
//get exact data
$cur_section_data = readexceldata::getExcelSectionData($filename,(isset($records['form_id']) && $records['form_id'] ? $records['form_id'] : null),$records['pd_id']);
if(count($cur_section_data))
{
$data['dataStatus'] = true;
@ -1380,7 +1388,7 @@ public function filterSalesPDList_post() {
}
else
{
$img_data[$key]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '');
$img_data[$value['key_name']]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? $sales_pd_img_data_value['img'] : '');
// $img_data[$value['key_name']]['img_data'][] = array('img_url' => $sales_pd_img_data_value['img'] ? 'BLOB' : '');
}
@ -1447,6 +1455,7 @@ public function filterSalesPDList_post() {
{
$records = $this->post('records');
$this->load->helper('smc_creditpd');
$this->load->helper('smcpdscore');
// print_r($records);
$view_data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($records['pd_id']);
@ -1468,8 +1477,41 @@ public function filterSalesPDList_post() {
$view_data['smc_images'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name!=' => 'satellite'),SMC_CREDIT_PD_DOCS);
$view_data['satellite'] = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $records['pd_id'],'isactive' => 1,'img_name=' => 'satellite'),SMC_CREDIT_PD_DOCS);
//print_r(count($view_data['smc_images']));die();
//score card part
$score_card_questions = $this->seperateScorecardQuestions($view_data);
$view_data['pd_score'] = SMCPDSCORE::genericDIPDScoreCalculate($score_card_questions,$view_data['pd_master_details']);
$final_score = $view_data['pd_score']['score_summary']['overall_score']['final_score'];
//GET phantom script from DB
$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => PHANTOMJSSCRIPT_LOCATION),SCRIPTS);
$exact_script = $phantom_script[0]['script_content'];
// print_r($exact_script);die();
$apppath = str_replace('\\','/',$this->external_path.'/pd_reports/'.$records['pd_id']);
$exact_script = str_replace('{{APPPATH}}',$apppath,$exact_script);
$exact_script = str_replace('{{place_score_here}}',$final_score,$exact_script);
//print_r($exact_script);die();
//GENERATE CHART PART
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();');
//print_r($ou);
$chart_img_path = $this->external_path.'/pd_reports/'.$records['pd_id'].'/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);
$view_data['base64_pdscore_chart_url'] = $base64_pdscore_chart_url;
// echo $base64_pdscore_chart_url;
// die();
//score card part
$html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true);
// echo $html_content;die();
echo $html_content;die();
$pdf_name = $view_data['pd_master_details'][0]['main_applicant'];
$pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF
@ -1493,6 +1535,55 @@ public function filterSalesPDList_post() {
}
}
function seperateScorecardQuestions($view_data)
{
$score_card_questions = array();
$customer_behaviour = array('1' => 'Others','2' => 'Rude','3' => 'Polite');
$over_all = array('2' => 'Positive','3' => 'Negative');
// print_r($view_data['pd_section_data'][4]);die();
$score_card_questions['approcah_to_pd_location'] = array('answer_id' => $view_data['pd_section_data'][2]['pd_location']['pd_location_approach_id'],'answer' => $view_data['pd_section_data'][2]['pd_location']['description']);
$score_card_questions['comment_locality'] = array('answer_id' => $view_data['pd_section_data'][2]['comment_locality']['comments_on_locality_id'],'answer' => $view_data['pd_section_data'][2]['comment_locality']['rating']);
$score_card_questions['customer_behaviour'] = array('answer_id' => $view_data['pd_section_data'][19]['customer_behaviour'],'answer' => $customer_behaviour[ $view_data['pd_section_data'][19]['customer_behaviour'] ]);
$score_card_questions['pd_officer_recommendation'] = array('answer_id' => $view_data['pd_section_data'][19]['pd_officer_recommendation'],'answer' => $over_all[ $view_data['pd_section_data'][19]['pd_officer_recommendation'] ]);
$score_card_questions['neighbourhood_status'] = array('answer_id' => $view_data['pd_section_data'][17]['neighbourhood_status'],'answer' => $view_data['pd_section_data'][17]['neighbourhood_status']);
$score_card_questions['business_seasonality'] = array('answer_id' => $view_data['pd_section_data'][4]['seasonality'],'answer' => $view_data['pd_section_data'][4]['seasonality']);
$score_card_questions['name_board_seen'] = array('answer_id' => 'no','answer' => 'no' );
$name_board_seen_img = $this->SMC_Credit_PD_Model->selectCustomRecords(array('doc_id', 'fk_smc_credit_pd_id','img','img_name','isactive'),array('fk_smc_credit_pd_id' => $view_data['pd_master_details'][0]['pd_id'],'isactive' => 1,'img_name=' => 'name_board_seen'),SMC_CREDIT_PD_DOCS);
if(is_array($name_board_seen_img) && count($name_board_seen_img))
{
$score_card_questions['name_board_seen'] = array('answer_id' => 'yes','answer' => 'yes' );
}
$score_card_questions['no_of_years_business_run'] = array('answer_id' => ( $view_data['pd_section_data'][8]['business_years'].'.'.(isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_months'] : '0') ) ,'answer' => ( $view_data['pd_section_data'][8]['business_years'].'.'.(isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_months'] : '0') ));
$score_card_questions['business_activity_has_seen'] = array('answer_id' => $view_data['pd_section_data'][8]['business_is_pd_visited'],'answer' => $view_data['pd_section_data'][8]['business_is_pd_visited']);
$score_card_questions['employees_total'] = array('answer_id' => ($view_data['pd_section_data'][7]['permanant_employees_person_met'] + $view_data['pd_section_data'][7]['temporary_employees_person_met'] ),'answer' => ($view_data['pd_section_data'][7]['permanant_employees_person_met'] + $view_data['pd_section_data'][7]['temporary_employees_person_met'] ));
$score_card_questions['owned_property'] = array('answer_id' => ($view_data['pd_section_data'][8]['business_ownership_type'] == 'Rented' ? 'No' : 'Yes') ,'answer' => ($view_data['pd_section_data'][8]['business_ownership_type'] == 'Rented' ? 'No' : 'Yes'));
$score_card_questions['business_activity'] = array('answer_id' => $view_data['pd_section_data'][8]['business_is_pd_visited'],'answer' => $view_data['pd_section_data'][8]['business_is_pd_visited']);
$score_card_questions['stock_visited'] = array('answer_id' => (isset($view_data['pd_section_data'][13]['estimated_uom']) ? $view_data['pd_section_data'][13]['estimated_uom'] : 'NA'),'answer' => (isset($view_data['pd_section_data'][13]['estimated_uom']) ? $view_data['pd_section_data'][13]['estimated_uom'] : 'NA'));
$score_card_questions['location_suited_for_busienss'] = array('answer_id' => $view_data['pd_section_data'][19]['business_location_suited'],'answer' =>$view_data['pd_section_data'][19]['business_location_suited']);
return ($score_card_questions);
}
}

View File

@ -102,7 +102,7 @@ class satellite_image
}
else if($pd_type == 3)
{
echo 'updae';
//echo 'updae';
$satellite_base64 = base64_encode(file_get_contents($satellite_image_png_path));
$CI->PD_Model->updateRecords(array('isactive' => 0),SMC_CREDIT_PD_DOCS,array('img_name' => 'satellite','fk_smc_credit_pd_id' => $pd_id));
$CI->PD_Model->saveRecords(array('img' => $satellite_base64,'img_name' => 'satellite','fk_smc_credit_pd_id' => $pd_id),SMC_CREDIT_PD_DOCS);

View File

@ -0,0 +1,372 @@
<?php
class SMCPDSCORE
{
public static function calculatePDScore111()
{
echo "calculatePDScore111";
}
//FULL PD SCORE CALCUALTIONS
public static function genericDIPDScoreCalculate($score_questions,$pd_master_details)
{
############ GENERIC SE-DI CASES #######################
############ SCROE VARIABLES DECLERATIONS ##############
// print_r($score_questions);//die();
$final_score_questions = array();
// LEVEL 1 WEIGHTAGES
$l1_general = 20;
$l1_business = 65;
$l1_final = 15;
// LEVEL2 WEIGHTAGES - Questions Weightages
/*-------- GENERAL --------------*/
$approcah_to_pd_location_L2 = 25;
$comment_locality_L2 = 15;
$customer_behaviour_L2 = 25;
$neighbourhood_status_L2 = 20;
$name_board_seen_L2 = 15;
/*-------- BUSNIESS --------------*/
$no_of_years_business_run_L2 = 20;
$business_seasonality_L2 = 10;
$employees_total_L2 = 15;
$owned_property_L2 = 10;
$stock_visited_L2 = 10;
// $stock_of_fm_L2 = 5;
$location_suited_for_busienss_L2 = 15;
$business_activity_has_seen_L2 = 20;
/*-------- FINAL --------------*/
$pd_officer_recommadations_L2 = 100;
//LEVEL3 SCORES - ANSWER SCORES
/*-------- GENERAL --------------*/
$approcah_to_pd_location = 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);
$neighbourhood_status = array( 'Positive' => 10, 'Negative' => 0,'Could Not Verify' => 0);
$name_board_seen = array('yes' => 10, 'no' => 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' => 10);
$employees_total = array('1000> to >50' => 10,'21<= to <=50' => 8, '11<= to <=20' => 6, '6<= to <10' =>4,'5>= to >0' => 2) ;
$owned_property = array('Yes' => 10, 'No' => 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);
$stock_answer_scores = array('yes' => 10, 'no' => 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);
/*-------- FINAL --------------*/
$pd_officer_recommandations = array('Positive' => 10,'Negative' => 0,'Refer to Credit' => 5,'Others' => 0);
/*-----------CALCULATION PART -----------*/
/*-----------GENERAL SECTION -----------*/
//echo "##################################################";
$over_all_general_l2 = 0;
$over_all_general_round_l2 = 0;
$general_distribute_level_weightage = 0;
//General Section L2 Weightage Distribution section
if(!strcmp($score_questions['neighbourhood_status']['answer'],'Could not verify'))
{
//echo "Yes could not";
$general_distribute_level_weightage += $neighbourhood_status_L2;
}
//End of General Section L2 Weightage Distribution section
//######1.5 neibourhood_check_as_per_pd_officer
if(!strcmp($score_questions['neighbourhood_status']['answer'],'Could not verify'))
{
$final_score_questions['general']['neighbourhood_status'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['neighbourhood_status']['answer'],'attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$neighbourhood_status[ $score_questions['neighbourhood_status']['answer'] != "" || $score_questions['neighbourhood_status']['answer'] != null ?$score_questions['neighbourhood_status']['answer']: "Negative" ],'max_score_band' => 0);
}
else
{
$neighbourhood_status_L2 = $general_distribute_level_weightage ? ($neighbourhood_status_L2 + ($neighbourhood_status_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $neighbourhood_status_L2;
$neibourhood_check_as_per_pd_officer_actual_score = ($l1_general/100) * ($neighbourhood_status_L2/100) * $neighbourhood_status[$score_questions['neighbourhood_status']['answer'] != "" || $score_questions['neighbourhood_status']['answer'] != null ? $score_questions['neighbourhood_status']['answer'] : "Negative" ];
$neibourhood_check_as_per_pd_officer_max_score = ($l1_general/100) * ($neighbourhood_status_L2/100) * max($neighbourhood_status);
$final_score_questions['general']['neighbourhood_status'] = array('l1_weightage' => $l1_general,'l2_weightage' => $neighbourhood_status_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['neighbourhood_status']['answer'],'attributed_score' => ($neibourhood_check_as_per_pd_officer_actual_score), 'max_score' => ($neibourhood_check_as_per_pd_officer_max_score),'score_band'=>$neighbourhood_status[$score_questions['neighbourhood_status']['answer'] != "" || $score_questions['neighbourhood_status']['answer'] != null ?$score_questions['neighbourhood_status']['answer']: "Negative" ],'max_score_band' => max($neighbourhood_status));
}
//echo $general_distribute_level_weightage = round($general_distribute_level_weightage,2);die();
//echo $general_distribute_level_weightage;
//#######1.1 person_met_is_applicant
// $person_met_is_applicant_L2 = $general_distribute_level_weightage ? ($person_met_is_applicant_L2 + ($person_met_is_applicant_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $person_met_is_applicant_L2 ;
// $person_met_is_applicant_actual_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * $person_met_is_applicant[$score_questions['general']['person_met_is_applicant']];
// $person_met_is_applicant_max_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * max($person_met_is_applicant);
// //echo $person_met_is_applicant_L2;
// //echo $person_met_is_applicant_max_score;
// $score_questions['general']['person_met_is_applicant'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($person_met_is_applicant_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['person_met_is_applicant'],'attributed_score' => ($person_met_is_applicant_actual_score), 'max_score' => ($person_met_is_applicant_max_score),'score_band'=>($person_met_is_applicant[$score_questions['general']['person_met_is_applicant']]),'max_score_band' => max($person_met_is_applicant));
//######1.2 pd_location_approach
$approcah_to_pd_location_L2 = $general_distribute_level_weightage ? ($approcah_to_pd_location_L2 + ($approcah_to_pd_location_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $approcah_to_pd_location_L2 ;
$pd_location_approach_actual_score = ($l1_general/100) * ($approcah_to_pd_location_L2/100) * $approcah_to_pd_location[$score_questions['approcah_to_pd_location']['answer']];
$approcah_to_pd_location_max_score = ($l1_general/100) * ($approcah_to_pd_location_L2/100) * max($approcah_to_pd_location);
$final_score_questions['general']['approcah_to_pd_location'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($approcah_to_pd_location_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['approcah_to_pd_location']['answer'],'attributed_score' => ($pd_location_approach_actual_score), 'max_score' => ($approcah_to_pd_location_max_score),'score_band'=>$approcah_to_pd_location[$score_questions['approcah_to_pd_location']['answer']],'max_score_band' => max($approcah_to_pd_location));
//######1.3 comment_locality
$comment_locality_L2 = $general_distribute_level_weightage ? ($comment_locality_L2 + ($comment_locality_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $comment_locality_L2;
$comment_locality_actual_score = ($l1_general/100) * ($comment_locality_L2/100) * $comment_locality[$score_questions['comment_locality']['answer']];
$comment_locality_max_score = ($l1_general/100) * ($comment_locality_L2/100) * max($comment_locality);
$final_score_questions['general']['comment_locality'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($comment_locality_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['comment_locality']['answer'],'attributed_score' => ($comment_locality_actual_score), 'max_score' => ($comment_locality_max_score),'score_band'=>$comment_locality[$score_questions['comment_locality']['answer']],'max_score_band' => max($comment_locality));
//######1.4 customer_behaviour
$customer_behaviour_L2 = $general_distribute_level_weightage ? ($customer_behaviour_L2 + ($customer_behaviour_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $customer_behaviour_L2;
$customer_behaviour_actual_score = ($l1_general/100) * ($customer_behaviour_L2/100) * $customer_behaviour[$score_questions['customer_behaviour']['answer']];
$customer_behaviour_max_score = ($l1_general/100) * ($customer_behaviour_L2/100) * max($customer_behaviour);
$final_score_questions['general']['customer_behaviour'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($customer_behaviour_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['customer_behaviour']['answer'],'attributed_score' => ($customer_behaviour_actual_score), 'max_score' => ($customer_behaviour_max_score),'score_band'=>$customer_behaviour[$score_questions['customer_behaviour']['answer']],'max_score_band' => max($customer_behaviour));
//######1.6 was_the_company_name_board_sighted
$name_board_seen_L2 = $general_distribute_level_weightage ? ($name_board_seen_L2 + ($name_board_seen_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $name_board_seen_L2;
$was_the_company_name_board_sighted_actual_score = ($l1_general/100) * ($name_board_seen_L2/100) * $name_board_seen[$score_questions['name_board_seen']['answer']];
$was_the_company_name_board_sighted_max_score = ($l1_general/100) * ($name_board_seen_L2/100) * max($name_board_seen);
$final_score_questions['general']['name_board_seen'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($name_board_seen_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['name_board_seen']['answer'],'attributed_score' => ($was_the_company_name_board_sighted_actual_score), 'max_score' => ($was_the_company_name_board_sighted_max_score),'score_band'=>$name_board_seen[$score_questions['name_board_seen']['answer']],'max_score_band' => max($name_board_seen));
/*-----------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['pd_officer_recommendation']['answer'] ];
$pd_officer_recommandations_max_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * max($pd_officer_recommandations);
$final_score_questions['final_remarks']['pd_officer_recommendation'] = array('l1_weightage' => $l1_final,'l2_weightage' => $pd_officer_recommadations_L2,'distributed_weightage' => 0,'answer' => $score_questions['pd_officer_recommendation']['answer'],'attributed_score' => round($pd_officer_recommandations_actual_score,2), 'max_score' => $pd_officer_recommandations_max_score,'score_band'=>$pd_officer_recommandations[ $score_questions['pd_officer_recommendation']['answer'] ],'max_score_band' => max($pd_officer_recommandations));
/*-----------END OF FINAL REMARKS SECTION -----------*/
/*-----------BUSINESS SECTION -----------*/
/* First Calculate Shortfall Type Questions to get distribute level
From 2.7 to 2.10 Questions are shortfall type questions (REF :- SSA_ScoreCard_Ver_090219(2))
*/
$business_distribute_level_weightage = 0;
//echo $score_questions['business']['minimum_supplier_info'];die();
// if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
// {
// $business_distribute_level_weightage += $minimum_supplier_info_L2;
// $minimum_supplier_info_L2 = 0;
// }
// if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
// {
// $business_distribute_level_weightage += $minimum_client_info_L2;
// $minimum_client_info_L2 = 0;
// }
// if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
// {
// $business_distribute_level_weightage += $stock_raw_material_enough_L2;
// $stock_raw_material_enough_L2 = 0;
// }
if(!strcasecmp($score_questions['stock_visited']['answer'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_visited_L2;$stock_visited_L2 = 0;
}
//echo $business_distribute_level_weightage;
//######2.10 stock_finished_goods_enough
$stock_visited_L2 = $business_distribute_level_weightage ? ($stock_visited_L2 + ($stock_visited_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $stock_visited_L2 ;
$stock_finished_goods_enough_actual_score = ($l1_business/100) * ($stock_visited_L2/100) * $stock_answer_scores [ $score_questions['stock_visited']['answer'] != "" || $score_questions['stock_visited']['answer'] != null ? strtolower($score_questions['stock_visited']['answer']) : "no" ];
$stock_finished_goods_enough_max_score = strcasecmp($score_questions['stock_visited']['answer'],'Not Applicable') ? ($l1_business/100) * ($stock_visited_L2/100) * max($stock_answer_scores) : 0;
$temp_stock_finished_goods_enough = strtolower($score_questions['stock_visited']['answer']);
$final_score_questions['business']['stock_visited'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($stock_visited_L2),'answer' => $score_questions['stock_visited']['answer'],'attributed_score' => ($stock_finished_goods_enough_actual_score), 'max_score' => ($stock_finished_goods_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ $temp_stock_finished_goods_enough != "" || $temp_stock_finished_goods_enough != null ? $temp_stock_finished_goods_enough : "no" ],'max_score_band' => max($stock_answer_scores));
//######2.1 no_of_years_business_run
$no_of_years_business_run_actual_score = 0;
$score_band = 0;
if($score_questions['no_of_years_business_run'])
{
foreach($no_of_years_business_run as $key => $value)
{
$exp = explode('to',$key);
//print_r($exp);
$left = $exp[0].$score_questions['no_of_years_business_run']['answer'];
$right = $score_questions['no_of_years_business_run']['answer'].$exp[1];
//echo $left.'````'.$right;echo "\n";die();
eval( '$left_exp = ' . $left . ';');
eval( '$right_exp = ' . $right . ';');
if($left_exp && $right_exp)
{
$no_of_years_business_run_L2 = $business_distribute_level_weightage ? ($no_of_years_business_run_L2 + ($no_of_years_business_run_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $no_of_years_business_run_L2 ;
$no_of_years_business_run_actual_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * $value;
$score_band = $value;
}
}
}
$no_of_years_business_run_max_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * max($no_of_years_business_run);
$final_score_questions['business']['no_of_years_business_run'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($no_of_years_business_run_L2),'answer' => $score_questions['no_of_years_business_run']['answer'],'attributed_score' => ($no_of_years_business_run_actual_score), 'max_score' => ($no_of_years_business_run_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
//######2.2 business seasonal
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $business_seasonality_L2 ;
$business_seasonality_actual_score = ($l1_business/100) * ($business_seasonality_L2/100) * $business_seasonality[ $score_questions['business_seasonality']['answer'] ];
$business_seasonality_max_score = ($l1_business/100) * ($business_seasonality_L2/100) * max($business_seasonality);
$final_score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_seasonality_L2),'answer' => $score_questions['business_seasonality']['answer'],'attributed_score' => ($business_seasonality_actual_score), 'max_score' =>($business_seasonality_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_seasonality[ $score_questions['business_seasonality']['answer'] ],'max_score_band' => max($business_seasonality));
//######2.3 employees_total
$employees_total_actual_score = 0;
$employees_total_L2 = $business_distribute_level_weightage ? ($employees_total_L2 + ($employees_total_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $employees_total_L2 ;
$score_band = 0;
if($score_questions['employees_total']['answer'])
{
foreach($employees_total as $key => $value)
{
$exp = explode('to',$key);
//print_r($exp);
$left = $exp[0].$score_questions['employees_total']['answer'];
$right = $score_questions['employees_total']['answer'].$exp[1];
//echo $left.'````'.$right;echo "\n";
eval( '$left_exp = ' . $left . ';');
eval( '$right_exp = ' . $right . ';');
if($left_exp && $right_exp)
{
$employees_total_actual_score = ($l1_business/100) * ($employees_total_L2/100) * $value;
$score_band = $value;
}
}
}
// echo $score_band;
// die();
$employees_total_max_score = ($l1_business/100) * ($employees_total_L2/100) * max($employees_total);
$final_score_questions['business']['employees_total'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($employees_total_L2),'answer' => $score_questions['employees_total']['answer'],'attributed_score' => ($employees_total_actual_score), 'max_score' => ($employees_total_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' =>$score_band,'max_score_band' => max($employees_total));
//######2.5 owned_property
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $owned_property_L2 ;
$owned_property_actual_score = ($l1_business/100) * ($owned_property_L2/100) * $owned_property[ $score_questions['owned_property']['answer'] ];
$owned_property_max_score = ($l1_business/100) * ($owned_property_L2/100) * max($owned_property);
$final_score_questions['business']['owned_property'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($owned_property_L2),'answer' => $score_questions['owned_property']['answer'],'attributed_score' => ($owned_property_actual_score), 'max_score' => ($owned_property_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_property[ $score_questions['owned_property']['answer'] ],'max_score_band' => max($owned_property));
//######2.11 location_suited_for_busienss
$location_suited_for_busienss_L2 = $business_distribute_level_weightage ? ($location_suited_for_busienss_L2 + ($location_suited_for_busienss_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $location_suited_for_busienss_L2 ;
$location_suited_for_busienss_actual_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * $location_suited_for_busienss[ $score_questions['location_suited_for_busienss']['answer'] ];
$location_suited_for_busienss_max_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * max($location_suited_for_busienss);
$final_score_questions['business']['location_suited_for_busienss'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($location_suited_for_busienss_L2),'answer' => $score_questions['location_suited_for_busienss']['answer'],'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['location_suited_for_busienss']['answer'] ],'max_score_band' => max($location_suited_for_busienss));
//######2.11 business_activity_has_seen
$business_activity_has_seen_L2 = $business_distribute_level_weightage ? ($business_activity_has_seen_L2 + ($business_activity_has_seen_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $business_activity_has_seen_L2 ;
$business_activity_has_seen_actual_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * $business_activity_has_seen[ $score_questions['business_activity_has_seen']['answer'] ];
$business_activity_has_seen_max_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * max($business_activity_has_seen);
$final_score_questions['business']['business_activity_has_seen'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_activity_has_seen_L2),'answer' => $score_questions['business_activity_has_seen']['answer'],'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_activity_has_seen']['answer'] ], 'max_score_band' => max($business_activity_has_seen));
/*-----------END OF BUSINESS SECTION -----------*/
/* Calculate Overall Total*/
$overall_max_score = 0;
$overall_actual_score = 0;
// print_r($final_score_questions);die();
foreach($final_score_questions as $key => $value)
{
$current_max_score = 0;
$current_actual_score = 0;
foreach($value as $v_key => $f_value)
{
$overall_max_score += $f_value['max_score'];
$overall_actual_score += $f_value['attributed_score'];
$current_max_score += $f_value['max_score'];
$current_actual_score += $f_value['attributed_score'];
}
$final_score_questions['score_summary'][$key] = array('actual_score' => $current_actual_score,'max_score' => $current_max_score,'score_per' => (($current_actual_score/$current_max_score) * 100));
}
$final_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));
//$score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details;
//print_r($score_questions);die();
return ($final_score_questions);
}
}
?>

View File

@ -87,6 +87,60 @@ defined('BASEPATH') OR exit('No direct script access allowed');
/* #########End of Score Card Table Styles######### */
/* ######### Mini Score Card Table Styles######### */
.mini_scorecard_table {
width: 100%;
page-break-inside: avoid;
}
.mini_scorecard_table td, .mini_scorecard_table th {
page-break-inside: avoid;
}
.mini_scorecard_table th {
padding-top: 5px;
padding-bottom: 5px;
text-align: center;
background-color: #0191ed;
color: white;page-break-inside: avoid;
}
/* #########End of Mini Score Card Table Styles######### */
/* #########End of Mini Score Card Div Styles######### */
#rcorners_green {
background: #33cc33;
padding: 3px;
width: 75px;
height: 5px;
}
#rcorners_red {
background: red;
padding: 3px;
width: 75px;
height: 5px;
}
#rcorners_light_green {
background: #99ff66;
padding: 3px;
width: 75px;
height: 5px;
}
#rcorners_amber{
background: #ff9900;
padding: 3px;
width: 75px;
height: 5px;
}
/* #########End of Mini Score Card DIv Styles######### */
/* #########Score Card2 Table Styles######### */
@ -216,6 +270,101 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</tbody>
</table>
<?php
echo '<div id="page_break"> </div>';
echo '<h2 contenteditable="true">PD Score Summary</h2>';
?>
<table class="scorecard_table">
<tr> <th> </th> <th>Actual Score</th> <th>Max Score</th> <th>Score %</th> </tr>
<tr> <td>General Section Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['general']['max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['general']['score_per'],1).'%'?></td></tr>
<tr> <td>Business Section Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['business']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['business']['max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['business']['score_per'],1).'%'?></td></tr>
<tr> <td>Final Remarks Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['final_remarks']['max_score'],2,'.',',')?></td><td class="customtd"> <?php echo round($pd_score['score_summary']['final_remarks']['score_per'],1).'%'?></td></tr>
<tr> <td>Final PD Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['overall_score']['overall_actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['overall_score']['overall_max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['overall_score']['final_score'],1).'%'?></td></tr>
</table>
<?php
//####################### CHART #############################
if(isset($base64_pdscore_chart_url))
{
echo "<br><br>";
echo '<p><img src="'.$base64_pdscore_chart_url.'" style="width:600px;height:350px;"/></p>';
echo '<div id="page_break"> </div>';
$business_captions = array("no_of_years_business_run" => "Business Vintage >>", "location_suited_for_busienss" => "Business Location suitability >>", "business_seasonality" => "Seasonality >>", "employees_total" => "Employee Strength >>", "cerificates" => "Business Certifications Sighted >>","owned_property" => "Business Premise Ownership >>", "owned_vechile" => "Vehicle Ownership >>", "business_activity_has_seen" => "Business Activity Observed >>", "minimum_supplier_info" => "Supplier Information Provided >>", "minimum_client_info" => "Client Information Provided >>","stock_visited" => "RM/FG Stock Sufficiency >>", "stock_finished_goods_enough" => "Finished/Traded Stock Sufficiency >>", "vintage_of_business_account" => "Main Business Banking Account Vintage >>");
$general_captions = array("otp_done" => "OTP authentication done >>","person_met_is_applicant" => "Is person Met, a loan applicant >>","qualification" => "Qualification of Loan Applicants >>","comment_locality" => "Comment on Locality >>","approcah_to_pd_location" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neighbourhood_status" => "Neighbourhood check >>","name_board_seen" => "Business Board Sighted >>","value_of_other_assets" => "Asset Value by Loan Amount % >>");
echo '<table class="mini_scorecard_table">';
echo '<tr> <th style="width:70%;font-size:16px;" colspan="2">Business Related Parameters Impacting Score</th> <th style="width:30%;font-size:16px;">Response</th> </tr>';
echo '<tbody>';
foreach($pd_score['business'] as $bsk => $business_score)
{
$class = null;
$answer = null;
$per = $business_score['attributed_score'] > 0 && $business_score['max_score'] > 0 ? ( ($business_score['attributed_score'] / $business_score['max_score']) * 100) : 0;
$class = ( $per >= 80 ? 'rcorners_green' : ($per >= 65 && $per < 80 ? 'rcorners_light_green' : ($per >= 50 && $per < 65 ? 'rcorners_amber' : 'rcorners_red')));
if($bsk == 'location_suited_for_busienss')
{
//$answer = $address_type_remarks_caption[ $business_score['answer'] ];
$answer = $business_score['answer'];
}
else if($bsk == 'no_of_years_business_run')
{
$answer = isset($business_score['answer']) ? $business_score['answer'].' Yrs' : '';
}
else if($bsk == 'business_seasonality')
{
$answer = isset($business_score['answer']) ? ((!strcasecmp($business_score['answer'], 'yes')) ? 'Seasonal': 'Not Seasonal') : '';
}
else
{
$answer = isset($business_score['answer']) ? $business_score['answer'] : '';
}
if(strcasecmp($answer,'Not Applicable'))
{
echo '<tr> <td style="width:70%;">'. $business_captions[$bsk] .'</td> <td style="width:30%;">'. '<div id="'. $class .'"></div></td> <td class="customtd">'. ucfirst($answer).'</td> </tr>';
}
}
echo '</tbody>';
echo '</table>';
echo '<br><br><br>';
echo '<table class="mini_scorecard_table">';
echo '<tr> <th style="width:70%;font-size:16px;" colspan="2">Other Parameters Impacting Score</th><th style="width:30%;font-size:16px;">Response</th> </tr>';
echo '<tbody>';
foreach($pd_score['general'] as $gsk => $general_score)
{
$class = null;
$per = $general_score['attributed_score'] > 0 && $general_score['max_score'] > 0 ? ( ($general_score['attributed_score'] / $general_score['max_score']) * 100) : 0;
$class = ( $per >= 80 ? 'rcorners_green' : ($per >= 65 && $per < 80 ? 'rcorners_light_green' : ($per >= 50 && $per < 65 ? 'rcorners_amber' : 'rcorners_red')));
$answer = ucfirst($general_score['answer']);
if(strcasecmp($answer,'Not Applicable'))
{
echo '<tr> <td style="width:70%;">'. $general_captions[$gsk] .'</td> <td style="width:30%;">'. '<div id="'. $class .'"></div></td> <td class="customtd">'. $answer.'</td> </tr>';
}
}
echo '</tbody>';
echo '</table>';
echo '<div id="page_break"> </div>';
}?>
<br>
<table class="scorecard_table">
<tbody>