1574 lines
58 KiB
PHP
1574 lines
58 KiB
PHP
<?php
|
|
|
|
class pdcompletenesscheck
|
|
{
|
|
|
|
|
|
###########################################
|
|
####### FULL PD CHECK #####################
|
|
###########################################
|
|
public static function fullPDCompletenessCheck($pdid,$pd_master_details,$client)
|
|
{
|
|
$CI =&get_instance();
|
|
$CI->load->model('PD_Model');
|
|
|
|
//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] = $CI->PD_Model->getSignedPDDocsURL($pdid,$i);
|
|
|
|
$fields = array('json');
|
|
$where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i);
|
|
$form_data[$i] = $CI->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]['json'],true));
|
|
// echo "seperateScoreQuestions";
|
|
|
|
|
|
|
|
$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)
|
|
{
|
|
|
|
if($person['is_person_met'] == true )
|
|
{
|
|
|
|
//print_r($person);die();
|
|
if(!$person['is_person_met_pic'])
|
|
{
|
|
$person_met_selfie_count++;
|
|
|
|
}
|
|
|
|
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++;
|
|
}
|
|
|
|
}
|
|
|
|
//get salary case details specifically
|
|
$sal_check = null;
|
|
if($pd_master_details[0]['customer_segment_abbr'] == 'SAL')
|
|
{
|
|
$sal_check = $CI->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid),XTRA_CHECK);
|
|
$sal_check = count($sal_check) ? $sal_check[0]['flag'] : null;
|
|
}
|
|
|
|
if($pd_master_details[0]['fk_pd_type'] == 2 && !$pd_master_details[0]['is_vendor_visit_disabled'])
|
|
{
|
|
$vendor_done_status = 1;
|
|
if(($pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != QC_COMPLETED))
|
|
{
|
|
$incomplete_details[] = 'Vendor yet to QC Complete the PD';
|
|
$vendor_done_status = 0;
|
|
}
|
|
else if((!$pd_master_details[0]['is_qc_enabled'] && $pd_master_details[0]['vendor_status'] != COMPLETED))
|
|
{
|
|
$incomplete_details[] = 'Vendor yet to Complete the PD';
|
|
$vendor_done_status = 0;
|
|
}
|
|
|
|
//check that all pd genie forms get fetched with vendor answers
|
|
if($vendor_done_status == 1)
|
|
{
|
|
$smart_pd_forms = array('18' => 'General Information','5' => 'Address Details','13' => 'Business Information' ,'19' => 'Neighbourhood / Reference','20' => 'Final Remarks Form','24' => 'Credit Manager Queries','22' => 'Business Assets','12' => 'Employment Information','11' => 'Stock Details');
|
|
$unfetched_forms = '';
|
|
$vendor_form_status = $CI->PD_Model->getVendorFormStatus($pdid);
|
|
//print_r($vendor_form_status);die();
|
|
foreach ($vendor_form_status as $key => $value)
|
|
{
|
|
if(!$value['form_status']){ $unfetched_forms .= $smart_pd_forms [ $value['fk_form_id'] ].', ' ; }
|
|
}
|
|
if($unfetched_forms)
|
|
{
|
|
$unfetched_forms = substr_replace($unfetched_forms,'', -2) ;
|
|
$incomplete_details[] = 'The following vendor section answers not fetched with PG Genie Form - '.$unfetched_forms;
|
|
}
|
|
//echo $unfetched_forms;
|
|
}
|
|
|
|
//die();
|
|
|
|
}
|
|
//kyc
|
|
if(array_key_exists('is_kyc', $general_form) && $general_form['is_kyc'] == "")
|
|
{
|
|
$incomplete_details[] = 'General Section - Applicant KYC not answered';
|
|
}
|
|
//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]['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;
|
|
$certificate_text = '';
|
|
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++;
|
|
$certificate_text .= "Shop and Est Act Certificate ,";
|
|
}
|
|
} 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++;
|
|
$certificate_text .= "GST Regn Certificate ,";
|
|
}
|
|
} else { $certificate_count++; }
|
|
|
|
|
|
if(isset($business_form['pf_regn']))
|
|
{
|
|
if(strtoupper($business_form['pf_regn'])=='YES' && $business_form['pf_regn_pic'] == "")
|
|
{
|
|
$certificate_count++;
|
|
$certificate_text .= "GST Regn Certificate ,";
|
|
}
|
|
} else { $certificate_count++; }
|
|
|
|
if(isset($business_form['esic_regn']))
|
|
{
|
|
if(strtoupper($business_form['esic_regn'])=='YES' && $business_form['esic_regn_pic'] == "")
|
|
{
|
|
$certificate_count++;
|
|
$certificate_text .= "ESIC Regn Certificate ,";
|
|
}
|
|
} 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++;
|
|
$certificate_text .= "Factory Certificate ,";
|
|
}
|
|
} //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++;
|
|
$certificate_text .= "Export Iimport Certificate ,";
|
|
}
|
|
} 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++;
|
|
$certificate_text .= "Practice Certificate ,";
|
|
}
|
|
} //else { $certificate_count++; }
|
|
//echo $certificate_count;die();
|
|
}
|
|
|
|
if($certificate_text != ''){ $certificate_text = rtrim($certificate_text, ","); }
|
|
if($certificate_count){ $incomplete_details[] = "Business Section - $certificate_text images(s) not captured"; }
|
|
|
|
}
|
|
|
|
#####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]['json'])?(json_decode($form_data[14][0]['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_assest_form = (json_decode($form_data[22][0]['json'],true));
|
|
// $businees_assest_images_count = isset($pd_images[22]) ? count($pd_images[22]) : 0;
|
|
//
|
|
|
|
#####Business Assets Form Questions########
|
|
$business_assest_form = (json_decode($form_data[22][0]['json'],true));
|
|
//print_r($business_assest_form);die();
|
|
$businees_assest_images_count = isset($pd_images[22]) ? count($pd_images[22]) : 0;
|
|
if( $client != 'WEB')// if API came from web then ignore this check
|
|
{
|
|
|
|
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';
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
if( $client == 'WEB')// if API came from web then ignore this check
|
|
{
|
|
if(array_key_exists('business_assets_for_address',$business_assest_form))
|
|
{
|
|
if(count($business_assest_form['business_assets_for_address']))
|
|
{
|
|
$overall_not_filled_questions = '';
|
|
if(!$business_assest_form['business_assets_for_address'][0]['business_years'])
|
|
{
|
|
$overall_not_filled_questions .= 'Business Operating Duration';
|
|
}
|
|
if(!$business_assest_form['business_assets_for_address'][0]['business_ownership_type'])
|
|
{
|
|
$overall_not_filled_questions .= ' Onwership Type';
|
|
}
|
|
|
|
if($overall_not_filled_questions)
|
|
{
|
|
$incomplete_details[] = 'Business Assets Section - '.$overall_not_filled_questions;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$incomplete_details[] = 'Business Assets Section - Business Operating Duration and ownership type';
|
|
}
|
|
}
|
|
}
|
|
#####End of Business Assets Form Questions########
|
|
|
|
$business_bank_form = isset($form_data[21][0]['json'])?(json_decode($form_data[21][0]['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]['json'])?(json_decode($form_data[1][0]['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]['json'])?(json_decode($form_data[2][0]['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]['json'])?(json_decode($form_data[11][0]['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
|
|
}
|
|
}
|
|
|
|
|
|
return $incomplete_details;
|
|
|
|
}
|
|
|
|
|
|
###########################################
|
|
####### TELE PD CHECK #####################
|
|
###########################################
|
|
public static function telePDCompletenessCheck($pdid,$pd_master_details,$client)
|
|
{
|
|
$CI =&get_instance();
|
|
$CI->load->model('PD_Model');
|
|
|
|
//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] = $CI->PD_Model->getSignedPDDocsURL($pdid,$i);
|
|
|
|
$fields = array('json');
|
|
$where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i);
|
|
$form_data[$i] = $CI->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]['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();
|
|
$selfie_images = $CI->PD_Model->selectCustomRecords(array('*'),array('fk_pd_id' => $pdid,'fk_form_id' => 18,'co_applicant_id!=' => null),PDDOCUMENTS);
|
|
// print_r($CI->db->last_query());//die();
|
|
// print_r($selfie_images);//die();
|
|
foreach($general_form['individuals'] as $person)
|
|
{
|
|
|
|
if($person['is_person_met'] == true )
|
|
{
|
|
|
|
$is_cur_permet_captured = false;
|
|
$is_cur_per_id_captured = false;
|
|
foreach ($selfie_images as $key => $value)
|
|
{
|
|
if($person['applicant_name'] == $value['pd_document_title'])
|
|
{
|
|
$is_cur_permet_captured = true;
|
|
}
|
|
if(($person['applicant_name'].'-id_proof') == $value['pd_document_title'])
|
|
{
|
|
$is_cur_per_id_captured = true;
|
|
}
|
|
}
|
|
//print_r($person);die();
|
|
if(!$is_cur_permet_captured)
|
|
{
|
|
$person_met_selfie_count++;
|
|
|
|
}
|
|
|
|
if(!$is_cur_per_id_captured)
|
|
{
|
|
$person_met_id_proof_count++;
|
|
}
|
|
}
|
|
if(($person['is_applicant'] == true && $person['is_person_met'] == true))
|
|
{
|
|
$person_met_is_applicant_count++;
|
|
}
|
|
|
|
}
|
|
|
|
//get salary case details specifically
|
|
$sal_check = null;
|
|
if($pd_master_details[0]['customer_segment_abbr'] == 'SAL')
|
|
{
|
|
$sal_check = $CI->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'; }
|
|
//print_r($person_met_selfie_count);die();
|
|
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]['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;
|
|
$certificate_text = '';
|
|
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++;
|
|
$certificate_text .= "Shop and Est Act Certificate ,";
|
|
}
|
|
} 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++;
|
|
$certificate_text .= "GST Regn Certificate ,";
|
|
|
|
}
|
|
} 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++;
|
|
$certificate_text .= "ESIC Regn Certificate ,";
|
|
}
|
|
} 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++;
|
|
$certificate_text .= "Factory Certificate ,";
|
|
|
|
}
|
|
} //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++;
|
|
$certificate_text .= "Export Iimport Certificate ,";
|
|
}
|
|
} 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++;
|
|
$certificate_text .= "Practice Certificate ,";
|
|
}
|
|
} //else { $certificate_count++; }
|
|
//echo $certificate_count;die();
|
|
}
|
|
|
|
|
|
if($certificate_text != ''){ $certificate_text = rtrim($certificate_text, ","); }
|
|
if($certificate_count){ $incomplete_details[] = "Business Section - $certificate_text images(s) not captured"; }
|
|
|
|
}
|
|
|
|
#####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]['json'])?(json_decode($form_data[14][0]['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]['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]['json'])?(json_decode($form_data[21][0]['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]['json'])?(json_decode($form_data[1][0]['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]['json'])?(json_decode($form_data[2][0]['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]['json'])?(json_decode($form_data[11][0]['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
|
|
}
|
|
}
|
|
|
|
|
|
return $incomplete_details;
|
|
}
|
|
|
|
|
|
}
|
|
?>
|