PD REPORTS

This commit is contained in:
velz 2019-02-26 17:51:18 +05:30
parent ef40e04306
commit 326bae3fc7
19 changed files with 4530 additions and 102 deletions

View File

@ -89,7 +89,7 @@ $autoload['drivers'] = array();
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myuitil','myhttpclient');
$autoload['helper'] = array('url','file','form', 'jwt', 'authorization', 'date','mylog','myocr','mydb','pdalerts','myuitil','myhttpclient','pdscore','businessform','otherincomeform','financialform','neighbourreferencecheckform', 'otherfamilyform', 'assetsform','stockform', 'bankingform');
/*
| -------------------------------------------------------------------

View File

@ -97,7 +97,7 @@ defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','lend
defined('LOGTOBOT') OR define('LOGTOBOT',1);
defined('LOGTOSYS') OR define('LOGTOSYS',1);
defined('PROCESSJSON') OR define('PROCESSJSON',0);
defined('PROCESSJSON') OR define('PROCESSJSON',1);
defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=467975ee8e33abf1549803925eaace0f');
/*******************Constants PD status*********************************/
@ -496,6 +496,28 @@ defined('PDOFFICERRECOMMENDATIONSID') OR define('PDOFFICERRECOMMENDATIONSID','pd
defined('PRICINGINFO') OR define('PRICINGINFO','m_pricing_info');
defined('PRICINGINFOID') OR define('PRICINGINFOSID','pricing_info_id');
defined('SCORECARD') OR define('SCORECARD','m_scorecard');
defined('SCORECARDID') OR define('SCORECARDID','scorecard_id');
defined('LEVEL1') OR define('LEVEL1','m_level1');
defined('LEVEL1ID') OR define('LEVEL1ID','level1_id');
defined('LEVEL2') OR define('LEVEL2','m_level2');
defined('LEVEL2ID') OR define('LEVEL2ID','level2_id');
defined('LEVEL3') OR define('LEVEL3','m_level3');
defined('LEVEL3ID') OR define('LEVEL3ID','level3_id');
defined('PLCCOMBINATION') OR define('PLCCOMBINATION','m_plc_combination');
defined('PLCCOMBINATIONID') OR define('PLCCOMBINATIONID','plc_combination_id');
defined('PERSONALASSETGRID') OR define('PERSONALASSETGRID','m_personal_asset_grid');
defined('PERSONALASSETGRIDID') OR define('PERSONALASSETGRIDID','personal_asset_grid_id');
defined('PERSONALASSETGRIDVARIANCE') OR define('PERSONALASSETGRIDVARIANCE','m_personal_asset_grid_variance');
defined('PERSONALASSETGRIDVARIANCEID') OR define('PERSONALASSETGRIDVARIANCEID','m_personal_asset_grid_variance');

View File

@ -798,7 +798,10 @@ class Entity_Management_Controller extends REST_Controller {
public function listEntityPricingInfo_post()
{
$records = $this->post('records');
echo 'called';
$logger = MYLOG::logFunction();
$logger->info("CUSTOM SPECIFIC TEMPLATE ",array('PDID' => "sdfkhs"));
die();
$columns = array('ENTITY.short_name as lender_name', 'pricing_info_id', 'fk_lender_id', 'slab_name', 'from', 'to', 'full_pd_di', 'full_pd_ai', 'smart_pd', 'tele_pd', 'PRICINGINFO.isactive', 'PRICINGINFO.createdon', 'PRICINGINFO.updateon', 'PRICINGINFO.fk_createdby',' PRICINGINFO.fk_updatedby');
$table = PRICINGINFO.' as PRICINGINFO';

View File

@ -255,11 +255,13 @@ class PD_Controller extends REST_Controller {
{
foreach($result_data as $key => $res)
{
$fields = array('city_id','name as city_name');
$where_condition_array = array('isactive' => 1,'fk_state_id' => $res['state_id']);
$cities = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,CITY);
// $fields = array('city_id','name as city_name');
// $where_condition_array = array('isactive' => 1,'fk_state_id' => $res['state_id']);
// $cities = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,CITY);
//array_push($result_data[$key],$cities);
$cities = $this->db->DISTINCT()->SELECT('city_id,name as city_name')->FROM(CITY)->WHERE('fk_state_id',$res['state_id'])->OR_WHERE('fk_state_id is null')->ORDER_BY('fk_state_id,city_name')->GET()->result_array();
$result_data[$key]['cities'] = $cities;
//print_r($this->db->last_query());
// $fields = array('pincode_id','pincode');
// $where_condition_array = array('isactive' => 1,'fk_state_id' => $stateid);
@ -645,8 +647,8 @@ class PD_Controller extends REST_Controller {
$OTP = substr($string2,0,6);
$msg = "Code for starting your personal discussions with the verification officer is ".$OTP .". Pls share this only when the officer has reached your place in person";
$no = (string)$pd_details['mobile_no'];
unset($pd_details['mobile_no']);
$pd_details['OTP'] = $OTP;
unset($pd_details['mobile_no']);
$pd_details['OTP'] = $OTP;
$this->aws_sns->sendSMS($msg,$no);
}
@ -726,7 +728,7 @@ class PD_Controller extends REST_Controller {
$dataToBot = array('Task Name'=>'PD Template Assign','Template Catagory'=>'GENERIC TEMPLATE ID - '.$pd_details['pd_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster');
$dataToBot = array('Task Name'=>'PD Template Assign','Template Catagory'=>'GENERIC TEMPLATE ID - '.$pd_details['fk_pd_template_id'] ,'PDID'=> $pd_details['pd_id'],'Method' => 'UpdatePDMaster');
MYHTTPCLIENT::sendPOST($dataToBot);
@ -2280,7 +2282,11 @@ class PD_Controller extends REST_Controller {
$processed_json = GETPROCESSEDJSON::convertNeighbourDetailsForm($records,$formid);
break;
case 20:
$processed_json = $processed_json = GETPROCESSEDJSON::convertFinalRemarksForm($records,$formid);
$processed_json = GETPROCESSEDJSON::convertFinalRemarksForm($records,$formid);
break;
case 21:
$processed_json = GETPROCESSEDJSON::convertBankingInfoDetailsForm($records,$formid);
break;
case 22:
@ -2300,10 +2306,13 @@ class PD_Controller extends REST_Controller {
unset($records['fk_createdby']);
unset($records['company_id']);
$records = json_encode($records);
if($processed_json != null)
{
$processed_json = json_encode($processed_json);
}
$temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => json_encode($processed_json));
$temp_array = array('fk_form_id'=>$formid,'company_id' => $company_id,'fk_pd_id'=>$pdid,'fk_createdby'=>$createdby,'json'=>$records,'processed_json' => $processed_json);
$id = $this->PD_Model->saveRecords($temp_array,PDFORMDETAILSJSON);
if($id != "" || $id != null)
{
@ -3354,57 +3363,31 @@ class PD_Controller extends REST_Controller {
$is_regenerate = 1;
}
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
$data['pd_master_details'] = $this->PD_Model->getPDMasterDetails($pdid);
$data['applicants_details'] = $this->PD_Model->getApplicantsDetails($pdid);
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
//$data['score'] = $this->calculateScore($pdid);
//GET ALL PROCESSED JSON
for($i = 1;$i<=25;$i++)
{
$fields = array('processed_json');
$where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i);
$data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC');
}
//Get PD Report orginal blob
$fields = array('report_template_id', 'fk_template_id','content');
$where_condition_array = array('fk_template_id'=>$pd_master_details[0]['fk_pd_template_id'],'isactive'=>1);
$result_array = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,REPORTTEMPLATES);
$original_template = $result_array[0]['content'];
// //CHeck if already pd original version created
if(count($result_array))
{
preg_match_all("/{{(.*?)}}/",$result_array[0]['content'],$keys_from_template);
//print_r($keys_from_template);
$pd_form_raw_data = $this->PD_Model->getPDFormDetails($pdid);
//print_r($pd_form_raw_data);
foreach($keys_from_template[1] as $key_from_template => $template_key)
{
foreach($pd_form_raw_data as $pd_form_raw_data_key => $pd_form_raw)
{
if($temp_key = array_search($template_key,$pd_form_raw))
{
//echo $pd_form_raw_data[$pd_form_raw_data_key]['column_value'].'---'.$pd_form_raw_data[$pd_form_raw_data_key]['column_name'];
//echo "\n\n";
$result_array[0]['content'] = str_replace($keys_from_template[0][$key_from_template],$pd_form_raw_data[$pd_form_raw_data_key]['column_value'],$result_array[0]['content']);
}
}
}
}
$temp = $this->load->view('report_templates/JSONTOREPORT',$data,true);
//PDF Gen using DOM PDF
$pdf_doc = $this->pdfgenerator->generate($temp, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF
$output_file2 = APPPATH."/docs/sample.pdf";
$bytes = file_put_contents($output_file2, $pdf_doc);
$output_file = APPPATH."/docs/temp.html";
$ifp = fopen( $output_file, 'wb' );
//fwrite( $ifp, $original_template );
fwrite( $ifp, $result_array[0]['content'] );
fclose( $ifp );
//print_r($output_file);
$file= file_get_contents($output_file);
$pdf_doc = $this->pdfgenerator->generate($file, $filename='original_version', $stream=false, $paper = 'A4', $orientation = "portrait");
//print_r($pdf_doc);
$output_file2 = APPPATH."/docs/sample.pdf";
if(file_put_contents($output_file2, $pdf_doc))
{
$bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id'];
$main_applicant_name = $pd_master_details[0]['main_applicant'];
$bucketname = LENDER_BUCKET_NAME_PREFIX.$data['pd_master_details'][0]['fk_lender_id'];
$main_applicant_name = $data['pd_master_details'][0]['main_applicant'];
$key = "";
if($is_regenerate == 0)
{
@ -3412,31 +3395,35 @@ class PD_Controller extends REST_Controller {
}
else
{
$latest_version = $pd_master_details[0]['pd_report_latest_version'] + 1;
$latest_version = $data['pd_master_details'][0]['pd_report_latest_version'] + 1;
$key = 'pd'.$pdid.'/pd_reports/'.$main_applicant_name.'.version'.$latest_version.'.pdf';
}
$sourcefile = $output_file2;
// print_r($sourcefile);
// die();
$bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
$s3result= $this->aws_s3->uploadFileToS3Bucket($bucket_data);
//print_r($s3result);
if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200)
{
//$result_array[0]['content']
$where_condition_array = array("pd_id" => $pdid);
$temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>$result_array[0]['content'],'pd_report_latest_version' => 0);
$temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>null,'pd_report_latest_version' => 0);
if($is_regenerate != 0)
{
$temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>$result_array[0]['content'],'pd_report_latest_version'=>$pd_master_details[0]['pd_report_latest_version'] + 1);
//$result_array[0]['content']
$temp_array = array('is_original_report_created'=>1,'pd_report_latest_version_blob'=>null,'pd_report_latest_version'=>$data['pd_master_details'][0]['pd_report_latest_version'] + 1);
}
$id = $this->PD_Model->updateRecords($temp_array,PDTRIGGER,$where_condition_array);
$latest_version = 0;
if($is_regenerate != 0){ $latest_version = $pd_master_details[0]['pd_report_latest_version'] + 1; }
$blob_table_temp_array = array('version_no' => $latest_version,'content' => $result_array[0]['content'],'fk_pd_id' => $pdid,'fk_createdby' => $fk_createdby);
if($is_regenerate != 0){ $latest_version = $data['pd_master_details'][0]['pd_report_latest_version'] + 1; }
//$result_array[0]['content']
$blob_table_temp_array = array('version_no' => $latest_version,'content' => null,'fk_pd_id' => $pdid,'fk_createdby' => $fk_createdby);
$id = $this->PD_Model->saveRecords($blob_table_temp_array,PDREPORTSVERSIONBLOB);
@ -4114,7 +4101,8 @@ class PD_Controller extends REST_Controller {
$records = $this->post('records');
$pdid = $records['pd_id'];
$fk_createdby = $records['fk_createdby'];
// $this->calculateScore($pdid);
// die();
$is_regenerate = 0;
if(isset($records['regenerate']))
{
@ -4136,13 +4124,13 @@ class PD_Controller extends REST_Controller {
// }
$data['pd_processed_forms'][$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC');
}
print_r($data['pd_processed_forms']);die();
//print_r($data['pd_processed_forms']);die();
// print_r(json_decode($data['pd_processed_forms'][13][0]['processed_json'],true));
// echo count($data['pd_processed_forms'][1]);
// die();
$t = $this->load->view('report_templates/JSONTOREPORT',$data,true);
//print_r($t);die();
//PDF Gen using DOM PDF
$pdf_doc = $this->pdfgenerator->generate($t, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF
@ -4275,6 +4263,7 @@ class PD_Controller extends REST_Controller {
array('form_id' => 22,'form_name' => 'Business Assets'),
array('form_id' => 21,'form_name' => 'Business Banking'),
array('form_id' => 14,'form_name' => 'Financial Information'),
array('form_id' => 16,'form_name' => 'Assessed Income'),
array('form_id' => 1,'form_name' => 'Supplier Details'),
array('form_id' => 2,'form_name' => 'Client Details'),
array('form_id' => 11,'form_name' => 'Stock Details'),
@ -4288,6 +4277,7 @@ class PD_Controller extends REST_Controller {
array('form_id' => 13,'form_name' => 'About Business'),
array('form_id' => 22,'form_name' => 'Business Assets'),
array('form_id' => 21,'form_name' => 'Business Banking'),
array('form_id' => 14,'form_name' => 'Financial Information'),
array('form_id' => 16,'form_name' => 'Assessed Income'),
array('form_id' => 1,'form_name' => 'Supplier Details'),
array('form_id' => 2,'form_name' => 'Client Details'),
@ -4627,6 +4617,8 @@ class PD_Controller extends REST_Controller {
{
foreach($json['business_assets_details'] as $asset_key => $business_asset)
{
//print_r($business_asset);
if(!strcmp($business_asset['business_emi'],'yes'))
{
$business_assets_mode_name = "";
@ -4651,7 +4643,7 @@ class PD_Controller extends REST_Controller {
}
}
$business_assest_data[] = array('business_assets_mode'=>$business_asset['business_assets_mode'],'business_assets_mode_name'=>$business_assets_mode_name,'business_details'=>$business_asset['business_details'],'business_name_of_the_owner'=>$business_asset['business_name_of_the_owner']['name']);
$business_assest_data[] = array('business_assets_mode'=>$business_asset['business_assets_mode'],'business_assets_mode_name'=>$business_assets_mode_name,'business_details'=>$business_asset['business_details'],'business_name_of_the_owner'=>$business_asset['business_name_of_the_owner']);
}
}
@ -5053,4 +5045,325 @@ class PD_Controller extends REST_Controller {
return $result;
}
public function calculateScore($pdid)
{
//GET JSON FORM DATA
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
//print_r($pd_master_details);
$form_data = $this->PD_Model->getScorablePDFormDetailsJSON($pdid);
//print_r($form_data);
//seperate PD Scorable quesitons from JSON
$score_questions = $this->seperateScoreQuestions($form_data,$pd_master_details[0]['is_otp_done']);
//Get Pesrsonal Assets Grid Masters Details
$this->db->SELECT('*');
$this->db->FROM(PERSONALASSETGRID);
$this->db->WHERE('isactive',1);
$this->db->WHERE('loan_amount_from<',$pd_master_details[0]['loan_amount']);
$this->db->WHERE('loan_amount_to>',$pd_master_details[0]['loan_amount']);
$personal_asset_grid['master_grid'] = $this->db->GET()->result_array();
$this->db->SELECT('*');
$this->db->FROM(PERSONALASSETGRIDVARIANCE);
$this->db->WHERE('isactive',1);
$personal_asset_grid['variance_grid'] = $this->db->GET()->result_array();
// Call PD score functions
$combination = $pd_master_details[0]['fk_lender_id'].$pd_master_details[0]['fk_product_id'].$pd_master_details[0]['fk_customer_segment'];
switch($combination)
{
case 1111:
PDSCORE::calculatePDScore111($score_questions,$pd_master_details,$personal_asset_grid);
break;
default:
switch($pd_master_details[0]['fk_customer_segment'])
{
case 1:
PDSCORE::genericDI($score_questions,$pd_master_details,$personal_asset_grid);
break;
}
}
}
//Get All Scorable Question from various PD Forms - 3 Questions Pending
public function seperateScoreQuestions($form_data,$OTP)
{
$score_questions = array();
#####General Form Questions########
$general_form = (json_decode($form_data[18][0]['processed_json'],true));
//print_r($form_data);
// - QNO (1.7) OTP AUTHENDICATION DONE
$score_questions['general']['otp_done'] = $OTP ? 'Yes': 'No';
// 1 - QNO(1.1) - Is Person Met, One Of the Applicant's
$qualification_temp_array = array();
foreach($general_form['individuals'] as $person)
{
array_merge($qualification_temp_array,array($person['qualification']));
if($person['is_applicant'] == true && $person['is_person_met'] == true)
{
$score_questions['general']['person_met_is_applicant'] = 'yes';
}
}
$min = count($qualification_temp_array) ? min($qualification_temp_array) : 6;
// 2 - QNO(1.8) - Qualification
$score_questions['general']['qualification'] = $min;
// 3 - QNO(2.1) - No of Years Business Run
if(array_key_exists('companies',$general_form))
{
$score_questions['business']['no_of_years_business_run'] = $general_form['companies'][0]['business_years'];
}
#####End of General Form Questions########
#####Address Form Questions########
$address_form = (json_decode($form_data[5][0]['processed_json'],true));
// 4 - QNO(1.2) - Comment on locality
$score_questions['general']['comment_locality'] = $address_form['comment_locality_master'];
// 5 - QNO(1.3) - pd location approach
$score_questions['general']['pd_location_approach'] = $address_form['pd_location_master'];
#####ENd Of Address Form Questions########
#####Final Remarks Form Questions########
$final_remarks_form = (json_decode($form_data[20][0]['processed_json'],true));
//print_r($final_remarks_form);
// 6 - QNO(1.4) - customer behaviour
$score_questions['general']['customer_behaviour'] = $final_remarks_form['final_custormer_remark_type_master'];
// 7 - QNO(3.1) - pd_officer_recommadations
$score_questions['final_remarks']['pd_officer_recommandations'] = $final_remarks_form['pd_officers_recommendation_master'];
// 8 - QNO(2.11) - pd location approach
$score_questions['business']['location_suited_for_busienss'] = $final_remarks_form['is_service_provided'];
#####End of Final Remarks Form Questions########
#####Neighbourhood Form Questions########
$neighbourhood_form = (json_decode($form_data[19][0]['processed_json'],true));
//print_r($neighbourhood_form);
// 9 - QNO(1.5) - neibourhood_check_as_per_pd_officer
$score_questions['general']['neibourhood_check_as_per_pd_officer'] = isset($neighbourhood_form['neighbourhood_status']) ? $neighbourhood_form['neighbourhood_status'] : 'Negative';
#####End of Neighbourhood Form Questions########
#####Business Form Questions########
$business_form = (json_decode($form_data[13][0]['processed_json'],true));
//print_r($business_form);
// 10 - QNO(1.6) - was_the_company_name_board_sighted
$score_questions['general']['was_the_company_name_board_sighted'] = isset($business_form['was_the_company_name_board_sighted']) ? $business_form['was_the_company_name_board_sighted'] : 'No';
// 11 - QNO(2.2) - seasonality
$score_questions['business']['business_seasonality'] = $business_form['seasonality'];
// 12 - QNO(2.3) - employees_total
$score_questions['business']['employees_total'] = $business_form['employees_total'];
// 13 - QNO(2.4) - all business certificate
$temp = array();
$temp['shop_eat_act_cert'] = $business_form['shop_eat_act_cert'];
$temp['gst_Regn_cert'] = $business_form['gst_Regn_cert'];
$temp['pf_regn'] = $business_form['pf_regn'];
$temp['esic_regn'] = $business_form['esic_regn'];
$temp['export_import_cert'] = $business_form['export_import_cert'];
$temp['factory_cert'] = $business_form['factory_cert'];
$temp['cert_of_practice'] = isset($business_form['cert_of_practice']) ? $business_form['cert_of_practice']: 'not applicable';
$score_questions['business']['cerificates'] = $temp;
#####End of Business Form Questions########
#####Business Assets Form Questions########
$business_assest_form = (json_decode($form_data[22][1]['processed_json'],true));
//print_r($business_assest_form);die();
if(array_key_exists('business_assets_details',$business_assest_form))
{
$property_count = 0;
$vechile_count = 0;
foreach($business_assest_form['business_assets_details'] as $value)
{
if($value['business_assets_mode'] == 2)
{
$property_count++;
}
if($value['business_assets_mode'] == 3)
{
$vechile_count++;
}
}
// 14 - QNO(2.5) - owned_property
$score_questions['business']['owned_property'] = $property_count ? 'yes':'no';
// 15 - QNO(2.6) - owned_vechile
$score_questions['business']['owned_vechile'] = $vechile_count ? 'yes':'no';
// - QNO (2.12) - business_activity seen
$score_questions['business']['business_activity_has_seen'] = $business_assest_form['business_activity'];
}
#####End of Business Assets Form Questions########
#####supplier Form Questions########
$supplier_form = (json_decode($form_data[1][0]['processed_json'],true));
//print_r($supplier_form);
if(count($supplier_form))
{
$supplier_count = 0;
if(array_key_exists('manufacturing_details',$supplier_form))
{
foreach($supplier_form['manufacturing_details'] as $manufacturing_details)
{
$supplier_count = count($manufacturing_details['main_raw_materials']) ? ++$supplier_count: $supplier_count;
}
}
if(array_key_exists('trade_details',$supplier_form))
{
foreach($supplier_form['trade_details'] as $trade_details)
{
$supplier_count = count($supplier_form['trade_details']) ? ++$supplier_count: $supplier_count;
}
}
// 16 - QNO(2.7) - atleast one supplier
$score_questions['business']['minimum_supplier_info'] = $supplier_count ? 'Provided':'Not Provided';
}
else
{
$score_questions['business']['minimum_supplier_info'] = 'Not Applicable';
}
#####End of supplier Form Questions########
#####client Form Questions########
$client_form = (json_decode($form_data[2][0]['processed_json'],true));
//print_r($client_form);die();
if(count($client_form))
{
$client_count = 0;
if(array_key_exists('manufacturing_details',$client_form))
{
foreach($client_form['manufacturing_details'] as $manufacturing_details)
{
$client_count = count($manufacturing_details['main_raw_materials']) ? ++$client_count: $client_count;
}
}
if(array_key_exists('trade_details',$client_form))
{
foreach($client_form['trade_details'] as $trade_details)
{
$client_count = count($client_form['trade_details']) ? ++$client_count: $client_count;
}
}
if(array_key_exists('service_provider_details',$client_form))
{
foreach($client_form['service_provider_details'] as $service_provider_details)
{
$client_count = count($client_form['service_provider_details']) ? ++$client_count: $client_count;
}
}
// 17 - QNO(2.8) - atleast one client
$score_questions['business']['minimum_client_info'] = $client_count ? 'Provided':'Not Provided';
}
else
{
$score_questions['business']['minimum_client_info'] = 'Not Applicable';
}
#####End of client Form Questions########
#####Stock Form Questions########
$stock_form = (json_decode($form_data[11][0]['processed_json'],true));
//print_r($stock_form);
if(count($stock_form))
{
//print_r($stock_form);die();
$score_questions['business']['stock_raw_material_enough'] = isset($stock_form['manufacturing_raw_materials']['is_sufficiant_raw']) ? $stock_form['manufacturing_raw_materials']['is_sufficiant_raw']: 'no';
$score_questions['business']['stock_finished_goods_enough'] = isset($stock_form['is_sufficiant_finished_and_traded_goods']) ? $stock_form['is_sufficiant_finished_and_traded_goods'] : 'no';
}
else
{
$score_questions['general']['value_of_other_assets'] = 'Not Applicable';
}
#####End of Stock Form Questions########
#####Other Assest Form Questions########
$other_asset_form = (json_decode($form_data[4][0]['processed_json'],true));
//print_r($other_asset_form);
$over_all_asset_value = 0;
if(array_key_exists('assets_details',$other_asset_form))
{
foreach($other_asset_form['assets_details'] as $asset)
{
$over_all_asset_value += $asset['approximate_market_value'] ;
}
}
// 18 Q.NO(1.9)
$score_questions['general']['value_of_other_assets'] = $over_all_asset_value;
#####End of Other Assest Form Questions########
######Business Banking ##############
$business_bank_form = (json_decode($form_data[21][0]['processed_json'],true));
//print_r($business_bank_form);
$vintage = array();
if(array_key_exists('banking_details',$business_bank_form))
{
foreach($business_bank_form['banking_details'] as $banking)
{
$year = $banking['vintage_year'] ? $banking['vintage_year'] : 0 ;
$month = $banking['vintage_month'] ? $banking['vintage_month'] : 0;
$temp = $year.'.'.$month;
$vintage = array_merge($vintage,array($temp));
}
}
$score_questions['business']['vintage_of_business_account'] = count($vintage)? max($vintage) : 0;
######End of Business Banking ##############
return $score_questions;
}
}

Binary file not shown.

View File

@ -0,0 +1,191 @@
<?php
class Assetsform
{
// other asset details
public static function getOthersAssetsDetails($values){
$mergeResult=array();
foreach($values as $fetchVal){
$storeValue=array();
$storeValue['assets_mode'] = $fetchVal['assets_mode'];
$storeValue['name_of_the_owner'] = $fetchVal['name_of_the_owner']['id']==0 ? $fetchVal['other_owner'] : $fetchVal['name_of_the_owner']['name'];
// this is for investments type
if($fetchVal['assets_mode']==7){
$storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['approximate_market_value'];
switch($fetchVal['details'][0]['investments_type']) {
case 1:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['other_investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
break;
case 2:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
break;
case 3:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
break;
case 4:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
break;
case 5:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
break;
case 6:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
break;
default:
$storeValue['about_assets'] = ' Invested in '.$fetchVal['details'][0]['investments_type'].' with '.$fetchVal['details'][0]['bank_name'];
}
}
// this is for life insurance
else if($fetchVal['assets_mode']==6){
$storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['details'][0]['sum_assured'];
switch($fetchVal['details'][0]['frequency_mode']) {
case 1:
$storeValue['about_assets'] = $fetchVal['details'][0]['other_frequency_mode'].' premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
break;
case 2:
$storeValue['about_assets'] ='Annualy premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
break;
case 3:
$storeValue['about_assets'] ='Halfyearly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
break;
case 4:
$storeValue['about_assets'] ='Fortnightly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
break;
case 5:
$storeValue['about_assets'] ='Daily premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
break;
case 6:
$storeValue['about_assets'] ='Quarterly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
break;
case 7:
$storeValue['about_assets'] ='Monthly premium of Rs.'.$fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
break;
default:
$setFrequencyType = $fetchVal['details'][0]['premium_paid'].' covering '.$fetchVal['details'][0]['members_coverd'];
}
}
// this is machinaries
else if($fetchVal['assets_mode']==4){
$storeValue['approximate_market_value'] = '';
$storeValue['about_assets'] = $fetchVal['details'][0]['equipment_manufacturing_description'];
}
// this is for vehicle
else if($fetchVal['assets_mode']==3){
$storeValue['approximate_market_value'] = '';
$storeValue['about_assets'] = $fetchVal['details'][0]['manufacturer_model_vehicle'].' purchased in '. $fetchVal['purchase_year'];
}
// this property
else if($fetchVal['assets_mode']==2){
$storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['approximate_market_value'];
$storeValue['about_assets'] = $fetchVal['details'][0]['property_type']==1 ? $fetchVal['details'][0]['other_property_type'].' purchased in '. $fetchVal['purchase_year'] : $fetchVal['details'][0]['property_type'].' purchased in '. $fetchVal['purchase_year'];
}
//this is for other
else if($fetchVal['assets_mode']==1){
$storeValue['approximate_market_value'] = 'Rs.'.$fetchVal['details'][0]['any_other_asset_value'];
$storeValue['about_assets'] = $fetchVal['details'][0]['any_other_assets'].' purchased in '. $fetchVal['purchase_year'];
}
array_push($mergeResult,$storeValue);
}
return $mergeResult;
}
// business asset details
public static function getBusinessAssetsDetails($values){
$mergeResult=array();
foreach($values as $fetchVal){
$storeValue=array();
$storeValue['business_assets_mode'] = $fetchVal['business_assets_mode_master'];
// this is machinaries
if($fetchVal['business_assets_mode']==4){
switch(strtoupper($fetchVal['business_ownership_type'])) {
case 'RENTED':
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['equipment_manufacturing_description'].' rented at Rs.'.$fetchVal['business_monthly_rented_amt'];
$storeValue['business_approximate_market_value'] = '';
break;
case 'OWNED':
$storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner']['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner']['name'];
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['equipment_manufacturing_description'].' purchased in '.$fetchVal['business_purchase_year'];
$storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value'];
break;
default:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
// this is for vehicle
else if($fetchVal['business_assets_mode']==3){
switch(strtoupper($fetchVal['business_ownership_type'])) {
case 'RENTED':
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['manufacturer_model_vehicle'].' rented at Rs.'.$fetchVal['business_monthly_rented_amt'];
$storeValue['business_approximate_market_value'] = '';
break;
case 'OWNED':
$storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner']['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner']['name'];
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['manufacturer_model_vehicle'].' purchased in '. $fetchVal['business_purchase_year'];
$storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value'];
break;
default:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
// this property
else if($fetchVal['business_assets_mode']==2){
switch(strtoupper($fetchVal['business_ownership_type'])) {
case 'RENTED':
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type'].' rented at Rs.'. $fetchVal['business_monthly_rented_amt'] : $fetchVal['business_details'][0]['property_type'].' rented at Rs.'. $fetchVal['business_monthly_rented_amt'];
$storeValue['business_approximate_market_value'] = '';
break;
case 'OWNED':
$storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner']['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner']['name'];
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['property_type']==1 ? $fetchVal['business_details'][0]['other_property_type'].' purchased in '. $fetchVal['business_purchase_year'] : $fetchVal['business_details'][0]['property_type'].' purchased in '. $fetchVal['business_purchase_year'];
$storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value'];
break;
default:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
//this is for other
else if($fetchVal['business_assets_mode']==1){
switch(strtoupper($fetchVal['business_ownership_type'])) {
case 'RENTED':
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['any_other_assets'].' rented at Rs.'. $fetchVal['business_monthly_rented_amt'];
$storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_details'][0]['any_other_asset_value'];
break;
case 'OWNED':
$storeValue['business_name_of_the_owner'] = $fetchVal['business_name_of_the_owner']['id']==0 ? $fetchVal['business_name_of_the_other_owner'] : $fetchVal['business_name_of_the_owner']['name'];
$storeValue['about_business_assets'] = $fetchVal['business_details'][0]['any_other_assets'].' purchased in '. $fetchVal['business_purchase_year'].' at Rs.'.$fetchVal['business_details'][0]['any_other_asset_value'];
$storeValue['business_approximate_market_value'] = 'Rs.'.$fetchVal['business_approximate_market_value'];
break;
default:
$storeValue['business_name_of_the_owner'] = '';
$storeValue['about_business_assets'] = '';
$storeValue['business_approximate_market_value'] = '';
}
}
array_push($mergeResult,$storeValue);
}
return $mergeResult;
}
}
?>

View File

@ -0,0 +1,49 @@
<?php
class Bankingform
{
//get business Banking
public static function getBusinessBankingDetails($values){
if(count($values)>0){
$values = array_map(function($tag) {
$count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :"";
$count_vintage .= ($tag['vintage_year'] == 1) ? " Year" : (($tag['vintage_year'] > 1) ? " Years" : "");
$count_vintage.=' ';
$count_vintage .=$tag['vintage_month'] >0 ? $tag['vintage_month'] : "";
$count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : "");
return array(
'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : $tag['applicant_name']['name'],
'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name'],
'account_type' => $tag['account_type'],
'main_business' => $tag['salary'],
'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : ''),
'vintage' => $count_vintage,
);
}, $values);
}
return $values;
}
// get individual banking
public static function getIndividualBankingDetails($values){
if(count($values)>0){
$values = array_map(function($tag) {
$count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :"";
$count_vintage .= ($tag['vintage_year'] == 1) ? " Year" : (($tag['vintage_year'] > 1) ? " Years" : "");
$count_vintage.=' ';
$count_vintage .=$tag['vintage_month'] >0 ? $tag['vintage_month'] : "";
$count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : "");
return array(
'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : $tag['applicant_name']['name'],
'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name'],
'account_type' => $tag['account_type'],
'main_business' => $tag['salary'],
'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : ''),
'vintage' => $count_vintage,
);
}, $values);
}
return $values;
}
}
?>

View File

@ -0,0 +1,426 @@
<?php
class Businessform
{
//get partner details
public static function getPartnerDetails($values){
$getPartner=array();
foreach($values as $parRow){
$getPartner = array_map(function($tag) {
$con_business_run = $tag['current_business_experiance_year'] >0 ? $tag['current_business_experiance_year'] :"";
$con_business_run .= ($tag['current_business_experiance_year'] == 1) ? "Year" : (($tag['current_business_experiance_year'] > 1) ? "Years" : "");
$con_business_run.=' ';
$con_business_run .=$tag['current_business_experiance_month'] >0 ? $tag['current_business_experiance_month'] : "";
$con_business_run .=($tag['current_business_experiance_month'] == 1) ? "Month" : (($tag['current_business_experiance_month'] > 1) ? "Months" : "");
return array(
'name' => array_key_exists('partner_other_name',$tag) ? $tag['partner_other_name'] : $tag['partner_name_master'],
'share_holding' => $tag['shareholding'].'%',
'no_years_business' => $con_business_run,
'total_experience' => $tag['total_business_experiance'],
'previous_experience' => array_key_exists('total_business_previous_experience',$tag) ? $tag['total_business_previous_experience'] : '',
);
}, $values);
}
return $getPartner;
}
//get family members details
public static function getFamilyMemberDetails($values){
$getFamilyMembers=array();
foreach($values as $parRow){
$getFamilyMembers = array_map(function($tag) {
return array(
'name' => $tag['family_member_salutation_master'].' '.$tag['family_member_name'],
'relation' => $tag['other_family_relationship_id_master'] .' of '.$tag['relation_to_id_master'],
'designation' => $tag['relationship_with_company_id_master'],
'started_business' => $tag['started_business'],
);
}, $values);
}
return $getFamilyMembers;
}
// get business activity details
public static function getActivityDetails($values,$type){
$getRow=array();
if($type==1 || $type==2 || $type==3){
foreach($values as $busManuRowkey=>$busManuRow){
$getEachProducts=array();
$getEachProducts['products']=$busManuRow['main_products'];
$getEachProducts['area_of_sale']=$busManuRow['area_of_sale'];
// check area of sales
$mergeStatesCities='';
if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='NO'){
// states
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
$mergeStatesCities=$mergeStatesCities;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
$mergeStatesCities = $mergeStatesCities;
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
$mergeStatesCities .=$childCityRow;
}
$mergeStatesCities .=' of ';
$mergeStatesCities .=$childRow['state_name'];
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
}
$getEachProducts['sales_done']=$mergeStatesCities;
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
//$mergeMaxStatesCities .=' of ';
//$mergeMaxStatesCities .=$childMRow['state_name'];
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
// area of sales with yes options
else if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='YES'){
// pan india
$getEachProducts['sales_done']='Pan India.';
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
if(!empty($childMRow['state_name'])){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
}
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
// check area of sale export
else if(strtoupper($busManuRow['area_of_sale'])=='EXPORT'){
$mergeMaxStatesCities='';
// countries_where_export_done
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
$mergeStatesCities=$mergeStatesCities;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
$mergeStatesCities .=' '.$childRow['approx_sale'];
$mergeStatesCities .='% sales done in ';
$mergeStatesCities .=$childRow['country_name'];
//$mergeStatesCities .= ($chilKey==count($busManuRow['countries_where_export_done'])-1 ? "." : "");
}
$mergeStatesCities.='.';
$getEachProducts['sales_done']=$mergeStatesCities;
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
// check area of sale both
else if(strtoupper($busManuRow['area_of_sale'])=='BOTH'){
//print_r($busManuRow);die();
if(strtoupper($busManuRow['pan_india_options'])=='NO'){
// states
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
$mergeStatesCities=$mergeStatesCities;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
$mergeStatesCities = $mergeStatesCities;
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
$mergeStatesCities .=$childCityRow;
}
$mergeStatesCities .=' of ';
$mergeStatesCities .=$childRow['state_name'];
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
}
$getEachProducts['sales_done']=$mergeStatesCities;
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
//$mergeMaxStatesCities .=' of ';
//$mergeMaxStatesCities .=$childMRow['state_name'];
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
else if(strtoupper($busManuRow['pan_india_options'])=='YES'){
// pan india
$getEachProducts['sales_done']='Pan India.';
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
if(!empty($childMRow['state_name'])){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
}
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
else{
$getEachProducts['sales_done']="";
$getEachProducts['max_sales_done']="";
}
// countries_where_export_done
if(array_key_exists('countries_where_export_done',$busManuRow)){
$mergeBothStates='';
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
$mergeBothStates=$mergeBothStates;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
$mergeBothStates .=' '.$childRow['approx_sale'];
$mergeBothStates .='% sales done in ';
$mergeBothStates .=$childRow['country_name'];
}
$mergeBothStates.='.';
$getEachProducts['both_sales_done']=$mergeBothStates;
}
}
array_push($getRow,$getEachProducts);
}
}
else if($type==4) {
foreach($values as $busManuRowkey=>$busManuRow){
$getEachProducts=array();
$getEachProducts['products']=$busManuRow['main_products'];
$getEachProducts['area_of_sale']=$busManuRow['area_of_sale'];
// check area of sales
$mergeStatesCities='';
if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='NO'){
// states
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
$mergeStatesCities=$mergeStatesCities;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
$mergeStatesCities = $mergeStatesCities;
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
$mergeStatesCities .=$childCityRow;
}
$mergeStatesCities .=' of ';
$mergeStatesCities .=$childRow['state_name'];
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
}
$getEachProducts['sales_done']=$mergeStatesCities;
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
//$mergeMaxStatesCities .=' of ';
//$mergeMaxStatesCities .=$childMRow['state_name'];
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
// area of sales with yes options
else if(strtoupper($busManuRow['area_of_sale'])=='WITHIN INDIA' && strtoupper($busManuRow['pan_india_options'])=='YES'){
// pan india
$getEachProducts['sales_done']='Pan India.';
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
if(!empty($childMRow['state_name'])){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
}
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
// check area of sale export
else if(strtoupper($busManuRow['area_of_sale'])=='EXPORT'){
$mergeMaxStatesCities='';
// countries_where_export_done
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
$mergeStatesCities=$mergeStatesCities;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
$mergeStatesCities .=' '.$childRow['approx_sale'];
$mergeStatesCities .='% revenue from ';
$mergeStatesCities .=$childRow['country_name'];
//$mergeStatesCities .= ($chilKey==count($busManuRow['countries_where_export_done'])-1 ? "." : "");
}
$mergeStatesCities.='.';
$getEachProducts['sales_done']=$mergeStatesCities;
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
// check area of sale both
else if(strtoupper($busManuRow['area_of_sale'])=='BOTH'){
//print_r($busManuRow);die();
if(strtoupper($busManuRow['pan_india_options'])=='NO'){
// states
foreach($busManuRow['india_where_sale_done'] as $chilKey=>$childRow){
$mergeStatesCities=$mergeStatesCities;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['india_where_sale_done'])-1 ? ' and ' : ",");
foreach($childRow['city_name'] as $chilCityKey=>$childCityRow){
$mergeStatesCities = $mergeStatesCities;
$mergeStatesCities .= ($chilCityKey==0) ? "":($chilCityKey==count($childRow['city_name'])-1 ? ' and ' : ",");
$mergeStatesCities .=$childCityRow;
}
$mergeStatesCities .=' of ';
$mergeStatesCities .=$childRow['state_name'];
$mergeStatesCities .= ($chilKey==count($busManuRow['india_where_sale_done'])-1 ? "." : "");
}
$getEachProducts['sales_done']=$mergeStatesCities;
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? ' and ' : ",");
foreach($childMRow['city_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['city_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
//$mergeMaxStatesCities .=' of ';
//$mergeMaxStatesCities .=$childMRow['state_name'];
//$mergeMaxStatesCities .= ($chilMKey==count($busManuRow['max_sale_state_name'])-1 ? "." : "");
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
else if(strtoupper($busManuRow['pan_india_options'])=='YES'){
// pan india
$getEachProducts['sales_done']='Pan India.';
// max sales done
$mergeMaxStatesCities='';
foreach($busManuRow['max_sale_state_name'] as $chilMKey=>$childMRow){
if(!empty($childMRow['state_name'])){
$mergeMaxStatesCities=$mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMKey==0) ? "":($chilMKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
foreach($childMRow['state_name'] as $chilMCityKey=>$childMCityRow){
$mergeMaxStatesCities = $mergeMaxStatesCities;
$mergeMaxStatesCities .= ($chilMCityKey==0) ? "":($chilMCityKey==count($childMRow['state_name'])-1 ? ' and ' : ",");
$mergeMaxStatesCities .=$childMCityRow;
}
}
}
$mergeMaxStatesCities.='.';
$getEachProducts['max_sales_done']=$mergeMaxStatesCities;
}
else{
$getEachProducts['sales_done']="";
$getEachProducts['max_sales_done']="";
}
// countries_where_export_done
if(array_key_exists('countries_where_export_done',$busManuRow)){
$mergeBothStates='';
foreach($busManuRow['countries_where_export_done'] as $chilKey=>$childRow){
$mergeBothStates=$mergeBothStates;
$mergeStatesCities .= ($chilKey==0) ? "":($chilKey==count($busManuRow['countries_where_export_done'])-1 ? ' and ' : ",");
$mergeBothStates .=' '.$childRow['approx_sale'];
$mergeBothStates .='% revenue from ';
$mergeBothStates .=$childRow['country_name'];
}
$mergeBothStates.='.';
$getEachProducts['both_sales_done']=$mergeBothStates;
}
}
array_push($getRow,$getEachProducts);
}
}
else if($type==5){
foreach($values as $busManuRowkey=>$busManuRow){
$getEachProducts=array();
$getEachProducts['products']=$busManuRow['others_details'];
array_push($getRow,$getEachProducts);
}
}
return $getRow;
}
// get business peak period details
public static function getBusinessPeakDetails($details){
$getRow='The Business has major changes,';
$getRow.= count($details) >1 ?' the periods of ' :' the period of ';
foreach($details as $key=>$value){
$getRow=$getRow;
$getRow .= ($key==0) ? "":($key==count($details)-1 ? ' and ' : ",");
switch($value) {
case 1:
$getRow .='February';
break;
case 2:
$getRow .='January';
break;
case 3:
$getRow .='March';
break;
case 4:
$getRow .='April';
break;
case 5:
$getRow .='May';
break;
case 6:
$getRow .='June';
break;
case 7:
$getRow .='July';
break;
case 8:
$getRow .='August';
break;
case 9:
$getRow .='September';
break;
case 10:
$getRow .='October';
break;
case 11:
$getRow .='November';
break;
case 12:
$getRow .='December';
break;
}
}
$getRow .=' maximum sales/services done.';
return $getRow;
}
}
?>

View File

@ -0,0 +1,113 @@
<?php
class Financialform
{
//other loan obligations
public static function getOtherLoanDetails($values){
$values = array_map(function($tag) {
$setFrequencyType='';
switch($tag['frequency']) {
case 1:
$setFrequencyType = ' per '.$tag['other_frequency'];
break;
case 2:
$setFrequencyType = ' per annum';
break;
case 3:
$setFrequencyType = ' per halfyearly';
break;
case 4:
$setFrequencyType = ' per fortnightly';
break;
case 5:
$setFrequencyType = ' per daily';
break;
case 6:
$setFrequencyType = ' per quarterly';
break;
case 7:
$setFrequencyType = ' per month';
break;
default:
$setFrequencyType = ' per';
}
$loanTaken=$tag['loan_taken_by'];
return array(
'loan_type' => $tag['loan_type']==1 ? $tag['others_loan_type'] : $tag['loan_type_master'],
'loan_amount' => $tag['loan_amount'],
'frequency' => $tag['frequency']==1 ? $tag['other_frequency'] : $tag['frequency_master'],
'lender' => $tag['lender']==1 ? $tag['others_lender'] : $tag['lender_master'],
'original_tenure' => $tag['original_tenure'],
'current_balance_tenure' => $tag['current_balance_tenure'],
'elapsed_tenure' => $tag['elapsed_tenure'],
'emi' => $tag['emi'].$setFrequencyType,
'loan_taken_by' => $loanTaken['id']==0 ? $tag['others_loan_taken'] : $loanTaken['name'],
);
}, $values);
return $values;
}
// business financial details
public static function getBusinessFinancialDetails($values){
$values = array_map(function($tag) {
return array(
'financial_year' => $tag['financial_year'],
'financial_annual_sale' => 'Rs.'.$tag['financial_annual_sale'],
'financial_net_profit' => $tag['finanical_profit_or_loss']==1 ? 'Rs.'.$tag['financial_net_profit'] : '',
'financial_margin_of_profit' => $tag['finanical_profit_or_loss']==1 ? $tag['financial_margin_of_profit'] : '',
'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? 'Rs.'.$tag['financial_net_loss'] : '',
'financial_margin_of_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_margin_of_loss'] : '',
'profit_variation' => $tag['financial_variation'],
'sale_variation' => $tag['financial_profit_to_sale_variation'],
);
}, $values);
return $values;
}
// get customer financial
public static function getBusinessCustomerFinancialDetails($values) {
$values = array_map(function($tag) {
if($tag['estimate_profit_or_loss']==1){
return array(
'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'],
'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'],
'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')',
'estimate_sales_to' => 'Rs.'.$tag['estimate_sales_to'],
'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'],
'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_profit_margin'] : 'Rs.'.$tag['estimate_net_profit'],
'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_profit_from'].', Rs.'.$tag['estimate_net_profit_to'].')' : '',
'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_profit_percent'] : $tag['estimate_profit_margin_percent'],
'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '( '.$tag['estimate_profit_range_from'].', '.$tag['estimate_profit_range_to'].')',
);
}
else if($tag['estimate_profit_or_loss']==2){
return array(
'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'],
'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'],
'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')',
'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'],
'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_net_loss'] : 'Rs.'.$tag['estimate_loss_margin'],
'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_loss_from'].', Rs.'.$tag['estimate_net_loss_to'].')' : '',
'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_loss_percent'] : $tag['estimate_loss_margin_percent'],
'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '('.$tag['estimate_loss_range_from'].', '.$tag['estimate_loss_range_to'].')',
);
}
}, $values);
return $values;
}
// get customer header
public static function getBusinessCustomerHeader($values){
if(count($values)>0 && $values[0]['estimate_profit_or_loss']==1){
return array("Sales","Net Profit","Net Margin %");
}
else if(count($values)>0 && $values[0]['estimate_profit_or_loss']==2){
return array("Sales","Net Loss","Net Margin %");
}
else {
return array();
}
}
}
?>

View File

@ -1857,6 +1857,8 @@ class GETPROCESSEDJSON
/*****************########## FINAL REMARKS FORM DETAILS ##########**************/
public static function convertFinalRemarksForm($raw_json,$formid)
{
echo "FEPJ called";
$CI =& get_instance();
$master_tables_field_names = $CI->config->item('master_tables_field_names');
$master_tables_pkid = $CI->config->item('master_tables_pkid');

View File

@ -56,17 +56,37 @@ class MYUITIL
}
public static function findCompanyName($array,$companyid)
public static function findCompanyName($array,$companyid,$type)
{
if($array != null)
if($array != null && $type==1)
{
foreach($array as $key => $value)
{
if($companyid == $value['company_order_id'])
{
return $value['company_name'];
}
}
}
if($array != null && $type==2)
{
foreach($array as $key => $value)
{
//print_r($value);die();
// echo date("d-m-Y", strtotime($value['business_date_object']) );
// die();
if($companyid == $value['company_order_id'])
{
$getSentense = $value['company_name'];
$getSentense .=' is a ';
$getSentense .=$value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master'];
$getSentense .=' ,formed on ';
$getSentense .=$value['business_date_object'] ? date("d-m-Y", strtotime($value['business_date_object'])) : '';
$getSentense .='.';
return $getSentense;
//return $value['company_name'].' is a '.$value['business_entity_type']==1 ? $value['business_entity_type_other'] : $value['business_entity_type_master'] .' formed on '.date("d-m-Y", strtotime($value['business_date_object']));
}
}
}
else

View File

@ -0,0 +1,78 @@
<?php
class Neighbourreferencecheckform
{
public static function getNeighbourhoodDetails($values,$pdMasterValue){
$applicantName=$pdMasterValue['main_applicant'];
$values = array_map(function($tag) use ($applicantName) {
$makeSentense='Neighbour ';
$makeSentense.= $tag['neighbourhood_name'];
$makeSentense.=" was met and he/she confirmed that he/she ";
if(strtoupper($tag['do_know'])=='YES'){
$makeSentense.="knows ".$applicantName.' since ';
$makeSentense.= ($tag['how_long_do_know_in_year'] == 1) ? $tag['how_long_do_know_in_year']." year" : (($tag['how_long_do_know_in_year'] > 1) ? $tag['how_long_do_know_in_year']." years" : "");
$makeSentense.=' and he/she is ';
$makeSentense.=(strtoupper($tag['is_applicant_owner']) == 'YES') ? "owner of the business." : ((strtoupper($tag['is_applicant_owner']) == 'NO') ? "not owner of the business." : "");
}
else if(strtoupper($tag['do_know'])=='NO'){
$makeSentense.="does not know ".$applicantName.'.';
}
return $makeSentense;
}, $values);
return $values;
}
public static function getReferenceDetails($values,$pdMasterValue) {
$applicantName=$pdMasterValue['main_applicant'];
$values = array_map(function($tag) use ($applicantName) {
$makeSentense=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : "");
$makeSentense.= ' '.$tag['reference_name'].' of SineEdge was contacted over phone at ';
$makeSentense.=$tag['mobile'].'. ';
$makeSentense.='He is related to this business since last ';
$makeSentense.=($tag['year_relation_applicant'] == 1) ? $tag['year_relation_applicant']." year" : (($tag['year_relation_applicant'] > 1) ? $tag['year_relation_applicant']." years" : "");
$makeSentense.=" is doing a business of Rs.".$tag['business_volume_amount'];
switch($tag['business_volume_unit']) {
case 1:
$makeSentense .= ' per '.$tag['others_unit'].'.';
break;
case 2:
$makeSentense .= ' per annum.';
break;
case 3:
$makeSentense .= ' per halfyearly.';
break;
case 4:
$makeSentense .= ' per fortnightly.';
break;
case 5:
$makeSentense .= ' per daily.';
break;
case 6:
$makeSentense .= ' per quarterly.';
break;
case 7:
$makeSentense .= ' per month.';
break;
default:
$makeSentense .= '. ';
}
if($tag['reference_final_remarks']==3){
$makeSentense .=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : "");
$makeSentense .=' did not provide sufficient information to validate the business credentials.';
}
else if($tag['reference_final_remarks']==2) {
$makeSentense .=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : "");
$makeSentense .=' reference check was negative.';
}
else if($tag['reference_final_remarks']==1) {
$makeSentense .=($tag['relationship_with'] == 1) ? $tag['others'] : (($tag['relationship_with'] > 1) ? $tag['relationship_with_master'] : "");
$makeSentense .=' reference check was positive.';
}
return $makeSentense;
}, $values);
return $values;
}
}
?>

View File

@ -0,0 +1,38 @@
<?php
class Otherfamilyform
{
public static function getFamilyDetails($values){
$mergeResult=array();
foreach($values as $fetchVal){
$storeValue=array();
$storeValue['selected_person']=$fetchVal['selected_person_master'];
$storeValue['residency_address']=$fetchVal['residence_place'].','.$fetchVal['residence_city'].','.$fetchVal['residence_state'].'-';
$storeValue['residency_address'] .=($fetchVal['residence_pin'] == 1) ? $fetchVal['residence_other_pincode'] : (($fetchVal['residence_pin'] > 1) ? $fetchVal['residence_pin'] : "");
//$storeValue['residency_address'] .='.';
$storeValue['residence_No_of_years']=($fetchVal['residence_No_of_years'] == 1) ? $fetchVal['residence_No_of_years'].' year' :(($fetchVal['residence_No_of_years'] > 1) ? $fetchVal['residence_No_of_years'].' years' : "");
$storeValue['residence_ownership']=($fetchVal['residence_ownership'] == 1) ? $fetchVal['ownershipOther'] :(($fetchVal['residence_ownership'] == 3) ? $fetchVal['residence_ownership_master'].' @ Rs.'.$fetchVal['rent'].' per month' : $fetchVal['residence_ownership_master']);
$storeValue['no_family_members']= count($fetchVal['family_members_details']) > 0 ? count($fetchVal['family_members_details']) : '0';
$storeValue['family_members_details'] = array_map(function($tag) {
$getFamilyEarning='';
if($tag['family_member_earning_status']==1){
$getFamilyEarning= 'Earning ';
$getFamilyEarning .= $tag['earning_segment_master']==1 ? $tag['earning_if_others_segment'].' with '.$tag['earning_name_of_the_employer_or_business'].' since '.$tag['earning_number_of_years_in_employment_or_business'].' years earning Rs.'.$tag['earning_gross_income_per_month'].' per month ' : $tag['earning_segment_master'].' with '.$tag['earning_name_of_the_employer_or_business'].' since '.$tag['earning_number_of_years_in_employment_or_business'].' years earning Rs.'.$tag['earning_gross_income_per_month'].' per month ';
}
else if($tag['family_member_earning_status']==2){
$getFamilyEarning= 'Non-Earning '.$tag['non_earning_occupation_master'];
}
return array(
'name' => $tag['family_member_name'],
'family_member_relationship' => $tag['family_member_relationship_master'],
'family_member_age' => $tag['family_member_age'],
'family_member_earning' => $getFamilyEarning,
);
}, $fetchVal['family_members_details']);
array_push($mergeResult,$storeValue);
}
return $mergeResult;
}
}
?>

View File

@ -0,0 +1,16 @@
<?php
class Otherincomeform
{
public static function getIncomeDetails($values){
$values = array_map(function($tag) {
return array(
'source' => $tag['source']==1 ? $tag['others_source'] : $tag['source_master'],
'amount' => 'Rs.'.$tag['amount'],
'frequency' => $tag['frequency']==1 ? $tag['others_frequency'] : $tag['frequency_master'],
);
}, $values);
return $values;
}
}
?>

View File

@ -0,0 +1,445 @@
<?php
class PDSCORE
{
public static function calculatePDScore111()
{
echo "calculatePDScore111";
}
public static function genericDI($score_questions,$pd_master_details,$personal_asset_grid)
{
print_r($score_questions);
############ 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;
$customer_behaviour_L2 = 10;
$neibourhood_check_as_per_pd_officer_L2 = 10;
$was_the_company_name_board_sighted_L2 = 10;
$otp_done_L2 = 10;
$qualification_L2 = 10;
$value_of_other_assets_L2 = 15;
/*-------- BUSNIESS --------------*/
$no_of_years_business_run_L2 = 10;
$business_seasonality_L2 = 10;
$employees_total_L2 = 10;
$cerificates_L2 = 10;
$owned_property_L2 = 7;
$owned_vechile_L2 = 3;
$minimum_supplier_info_L2 = 5;
$minimum_client_info_L2 = 5;
$stock_raw_material_enough_L2 = 5;
$stock_finished_goods_enough_L2 = 5;
$location_suited_for_busienss_L2 = 10;
$business_activity_has_seen_L2 = 10;
$vintage_of_business_account_L2 = 10;
/*-------- 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);
$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 Professinal 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 chnages 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);
/*-----------CALCULATION PART -----------*/
/*-----------GENERAL SECTION -----------*/
echo "##################################################";
$general_distribute_level_weightage = 0;
//#######1.1 person_met_is_applicant
$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);
$score_questions['general']['person_met_is_applicant'] = array('l1_weightage' => $l1_general,'l2_weightage' => $person_met_is_applicant_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['person_met_is_applicant'],'actual_score' => $person_met_is_applicant_actual_score, 'max_score' => $person_met_is_applicant_max_score);
//######1.2 pd_location_approach
$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'],'actual_score' => $pd_location_approach_actual_score, 'max_score' => $pd_location_approach_max_score);
//######1.3 comment_locality
$comment_locality_actual_score = ($l1_general/100) * ($comment_locality_L2/100) * $comment_locality[$score_questions['general']['comment_locality']];
$comment_locality_max_score = ($l1_general/100) * ($comment_locality_L2/100) * max($comment_locality);
$score_questions['general']['comment_locality'] = array('l1_weightage' => $l1_general,'l2_weightage' => $comment_locality_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['comment_locality'],'actual_score' => $comment_locality_actual_score, 'max_score' => $comment_locality_max_score);
//######1.4 customer_behaviour
$customer_behaviour_actual_score = ($l1_general/100) * ($customer_behaviour_L2/100) * $customer_behaviour[$score_questions['general']['customer_behaviour']];
$customer_behaviour_max_score = ($l1_general/100) * ($customer_behaviour_L2/100) * max($customer_behaviour);
$score_questions['general']['customer_behaviour'] = array('l1_weightage' => $l1_general,'l2_weightage' => $customer_behaviour_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['customer_behaviour'],'actual_score' => $customer_behaviour_actual_score, 'max_score' => $customer_behaviour_max_score);
//######1.5 neibourhood_check_as_per_pd_officer
$neibourhood_check_as_per_pd_officer_actual_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * $neibourhood_check_as_per_pd_officer[$score_questions['general']['neibourhood_check_as_per_pd_officer']];
$neibourhood_check_as_per_pd_officer_max_score = ($l1_general/100) * ($neibourhood_check_as_per_pd_officer_L2/100) * max($neibourhood_check_as_per_pd_officer);
$score_questions['general']['neibourhood_check_as_per_pd_officer'] = array('l1_weightage' => $l1_general,'l2_weightage' => $neibourhood_check_as_per_pd_officer_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['neibourhood_check_as_per_pd_officer'],'actual_score' => $neibourhood_check_as_per_pd_officer_actual_score, 'max_score' => $neibourhood_check_as_per_pd_officer_max_score);
//######1.6 was_the_company_name_board_sighted
$was_the_company_name_board_sighted_actual_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * $was_the_company_name_board_sighted[$score_questions['general']['was_the_company_name_board_sighted']];
$was_the_company_name_board_sighted_max_score = ($l1_general/100) * ($was_the_company_name_board_sighted_L2/100) * max($was_the_company_name_board_sighted);
$score_questions['general']['was_the_company_name_board_sighted'] = array('l1_weightage' => $l1_general,'l2_weightage' => $was_the_company_name_board_sighted_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['was_the_company_name_board_sighted'],'actual_score' => $was_the_company_name_board_sighted_actual_score, 'max_score' => $was_the_company_name_board_sighted_max_score);
//######1.7 otp_done
$otp_done_actual_score = ($l1_general/100) * ($otp_done_L2/100) * $otp_done[$score_questions['general']['otp_done']];
$otp_done_max_score = ($l1_general/100) * ($otp_done_L2/100) * max($otp_done);
$score_questions['general']['otp_done'] = array('l1_weightage' => $l1_general,'l2_weightage' => $otp_done_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['otp_done'],'actual_score' => $otp_done_actual_score, 'max_score' => $otp_done_max_score);
//######1.8 qualification
$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)],'actual_score' => $qualification_actual_score, 'max_score' => $qualification_max_score);
//######1.9 value of assets as a % of Loan Amount
//$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
$actual_value_of_assets = 600000;
//$loan_amount = $pd_master_details[0]['loan_amount'];
$loan_amount = 2000000;
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
$actual_value_of_assets_percentage = ($actual_value_of_assets / $loan_amount) * 100;
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
$final_asset_score = 'DEFAULT';
foreach($personal_asset_grid['variance_grid'] as $grid)
{
//print_r($grid);
if($grid['variance_ ratio_from'] < $variance && $grid['variance_ration_to'] > $variance)
{
$final_asset_score = $grid['score'];
$final_asset_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
}
}
$score_questions['general']['value_of_other_assets'] = array('l1_weightage' => $l1_general,'l2_weightage' => $value_of_other_assets_L2,'distributed_weightage' => $general_distribute_level_weightage,'answer' => $score_questions['general']['value_of_other_assets'],'actual_score' => $final_asset_score, 'max_score' => (($l1_general/100 ) * ($value_of_other_assets_L2/100) * 10));
/*-----------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'],'actual_score' => $pd_officer_recommandations_actual_score, 'max_score' => $pd_officer_recommandations_max_score);
/*-----------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;
if(!strcasecmp($score_questions['business']['minimum_supplier_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_supplier_info_L2;
}
if(!strcasecmp($score_questions['business']['minimum_client_info'],'Not Applicable'))
{
$business_distribute_level_weightage += $minimum_client_info_L2;
}
if(!strcasecmp($score_questions['business']['stock_raw_material_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_raw_material_enough_L2;
}
if(!strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable'))
{
$business_distribute_level_weightage += $stock_finished_goods_enough_L2;
}
//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 ))) : $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'],'actual_score' => $minimum_supplier_info_actual_score, 'max_score' => $minimum_supplier_info_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.8 atleast one client info provided
$minimum_client_info_L2 = $business_distribute_level_weightage ? ($minimum_client_info_L2 + ($minimum_client_info_L2 / (100 - $business_distribute_level_weightage ))) : $minimum_client_info_L2 ;
$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'],'actual_score' => $minimum_client_info_actual_score, 'max_score' => $minimum_client_info_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.9 stock of raw material
$stock_raw_material_enough_L2 = $business_distribute_level_weightage ? ($stock_raw_material_enough_L2 + ($stock_raw_material_enough_L2 / (100 - $business_distribute_level_weightage ))) : $stock_raw_material_enough_L2 ;
$stock_raw_material_enough_actual_score = ($l1_business/100) * ($stock_raw_material_enough_L2/100) * $stock_answer_scores [ $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'],'actual_score' => $stock_raw_material_enough_actual_score, 'max_score' => $stock_raw_material_enough_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.10 stock_finished_goods_enough
$stock_finished_goods_enough_L2 = $business_distribute_level_weightage ? ($stock_finished_goods_enough_L2 + ($stock_finished_goods_enough_L2 / (100 - $business_distribute_level_weightage ))) : $stock_finished_goods_enough_L2 ;
$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'] ];
$stock_finished_goods_enough_max_score = strcasecmp($score_questions['business']['stock_finished_goods_enough'],'Not Applicable') ? ($l1_business/100) * ($stock_finished_goods_enough_L2/100) * max($stock_answer_scores) : 0;
$score_questions['business']['stock_finished_goods_enough'] = array('l1_weightage' => $l1_business,'l2_weightage' => $stock_finished_goods_enough_L2,'answer' => $score_questions['business']['stock_finished_goods_enough'],'actual_score' => $stock_finished_goods_enough_actual_score, 'max_score' => $stock_finished_goods_enough_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.1 Business Certificates
$cerificates_L2 = $business_distribute_level_weightage ? ($cerificates_L2 + ($cerificates_L2 / (100 - $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++;
}
}
$business_certificates_distribution = $cerificates_L2 / $business_certificates_distribution_count;
$certificate_actual_score = 0;
$certificate_max_score = 0;
foreach($score_questions['business']['cerificates'] as $certificate_key => $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,'actual_score' => $acutal_score, 'max_score' => $max_score);
$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;
$score_questions['business']['cerificates']['distributed_weightage'] = $business_distribute_level_weightage;
$score_questions['business']['cerificates']['max_score'] = $certificate_max_score;
$score_questions['business']['cerificates']['actual_score'] = $certificate_actual_score;
//echo $business_certificates_distribution;die();
//######2.1 no_of_years_business_run
$no_of_years_business_run_actual_score = 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 ))) : $no_of_years_business_run_L2 ;
$no_of_years_business_run_actual_score = ($l1_business/100) * ($no_of_years_business_run_L2/100) * $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'],'actual_score' => $no_of_years_business_run_actual_score, 'max_score' => $no_of_years_business_run_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.2 business seasonal
$business_seasonality_L2 = $business_distribute_level_weightage ? ($business_seasonality_L2 + ($business_seasonality_L2 / (100 - $business_distribute_level_weightage ))) : $business_seasonality_L2 ;
$business_seasonality_actual_score = ($l1_business/100) * ($business_seasonality_L2/100) * $business_seasonality[ $score_questions['business']['business_seasonality'] ];
$business_seasonality_max_score = ($l1_business/100) * ($business_seasonality_L2/100) * max($business_seasonality);
$score_questions['business']['business_seasonality'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_seasonality_L2,'answer' => $score_questions['business']['business_seasonality'],'actual_score' => $no_of_years_business_run_actual_score, 'max_score' => $no_of_years_business_run_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.3 employees_total
$employees_total_actual_score = 0;
$employees_total_L2 = $business_distribute_level_weightage ? ($employees_total_L2 + ($employees_total_L2 / (100 - $business_distribute_level_weightage ))) : $employees_total_L2 ;
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;
}
}
$employees_total_max_score = ($l1_business/100) * ($employees_total_L2/100) * max($employees_total);
$score_questions['business']['employees_total'] = array('l1_weightage' => $l1_business,'l2_weightage' => $employees_total_L2,'answer' => $score_questions['business']['employees_total'],'actual_score' => $employees_total_actual_score, 'max_score' => $employees_total_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.5 owned_property
$owned_property_L2 = $business_distribute_level_weightage ? ($owned_property_L2 + ($owned_property_L2 / (100 - $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'],'actual_score' => $owned_property_actual_score, 'max_score' => $owned_property_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.6 owned_vechile
$owned_vechile_L2 = $business_distribute_level_weightage ? ($owned_vechile_L2 + ($owned_vechile_L2 / (100 - $business_distribute_level_weightage ))) : $owned_vechile_L2 ;
$owned_vechile_actual_score = ($l1_business/100) * ($owned_vechile_L2/100) * $owned_vechile[ $score_questions['business']['owned_vechile'] ];
$owned_vechile_max_score = ($l1_business/100) * ($owned_vechile_L2/100) * max($owned_vechile);
$score_questions['business']['owned_vechile'] = array('l1_weightage' => $l1_business,'l2_weightage' => $owned_vechile_L2,'answer' => $score_questions['business']['owned_vechile'],'actual_score' => $owned_vechile_actual_score, 'max_score' => $owned_vechile_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######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 ))) : $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'],'actual_score' => $location_suited_for_busienss_actual_score, 'max_score' => $location_suited_for_busienss_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######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_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'],'actual_score' => $business_activity_has_seen_actual_score, 'max_score' => $business_activity_has_seen_max_score,'distributed_weightage' => $business_distribute_level_weightage);
//######2.13 vintage business banking
$vintage_of_business_account_L2 = $business_distribute_level_weightage ? ($vintage_of_business_account_L2 + ($vintage_of_business_account_L2 / (100 - $business_distribute_level_weightage ))) : $vintage_of_business_account_L2 ;
$vintage_of_business_account_actual_score = 0;
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;
}
}
$vintage_of_business_account_max_score = ($l1_business/100) * ($vintage_of_business_account_L2/100) * max($vintage_of_business_account);
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => $business_activity_has_seen_L2,'answer' => $score_questions['business']['vintage_of_business_account'],'actual_score' => $vintage_of_business_account_actual_score, 'max_score' => $vintage_of_business_account_max_score,'distributed_weightage' => $business_distribute_level_weightage);
/*-----------END OF BUSINESS SECTION -----------*/
/* Calculate Overall Total*/
$overall_max_score = 0;
$overall_actual_score = 0;
foreach($score_questions as $key => $value)
{
foreach($value as $v_key => $f_value)
{
$overall_max_score += $f_value['max_score'];
$overall_actual_score += $f_value['actual_score'];
}
}
$score_questions['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => ($overall_actual_score/$overall_max_score) * 100);
print_r($score_questions);
}
}
?>

View File

@ -0,0 +1,81 @@
<?php
class Stockform
{
// manufacturing details
public static function getStockManufacturingDetails($rawMaterial,$goods){
$getRawMaterial=array();
$getGoods=array();
// raw material
if(count($rawMaterial)>0){
$getRawMaterial = array_map(function($tag) {
$getUom= $tag['raw_uom']==1 ? $tag['other_uom'] : $tag['raw_uom'];
$getSufficient= (strtoupper($tag['stock_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_raw']) =='YES') ? 'Yes, the stock of raw materials observed and sufficient considering the size of operations' : 'No, the stock of raw materials observed and sufficient considering the size of operations because of '.$tag['rawmaterial_remarks']);
return array(
'type' => 'Raw Material',
'name' => $tag['raw_name'],
'quantity' => strtoupper($tag['stock_observed'])=='YES' ? $tag['raw_quantity'] : '',
'uom' => strtoupper($tag['stock_observed'])=='YES' ? $getUom : '',
'value' => strtoupper($tag['stock_observed'])=='YES' ? 'Rs.'.$tag['raw_value'] : '',
'is_sufficiant' => (strtoupper($tag['stock_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['stock_observed'])=='NO') ? $getSufficient : ''),
);
}, $rawMaterial);
}
// goods
if(count($goods)>0){
$getGoods = array_map(function($tag) {
$getGUom= $tag['goods_uom']==1 ? $tag['goods_other_uom'] : $tag['goods_uom'];
$getGSufficient= (strtoupper($tag['goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_goods']) =='YES') ? 'Yes, the stock of finished goods observed and sufficient considering the size of operations' : 'No, the stock of finished goods observed and sufficient considering the size of operations because of '.$tag['finishedgoods_remarks']);
return array(
'type' => 'Finished Goods',
'name' => $tag['goods_name'],
'quantity' => strtoupper($tag['goods_observed'])=='YES' ? $tag['goods_quantity'] : '',
'uom' => strtoupper($tag['goods_observed'])=='YES' ? $getGUom : '',
'value' => strtoupper($tag['goods_observed'])=='YES' ? 'Rs.'.$tag['goods_value'] : '',
'is_sufficiant' => (strtoupper($tag['goods_observed'])=='YES') ? $getGSufficient : ((strtoupper($tag['goods_observed'])=='NO') ? $getGSufficient : ''),
);
}, $goods);
}
return array_merge($getRawMaterial,$getGoods);
}
//get retail
public static function getStockRetailDetails($goods){
// goods
if(count($goods)>0){
$goods = array_map(function($tag) {
$getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : $tag['traded_goods_uom'];
$getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']);
return array(
'name' => $tag['traded_goods_name'],
'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '',
'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '',
'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$tag['estimated_traded_goods_value'] : '',
'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''),
);
}, $goods);
}
return $goods;
}
// get wholesale
public static function getStockWholesaleDetails($goods){
// goods
if(count($goods)>0){
$goods = array_map(function($tag) {
$getUom= $tag['traded_goods_uom']==1 ? $tag['traded_goods_other_uom'] : $tag['traded_goods_uom'];
$getSufficient= (strtoupper($tag['traded_goods_observed']) =='NO') ? 'No Stock Observed' : ((strtoupper($tag['is_sufficiant_traded_goods']) =='YES') ? 'Yes, the stock of traded goods observed' : 'No, the stock of traded goods observed because of '.$tag['traded_goods_remarks']);
return array(
'name' => $tag['traded_goods_name'],
'quantity' => strtoupper($tag['traded_goods_observed'])=='YES' ? $tag['traded_goods_quantity'] : '',
'uom' => strtoupper($tag['traded_goods_observed'])=='YES' ? $getUom : '',
'value' => strtoupper($tag['traded_goods_observed'])=='YES' ? 'Rs.'.$tag['estimated_traded_goods_value'] : '',
'is_sufficiant' => (strtoupper($tag['traded_goods_observed'])=='YES') ? $getSufficient : ((strtoupper($tag['traded_goods_observed'])=='NO') ? $getSufficient : ''),
);
}, $goods);
}
return $goods;
}
}
?>

View File

@ -14,7 +14,7 @@ class PD_Model extends SPARQ_Model {
public function listLessPDDetails($page,$limit,$sort,$pdofficerid,$datetype,$fdate,$tdate,$lenderid,$status)// $page represents mysql offset
{
//echo $status;die();
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name');
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id','LEFT');
$this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT');
@ -126,7 +126,7 @@ class PD_Model extends SPARQ_Model {
public function PDListwithGlobalFilters($pd_type,$pd_status,$pd_from_date,$pd_to_date,$pd_city,$pd_products,$pd_lender,$pd_applicant_name,$pd_applicant_lender_ref)
{
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name');
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name,PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name, PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i:%s") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i:%s") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDTRIGGER.other_pincode,PDAPPLICANTSDETAILS.applicant_name,PDTRIGGER.is_otp_done');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id','LEFT');
$this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT');
@ -643,7 +643,7 @@ class PD_Model extends SPARQ_Model {
*/
public function getPDMasterDetails($pdid)
{
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode');
$this->db->SELECT('PDTRIGGER.pd_id, PDTRIGGER.fk_lender_id,ENTITY.full_name as lender_full_name,ENTITY.short_name as lender_short_name, PDTRIGGER.fk_entity_billing_id,ENTITYBILLING.billing_name,PDTRIGGER.lender_applicant_id, DATE_FORMAT(PDTRIGGER.pd_date_of_initiation, "%d/%m/%Y") as pd_date_of_initiation, PDTRIGGER.fk_product_id,PRODUCTS.name as product_name,PRODUCTS.abbr as product_abbr, PDTRIGGER.fk_subproduct_id,SUBPRODUCTS.name as subproduct_name,SUBPRODUCTS.abbr as subproduct_abbr, PDTRIGGER.fk_pd_type,PDTYPE.type_name as pd_type_name, PDTRIGGER.pd_status,PDTRIGGER.pd_specific_clarification, DATE_FORMAT(PDTRIGGER.createdon,"%d/%m/%Y %H:%i %p") as createdon, PDTRIGGER.fk_createdby, DATE_FORMAT(PDTRIGGER.updatedon,"%d/%m/%Y %H:%i %p") as updatedon, PDTRIGGER.fk_updatedby,concat(USERPROFILE.first_name," ",USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name," ",USERPROFILE1.last_name) as updatedby, PDTRIGGER.fk_pd_allocation_type,,PDALLOCATIONTYPE.pd_allocation_type_name, PDTRIGGER.fk_pd_allocated_to,concat(USERPROFILE2.first_name," ",USERPROFILE2.last_name) as pd_allocated_to,PDTRIGGER.executive_id,concat(EXECUTIVE.first_name," ",EXECUTIVE.last_name) as executive_name,PDTRIGGER.central_pd_officer_id,concat(CENTRALOFFICER.first_name," ",CENTRALOFFICER.last_name) as centralofficer,PDTRIGGER.fk_pd_template_id,TEMPLATE.template_name, PDTRIGGER.fk_customer_segment,CUSTOMERSEGMENT.name as customer_segment_name,CUSTOMERSEGMENT.abbr as customer_segment_abbr, PDTRIGGER.pd_officier_final_judgement, PDTRIGGER.pd_agency_id,AGENCY.full_name as agency_name, PDTRIGGER.loan_amount,PDTRIGGER.addressline1,PDTRIGGER.addressline2,PDTRIGGER.addressline3,PDTRIGGER.fk_city,CITY.name as city_name,PDTRIGGER.fk_state,STATE.name as state_name,PINCODE.pincode,PDTRIGGER.pincode as pincode_id,PDTRIGGER.pd_contact_person,PDTRIGGER.pd_contact_mobileno,DATE_FORMAT(PDTRIGGER.scheduled_on,"%d/%m/%Y %h:%i %p") as scheduled_on,PDTRIGGER.scheduled_on as scheduled_on_for_validation,DATE_FORMAT(PDTRIGGER.scheduled_on,"%dth %b %Y ") as scheduled_date_for_log,DATE_FORMAT(PDTRIGGER.scheduled_on,"%h:%i %p") as scheduled_time_for_log,DATE_FORMAT(PDTRIGGER.completed_on,"%d/%m/%Y %h:%i:%s %p") as completed_on,PDTRIGGER.remarks,PDTRIGGER.bounce_reason,PDTRIGGER.bounce_reason_others,BOUNCEMASTER.bounce_reason_name,PDTRIGGER.is_original_report_created,PDTRIGGER.pd_report_latest_version,PDAPPLICANTSDETAILS.applicant_name as main_applicant,PDTRIGGER.pd_branch_id,ENTITYLENDERBRANCH.branch_name,PDTRIGGER.qc_feedback,PDTRIGGER.qc_rating,PDTRIGGER.qc_remarks,PDTRIGGER.lender_rating,PDTRIGGER.lender_feedback,PDAPPLICANTSDETAILS.applicant_title_name,TITLES.name as title_name,PDTRIGGER.pd_contact_landline,PDTRIGGER.other_pincode,PDTRIGGER.is_otp_done');
$this->db->FROM(PDTRIGGER.' as PDTRIGGER');
$this->db->JOIN(ENTITY.' as ENTITY','PDTRIGGER.fk_lender_id = ENTITY.entity_id ','LEFT');
$this->db->JOIN(ENTITYBILLING.' as ENTITYBILLING','PDTRIGGER.fk_entity_billing_id = ENTITYBILLING.entity_billing_id','LEFT');
@ -1024,6 +1024,10 @@ class PD_Model extends SPARQ_Model {
{
if($result->OTP == $pddata['OTP'])
{
$fields = ('is_otp_done');
$where_condition_array = array('pd_id' => $pdotp['pd_id']);
$this->PD_Model->updateRecords($fields,PDTRIGGER,$where_condition_array);
$result = true;
}else
{
@ -1327,4 +1331,30 @@ class PD_Model extends SPARQ_Model {
return $assessed_income;
}
public function getScorablePDFormDetailsJSON($pdid)
{
$array = array(1,2,4,5,11,13,18,19,20,21,22);
$return_data = array();
foreach($array as $key => $value)
{
$this->db->SELECT('processed_json');
$this->db->FROM(PDFORMDETAILSJSON);
$this->db->WHERE('isactive','1');
$this->db->WHERE('fk_pd_id',$pdid);
$this->db->WHERE('fk_form_id',$value);
$data = $this->db->GET()->result_array();
if(count($data))
{
//echo $value;
$return_data[$value] = $data;
}
}
// print_r($return_data);die();
return $return_data;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff