TELE PD UAT WARP UP
This commit is contained in:
parent
678cf2a220
commit
48dc954952
@ -833,7 +833,10 @@ class PD_Controller extends REST_Controller {
|
||||
if(isset($pd_details['pd_status']) && $pd_details['pd_status'] == STARTED)
|
||||
{
|
||||
// echo 'STARTED';
|
||||
$pd_details['start_location'] = $pd_details['link'];
|
||||
if($exist_pd_details[0]['fk_pd_type'] == 1)
|
||||
{
|
||||
$pd_details['start_location'] = $pd_details['link'];
|
||||
}
|
||||
|
||||
unset($pd_details['link']);
|
||||
$string2 = str_shuffle('1234567890');
|
||||
@ -6031,7 +6034,7 @@ public function getPDFormDetailsJSON_post()
|
||||
//print_r($data['pd_master_details'][0]['is_score_card_enabled']);die();
|
||||
// echo "**************************";
|
||||
//$data['dsc_cards'] = $this->getDetailedScoreCardChart( $data['pd_score'] );
|
||||
if($data['pd_master_details'][0]['is_score_card_enabled'] == 1 && ($data['pd_master_details'][0]['customer_segment_abbr'] != "SAL"))// && $data['pd_master_details'][0]['customer_segment_abbr'] != "SAL-CHQ")) //&& ($data['pd_master_details'][0]['customer_segment_abbr'] != ''))
|
||||
if($data['pd_master_details'][0]['is_score_card_enabled'] == 0 && ($data['pd_master_details'][0]['customer_segment_abbr'] != "SAL"))// && $data['pd_master_details'][0]['customer_segment_abbr'] != "SAL-CHQ")) //&& ($data['pd_master_details'][0]['customer_segment_abbr'] != ''))
|
||||
{
|
||||
//echo $data['pd_master_details'][0]['is_score_card_enabled'].'-'.$data['pd_master_details'][0]['customer_segment_abbr'];die();
|
||||
$data['pd_score'] = $this->calculateScore($pdid);
|
||||
@ -7479,14 +7482,17 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
break;
|
||||
|
||||
default:
|
||||
switch($pd_master_details[0]['fk_customer_segment'])
|
||||
switch($pd_master_details[0]['fk_pd_type'])
|
||||
{
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 9:
|
||||
$score_questions = PDSCORE::genericDI($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details);
|
||||
case 1://FULL PD
|
||||
$score_questions = PDSCORE::genericDIPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details);
|
||||
break;
|
||||
|
||||
case 2://smart PD
|
||||
break;
|
||||
|
||||
case 3://tele PD
|
||||
$score_questions = PDSCORE::genericTelePDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -8199,737 +8205,41 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
public function pdFormsCompletenessCheck_post()
|
||||
{
|
||||
$pdid = $this->post('pd_id');
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
|
||||
|
||||
$client = $this->post('client') ? $this->post('client') : 'WEB';
|
||||
//print_r($pd_master_details);die();
|
||||
$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_raw_material_enough" => "Raw Materials 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 >>","pd_location_approach" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neibourhood_check_as_per_pd_officer" => "Neighbourhood check >>","was_the_company_name_board_sighted" => "Business Board Sighted >>","value_of_other_assets" => "Asset Value by Loan Amount % >>");
|
||||
|
||||
//Get all form Images
|
||||
|
||||
$pd_images = array();
|
||||
$form_data = array();
|
||||
for($i = 1;$i<=30;$i++)
|
||||
{
|
||||
$pd_images[$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i);
|
||||
|
||||
$fields = array('processed_json');
|
||||
$where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i);
|
||||
$form_data[$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC');
|
||||
}
|
||||
|
||||
$incomplete_details = array();
|
||||
// print_r($pd_images);die();
|
||||
|
||||
|
||||
|
||||
#####General Form Questions########
|
||||
$general_form = (json_decode($form_data[18][0]['processed_json'],true));
|
||||
// echo "seperateScoreQuestions";
|
||||
//print_r($general_form);die();
|
||||
|
||||
|
||||
$person_met_is_applicant_count = 0;
|
||||
$person_met_selfie_count = 0;
|
||||
$person_met_id_proof_count = 0;
|
||||
//print_r( $general_form['individuals'] );die();
|
||||
foreach($general_form['individuals'] as $person)
|
||||
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
|
||||
$res_array = array();
|
||||
$this->load->helper('pdcompletenesscheck');
|
||||
switch($pd_master_details[0]['fk_pd_type'])
|
||||
{
|
||||
|
||||
if($person['is_person_met'] == true )
|
||||
{
|
||||
case 1://FUll PD
|
||||
$res_array = pdcompletenesscheck::fullPDCompletenessCheck($pdid,$pd_master_details,$client);
|
||||
break;
|
||||
|
||||
//print_r($person);die();
|
||||
if(!$person['is_person_met_pic'])
|
||||
{
|
||||
$person_met_selfie_count++;
|
||||
case 2://smartPD
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(!$person['is_person_met_id_proof'])
|
||||
{
|
||||
$person_met_id_proof_count++;
|
||||
}
|
||||
}
|
||||
if(($person['is_applicant'] == true && $person['is_person_met'] == true))
|
||||
{
|
||||
$person_met_is_applicant_count++;
|
||||
}
|
||||
case 3://tele PD
|
||||
$res_array = pdcompletenesscheck::telePDCompletenessCheck($pdid,$pd_master_details,$client);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
//get salary case details specifically
|
||||
$sal_check = null;
|
||||
if($pd_master_details[0]['customer_segment_abbr'] == 'SAL')
|
||||
{
|
||||
$sal_check = $this->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),XTRA_CHECK);
|
||||
$sal_check = count($sal_check) ? $sal_check[0]['flag'] : null;
|
||||
}
|
||||
|
||||
//if(!$person_met_is_applicant_count && $sal_check == null){ $incomplete_details[] = 'General Section - Person met is not an applicant'; }
|
||||
if($person_met_selfie_count && $sal_check == null){ $incomplete_details[] = 'General Section - Person met selfie image with PD officer not captured'; }
|
||||
if($person_met_id_proof_count && $sal_check == null ){ $incomplete_details[] = 'General Section - Person met ID proof image not captured'; }
|
||||
#####End of General Form Questions########
|
||||
|
||||
|
||||
#####Address Form Questions########
|
||||
if($client != "WEB")
|
||||
{
|
||||
if(count($pd_images[5]))
|
||||
{
|
||||
$approach_image_count = 0;
|
||||
|
||||
foreach ($pd_images[5] as $key => $value)
|
||||
{
|
||||
if(substr_count(strtolower($value['pd_document_title']),strtolower('Approach to PD Location')))
|
||||
{
|
||||
$approach_image_count++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(!$approach_image_count){ $incomplete_details[] = 'Address Section - Approach to PD location Image not captured'; }
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$incomplete_details[] = 'Address Section - Approach to PD location Image not captured';
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//echo $pd_master_details[0]['customer_segment_abbr'];die();
|
||||
if($pd_master_details[0]['customer_segment_abbr'] == 'SE-AI' || $pd_master_details[0]['customer_segment_abbr'] == 'SE-DI')
|
||||
{
|
||||
#####Business Form Questions########
|
||||
$business_form = (json_decode($form_data[13][0]['processed_json'],true));
|
||||
//print_r($business_form);die();
|
||||
//print_r(($business_form['shop_eat_act_cert']));die();
|
||||
$is_manufacturing_selected = 0;
|
||||
$selected_type_of_activity = array();
|
||||
foreach ($business_form['select_business_activity_type'] as $key => $value) {
|
||||
if($value['type_of_activity_id'] == 2){ $is_manufacturing_selected = 1; }
|
||||
array_push($selected_type_of_activity,$value['type_of_activity_id']);
|
||||
|
||||
}
|
||||
$is_name_board_seen = false;
|
||||
if($business_form['was_the_company_name_board_sighted'] == "")
|
||||
{
|
||||
$incomplete_details[] = 'Business Section - Name Board Seen Not answered';
|
||||
|
||||
}
|
||||
else if($business_form['was_the_company_name_board_sighted'] == "yes")
|
||||
{
|
||||
$is_name_board_seen = true;
|
||||
}
|
||||
|
||||
|
||||
if(!is_numeric($business_form['employees_permanent']) || !is_numeric($business_form['employees_appx_salary']) || !is_numeric($business_form['officer_total']))
|
||||
{
|
||||
$incomplete_details[] = 'Business Section - Company Employees Details Not Filled';
|
||||
}
|
||||
|
||||
if( ($pd_master_details[0]['lender_short_name'] != 'CLIX' && $pd_master_details[0]['lender_short_name'] != 'MWISE') && !is_numeric($business_form['employees_temporary']))
|
||||
{
|
||||
$incomplete_details[] = 'Business Section - Company Employees Details Not Filled';
|
||||
}
|
||||
|
||||
|
||||
if($client != 'WEB')// if API came from web then ignore this check
|
||||
{
|
||||
$certificate_count = 0;
|
||||
$name_board_image_count = 0;
|
||||
|
||||
if(count($pd_images[13]))
|
||||
{
|
||||
foreach ($pd_images[13] as $key => $value) {
|
||||
if(substr_count(strtolower($value['pd_document_title']),strtolower('Name board Seen')))
|
||||
{
|
||||
$name_board_image_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!$name_board_image_count){ $incomplete_details[] = 'Busienss Section - Business Name Board Image not captured'; }
|
||||
|
||||
|
||||
if(isset($business_form['shop_eat_act_cert']))
|
||||
{
|
||||
if(strtoupper($business_form['shop_eat_act_cert'])=='YES' && $business_form['shop_eat_act_cert_pic'] == "")
|
||||
{
|
||||
$certificate_count++;
|
||||
}
|
||||
} else { $certificate_count++; }
|
||||
|
||||
if(isset($business_form['gst_Regn_cert']))
|
||||
{
|
||||
if(strtoupper($business_form['gst_Regn_cert'])=='YES' && $business_form['gst_Regn_cert_pic'] == "")
|
||||
{
|
||||
$certificate_count++;
|
||||
}
|
||||
} else { $certificate_count++; }
|
||||
|
||||
|
||||
if(isset($business_form['pf_regn']))
|
||||
{
|
||||
if(strtoupper($business_form['pf_regn'])=='YES' && $business_form['pf_regn_pic'] == "")
|
||||
{
|
||||
$certificate_count++;
|
||||
}
|
||||
} else { $certificate_count++; }
|
||||
|
||||
if(isset($business_form['esic_regn']))
|
||||
{
|
||||
if(strtoupper($business_form['esic_regn'])=='YES' && $business_form['esic_regn_pic'] == "")
|
||||
{
|
||||
$certificate_count++;
|
||||
}
|
||||
} else { $certificate_count++; }
|
||||
|
||||
|
||||
|
||||
//If Business Type of activity is manufacturing then check these two certifications,
|
||||
if(in_array('2',$selected_type_of_activity))// || in_array('4',$selected_type_of_activity))
|
||||
{
|
||||
if(isset($business_form['factory_cert']))
|
||||
{
|
||||
if(strtoupper($business_form['factory_cert'])=='YES' && $business_form['factory_cert_pic'] == "")
|
||||
{
|
||||
$certificate_count++;
|
||||
}
|
||||
} //else { $certificate_count++; }
|
||||
}
|
||||
|
||||
//If Business Type of activity is manufacturing,wholesale,retail then check
|
||||
if(in_array('2',$selected_type_of_activity) || in_array('4',$selected_type_of_activity) || in_array('3',$selected_type_of_activity))
|
||||
{
|
||||
if(isset($business_form['export_import_cert']))
|
||||
{
|
||||
if(strtoupper($business_form['export_import_cert'])=='YES' && $business_form['export_import_cert_pic'] == "")
|
||||
{
|
||||
$certificate_count++;
|
||||
}
|
||||
} else { $certificate_count++; }
|
||||
}
|
||||
|
||||
|
||||
//If Business Type of activity is service Provider then check practice_cert certification
|
||||
if(in_array('5',$selected_type_of_activity))
|
||||
{
|
||||
if(isset($business_form['practice_cert']))
|
||||
{
|
||||
if(strtoupper($business_form['practice_cert'])=='YES' && (!isset($business_form['practice_cert_pic']) || $business_form['practice_cert_pic']== ""))
|
||||
{
|
||||
$certificate_count++;
|
||||
}
|
||||
} //else { $certificate_count++; }
|
||||
//echo $certificate_count;die();
|
||||
}
|
||||
|
||||
|
||||
if($certificate_count){ $incomplete_details[] = 'Business Section - Images for Document Sighted Not Sufficient'; }
|
||||
|
||||
}
|
||||
|
||||
#####End of Business Form Questions########
|
||||
|
||||
|
||||
########## Finance Form Questions################
|
||||
|
||||
if( $client != 'WEB')// if API came from web then ignore this check
|
||||
{
|
||||
$finance_form = isset($form_data[14][0]['processed_json'])?(json_decode($form_data[14][0]['processed_json'],true)):array();
|
||||
$finance_form_photo_count = isset($pd_images[14]) ? count($pd_images[14]) : 0;
|
||||
//print_r($finance_form);die();
|
||||
//print_r($pd_images[14]);die();
|
||||
if(isset($finance_form['is_financial_statements']))
|
||||
{
|
||||
if(!strcasecmp($finance_form['is_financial_statements'],'yes') && !($finance_form_photo_count))
|
||||
{
|
||||
$incomplete_details[] = 'Financial Section - Financial Images Not captured';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#####End of Finance Form Questions########
|
||||
|
||||
|
||||
#####Business Assets Form Questions########
|
||||
if( $client != 'WEB')// if API came from web then ignore this check
|
||||
{
|
||||
$business_assest_form = (json_decode($form_data[22][0]['processed_json'],true));
|
||||
$businees_assest_images_count = isset($pd_images[22]) ? count($pd_images[22]) : 0;
|
||||
//print_r($business_assest_form);die();
|
||||
if(array_key_exists('business_assets_details',$business_assest_form))
|
||||
{
|
||||
|
||||
foreach($business_assest_form['business_assets_details'] as $value)
|
||||
{
|
||||
if(isset($value['business_assets_mode']) && $value['business_assets_mode'] == 4 && !($businees_assest_images_count))
|
||||
{
|
||||
$incomplete_details[] = 'Business Assets Section - Machinery Image';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
#####End of Business Assets Form Questions########
|
||||
|
||||
$business_bank_form = isset($form_data[21][0]['processed_json'])?(json_decode($form_data[21][0]['processed_json'],true)):array();
|
||||
if(count($business_bank_form))
|
||||
{
|
||||
$not_available_count = 0;
|
||||
if(isset($business_bank_form['banking_details']) && count($business_bank_form['banking_details']))
|
||||
{
|
||||
foreach ($business_bank_form['banking_details'] as $business_acc_key => $business_acc_value) {
|
||||
if(!strcasecmp($business_acc_value['is_main'],'Yes') && ( !is_numeric($business_acc_value['vintage_year'])))
|
||||
{
|
||||
$not_available_count++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if($not_available_count)
|
||||
{
|
||||
$incomplete_details[] = 'Business Banking Form - Vintage of the Main Business AC info missing';
|
||||
}
|
||||
}
|
||||
if($client != 'WEB')
|
||||
{
|
||||
|
||||
#####supplier Form Questions########
|
||||
$supplier_form = isset($form_data[1][0]['processed_json'])?(json_decode($form_data[1][0]['processed_json'],true)):array();
|
||||
|
||||
//print_r($supplier_form);die();
|
||||
$supplier_count = 0;
|
||||
$insufficient_supplier_info = 0;
|
||||
$supplier_images = isset($pd_images[1]) ? $pd_images[1] : array();
|
||||
//print_r($pd_images[1]);die();
|
||||
|
||||
if(count($supplier_form))
|
||||
{
|
||||
if($supplier_form['supplier_info_available'] == 1)
|
||||
{
|
||||
if(array_key_exists('manufacturing_details',$supplier_form))
|
||||
{
|
||||
if(isset($supplier_form['manufacturing_details'][0]['main_raw_materials']))
|
||||
{
|
||||
|
||||
|
||||
foreach ($supplier_form['manufacturing_details'][0]['main_raw_materials'] as $manu_key => $manu_value)
|
||||
{
|
||||
|
||||
|
||||
if($manu_value['manufacturing_raw_material_name'] != "" && $manu_value['manufacturing_supplier_name'] != "" && $manu_value['manufacturing_contact_person_name'] != "" && ($manu_value['manufacturing_contact_person_mobile_number'] != "" || $manu_value['person_landline'] != ""))
|
||||
{
|
||||
$supplier_count ++;
|
||||
//$cureent_supplier_images_count = 0 ;
|
||||
|
||||
//Images name check
|
||||
//$supplier_name = $manu_value['manufacturing_supplier_name'].' - Raw Material '.($manu_key+1);
|
||||
|
||||
// if(count($supplier_images))
|
||||
// {
|
||||
// foreach ($supplier_images as $key => $value)
|
||||
// {
|
||||
// if( !strcasecmp($supplier_name, $value['pd_document_title']))
|
||||
// {
|
||||
// $cureent_supplier_images_count++;
|
||||
// }
|
||||
|
||||
|
||||
// }
|
||||
// if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient.';}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
|
||||
// }
|
||||
}
|
||||
else if($manu_value['manufacturing_raw_material_name'] == "" || $manu_value['manufacturing_supplier_name'] == "" )
|
||||
{
|
||||
$insufficient_supplier_info++;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Supplier Section - Supplier (Raw Material '.($key+1).') Details not sufficient';
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//echo 'IN manu-'.$supplier_count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(array_key_exists('trade_details',$supplier_form))
|
||||
{
|
||||
|
||||
if(isset($supplier_form['trade_details'][0]['trading_products']))
|
||||
{
|
||||
|
||||
foreach ($supplier_form['trade_details'][0]['trading_products'] as $trading_key => $trading_value)
|
||||
{
|
||||
if($trading_value['trade_product_name'] != "" && $trading_value['trade_supplier_name'] != "" && $trading_value['trade_product_contact_person_name'] != "" && ($trading_value['trade_product_contact_person_mobile_number'] != "" || $trading_value['person_landline'] != ""))
|
||||
{
|
||||
$supplier_count ++;
|
||||
|
||||
// $cureent_supplier_images_count = 0 ;
|
||||
|
||||
// //Images name check
|
||||
// $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product '.($trading_key+1);
|
||||
// if(count($supplier_images))
|
||||
// {
|
||||
// foreach ($supplier_images as $key => $value)
|
||||
// {
|
||||
// if( !strcasecmp($supplier_name, $value['pd_document_title']))
|
||||
// {
|
||||
// $cureent_supplier_images_count++;
|
||||
// }
|
||||
// }
|
||||
// if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
|
||||
// }
|
||||
|
||||
else if($trading_value['trade_product_name'] == "" || $trading_value['trade_supplier_name'] == "" )
|
||||
{
|
||||
$insufficient_supplier_info++;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Supplier Section - Supplier (Trading Product '.($key+1).') Details not sufficient';
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//echo 'IN trade-'.$supplier_count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(array_key_exists('servicing_details',$supplier_form))
|
||||
{
|
||||
|
||||
if(isset($supplier_form['servicing_details'][0]['service_providers']))
|
||||
{
|
||||
|
||||
foreach ($supplier_form['servicing_details'][0]['service_providers'] as $serivce_key => $service_value)
|
||||
{
|
||||
if($service_value['service_provider_name'] != "" && $service_value['service_provider_supplier_name'] != "" && $service_value['service_provider_contact_person_name'] != "" && ($service_value['service_provider_contact_person_mobile_number'] != "" || $service_value['person_landline'] != ""))
|
||||
{
|
||||
$supplier_count ++;
|
||||
|
||||
// $cureent_supplier_images_count = 0 ;
|
||||
|
||||
// //Images name check
|
||||
// $supplier_name = $trading_value['trade_supplier_name'].' - Trading Product '.($trading_key+1);
|
||||
// if(count($supplier_images))
|
||||
// {
|
||||
// foreach ($supplier_images as $key => $value)
|
||||
// {
|
||||
// if( !strcasecmp($supplier_name, $value['pd_document_title']))
|
||||
// {
|
||||
// $cureent_supplier_images_count++;
|
||||
// }
|
||||
// }
|
||||
// if($cureent_supplier_images_count < 2){ $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Image Not Sufficient';}
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Supplier Section - '.$supplier_name.' - Images Not Found';
|
||||
// }
|
||||
|
||||
else if($service_value['service_provider_name'] == "" || $service_value['service_provider_supplier_name'] == "" )
|
||||
{
|
||||
$insufficient_supplier_info++;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Supplier Section - Supplier (Trading Product '.($key+1).') Details not sufficient';
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//echo 'IN trade-'.$supplier_count;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//echo $supplier_count. count($supplier_images);die();
|
||||
//echo $insufficient_supplier_info;
|
||||
if($supplier_form['bill_info'] == 'yes' && $supplier_count && (count($supplier_images) < 3) ){ $incomplete_details[] = 'Supplier Section - Images Not sufficient'; }
|
||||
if($insufficient_supplier_info){ $incomplete_details[] = 'Supplier Section - Information Not sufficient';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//echo $score_questions['business']['minimum_supplier_info'];die();
|
||||
#####End of supplier Form Questions########
|
||||
|
||||
|
||||
#####client Form Questions########
|
||||
$client_form = isset($form_data[2][0]['processed_json'])?(json_decode($form_data[2][0]['processed_json'],true)):array();
|
||||
//print_r($client_form);die();
|
||||
$client_images = isset($pd_images[2]) ? $pd_images[2] : array();
|
||||
$client_count = 0;
|
||||
$insufficient_client_info = 0;
|
||||
if(count($client_form))
|
||||
{
|
||||
if($client_form['client_info_available'] == 1)
|
||||
{
|
||||
|
||||
if(array_key_exists('manufacturing_details',$client_form))
|
||||
{
|
||||
if(isset($client_form['manufacturing_details'][0]['main_raw_materials']))
|
||||
{
|
||||
|
||||
foreach ($client_form['manufacturing_details'][0]['main_raw_materials'] as $key => $value)
|
||||
{
|
||||
if($value['manufacturing_product_name'] != "" && $value['manufacturing_client_name'] != "" && $value['manufacturing_contact_person_name'] != "" && ($value['manufacturing_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
|
||||
{
|
||||
$client_count++;
|
||||
// $current_client_images_count = 0 ;
|
||||
|
||||
// //Images name check
|
||||
// $client_name = $value['manufacturing_client_name'].' - Manufacturing Product '.($key+1);
|
||||
|
||||
// if(count($client_images))
|
||||
// {
|
||||
// foreach ($client_images as $key => $value)
|
||||
// {
|
||||
// if( !strcasecmp($client_name, $value['pd_document_title']))
|
||||
// {
|
||||
// $current_client_images_count++;
|
||||
// }
|
||||
// }
|
||||
// if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
|
||||
// }
|
||||
|
||||
}
|
||||
else if($value['manufacturing_product_name'] == "" || $value['manufacturing_client_name'] == "" )
|
||||
{
|
||||
$insufficient_client_info++;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Client Section - Client (Manufacturing Product '.($key+1).') Details not sufficient';
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists('trade_details',$client_form))
|
||||
{
|
||||
|
||||
if(isset($client_form['trade_details'][0]['trading_products']))
|
||||
{
|
||||
|
||||
foreach ($client_form['trade_details'][0]['trading_products'] as $key => $value)
|
||||
{
|
||||
//print_r($value);die();
|
||||
if($value['trade_product_name'] != "" && (isset($value['trade_client_name'])) && $value['trade_client_name'] != "" && $value['trade_product_contact_person_name'] != "" && ($value['trade_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
|
||||
{
|
||||
$client_count++;
|
||||
// $current_client_images_count = 0 ;
|
||||
|
||||
// //Images name check
|
||||
// $client_name = $value['trade_client_name'].' - Trading Product '.($key+1);
|
||||
|
||||
// if(count($client_images))
|
||||
// {
|
||||
// foreach ($client_images as $key => $value)
|
||||
// {
|
||||
// if( !strcasecmp($client_name, $value['pd_document_title']))
|
||||
// {
|
||||
// $current_client_images_count++;
|
||||
// }
|
||||
// }
|
||||
// if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Client Section - '.$client_name .'- Images Not Found';
|
||||
// }
|
||||
}
|
||||
else if($value['trade_product_name'] == "" || (isset($value['trade_client_name'])) && $value['trade_client_name'] == "" )
|
||||
{
|
||||
$insufficient_client_info++;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Client Section - Client (Trading Product '.($key+1).') Details not sufficient';
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(array_key_exists('service_provider_details',$client_form))
|
||||
{
|
||||
if(isset($client_form['service_provider_details'][0]['service_products']))
|
||||
{
|
||||
foreach ($client_form['service_provider_details'][0]['service_products'] as $key => $value)
|
||||
{
|
||||
|
||||
if($value['service_provider_product_name'] != "" && $value['service_provider_client_name'] != "" && $value['service_provider_product_contact_person_name'] != "" && ($value['service_provider_product_contact_person_mobile_number'] != "" || $value['person_landline'] != ""))
|
||||
{
|
||||
$client_count++;
|
||||
// $current_client_images_count = 0 ;
|
||||
|
||||
// //Images name check
|
||||
// $client_name = $value['service_provider_client_name'].' - Service Provider '.($key+1);
|
||||
|
||||
// if(count($client_images))
|
||||
// {
|
||||
// foreach ($client_images as $key => $value)
|
||||
// {
|
||||
// if( !strcasecmp($client_name, $value['pd_document_title']))
|
||||
// {
|
||||
// $current_client_images_count++;
|
||||
// }
|
||||
// }
|
||||
// if($current_client_images_count < 2){ $incomplete_details[] = 'Client Section - '.$client_name.' - Image Not Sufficient';}
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] ='Client Section - ' .$client_name .'- Images Not Found';
|
||||
// }
|
||||
|
||||
}
|
||||
else if($value['service_provider_product_name'] == "" || $value['service_provider_client_name'] == "" )
|
||||
{
|
||||
$insufficient_client_info++;
|
||||
}
|
||||
// else
|
||||
// {
|
||||
// $incomplete_details[] = 'Client Section - Client (Service Provider '.($key+1).') Details not sufficient';
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//echo $client_count;die();
|
||||
if(isset($client_form['bill_info']) && $client_form['bill_info'] == 'yes' && $client_count && (count($client_images) < 3) ){ $incomplete_details[] = 'Client Section - Images not sufficient';}
|
||||
if($insufficient_client_info){ $incomplete_details[] = 'Client Section - Information Not Sufficient';}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#####End of client Form Questions########
|
||||
|
||||
|
||||
#####Stock Form Questions########
|
||||
$stock_form = isset($form_data[11][0]['processed_json'])?(json_decode($form_data[11][0]['processed_json'],true)):array();
|
||||
//print_r($stock_form);die();
|
||||
if(count($stock_form))
|
||||
{
|
||||
//print_r($stock_form);die();
|
||||
if(isset($stock_form['manufacturing_details']) && ($stock_form['manufacturing_details'] != null || $stock_form['manufacturing_details'] != ""))
|
||||
{
|
||||
|
||||
// if( strcasecmp($stock_form['manufacturing_details'][0]['is_sufficiant_raw'],'not applicable') && strcasecmp($stock_form['is_sufficiant_finished_and_traded_goods'],'not applicable'))
|
||||
// {
|
||||
// echo 'Yes';
|
||||
// // if( !(isset($pd_images[11][0]) ))//&& !count($pd_images[11][0])) )
|
||||
// // {
|
||||
// // $incomplete_details[] = 'Stock Form - Images not sufficient';
|
||||
// // }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
|
||||
$total_stock_observed = 0;
|
||||
|
||||
if( isset($stock_form['manufacturing_details'][0]['manufacturing_raw_materials']) && count($stock_form['manufacturing_details'][0]['manufacturing_raw_materials']))
|
||||
{
|
||||
foreach ($stock_form['manufacturing_details'][0]['manufacturing_raw_materials'] as $key => $value)
|
||||
{
|
||||
//echo strcasecmp($value['stock_observed'],'no');die();
|
||||
|
||||
if((strcasecmp($value['stock_observed'],'no'))) { $total_stock_observed++; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( isset($stock_form['manufacturing_details'][0]['manufacturing_finished_goods']) && count($stock_form['manufacturing_details'][0]['manufacturing_finished_goods']))
|
||||
{
|
||||
foreach ($stock_form['manufacturing_details'][0]['manufacturing_finished_goods'] as $key => $value)
|
||||
{
|
||||
if((strcasecmp($value['goods_observed'],'no'))) { $total_stock_observed++; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( isset($stock_form['retail_details'][0]['retail_traded_goods']) && count($stock_form['retail_details'][0]['retail_traded_goods']))
|
||||
{
|
||||
foreach ($stock_form['retail_details'][0]['retail_traded_goods'] as $key => $value)
|
||||
{
|
||||
if((strcasecmp($value['traded_goods_observed'],'no'))) { $total_stock_observed++; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( isset($stock_form['trade_details'][0]['trading_traded_goods']) && count($stock_form['trade_details'][0]['trading_traded_goods']))
|
||||
{
|
||||
foreach ($stock_form['trade_details'][0]['trading_traded_goods'] as $key => $value)
|
||||
{
|
||||
if((strcasecmp($value['traded_goods_observed'],'no'))) { $total_stock_observed++; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if( $total_stock_observed != 0 && !(count($pd_images[11])))//&& !count($pd_images[11][0])) )
|
||||
{
|
||||
$incomplete_details[] = 'Stock Section - Images not sufficient';//. Available Images';// - '.(count($pd_images[11]) ? count($pd_images[11]) : 0);
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
}// end of CS - SE
|
||||
else if($pd_master_details[0]['customer_segment_abbr'] == 'SAL')// || $pd_master_details[0]['customer_segment_abbr'] == 'SAL-CHQ')
|
||||
{
|
||||
//have to check salary information form
|
||||
}
|
||||
else if(($pd_master_details[0]['customer_segment_abbr'] == 'SE-RI'))
|
||||
{
|
||||
//have to check rental information form
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $incomplete_details;
|
||||
$data['msg'] = count($incomplete_details) ? 'PD Details are incomplete' : 'All forms were answered';
|
||||
$data['records'] = $res_array;
|
||||
$data['msg'] = count($res_array) ? 'PD Details are incomplete' : 'All forms were answered';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function convertImgUrlToBase64_post()
|
||||
{
|
||||
$img_url = $this->post('img_url');
|
||||
@ -9563,6 +8873,9 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
|
||||
$img_array['image'] = $records['image'];
|
||||
$img_array['Name'] = $records['name'];
|
||||
$current_doc_title = $records['image_key'];
|
||||
|
||||
//update geo location to pd master table
|
||||
$this->PD_Model->updateRecords(array('start_location' => $records['link']),PDTRIGGER,array('pd_id' => $records['fk_pd_id']));
|
||||
}
|
||||
else if(strpos($records['image_key'], 'common_image') !== false)
|
||||
{
|
||||
|
||||
1469
api/application/helpers/pdcompletenesscheck_helper.php
Normal file
1469
api/application/helpers/pdcompletenesscheck_helper.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,8 @@ class PDSCORE
|
||||
echo "calculatePDScore111";
|
||||
}
|
||||
|
||||
|
||||
public static function genericDI($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details)
|
||||
//FULL PD SCORE CALCUALTIONS
|
||||
public static function genericDIPDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details)
|
||||
{
|
||||
//echo 'RRRRR';die();
|
||||
//print_r($personal_asset_grid);die();echo "###################";
|
||||
@ -549,7 +549,7 @@ class PDSCORE
|
||||
$vintage_of_business_account_for_display = explode('.',($score_questions['business']['vintage_of_business_account']));
|
||||
$vintage_of_business_account_for_display = ($vintage_of_business_account_for_display[0] != 0 ? $vintage_of_business_account_for_display[0].' Yrs ' : '') . (isset($vintage_of_business_account_for_display[1]) && $vintage_of_business_account_for_display[1] != 0 ? $vintage_of_business_account_for_display[1].' Mns ' : '');
|
||||
|
||||
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_activity_has_seen_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
|
||||
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($vintage_of_business_account_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
|
||||
/*-----------END OF BUSINESS SECTION -----------*/
|
||||
|
||||
|
||||
@ -583,7 +583,599 @@ class PDSCORE
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// TELE PD SCORE CALCUALTIONS
|
||||
|
||||
public static function genericTelePDScoreCalculate($score_questions,$loan_amt_from_loam_form,$personal_asset_grid,$pd_master_details)
|
||||
{
|
||||
//echo 'RRRRR';die();
|
||||
//print_r($personal_asset_grid);die();echo "###################";
|
||||
############ GENERIC SE-DI CASES #######################
|
||||
############ SCROE VARIABLES DECLERATIONS ##############
|
||||
|
||||
// LEVEL 1 WEIGHTAGES
|
||||
$l1_general = 25;
|
||||
$l1_business = 50;
|
||||
$l1_final = 25;
|
||||
|
||||
// LEVEL2 WEIGHTAGES - Questions Weightages
|
||||
|
||||
/*-------- GENERAL --------------*/
|
||||
// $person_met_is_applicant_L2 = 15;
|
||||
// $pd_location_approach_L2 = 10;
|
||||
// $comment_locality_L2 = 10;
|
||||
// $neibourhood_check_as_per_pd_officer_L2 = 10;
|
||||
#### the above four prams distributed to below params
|
||||
|
||||
|
||||
|
||||
$customer_behaviour_L2 =18.18181818181818;
|
||||
$was_the_company_name_board_sighted_L2 = 18.18181818181818;
|
||||
$otp_done_L2 = 18.18181818181818;
|
||||
$qualification_L2 = 18.18181818181818;
|
||||
$value_of_other_assets_L2 = 27.27272727272727;
|
||||
|
||||
/*-------- BUSNIESS --------------*/
|
||||
// $employees_total_L2 = 10;
|
||||
// $business_activity_has_seen_L2 = 10;
|
||||
// $location_suited_for_busienss_L2 = 10;
|
||||
|
||||
$no_of_years_business_run_L2 = 14.285714285714;
|
||||
$business_seasonality_L2 = 14.285714285714;
|
||||
$cerificates_L2 = 14.285714285714;
|
||||
$owned_property_L2 = 10;
|
||||
$owned_vechile_L2 = 4.2857142857143;
|
||||
$minimum_supplier_info_L2 = 7.1428571428571;
|
||||
$minimum_client_info_L2 = 7.1428571428571;
|
||||
$stock_raw_material_enough_L2 = 7.1428571428571;
|
||||
$stock_finished_goods_enough_L2 = 7.1428571428571;
|
||||
$vintage_of_business_account_L2 = 14.285714285714;
|
||||
|
||||
/*-------- FINAL --------------*/
|
||||
$pd_officer_recommadations_L2 = 100;
|
||||
|
||||
//LEVEL3 SCORES - ANSWER SCORES
|
||||
/*-------- GENERAL --------------*/
|
||||
$person_met_is_applicant = array('yes' => 10, 'no' => 0);
|
||||
$pd_location_approach = array('Very Easy to locate & Reach' => 10,'Easy to locate & Reach' => 7,'Difficult to locate & Reach' => 4,'Very Difficult to locate & Reach' => 2);
|
||||
$comment_locality = array('Excellent' => 10,'Good' => 7,'Poor' => 5,'Very Poor' => 2);
|
||||
$customer_behaviour = array('Rude' => 0,'Polite' => 10,'Others' => 0);
|
||||
$neibourhood_check_as_per_pd_officer = array( 'Positive' => 10, 'Negative' => 0,'Could not verify' => 0);
|
||||
$was_the_company_name_board_sighted = array('yes' => 10, 'no' => 0);
|
||||
$supplir_client_answer_scores = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
|
||||
$otp_done = array('Yes' => 10, 'No' => 0);
|
||||
$qualification = array( 'name_score' => array('Completed Professional Course' => 10,'Completed Post Graduation' => 8, 'Completed Graduation' => 6,'Completed Schooling' => 4,'Not Completed Schooling' => 2,'No Formal Education' => 0),
|
||||
'id_score' => array('1' => 10,'2' => 8,'3' => 6,'4' => 4,'5' => 2,'6' => 0));
|
||||
|
||||
/*-------- BUSNIESS --------------*/
|
||||
$no_of_years_business_run = array('100> to >=10' => 10,'5<= to <10' => 8,'3<= to <5' => 6,'1<= to <3' => 4,' 1> to >0' => 2);
|
||||
$business_seasonality = array('yes' => 5, 'no major changes in sales' => 10);
|
||||
$employees_total = array('1000> to >50' => 10,'21<= to <=50' => 8, '11<= to <=20' => 6, '6<= to <10' =>4,'5>= to >0' => 2) ;
|
||||
$cerificates = array('yes' => 10,'no' => 0, 'not applicable' => 0);
|
||||
$owned_property = array('yes' => 10, 'no' => 0);
|
||||
$owned_vechile = array('yes' => 10, 'no' => 0);
|
||||
$minimum_supplier_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$minimum_client_info = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$stock_answer_scores = array('yes' => 10, 'no' => 0,'not applicable' => 0);
|
||||
$stock_raw_material_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$stock_finished_goods_enough = array('Provided' => 10, 'Not Provided' => 0,'Not Applicable' => 0);
|
||||
$location_suited_for_busienss = array('well_suited' => 10 ,'fairly_suited' => 6,'not_suited' => 0);
|
||||
$business_activity_has_seen = array('yes' => 10, 'no' => 0);
|
||||
$vintage_of_business_account = array('100> to >=10' => 10,'7<= to <10' => 8,'5<= to <7' => 6,'3<= to <5' => 4,'3> to >0' => 2);
|
||||
/*-------- FINAL --------------*/
|
||||
$pd_officer_recommandations = array('Positive' => 10,'Negative' => 0,'Refer to Credit' => 5,'Others' => 0);
|
||||
|
||||
|
||||
/*-----------CALCULATION PART -----------*/
|
||||
/*-----------GENERAL SECTION -----------*/
|
||||
//echo "##################################################";
|
||||
|
||||
$over_all_general_l2 = 0;
|
||||
$over_all_general_round_l2 = 0;
|
||||
$general_distribute_level_weightage = 0;
|
||||
|
||||
//General Section L2 Weightage Distribution section
|
||||
if($pd_master_details[0]['is_otp_enabled'] != 1)
|
||||
{
|
||||
$general_distribute_level_weightage += $otp_done_L2;
|
||||
}
|
||||
|
||||
// if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
|
||||
// {
|
||||
// //echo "Yes could not";
|
||||
// $general_distribute_level_weightage += $neibourhood_check_as_per_pd_officer_L2;
|
||||
// }
|
||||
|
||||
//End of General Section L2 Weightage Distribution section
|
||||
|
||||
|
||||
//######1.7 otp_done
|
||||
if($pd_master_details[0]['is_otp_enabled'] == 1)
|
||||
{
|
||||
$otp_done_L2 = $general_distribute_level_weightage ? ($otp_done_L2 + ($otp_done_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $otp_done_L2;
|
||||
|
||||
$otp_done_actual_score = ($l1_general/100) * ($otp_done_L2/100) * $otp_done[$score_questions['general']['otp_done']];
|
||||
|
||||
$otp_done_max_score = ($l1_general/100) * ($otp_done_L2/100) * max($otp_done);
|
||||
|
||||
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($otp_done_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['otp_done'],'attributed_score' => ($otp_done_actual_score), 'max_score' => ($otp_done_max_score),'score_band'=>$otp_done[$score_questions['general']['otp_done']],'max_score_band' => max($otp_done));
|
||||
}
|
||||
else
|
||||
{
|
||||
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => 'Not Applicable','attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$otp_done[ $score_questions['general']['otp_done'] != "" || $score_questions['general']['otp_done'] != null ?$score_questions['general']['otp_done']: "No" ],'max_score_band' => 0);
|
||||
}
|
||||
|
||||
//######1.5 neibourhood_check_as_per_pd_officer
|
||||
// if(!strcmp($score_questions['general']['neibourhood_check_as_per_pd_officer'],'Could not verify'))
|
||||
// {
|
||||
// $score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => 0,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'attributed_score' => 0.00, 'max_score' => 0.00,'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => 0);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// $neibourhood_check_as_per_pd_officer_L2 = $general_distribute_level_weightage ? ($neibourhood_check_as_per_pd_officer_L2 + ($neibourhood_check_as_per_pd_officer_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $neibourhood_check_as_per_pd_officer_L2;
|
||||
|
||||
// $neibourhood_check_as_per_pd_officer_actual_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * $neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ];
|
||||
|
||||
// $neibourhood_check_as_per_pd_officer_max_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * max($neibourhood_check_as_per_pd_officer);
|
||||
|
||||
// $score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => $neibourhood_check_as_per_pd_officer_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'attributed_score' => ($neibourhood_check_as_per_pd_officer_actual_score), 'max_score' => ($neibourhood_check_as_per_pd_officer_max_score),'score_band'=>$neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer'] != "" || $score_questions['general']['neibourhood_check_as_per_pd_officer'] != null ?$score_questions['general']['neibourhood_check_as_per_pd_officer']: "Negative" ],'max_score_band' => max($neibourhood_check_as_per_pd_officer));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
//echo $general_distribute_level_weightage = round($general_distribute_level_weightage,2);die();
|
||||
|
||||
//echo $general_distribute_level_weightage;
|
||||
|
||||
|
||||
|
||||
//#######1.1 person_met_is_applicant
|
||||
|
||||
// $person_met_is_applicant_L2 = $general_distribute_level_weightage ? ($person_met_is_applicant_L2 + ($person_met_is_applicant_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $person_met_is_applicant_L2 ;
|
||||
|
||||
|
||||
// $person_met_is_applicant_actual_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * $person_met_is_applicant[$score_questions['general']['person_met_is_applicant']];
|
||||
|
||||
// $person_met_is_applicant_max_score = ($l1_general/100) * ($person_met_is_applicant_L2/100) * max($person_met_is_applicant);
|
||||
// //echo $person_met_is_applicant_L2;
|
||||
// //echo $person_met_is_applicant_max_score;
|
||||
|
||||
// $score_questions['general']['person_met_is_applicant'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($person_met_is_applicant_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['person_met_is_applicant'],'attributed_score' => ($person_met_is_applicant_actual_score), 'max_score' => ($person_met_is_applicant_max_score),'score_band'=>($person_met_is_applicant[$score_questions['general']['person_met_is_applicant']]),'max_score_band' => max($person_met_is_applicant));
|
||||
|
||||
//######1.2 pd_location_approach
|
||||
|
||||
// $pd_location_approach_L2 = $general_distribute_level_weightage ? ($pd_location_approach_L2 + ($pd_location_approach_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $pd_location_approach_L2 ;
|
||||
|
||||
// $pd_location_approach_actual_score = ($l1_general/100) * ($pd_location_approach_L2/100) * $pd_location_approach[$score_questions['general']['pd_location_approach']];
|
||||
|
||||
// $pd_location_approach_max_score = ($l1_general/100) * ($pd_location_approach_L2/100) * max($pd_location_approach);
|
||||
|
||||
// $score_questions['general']['pd_location_approach'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($pd_location_approach_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['pd_location_approach'],'attributed_score' => ($pd_location_approach_actual_score), 'max_score' => ($pd_location_approach_max_score),'score_band'=>$pd_location_approach[$score_questions['general']['pd_location_approach']],'max_score_band' => max($pd_location_approach));
|
||||
|
||||
//######1.3 comment_locality
|
||||
|
||||
// $comment_locality_L2 = $general_distribute_level_weightage ? ($comment_locality_L2 + ($comment_locality_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $comment_locality_L2;
|
||||
|
||||
// $comment_locality_actual_score = ($l1_general/100) * ($comment_locality_L2/100) * $comment_locality[$score_questions['general']['comment_locality']];
|
||||
|
||||
// $comment_locality_max_score = ($l1_general/100) * ($comment_locality_L2/100) * max($comment_locality);
|
||||
|
||||
// $score_questions['general']['comment_locality'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($comment_locality_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['comment_locality'],'attributed_score' => ($comment_locality_actual_score), 'max_score' => ($comment_locality_max_score),'score_band'=>$comment_locality[$score_questions['general']['comment_locality']],'max_score_band' => max($comment_locality));
|
||||
|
||||
//######1.4 customer_behaviour
|
||||
|
||||
$customer_behaviour_L2 = $general_distribute_level_weightage ? ($customer_behaviour_L2 + ($customer_behaviour_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $customer_behaviour_L2;
|
||||
|
||||
$customer_behaviour_actual_score = ($l1_general/100) * ($customer_behaviour_L2/100) * $customer_behaviour[$score_questions['general']['customer_behaviour']];
|
||||
|
||||
$customer_behaviour_max_score = ($l1_general/100) * ($customer_behaviour_L2/100) * max($customer_behaviour);
|
||||
|
||||
$score_questions['general']['customer_behaviour'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($customer_behaviour_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['customer_behaviour'],'attributed_score' => ($customer_behaviour_actual_score), 'max_score' => ($customer_behaviour_max_score),'score_band'=>$customer_behaviour[$score_questions['general']['customer_behaviour']],'max_score_band' => max($customer_behaviour));
|
||||
|
||||
//######1.6 was_the_company_name_board_sighted
|
||||
|
||||
$was_the_company_name_board_sighted_L2 = $general_distribute_level_weightage ? ($was_the_company_name_board_sighted_L2 + ($was_the_company_name_board_sighted_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $was_the_company_name_board_sighted_L2;
|
||||
|
||||
$was_the_company_name_board_sighted_actual_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * $was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']];
|
||||
|
||||
$was_the_company_name_board_sighted_max_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * max($was_the_company_name_board_sighted);
|
||||
|
||||
$score_questions['general']['was_the_company_name_board_sighted'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($was_the_company_name_board_sighted_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['was_the_company_name_board_sighted'],'attributed_score' => ($was_the_company_name_board_sighted_actual_score), 'max_score' => ($was_the_company_name_board_sighted_max_score),'score_band'=>$was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']],'max_score_band' => max($was_the_company_name_board_sighted));
|
||||
|
||||
|
||||
|
||||
//######1.8 qualification
|
||||
|
||||
$qualification_L2 = $general_distribute_level_weightage ? ($qualification_L2 + ($qualification_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $qualification_L2;
|
||||
|
||||
$qualification_actual_score = ($l1_general/100) * ($qualification_L2/100) * $qualification['id_score'][$score_questions['general']['qualification']];
|
||||
|
||||
$qualification_max_score = ($l1_general/100) * ($qualification_L2/100) * max($qualification['id_score']);
|
||||
$keys = array_keys($qualification['name_score']);
|
||||
|
||||
$score_questions['general']['qualification'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($qualification_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $keys[($score_questions['general']['qualification']-1)],'attributed_score' => ($qualification_actual_score), 'max_score' => ($qualification_max_score),'score_band'=>$qualification['id_score'][$score_questions['general']['qualification']],'max_score_band' => max($qualification['id_score']));
|
||||
|
||||
//######1.9 value of assets as a % of Loan Amount
|
||||
//print_r($personal_asset_grid);
|
||||
|
||||
$value_of_other_assets_L2 = $general_distribute_level_weightage ? ($value_of_other_assets_L2 + ($value_of_other_assets_L2 / (100 - $general_distribute_level_weightage )) * $general_distribute_level_weightage) : $value_of_other_assets_L2;
|
||||
|
||||
$asset_calculation_details = array();
|
||||
|
||||
$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
|
||||
$asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2);
|
||||
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
|
||||
//print_r($loan_amt_from_loam_form);die();
|
||||
$loan_amount = (int)$loan_amt_from_loam_form;
|
||||
$asset_calculation_details['loan_amount'] = $loan_amount;
|
||||
//echo 'loan_amount - '.$loan_amount;
|
||||
|
||||
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
|
||||
//print_r($personal_asset_grid);
|
||||
//echo $avg_expected_value_of_assets;
|
||||
$asset_calculation_details['avg_expected_value_of_assets'] = round($avg_expected_value_of_assets,2);
|
||||
//echo "avg_expected_value_of_assets - ".$avg_expected_value_of_assets;
|
||||
//$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
|
||||
|
||||
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $loan_amount;
|
||||
$asset_calculation_details['expected_value_of_assets'] = round($expected_value_of_assets,2);
|
||||
//echo 'expected_value_of_assets--'.$expected_value_of_assets;
|
||||
|
||||
|
||||
|
||||
$actual_value_of_assets_percentage = ($actual_value_of_assets / $loan_amount) * 100;
|
||||
$asset_calculation_details['actual_value_of_assets_percentage'] =
|
||||
round($actual_value_of_assets_percentage,2);
|
||||
//echo 'actual_value_of_assets_percentage--'.$actual_value_of_assets_percentage;
|
||||
|
||||
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
|
||||
|
||||
|
||||
//echo 'varience--'.$variance;
|
||||
//die();
|
||||
$asset_calculation_details['variance'] = round($variance,2);
|
||||
|
||||
$final_asset_attributed_score = 0;
|
||||
$final_asset_score = 0;
|
||||
if($actual_value_of_assets > 0 )
|
||||
{
|
||||
foreach($personal_asset_grid['variance_grid'] as $grid)
|
||||
{
|
||||
//print_r($grid['score']);
|
||||
if($grid['variance_ ratio_from'] <= $variance && $grid['variance_ration_to'] > $variance)
|
||||
{
|
||||
$final_asset_score = $grid['score'];
|
||||
$final_asset_attributed_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
$asset_calculation_details['score'] = $final_asset_score;
|
||||
// echo "final_asset_score--".$final_asset_score;
|
||||
// die();
|
||||
$score_questions['general']['value_of_other_assets'] = array('l1_weightage' => $l1_general,'l2_weightage' => ($value_of_other_assets_L2),'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['value_of_other_assets'],'attributed_score' => ($final_asset_attributed_score), 'max_score' => ((($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10)),'score_band'=> $final_asset_score,'max_score_band' => 10);
|
||||
|
||||
|
||||
/*-----------END OF GENERAL SECTION -----------*/
|
||||
|
||||
/*-----------FINAL REMARKS SECTION -----------*/
|
||||
//###### 3.1 PD Officer Recommandation
|
||||
|
||||
$pd_officer_recommandations_actual_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * $pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ];
|
||||
|
||||
$pd_officer_recommandations_max_score = ($l1_final/100) * ($pd_officer_recommadations_L2/100) * max($pd_officer_recommandations);
|
||||
|
||||
$score_questions['final_remarks']['pd_officer_recommandations'] = array('l1_weightage' => $l1_final,'l2_weightage' => $pd_officer_recommadations_L2,'distributed_weightage' => 0,'answer' => $score_questions['final_remarks']['pd_officer_recommandations'],'attributed_score' => round($pd_officer_recommandations_actual_score,2), 'max_score' => $pd_officer_recommandations_max_score,'score_band'=>$pd_officer_recommandations[ $score_questions['final_remarks']['pd_officer_recommandations'] ],'max_score_band' => max($pd_officer_recommandations));
|
||||
/*-----------END OF FINAL REMARKS SECTION -----------*/
|
||||
|
||||
|
||||
/*-----------BUSINESS SECTION -----------*/
|
||||
|
||||
|
||||
/* First Calculate Shortfall Type Questions to get distribute level
|
||||
From 2.7 to 2.10 Questions are shortfall type questions (REF :- SSA_ScoreCard_Ver_090219(2))
|
||||
*/
|
||||
|
||||
$business_distribute_level_weightage = 0;
|
||||
|
||||
//echo $score_questions['business']['minimum_supplier_info'];die();
|
||||
if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $minimum_supplier_info_L2;
|
||||
$minimum_supplier_info_L2 = 0;
|
||||
}
|
||||
if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $minimum_client_info_L2;
|
||||
$minimum_client_info_L2 = 0;
|
||||
}
|
||||
if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $stock_raw_material_enough_L2;
|
||||
$stock_raw_material_enough_L2 = 0;
|
||||
}
|
||||
if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable'))
|
||||
{
|
||||
$business_distribute_level_weightage += $stock_finished_goods_enough_L2;$stock_finished_goods_enough_L2 = 0;
|
||||
}
|
||||
//echo $business_distribute_level_weightage;
|
||||
|
||||
//######2.7 atleast one supplier info provided
|
||||
$minimum_supplier_info_L2 = $business_distribute_level_weightage ? ($minimum_supplier_info_L2 + ($minimum_supplier_info_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $minimum_supplier_info_L2 ;
|
||||
|
||||
$minimum_supplier_info_actual_score = ($l1_business/100) * ($minimum_supplier_info_L2/100) * $minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ];
|
||||
|
||||
$minimum_supplier_info_max_score = strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_supplier_info_L2/100) * max($minimum_supplier_info) : 0;
|
||||
|
||||
$score_questions['business']['minimum_supplier_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($minimum_supplier_info_L2),'answer' => $score_questions['business']['minimum_supplier_info'],'attributed_score' => ($minimum_supplier_info_actual_score), 'max_score' => ($minimum_supplier_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_supplier_info [ $score_questions['business']['minimum_supplier_info'] ],'max_score_band' => max($minimum_supplier_info));
|
||||
|
||||
//######2.8 atleast one client info provided
|
||||
$minimum_client_info_L2 = $business_distribute_level_weightage ? ($minimum_client_info_L2 + ($minimum_client_info_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $minimum_client_info_L2 ;
|
||||
|
||||
$minimum_client_info_actual_score = ($l1_business/100) * ($minimum_client_info_L2/100) * $minimum_client_info [ $score_questions['business']['minimum_client_info'] ];
|
||||
|
||||
$minimum_client_info_max_score = strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable') ? ($l1_business/100) * ($minimum_client_info_L2/100) * max($minimum_client_info) : 0;
|
||||
|
||||
$score_questions['business']['minimum_client_info'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($minimum_client_info_L2),'answer' => $score_questions['business']['minimum_client_info'],'attributed_score' => ($minimum_client_info_actual_score), 'max_score' => ($minimum_client_info_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band'=>$minimum_client_info [ $score_questions['business']['minimum_client_info'] ],'max_score_band' => max($minimum_client_info));
|
||||
|
||||
//######2.9 stock of raw material
|
||||
$stock_raw_material_enough_L2 = $business_distribute_level_weightage ? ($stock_raw_material_enough_L2 + ($stock_raw_material_enough_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $stock_raw_material_enough_L2 ;
|
||||
|
||||
$stock_raw_material_enough_actual_score = ($l1_business/100) * ($stock_raw_material_enough_L2/100) * $stock_answer_scores [ strtolower($score_questions['business']['stock_raw_material_enough']) ];
|
||||
|
||||
$stock_raw_material_enough_max_score = strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable') ? ($l1_business/100) * ($stock_raw_material_enough_L2/100) * max($stock_answer_scores) : 0;
|
||||
|
||||
$score_questions['business']['stock_raw_material_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($stock_raw_material_enough_L2),'answer' => $score_questions['business']['stock_raw_material_enough'],'attributed_score' => ($stock_raw_material_enough_actual_score), 'max_score' => ($stock_raw_material_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ strtolower($score_questions['business']['stock_raw_material_enough']) ],'max_score_band' =>max($stock_answer_scores) );
|
||||
|
||||
//######2.10 stock_finished_goods_enough
|
||||
$stock_finished_goods_enough_L2 = $business_distribute_level_weightage ? ($stock_finished_goods_enough_L2 + ($stock_finished_goods_enough_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $stock_finished_goods_enough_L2 ;
|
||||
|
||||
$stock_finished_goods_enough_actual_score = ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * $stock_answer_scores [ $score_questions['business']['stock_finished_goods_enough'] != "" || $score_questions['business']['stock_finished_goods_enough'] != null ? strtolower($score_questions['business']['stock_finished_goods_enough']) : "no" ];
|
||||
|
||||
$stock_finished_goods_enough_max_score = strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable') ? ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * max($stock_answer_scores) : 0;
|
||||
|
||||
|
||||
$temp_stock_finished_goods_enough = strtolower($score_questions['business']['stock_finished_goods_enough']);
|
||||
$score_questions['business']['stock_finished_goods_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($stock_finished_goods_enough_L2),'answer' => $score_questions['business']['stock_finished_goods_enough'],'attributed_score' => ($stock_finished_goods_enough_actual_score), 'max_score' => ($stock_finished_goods_enough_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $stock_answer_scores [ $temp_stock_finished_goods_enough != "" || $temp_stock_finished_goods_enough != null ? $temp_stock_finished_goods_enough : "no" ],'max_score_band' => max($stock_answer_scores));
|
||||
|
||||
|
||||
|
||||
//######2.1 Business Certificates
|
||||
|
||||
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $cerificates_L2;
|
||||
|
||||
//find out no of not applicable cases
|
||||
$business_certificates_distribution_count = 0;
|
||||
|
||||
foreach($score_questions['business']['cerificates'] as $value)
|
||||
{
|
||||
|
||||
if(strcasecmp($value,'not applicable'))
|
||||
{
|
||||
$business_certificates_distribution_count++;
|
||||
//echo $value;
|
||||
}
|
||||
}
|
||||
$business_certificates_distribution_count;
|
||||
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
|
||||
|
||||
|
||||
|
||||
// echo $cerificates_L2.'---';echo $business_certificates_distribution_count;
|
||||
// echo $business_certificates_distribution;die();
|
||||
$certificate_actual_score = 0;
|
||||
$certificate_max_score = 0;
|
||||
//print_r($score_questions['business']['cerificates']);
|
||||
foreach($score_questions['business']['cerificates'] as $certificate_key => $certificate)
|
||||
{
|
||||
//print_r($certificate);
|
||||
$acutal_score = 0;
|
||||
$max_score = 0;
|
||||
if(strcasecmp($certificate,'not applicable'))
|
||||
{
|
||||
$acutal_score = ($l1_business/100) * ($business_certificates_distribution/100) * $cerificates[$certificate];
|
||||
$max_score = ($l1_business/100) * ($business_certificates_distribution/100) * max($cerificates);
|
||||
|
||||
}
|
||||
$score_questions['business']['cerificates'][$certificate_key] = array('answer' => $certificate,'attributed_score' => ($acutal_score), 'max_score' => ($max_score),'score_band' => $cerificates[$certificate],'max_score_band'=> max($cerificates),'l1_weightage' =>($l1_business),'l2_weightage'=> ($business_certificates_distribution));
|
||||
|
||||
$certificate_actual_score += $acutal_score;
|
||||
$certificate_max_score += $max_score;
|
||||
}
|
||||
|
||||
$score_questions['business']['cerificates']['l1_weightage'] = $l1_business;
|
||||
$score_questions['business']['cerificates']['l2_weightage'] = (($business_certificates_distribution * $business_certificates_distribution_count));
|
||||
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
|
||||
$score_questions['business']['cerificates']['max_score'] = ($certificate_max_score);
|
||||
$score_questions['business']['cerificates']['attributed_score'] = ($certificate_actual_score);
|
||||
$score_questions['business']['cerificates']['score_band'] = 'Derived';
|
||||
$score_questions['business']['cerificates']['max_score_band'] = 'Derived';
|
||||
|
||||
//print_r($score_questions['business']['cerificates']);die();
|
||||
//######2.1 no_of_years_business_run
|
||||
|
||||
$no_of_years_business_run_actual_score = 0;
|
||||
$score_band = 0;
|
||||
foreach($no_of_years_business_run as $key => $value)
|
||||
{
|
||||
$exp = explode('to',$key);
|
||||
//print_r($exp);
|
||||
$left = $exp[0].$score_questions['business']['no_of_years_business_run'];
|
||||
$right = $score_questions['business']['no_of_years_business_run'].$exp[1];
|
||||
//echo $left.'````'.$right;echo "\n";
|
||||
eval( '$left_exp = ' . $left . ';');
|
||||
eval( '$right_exp = ' . $right . ';');
|
||||
if($left_exp && $right_exp)
|
||||
{
|
||||
|
||||
$no_of_years_business_run_L2 = $business_distribute_level_weightage ? ($no_of_years_business_run_L2 + ($no_of_years_business_run_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $no_of_years_business_run_L2 ;
|
||||
|
||||
$no_of_years_business_run_actual_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * $value;
|
||||
$score_band = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$no_of_years_business_run_max_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * max($no_of_years_business_run);
|
||||
|
||||
$score_questions['business']['no_of_years_business_run'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($no_of_years_business_run_L2),'answer' => $score_questions['business']['no_of_years_business_run'],'attributed_score' => ($no_of_years_business_run_actual_score), 'max_score' => ($no_of_years_business_run_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($no_of_years_business_run));
|
||||
|
||||
|
||||
//######2.2 business seasonal
|
||||
|
||||
|
||||
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $business_seasonality_L2 ;
|
||||
|
||||
$business_seasonality_actual_score = ($l1_business/100) * ($business_seasonality_L2/100) * $business_seasonality[ $score_questions['business']['business_seasonality'] ];
|
||||
|
||||
$business_seasonality_max_score = ($l1_business/100) * ($business_seasonality_L2/100) * max($business_seasonality);
|
||||
|
||||
$score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_seasonality_L2),'answer' => $score_questions['business']['business_seasonality'],'attributed_score' => ($business_seasonality_actual_score), 'max_score' =>($business_seasonality_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_seasonality[ $score_questions['business']['business_seasonality'] ],'max_score_band' => max($business_seasonality));
|
||||
|
||||
//######2.3 employees_total
|
||||
// $employees_total_actual_score = 0;
|
||||
|
||||
// $employees_total_L2 = $business_distribute_level_weightage ? ($employees_total_L2 + ($employees_total_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $employees_total_L2 ;
|
||||
// $score_band = 0;
|
||||
// foreach($employees_total as $key => $value)
|
||||
// {
|
||||
// $exp = explode('to',$key);
|
||||
// //print_r($exp);
|
||||
// $left = $exp[0].$score_questions['business']['employees_total'];
|
||||
// $right = $score_questions['business']['employees_total'].$exp[1];
|
||||
// //echo $left.'````'.$right;echo "\n";
|
||||
// eval( '$left_exp = ' . $left . ';');
|
||||
// eval( '$right_exp = ' . $right . ';');
|
||||
// if($left_exp && $right_exp)
|
||||
// {
|
||||
// $employees_total_actual_score = ($l1_business/100) * ($employees_total_L2/100) * $value;
|
||||
// $score_band = $value;
|
||||
// }
|
||||
|
||||
// }
|
||||
// // echo $score_band;
|
||||
// // die();
|
||||
|
||||
|
||||
// $employees_total_max_score = ($l1_business/100) * ($employees_total_L2/100) * max($employees_total);
|
||||
|
||||
// $score_questions['business']['employees_total'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($employees_total_L2),'answer' => $score_questions['business']['employees_total'],'attributed_score' => ($employees_total_actual_score), 'max_score' => ($employees_total_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' =>$score_band,'max_score_band' => max($employees_total));
|
||||
|
||||
|
||||
//######2.5 owned_property
|
||||
|
||||
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $owned_property_L2 ;
|
||||
|
||||
$owned_property_actual_score = ($l1_business/100) * ($owned_property_L2/100) * $owned_property[ $score_questions['business']['owned_property'] ];
|
||||
$owned_property_max_score = ($l1_business/100) * ($owned_property_L2/100) * max($owned_property);
|
||||
|
||||
$score_questions['business']['owned_property'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($owned_property_L2),'answer' => $score_questions['business']['owned_property'],'attributed_score' => ($owned_property_actual_score), 'max_score' => ($owned_property_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_property[ $score_questions['business']['owned_property'] ],'max_score_band' => max($owned_property));
|
||||
|
||||
//######2.6 owned_vechile
|
||||
$owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $owned_vechile_L2 ;
|
||||
|
||||
$owned_vechile_actual_score = ($l1_business/100) * ($owned_vechile_L2/100) * $owned_vechile[ $score_questions['business']['owned_vechile'] ];
|
||||
$owned_vechile_max_score = ($l1_business/100) * ($owned_vechile_L2/100) * max($owned_vechile);
|
||||
|
||||
$score_questions['business']['owned_vechile'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($owned_vechile_L2),'answer' => $score_questions['business']['owned_vechile'],'attributed_score' => ($owned_vechile_actual_score), 'max_score' => ($owned_vechile_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $owned_vechile[ $score_questions['business']['owned_vechile'] ],'max_score_band' => max($owned_vechile));
|
||||
|
||||
//######2.11 location_suited_for_busienss
|
||||
|
||||
// $location_suited_for_busienss_L2 = $business_distribute_level_weightage ? ($location_suited_for_busienss_L2 + ($location_suited_for_busienss_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $location_suited_for_busienss_L2 ;
|
||||
|
||||
// $location_suited_for_busienss_actual_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ];
|
||||
// $location_suited_for_busienss_max_score = ($l1_business/100) * ($location_suited_for_busienss_L2/100) * max($location_suited_for_busienss);
|
||||
|
||||
// $score_questions['business']['location_suited_for_busienss'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($location_suited_for_busienss_L2),'answer' => $score_questions['business']['location_suited_for_busienss'],'attributed_score' => ($location_suited_for_busienss_actual_score), 'max_score' => ($location_suited_for_busienss_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $location_suited_for_busienss[ $score_questions['business']['location_suited_for_busienss'] ],'max_score_band' => max($location_suited_for_busienss));
|
||||
|
||||
// //######2.11 business_activity_has_seen
|
||||
|
||||
// $business_activity_has_seen_L2 = $business_distribute_level_weightage ? ($business_activity_has_seen_L2 + ($business_activity_has_seen_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $business_activity_has_seen_L2 ;
|
||||
|
||||
// $business_activity_has_seen_actual_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ];
|
||||
// $business_activity_has_seen_max_score = ($l1_business/100) * ($business_activity_has_seen_L2/100) * max($business_activity_has_seen);
|
||||
|
||||
// $score_questions['business']['business_activity_has_seen'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($business_activity_has_seen_L2),'answer' => $score_questions['business']['business_activity_has_seen'],'attributed_score' => ($business_activity_has_seen_actual_score), 'max_score' => ($business_activity_has_seen_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $business_activity_has_seen[ $score_questions['business']['business_activity_has_seen'] ], 'max_score_band' => max($business_activity_has_seen));
|
||||
|
||||
//######2.13 vintage business banking
|
||||
|
||||
$vintage_of_business_account_L2 = $business_distribute_level_weightage ? ($vintage_of_business_account_L2 + ($vintage_of_business_account_L2 / (100 - $business_distribute_level_weightage )) * $business_distribute_level_weightage) : $vintage_of_business_account_L2 ;
|
||||
|
||||
$vintage_of_business_account_actual_score = 0;
|
||||
$score_band = 0;
|
||||
foreach($vintage_of_business_account as $key => $value)
|
||||
{
|
||||
$exp = explode('to',$key);
|
||||
//print_r($exp);
|
||||
$left = $exp[0].$score_questions['business']['vintage_of_business_account'];
|
||||
$right = $score_questions['business']['vintage_of_business_account'].$exp[1];
|
||||
//echo $left.'````'.$right;echo "\n";
|
||||
eval( '$left_exp = ' . $left . ';');
|
||||
eval( '$right_exp = ' . $right . ';');
|
||||
if($left_exp && $right_exp)
|
||||
{
|
||||
$vintage_of_business_account_actual_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * $value;
|
||||
$score_band = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account);
|
||||
|
||||
|
||||
$vintage_of_business_account_for_display = explode('.',($score_questions['business']['vintage_of_business_account']));
|
||||
$vintage_of_business_account_for_display = ($vintage_of_business_account_for_display[0] != 0 ? $vintage_of_business_account_for_display[0].' Yrs ' : '') . (isset($vintage_of_business_account_for_display[1]) && $vintage_of_business_account_for_display[1] != 0 ? $vintage_of_business_account_for_display[1].' Mns ' : '');
|
||||
|
||||
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => ($vintage_of_business_account_L2),'answer' => $vintage_of_business_account_for_display,'attributed_score' => ($vintage_of_business_account_actual_score), 'max_score' => ($vintage_of_business_account_max_score),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
|
||||
/*-----------END OF BUSINESS SECTION -----------*/
|
||||
|
||||
|
||||
|
||||
/* Calculate Overall Total*/
|
||||
$overall_max_score = 0;
|
||||
$overall_actual_score = 0;
|
||||
foreach($score_questions as $key => $value)
|
||||
{
|
||||
|
||||
$current_max_score = 0;
|
||||
$current_actual_score = 0;
|
||||
foreach($value as $v_key => $f_value)
|
||||
{
|
||||
$overall_max_score += $f_value['max_score'];
|
||||
$overall_actual_score += $f_value['attributed_score'];
|
||||
|
||||
$current_max_score += $f_value['max_score'];
|
||||
$current_actual_score += $f_value['attributed_score'];
|
||||
|
||||
}
|
||||
$score_questions['score_summary'][$key] = array('actual_score' => $current_actual_score,'max_score' => $current_max_score,'score_per' => (($current_actual_score/$current_max_score) * 100));
|
||||
|
||||
}
|
||||
$score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => (($overall_actual_score/$overall_max_score) * 100));
|
||||
|
||||
$score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details;
|
||||
//print_r($score_questions);die();
|
||||
return ($score_questions);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user