PD REPORT ISSUE FIXED

This commit is contained in:
velz 2019-05-13 11:48:21 +05:30
parent e93e800624
commit eb1f4b9273
10 changed files with 329 additions and 41 deletions

View File

@ -71,7 +71,6 @@ $route['getListOfPDTeam'] = 'Common_Masters_Controller/getListOfPDTeam';
$route['getPdManage'] = 'Common_Masters_Controller/getPdManage';
$route['savePdTeamManage'] = 'Common_Masters_Controller/savePdTeamManage';
$route['getListOfPDTeamCityMapping'] = 'Common_Masters_Controller/getListOfPDTeamCityMapping';
//$route['getListOfPDTeamMap'] = 'Common_Masters_Controller/getListOfPDTeamMap';
$route['getListOfMaster'] = 'Common_Masters_Controller/getListOfMaster';
$route['saveMaster'] = 'Common_Masters_Controller/saveMaster';
$route['saveBranch'] = 'Common_Masters_Controller/saveBranch';
@ -222,4 +221,5 @@ $route['getDashBoardDetailsOfCity'] = 'Dash_Board_Controller/getDashBoardDetails
$route['getDashBoardAlertDetails'] = 'Dash_Board_Controller/getDashBoardDetailsOfAlert';
$route['PD_MIS_report'] = 'Dash_Board_Controller/PD_MIS_report';
//miscellanous
//$route['showBusinessScorecard'] = 'PD_Controller/';

View File

@ -618,6 +618,7 @@ class PD_Controller extends REST_Controller {
if($pd_id != null || $pd_id != '' && $count != 0)
{
// CALL pdnotification Helper function to send pd alerts @ params pdid,pdstatus
$logger = MYLOG::logFunction();
$logger->info("NEW PD Trigged : ".$pd_id,array('ENV'=>ENVIRONMENT,'DATA' => $pd_details));
PDALERTS::pdnotification($pd_id);
@ -709,6 +710,7 @@ class PD_Controller extends REST_Controller {
$pd_details['random_string'] = $randomString;
$url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString;
/* $ch = curl_init();
$timeout = 5;
$url = 'https://ssa.sineedge.com/ot/#/officertracking/'.$randomString;
@ -2523,7 +2525,7 @@ class PD_Controller extends REST_Controller {
}
else
{
$json = json_decode($rec[0]['json']);
$json = json_decode($rec[0]['processed_json']);
}
$data['dataStatus'] = true;
@ -4747,10 +4749,19 @@ class PD_Controller extends REST_Controller {
//print_r($records);
$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_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly();
// $data['pd_score'] = $this->calculateScore($pdid);
$data['pd_additional_requirements'] = $this->PD_Model->getPDAdditionalRequirements($pdid);
$data['score_questions_display'] = $this->PD_Model->getScoreableQuestionToDispaly();
$data['pd_score'] = $this->calculateScore($pdid);
$remp = array();
foreach($data['pd_score']['general'] as $key => $da)
{
//$remp = array_merge($remp,array($key => (string)($da['attributed_score'] * 100)));
$remp = array_merge($remp,array($key));
}
print_r($remp);
//die();
print_r(json_encode($remp,true));die();
// $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;
$chart = null;
@ -5832,19 +5843,34 @@ class PD_Controller extends REST_Controller {
//Get Latest Loan Amount form loan form.
$loan_amt_from_loam_form = json_decode($form_data[10][0]['processed_json'],true);
$loan_amt_from_loam_form = $loan_amt_from_loam_form['loan_amount'];
//echo $loan_amt_from_loam_form;
//seperate PD Scorable quesitons from JSON
$score_questions = $this->seperateScoreQuestions($form_data,$pd_master_details[0]['is_otp_done']);
//print_r($score_questions);die();
// echo "###################################";
//Get Pesrsonal Assets Grid Masters Details
$this->db->SELECT('*');
$this->db->FROM(PERSONALASSETGRID);
$this->db->WHERE('isactive',1);
$this->db->WHERE('loan_amount_from<=',(int)$pd_master_details[0]['loan_amount']);
$this->db->WHERE('loan_amount_to>=',(int)$pd_master_details[0]['loan_amount']);
$personal_asset_grid['master_grid'] = $this->db->GET()->result_array();
//print_r($this->db->last_query());die();
if((int)$loan_amt_from_loam_form >= 100000000 )
{
$this->db->SELECT('*');
$this->db->FROM(PERSONALASSETGRID);
$this->db->WHERE('isactive',1);
$this->db->ORDER_BY('personal_asset_grid_id','DESC');
$this->db->LIMIT(1) ;
$personal_asset_grid['master_grid'] = $this->db->GET()->result_array();
}
else
{
$this->db->SELECT('*');
$this->db->FROM(PERSONALASSETGRID);
$this->db->WHERE('isactive',1);
$this->db->WHERE('loan_amount_from<=',(int)$loan_amt_from_loam_form);
$this->db->WHERE('loan_amount_to>=',(int)$loan_amt_from_loam_form);
$personal_asset_grid['master_grid'] = $this->db->GET()->result_array();
}
// print_r($this->db->last_query());
// print_r($personal_asset_grid['master_grid']);
// die();
$this->db->SELECT('*');
$this->db->FROM(PERSONALASSETGRIDVARIANCE);
$this->db->WHERE('isactive',1);
@ -5866,7 +5892,10 @@ class PD_Controller extends REST_Controller {
default:
switch($pd_master_details[0]['fk_customer_segment'])
{
case 4:
case 5:
case 6:
case 7:
$score_questions = PDSCORE::genericDI($score_questions,$loan_amt_from_loam_form,$personal_asset_grid);
break;
}
@ -6029,10 +6058,10 @@ class PD_Controller extends REST_Controller {
$supplier_count = 0;
if(array_key_exists('manufacturing_details',$supplier_form))
{
foreach($supplier_form['manufacturing_details'] as $manufacturing_details)
if(isset($client_form['manufacturing_details'][0]['main_raw_materials']))
{
$supplier_count = count($manufacturing_details['main_raw_materials']) ? ++$supplier_count: $supplier_count;
$supplier_count += count($client_form['manufacturing_details'][0]['main_raw_materials']) ? count($client_form['manufacturing_details'][0]['main_raw_materials']) : 0;
}
@ -6041,10 +6070,11 @@ class PD_Controller extends REST_Controller {
if(array_key_exists('trade_details',$supplier_form))
{
foreach($supplier_form['trade_details'] as $trade_details)
if(isset($client_form['trade_details'][0]['trading_products']))
{
$supplier_count = count($trade_details['trading_products']) ? ++$supplier_count: $supplier_count;
$supplier_count += count($client_form['trade_details'][0]['trading_products']) ? count($client_form['trade_details'][0]['trading_products']): 0;
}
//echo 'IN trade-'.$supplier_count;
@ -6072,34 +6102,35 @@ class PD_Controller extends REST_Controller {
$client_count = 0;
if(array_key_exists('manufacturing_details',$client_form))
{
foreach($client_form['manufacturing_details'] as $manufacturing_details)
if(isset($client_form['manufacturing_details'][0]['main_raw_materials']))
{
$client_count = count($manufacturing_details['main_raw_materials']) ? ++$client_count: $client_count;
$client_count += count($client_form['manufacturing_details'][0]['main_raw_materials']) ? count($client_form['manufacturing_details'][0]['main_raw_materials']): 0;
}
}
if(array_key_exists('trade_details',$client_form))
{
foreach($client_form['trade_details'] as $trade_details)
if(isset($client_form['trade_details'][0]['trading_products']))
{
$client_count = count($trade_details['trading_products']) ? ++$client_count: $client_count;
$client_count += count($client_form['trade_details'][0]['trading_products']) ? count($client_form['trade_details'][0]['trading_products']): 0;
}
}
if(array_key_exists('service_provider_details',$client_form))
{
foreach($client_form['service_provider_details'] as $service_provider_details)
if(isset($client_form['service_provider_details'][0]['service_products']))
{
$client_count = count($service_provider_details['service_products']) ? ++$client_count: $client_count;
//print_r(count($client_form['service_provider_details'][0]['service_products']));
$client_count += count($client_form['service_provider_details'][0]['service_products']) ? count($client_form['service_provider_details'][0]['service_products']) : 0;
}
}
//echo $client_count;
// 17 - QNO(2.8) - atleast one client
$score_questions['business']['minimum_client_info'] = $client_count ? 'Provided':'Not Provided';
}

Binary file not shown.

View File

@ -1584,6 +1584,7 @@ class GETPROCESSEDJSON
{
if($business_assets_detail['business_assets_mode'] != "" || $business_assets_detail['business_assets_mode'] != null)
{
//echo $business_assets_detail['business_assets_mode'];
$CI->db->SELECT( $master_tables_field_names['ASSETTYPE'] );
$CI->db->FROM(ASSETTYPE);
$CI->db->WHERE('isactive',1);
@ -1592,6 +1593,7 @@ class GETPROCESSEDJSON
//print_r($CI->db->last_query());
if(count($assest_mode_name))
{
//print_r($assest_mode_name);
$raw_json['business_assets_details'][$business_assets_detail_key]['business_assets_mode_master'] = $assest_mode_name[0][$master_tables_field_names['ASSETTYPE']];
}
@ -1599,16 +1601,31 @@ class GETPROCESSEDJSON
{
$CI->db->SELECT( $master_tables_field_names['PROPERTIES'] );
$CI->db->FROM(PROPERTIES);
$CI->db->SELECT( $master_tables_field_names['ADDRESSTYPE'] );
$CI->db->FROM(ADDRESSTYPE);
$CI->db->WHERE('isactive',1);
$CI->db->WHERE( $master_tables_pkid['PROPERTIES'] ,$business_assets_detail['business_details'][0]['property_type']);
$CI->db->WHERE( $master_tables_pkid['ADDRESSTYPE'] ,$business_assets_detail['business_details'][0]['property_type']);
$assest_mode_name= $CI->db->GET()->result_array();
//print_r($CI->db->last_query());
//print_r($assest_mode_name);
if(count($assest_mode_name))
{
$raw_json['business_assets_details'][$business_assets_detail_key]['business_details'][0]['property_type_master'] = $assest_mode_name[0][$master_tables_field_names['PROPERTIES']];
$raw_json['business_assets_details'][$business_assets_detail_key]['business_details'][0]['property_type_master'] = $assest_mode_name[0][$master_tables_field_names['ADDRESSTYPE']];
}
// if($business_assets_detail['business_details'][0]['property_type'])
// {
// $CI->db->SELECT( $master_tables_field_names['ASSETTYPE'] );
// $CI->db->FROM(ASSETTYPE);
// $CI->db->WHERE('isactive',1);
// $CI->db->WHERE( $master_tables_pkid['ASSETTYPE'] ,$business_assets_detail['business_details'][0]['property_type']);
// $assest_type= $CI->db->GET()->result_array();
// //print_r($CI->db->last_query());
// if(count($assest_type))
// {
// $raw_json['business_assets_details'][$business_assets_detail_key]['business_details'][0]['business_details']['property_type_master'] = $assest_type[0][$master_tables_field_names['ASSETTYPE']];
// }
// }
}
if($business_assets_detail['business_assets_mode'] == 3)
@ -1629,7 +1646,8 @@ class GETPROCESSEDJSON
}
}
}
return $raw_json;
return ($raw_json);
}
/*****************########## END OF BUSINESS ASSETS FORM DETAILS ##########**************/

View File

@ -201,8 +201,8 @@ class PDSCORE
$actual_value_of_assets = $score_questions['general']['value_of_other_assets'];
$asset_calculation_details['actual_value_of_assets'] = round($actual_value_of_assets,2);
//echo 'actual_value_of_assets -'.$actual_value_of_assets;die();
//print_r($loan_amt_from_loam_form);
$loan_amount = $loan_amt_from_loam_form;
//print_r($loan_amt_from_loam_form);die();
$loan_amount = (int)$loan_amt_from_loam_form;
$asset_calculation_details['loan_amount'] = $loan_amount;
//echo 'loan_amount - '.$loan_amount;

View File

@ -0,0 +1,114 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?>
<html>
<head>
<script src="https://cdn.zingchart.com/zingchart.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Merriweather" rel="stylesheet">
<script>
zingchart.MODULESDIR = "https://cdn.zingchart.com/modules/";
ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "ee6b7db5b51705a13dc2339db3edaf6d"];
</script>
<style>
#myChart-wrapper {
margin: auto;
}
.zc-ref {
display: none;
}
</style>
</head>
<body>
<div id='myChart'><a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a></div>
<script>
var myConfig = {
"type": "hbar",
"font-family": "Helvetica",
"title": {
"text": "Detailed PD Score",
"font-family": "Arial",
"background-color": "none",
"font-color": "#A4A4A4",
"font-size": "14px"
},
"plot": {
"borderRadius": 8,
"hover-state": {
"visible": false
},
"animation": {
"delay": 0,
"effect": 1,
"speed": "0",
"method": "0",
"sequence": "3"
}
},
"plotarea": {
"margin": "60px 70px 20px 300px"
},
"scale-x": {
"line-color": "",
"values": ["Business Vintage >>", "Business Location suitability >>", "Seasonality >>", "Employee Strength >>", "Business Certifications Sighted >>","Business Premise Ownership >>", "Vehicle Ownership >>", "Business Activity Observed >>", "Supplier Information Shared >>", "Client Information Shared >>","Sufficiency of RM Stock Observed >>", "Sufficiency of Finished / Traded Stock Observed >>", "Main Business Banking Account Vintage >>"],
"tick": {
"visible": false
},
"guide": {
"visible": false
},
"item": {
"font-size": "10px",
"padding-right": "20px",
"auto-align": true,
"font-color": "#000"
}
},
"scale-y": {
"visible": false,
"guide": {
"visible": false
}
},
"series": [ {
"values": [42, 56, 77, 44, 81,42, 56, 77, 44, 81,50,89,100],
"bar-width": "25px",
"max-trackers": 0,
"value-box": {
"placement": "top",
"text": "%v%",
"decimals": 2,
"font-color": "#000",
"font-size": "12px"
},
"rules": [{
"rule": "%v <= 50",
"background-color": "#E53935"
}, {
"rule": "%v >= 50 && %i <= 70",
"background-color": "#ff9900"
}, {
"rule": "%v >= 70 && %i <= 80",
"background-color": "#99ff66"
}, {
"rule": "%v >= 80",
"background-color": "#33cc33"
}]
}]
};
zingchart.render({
id: 'myChart',
data: myConfig,
width: 800
});
</script>
</body>
</html>

View File

@ -998,7 +998,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$baRow = $pd_processed_forms[22][$business_count];
$businessAssetRow = json_decode($baRow['processed_json'],true);
//print_r($businessAssetRow);die();
//print_r($businessAssetRow);
$bindBusinessAsset["company_name"] ='Assets used for ';
$bindBusinessAsset["company_name"] .=MYUTIL::findCompanyName($all_company_details,$businessAssetRow['company_id'],1);
$bindBusinessAsset["company_name"] .=' Business :';
@ -1008,7 +1008,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
array_push($businessAssetResult,$bindBusinessAsset);
//print_r($businessAssetResult);
// print_r($businessAssetResult);die();
?>
<?php

View File

@ -3,6 +3,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
//echo $_SERVER['REQUEST_URI'];
$score = substr($_SERVER['REQUEST_URI'],(strripos($_SERVER['REQUEST_URI'],"?")+1));
//$score = 35.4;
?><!DOCTYPE html>
<html>
<title>PDSCORE CHART</title>
@ -93,10 +94,10 @@ $score = substr($_SERVER['REQUEST_URI'],(strripos($_SERVER['REQUEST_URI'],"?")+1
},
labels: ['0', '10', '20','30', '40', '50', '60', '70', '80', '90', '100'],
ring: {
size: 60,
size: 65,
rules: [{
rule: '%v <= 40',
backgroundColor: '#E53935'
backgroundColor: '#E53935',
}, {
rule: '%v > 40 && %v < 70',
backgroundColor: '#ff9900'
@ -119,11 +120,11 @@ $score = substr($_SERVER['REQUEST_URI'],(strripos($_SERVER['REQUEST_URI'],"?")+1
series: [{
values: [<?php echo $score;?>], // starting value
backgroundColor: 'black',
indicator: [10, 10, 10, 10, 0.75],
indicator: [10, 1, 20, 10, 0.24],
animation: {
effect: 2,
effect: 1,
method: 1,
sequence: 4,
sequence: 1,
speed: 500
},
}]

124
api/businees_scorecard.php Normal file
View File

@ -0,0 +1,124 @@
<?php
//defined('BASEPATH') OR exit('No direct script access allowed');
$data = $_POST;
print_r(($data));
foreach($data as $k => $d)
{
print_r($k);
echo "###################";
print_r($d);
echo "@@@@@@@@@@@@@@@@@";
}
//die();
?>
<html>
<head>
<script src="https://cdn.zingchart.com/zingchart.min.js"></script>
<link href="https://fonts.googleapis.com/css?family=Merriweather" rel="stylesheet">
<script>
zingchart.MODULESDIR = "https://cdn.zingchart.com/modules/";
ZC.LICENSE = ["569d52cefae586f634c54f86dc99e6a9", "ee6b7db5b51705a13dc2339db3edaf6d"];
</script>
<style>
#myChart-wrapper {
margin: auto;
}
.zc-ref {
display: none;
}
</style>
</head>
<body>
<div id='myChart'><a class="zc-ref" href="https://www.zingchart.com/">Powered by ZingChart</a></div>
<script>
var myConfig = {
"type": "hbar",
"font-family": "Helvetica",
"title": {
"text": "Detailed PD Score",
"font-family": "Arial",
"background-color": "none",
"font-color": "#A4A4A4",
"font-size": "14px"
},
"plot": {
"borderRadius": 8,
"hover-state": {
"visible": false
},
"animation": {
"delay": 0,
"effect": 1,
"speed": "0",
"method": "0",
"sequence": "3"
}
},
"plotarea": {
"margin": "60px 70px 20px 300px"
},
"scale-x": {
"line-color": "",
"values": ["Business Vintage >>", "Business Location suitability >>", "Seasonality >>", "Employee Strength >>", "Business Certifications Sighted >>","Business Premise Ownership >>", "Vehicle Ownership >>", "Business Activity Observed >>", "Supplier Information Shared >>", "Client Information Shared >>","Sufficiency of RM Stock Observed >>", "Sufficiency of Finished / Traded Stock Observed >>", "Main Business Banking Account Vintage >>"],
"tick": {
"visible": false
},
"guide": {
"visible": false
},
"item": {
"font-size": "10px",
"padding-right": "20px",
"auto-align": true,
"font-color": "#000"
}
},
"scale-y": {
"visible": false,
"guide": {
"visible": false
}
},
"series": [ {
"values": [42, 56, 77, 44, 81,42, 56, 77, 44, 81,50,89,100],
"bar-width": "25px",
"max-trackers": 0,
"value-box": {
"placement": "top",
"text": "%v%",
"decimals": 2,
"font-color": "#000",
"font-size": "12px"
},
"rules": [{
"rule": "%v <= 50",
"background-color": "#E53935"
}, {
"rule": "%v >= 50 && %i <= 70",
"background-color": "#ff9900"
}, {
"rule": "%v >= 70 && %i <= 80",
"background-color": "#99ff66"
}, {
"rule": "%v >= 80",
"background-color": "#33cc33"
}]
}]
};
zingchart.render({
id: 'myChart',
data: myConfig,
width: 800
});
</script>
</body>
</html>

View File

@ -77,7 +77,7 @@ switch (ENVIRONMENT)
case 'testing':
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_errors', 0);
break;
case 'production':
ini_set('display_errors', 0);