SCORE CARD IMPROVED 3

This commit is contained in:
velz 2019-03-20 18:12:34 +05:30
parent 00345b55e3
commit 4b61d38a7d
6 changed files with 41 additions and 22 deletions

View File

@ -94,10 +94,12 @@ defined('PROFILE_PICTURE_BUCKET_NAME') OR define('PROFILE_PICTURE_BUCKET_NAME','
if(ENVIRONMENT == 'development')
{
defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','lender');
defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_dev');
}
else if(ENVIRONMENT == 'testing')
{
defined('LENDER_BUCKET_NAME_PREFIX') OR define('LENDER_BUCKET_NAME_PREFIX','len');
defined('PHANTOMJSSCRIPT_LOCATION') OR define('PHANTOMJSSCRIPT_LOCATION','phantomjs_test');
}
/*********************END of AWS resources Constants*************************************************/
@ -105,7 +107,8 @@ else if(ENVIRONMENT == 'testing')
defined('LOGTOBOT') OR define('LOGTOBOT',1);
defined('LOGTOSYS') OR define('LOGTOSYS',1);
defined('PROCESSJSON') OR define('PROCESSJSON',1);
defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=467975ee8e33abf1549803925eaace0f');
//defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=467975ee8e33abf1549803925eaace0f');
defined('BOTURL') OR define('BOTURL','https://cliq.zoho.com/api/v2/bots/sample/incoming?authtoken=4eb460042d45d28a898b5ea11b5b103e');
/*******************Constants PD status*********************************/
defined('TRIGGERED') OR define('TRIGGERED','TRIGGERED'); //First time PD Trigger.

View File

@ -3563,7 +3563,7 @@ class PD_Controller extends REST_Controller {
//echo $score_for_chart;
//GET phantom script from DB
$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => 'phantomjs_dev'),SCRIPTS);
$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => PHANTOMJSSCRIPT_LOCATION),SCRIPTS);
$exact_script = $phantom_script[0]['script_content'];
//print_r($exact_script);
@ -4338,7 +4338,7 @@ class PD_Controller extends REST_Controller {
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly();
$data['pd_score'] = $this->calculateScore($pdid);
print_r($data['pd_score']['business']);
//print_r($data['pd_score']['business']);
$score_for_chart = $data['pd_score']['score_summary']['overall_score']['final_score'] ? round($data['pd_score']['score_summary']['overall_score']['final_score'],2) : 0;
//echo $score_for_chart;
@ -5529,7 +5529,7 @@ class PD_Controller extends REST_Controller {
$temp['esic_regn'] = isset($business_form['esic_regn'])?$business_form['esic_regn']:'not applicable';
$temp['export_import_cert'] = isset($business_form['export_import_cert'])?$business_form['export_import_cert']:'not applicable';
$temp['factory_cert'] = isset($business_form['factory_cert'])?$business_form['factory_cert']:'not applicable';
$temp['cert_of_practice'] = isset($business_form['cert_of_practice']) ? $business_form['cert_of_practice']: 'not applicable';
$temp['cert_of_practice'] = isset($business_form['practice_cert']) ? $business_form['practice_cert']: 'not applicable';
$score_questions['business']['cerificates'] = $temp;
#####End of Business Form Questions########
@ -5652,7 +5652,11 @@ class PD_Controller extends REST_Controller {
if(count($stock_form))
{
//print_r($stock_form);die();
$score_questions['business']['stock_raw_material_enough'] = isset($stock_form['manufacturing_raw_materials']['is_sufficiant_raw']) ? $stock_form['manufacturing_raw_materials']['is_sufficiant_raw']: 'Not Applicable';
if(isset($stock_form['manufacturing_details']) && ($stock_form['manufacturing_details'] != null || $stock_form['manufacturing_details'] != ""))
{
$score_questions['business']['stock_raw_material_enough'] = isset($stock_form['manufacturing_details'][0]['is_sufficiant_raw']) ? $stock_form['manufacturing_details'][0]['is_sufficiant_raw']: 'Not Applicable';
}
$score_questions['business']['stock_finished_goods_enough'] = isset($stock_form['is_sufficiant_finished_and_traded_goods']) && ($stock_form['is_sufficiant_finished_and_traded_goods'] != "" || $stock_form['is_sufficiant_finished_and_traded_goods'] != null)? $stock_form['is_sufficiant_finished_and_traded_goods'] : 'Not Applicable';
}
else
@ -5674,7 +5678,16 @@ class PD_Controller extends REST_Controller {
//print_r($other_asset_form);
foreach($other_asset_form['assets_details'] as $asset)
{
//echo 'Value - '.$asset['approximate_market_value'];
$over_all_asset_value += $asset['approximate_market_value'] ;
if($asset['assets_mode'] == 6)//LIC
{
$over_all_asset_value += $asset['details'][0]['sum_assured'];
}
if($asset['assets_mode'] == 7)//Investments
{
$over_all_asset_value += $asset['details'][0]['amount_of_invest'];
}
}
}

Binary file not shown.

View File

@ -193,7 +193,7 @@ class PDSCORE
$asset_calculation_details = array();
$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
$asset_calculation_details['actual_value_of_assets'] = $actual_value_of_assets;
$asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2);
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
$loan_amount = $pd_master_details[0]['loan_amount'];
@ -201,33 +201,36 @@ class PDSCORE
//echo 'loan_amount - '.$loan_amount;
$avg_expected_value_of_assets = $personal_asset_grid['master_grid'][0]['avg_expected_value_assets'];
$asset_calculation_details['avg_expected_value_of_assets'] = $avg_expected_value_of_assets;
$asset_calculation_details['avg_expected_value_of_assets'] = round($avg_expected_value_of_assets,2);
//echo "avg_expected_value_of_assets - ".$avg_expected_value_of_assets;
//$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $personal_asset_grid['master_grid'][0]['loan_amount_to'];
$expected_value_of_assets = ($avg_expected_value_of_assets / 100 ) * $loan_amount;
$asset_calculation_details['expected_value_of_assets'] = $expected_value_of_assets;
$asset_calculation_details['expected_value_of_assets'] = round($expected_value_of_assets,2);
//echo 'expected_value_of_assets--'.$expected_value_of_assets;
$actual_value_of_assets_percentage = ($actual_value_of_assets / $loan_amount) * 100;
$asset_calculation_details['actual_value_of_assets_percentage'] =
$actual_value_of_assets_percentage;
round($actual_value_of_assets_percentage,2);
//echo 'actual_value_of_assets_percentage--'.$actual_value_of_assets_percentage;
$variance = (($actual_value_of_assets_percentage - $avg_expected_value_of_assets)/$avg_expected_value_of_assets )* 100 ;
//echo 'varience--'.$variance;
$asset_calculation_details['variance'] = $variance;
$asset_calculation_details['variance'] = round($variance,2);
$final_asset_attributed_score = 0;
$final_asset_score = 0;
foreach($personal_asset_grid['variance_grid'] as $grid)
if($actual_value_of_assets > 0 )
{
//print_r($grid['score']);
if($grid['variance_ ratio_from'] <= $variance && $grid['variance_ration_to'] > $variance)
foreach($personal_asset_grid['variance_grid'] as $grid)
{
$final_asset_score = $grid['score'];
$final_asset_attributed_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
//print_r($grid['score']);
if($grid['variance_ ratio_from'] <= $variance && $grid['variance_ration_to'] > $variance)
{
$final_asset_score = $grid['score'];
$final_asset_attributed_score = ($l1_general/100 ) * ($value_of_other_assets_L2/100)* $final_asset_score;
}
}
}
$asset_calculation_details['score'] = $final_asset_score;
@ -496,7 +499,7 @@ class PDSCORE
$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'],'attributed_score' => round($vintage_of_business_account_actual_score,2), 'max_score' => round($vintage_of_business_account_max_score,2),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
$score_questions['business']['vintage_of_business_account'] = array('l1_weightage' => $l1_business,'l2_weightage' => round($business_activity_has_seen_L2,2),'answer' => $score_questions['business']['vintage_of_business_account'],'attributed_score' => round($vintage_of_business_account_actual_score,2), 'max_score' => round($vintage_of_business_account_max_score,2),'distributed_weightage' => $business_distribute_level_weightage,'score_band' => $score_band,'max_score_band' => max($vintage_of_business_account));
/*-----------END OF BUSINESS SECTION -----------*/
@ -521,10 +524,10 @@ class PDSCORE
$score_questions['score_summary'][$key] = array('actual_score' => $current_actual_score,'max_score' => $current_max_score);
}
$score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => ($overall_actual_score/$overall_max_score) * 100);
$score_questions['score_summary']['overall_score'] = array('overall_actual_score' => $overall_actual_score, 'overall_max_score' => $overall_max_score,'final_score' => round(($overall_actual_score/$overall_max_score) * 100));
$score_questions['score_summary']['asset_calculation_details'] = $asset_calculation_details;
//print_r($score_questions);die();
//print_r($score_questions);die();
return ($score_questions);

View File

@ -1277,7 +1277,7 @@ class PD_Model extends SPARQ_Model {
$sales_items_by_months = array();
$this->db->SELECT('sim_id,sales_item,margin_value,margin_per,comments');
$this->db->SELECT('sim_id,sales_item,margin_value,margin_per,comments,sales_type');
$this->db->FROM(SALESITEMMONTHWISE.' as SALESITEMMONTHWISE');
$this->db->WHERE('SALESITEMMONTHWISE.fk_pd_id',$pdid);
$this->db->WHERE('SALESITEMMONTHWISE.isactive',1);
@ -1300,7 +1300,7 @@ class PD_Model extends SPARQ_Model {
foreach($sales_items_by_month as $month_key => $month)
{
$this->db->SELECT('simc_id,sales_date,sales_value');
$this->db->SELECT('simc_id,sales_date,sales_value,fk_frequency_id,frequency_value');
$this->db->FROM(SALESITEMMONTHWISECHILD.' as SALESITEMMONTHWISECHILD');
$this->db->WHERE('SALESITEMMONTHWISECHILD.fk_sim_id',$item['sim_id']);
$this->db->WHERE('month(SALESITEMMONTHWISECHILD.sales_date)',$month['month']);

View File

@ -242,7 +242,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
echo '</table>';
echo '<br><br><br>';
print_r($pd_score['business']);
//print_r($pd_score['business']);
echo '<table id="scorecard_table">';
// *** Business Section Questions Score Table