SMC FEEDBACK 2

This commit is contained in:
Velz2020 2021-02-23 00:05:20 +05:30
parent e552dfebb7
commit 5c929baf86
4 changed files with 109 additions and 90 deletions

View File

@ -1480,35 +1480,35 @@ public function filterSalesPDList_post() {
//print_r(count($view_data['smc_images']));die();
//score card part
$score_card_questions = $this->seperateScorecardQuestions($view_data);
$view_data['pd_score'] = SMCPDSCORE::genericDIPDScoreCalculate($score_card_questions,$view_data['pd_master_details']);
$final_score = round($view_data['pd_score']['score_summary']['overall_score']['final_score'],1);
// echo $final_score;die();
//GET phantom script from DB
$phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => PHANTOMJSSCRIPT_LOCATION),SCRIPTS);
// $score_card_questions = $this->seperateScorecardQuestions($view_data);
// $view_data['pd_score'] = SMCPDSCORE::genericDIPDScoreCalculate($score_card_questions,$view_data['pd_master_details']);
// $final_score = round($view_data['pd_score']['score_summary']['overall_score']['final_score'],1);
// // echo $final_score;die();
// //GET phantom script from DB
// $phantom_script = $this->PD_Model->selectCustomRecords(array('*'),array('script_name' => PHANTOMJSSCRIPT_LOCATION),SCRIPTS);
$exact_script = $phantom_script[0]['script_content'];
// print_r($exact_script);die();
$apppath = str_replace('\\','/',$this->external_path.'/pd_reports/'.$records['pd_id']);
$exact_script = str_replace('{{APPPATH}}',$apppath,$exact_script);
$exact_script = str_replace('{{place_score_here}}',$final_score,$exact_script);
//print_r($exact_script);die();
// $exact_script = $phantom_script[0]['script_content'];
// // print_r($exact_script);die();
// $apppath = str_replace('\\','/',$this->external_path.'/pd_reports/'.$records['pd_id']);
// $exact_script = str_replace('{{APPPATH}}',$apppath,$exact_script);
// $exact_script = str_replace('{{place_score_here}}',$final_score,$exact_script);
// //print_r($exact_script);die();
//GENERATE CHART PART
file_put_contents(APPPATH.'/views/js/phantomchart.js',$exact_script,LOCK_EX);
// //GENERATE CHART PART
// file_put_contents(APPPATH.'/views/js/phantomchart.js',$exact_script,LOCK_EX);
$str = 'phantomjs '.APPPATH.'/views/js/phantomchart.js';
exec($str,$ou);
exec('phantom.exit();');
// $str = 'phantomjs '.APPPATH.'/views/js/phantomchart.js';
// exec($str,$ou);
// exec('phantom.exit();');
//print_r($ou);
// //print_r($ou);
$chart_img_path = $this->external_path.'/pd_reports/'.$records['pd_id'].'/chart.png';
$type = pathinfo($chart_img_path, PATHINFO_EXTENSION);
$chart_img_content = file_get_contents($chart_img_path);
$base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($chart_img_content);
$view_data['base64_pdscore_chart_url'] = $base64_pdscore_chart_url;
// $chart_img_path = $this->external_path.'/pd_reports/'.$records['pd_id'].'/chart.png';
// $type = pathinfo($chart_img_path, PATHINFO_EXTENSION);
// $chart_img_content = file_get_contents($chart_img_path);
// $base64_pdscore_chart_url = 'data:image/' . $type . ';base64,' . base64_encode($chart_img_content);
// $view_data['base64_pdscore_chart_url'] = $base64_pdscore_chart_url;
// echo $base64_pdscore_chart_url;
// die();
//score card part
@ -1519,7 +1519,7 @@ public function filterSalesPDList_post() {
//End of PDF Gen using DOM PDF
$output_file = $this->external_path ."/pd_reports/" . $records['pd_id'] . "/temp.pdf";
$bytes = file_put_contents($output_file, $pdf_doc);
// echo $bytes;die();
//echo $bytes;die();
$bucket_name = LENDER_BUCKET_NAME_PREFIX.(ENVIRONMENT == 'production' ? 7 : 35);
$key = 'pd'.$records['pd_id'].'/pd_reports/'.$pdf_name.'.pdf';
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$output_file);

View File

@ -276,7 +276,8 @@ class readexceldata
$return_data = array();
foreach ($arr as $key => $value)
{
if($value)
if(is_string($value) || is_numeric($value))
// if($value)
{
$return_data[$key] = $value;
}

View File

@ -70,24 +70,35 @@ class smc_creditpd
$json = json_decode($section['json'],true);
$person_met = '';
$mobile_numbers_array = array();
foreach ($json['borrower_details'] as $key => $value)
{
$mobile_numbers = '';
if(isset($value['mobile_numbers']) && count($value['mobile_numbers']))
{
foreach ($value['mobile_numbers'] as $k => $smn)
{
if((count($value['mobile_numbers']) - 1) == $k){$mobile_numbers .= ($smn['mobile_no']); break;}
$mobile_numbers .= ($smn['mobile_no'].',');
$mobile_numbers .= ($smn['mobile_no'].',<br>');
}
$json['borrower_details'][ $key ] ['mobile_numbers'] = $mobile_numbers;
if($mobile_numbers)
{
$mobile_numbers_array[('##'.$k.'##')] = '( ' . str_replace('<br>', '', $mobile_numbers) . ' ) ';
}
}
if(isset($value['borrower_met']) && !strcasecmp($value['borrower_met'],'yes'))
{
$temp_person_met = $value['borrower_name'];
$temp_person_met .= ($mobile_numbers != '' ? '(' .$mobile_numbers. ') ,': ',');
$temp_person_met = $value['borrower_name'].', ';
if(isset($value['mobile_numbers']) && count($value['mobile_numbers']))
{
$temp_person_met = $value['borrower_name'].'##'.$k.'## , ';
}
//$temp_person_met .= ($mobile_numbers != '' ? '(' .$mobile_numbers. ') ,': ',');
$person_met .= $temp_person_met;
}
$mobile_numbers = '';
@ -107,6 +118,12 @@ class smc_creditpd
}
}
// print_r($person_met);
// print_r($mobile_numbers_array);
foreach ($mobile_numbers_array as $key => $value)
{
$person_met = str_replace($key, $value, $person_met);
}
$json['person_met'] = $person_met;
return $json;

View File

@ -298,11 +298,11 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</table>
<?php
echo '<div id="page_break"> </div>';
echo '<h2 contenteditable="true">PD Score Summary</h2>';
// echo '<div id="page_break"> </div>';
// echo '<h2 contenteditable="true">PD Score Summary</h2>';
?>
<table class="scorecard_table">
<!-- <table class="scorecard_table">
<tr> <th> </th> <th>Actual Score</th> <th>Max Score</th> <th>Score %</th> </tr>
<tr> <td>General Section Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['general']['max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['general']['score_per'],1).'%'?></td></tr>
@ -311,86 +311,87 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<tr> <td>Final Remarks Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['final_remarks']['max_score'],2,'.',',')?></td><td class="customtd"> <?php echo round($pd_score['score_summary']['final_remarks']['score_per'],1).'%'?></td></tr>
<tr> <td>Final PD Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['overall_score']['overall_actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['overall_score']['overall_max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['overall_score']['final_score'],1).'%'?></td></tr>
</table>
</table> -->
<?php
//####################### CHART #############################
if(isset($base64_pdscore_chart_url))
{
echo "<br><br>";
// if(isset($base64_pdscore_chart_url))
// {
// echo "<br><br>";
echo '<p><img src="'.$base64_pdscore_chart_url.'" style="width:600px;height:350px;"/></p>';
echo '<div id="page_break"> </div>';
// echo '<p><img src="'.$base64_pdscore_chart_url.'" style="width:600px;height:350px;"/></p>';
// echo '<div id="page_break"> </div>';
$business_captions = array("no_of_years_business_run" => "Business Vintage >>", "location_suited_for_busienss" => "Business Location suitability >>", "business_seasonality" => "Seasonality >>", "employees_total" => "Employee Strength >>", "cerificates" => "Business Certifications Sighted >>","owned_property" => "Business Premise Ownership >>", "owned_vechile" => "Vehicle Ownership >>", "business_activity_has_seen" => "Business Activity Observed >>", "minimum_supplier_info" => "Supplier Information Provided >>", "minimum_client_info" => "Client Information Provided >>","stock_visited" => "RM/FG Stock Sufficiency >>", "stock_finished_goods_enough" => "Finished/Traded Stock Sufficiency >>", "vintage_of_business_account" => "Main Business Banking Account Vintage >>");
//$business_captions = array("no_of_years_business_run" => "Business Vintage >>", "location_suited_for_busienss" => "Business Location suitability >>", "business_seasonality" => "Seasonality >>", "employees_total" => "Employee Strength >>", "cerificates" => "Business Certifications Sighted >>","owned_property" => "Business Premise Ownership >>", "owned_vechile" => "Vehicle Ownership >>", "business_activity_has_seen" => "Business Activity Observed >>", "minimum_supplier_info" => "Supplier Information Provided >>", "minimum_client_info" => "Client Information Provided >>","stock_visited" => "RM/FG Stock Sufficiency >>", "stock_finished_goods_enough" => "Finished/Traded Stock Sufficiency >>", "vintage_of_business_account" => "Main Business Banking Account Vintage >>");
$general_captions = array("otp_done" => "OTP authentication done >>","person_met_is_applicant" => "Is person Met, a loan applicant >>","qualification" => "Qualification of Loan Applicants >>","comment_locality" => "Comment on Locality >>","approcah_to_pd_location" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neighbourhood_status" => "Neighbourhood check >>","name_board_seen" => "Business Board Sighted >>","value_of_other_assets" => "Asset Value by Loan Amount % >>");
//$general_captions = array("otp_done" => "OTP authentication done >>","person_met_is_applicant" => "Is person Met, a loan applicant >>","qualification" => "Qualification of Loan Applicants >>","comment_locality" => "Comment on Locality >>","approcah_to_pd_location" => "Approach to PD location >>","customer_behaviour" => "Customer Behaviour >>","neighbourhood_status" => "Neighbourhood check >>","name_board_seen" => "Business Board Sighted >>","value_of_other_assets" => "Asset Value by Loan Amount % >>");
// echo '<div id="page_break"> </div>';
echo '<table class="mini_scorecard_table">';
echo '<tr> <th style="width:70%;font-size:16px;" colspan="2">Business Related Parameters Impacting Score</th> <th style="width:30%;font-size:16px;">Response</th> </tr>';
// echo '<table class="mini_scorecard_table">';
// echo '<tr> <th style="width:70%;font-size:16px;" colspan="2">Business Related Parameters Impacting Score</th> <th style="width:30%;font-size:16px;">Response</th> </tr>';
echo '<tbody>';
foreach($pd_score['business'] as $bsk => $business_score)
{
// echo '<tbody>';
// foreach($pd_score['business'] as $bsk => $business_score)
// {
$class = null;
$answer = null;
$per = $business_score['attributed_score'] > 0 && $business_score['max_score'] > 0 ? ( ($business_score['attributed_score'] / $business_score['max_score']) * 100) : 0;
// $class = null;
// $answer = null;
// $per = $business_score['attributed_score'] > 0 && $business_score['max_score'] > 0 ? ( ($business_score['attributed_score'] / $business_score['max_score']) * 100) : 0;
$class = ( $per >= 80 ? 'rcorners_green' : ($per >= 65 && $per < 80 ? 'rcorners_light_green' : ($per >= 50 && $per < 65 ? 'rcorners_amber' : 'rcorners_red')));
// $class = ( $per >= 80 ? 'rcorners_green' : ($per >= 65 && $per < 80 ? 'rcorners_light_green' : ($per >= 50 && $per < 65 ? 'rcorners_amber' : 'rcorners_red')));
if($bsk == 'location_suited_for_busienss')
{
//$answer = $address_type_remarks_caption[ $business_score['answer'] ];
$answer = $business_score['answer'];
}
else if($bsk == 'no_of_years_business_run')
{
$answer = isset($business_score['answer']) ? $business_score['answer'].' Yrs' : '';
}
else if($bsk == 'business_seasonality')
{
$answer = isset($business_score['answer']) ? ((!strcasecmp($business_score['answer'], 'yes')) ? 'Seasonal': 'Not Seasonal') : '';
}
else
{
$answer = isset($business_score['answer']) ? $business_score['answer'] : '';
}
// if($bsk == 'location_suited_for_busienss')
// {
// //$answer = $address_type_remarks_caption[ $business_score['answer'] ];
// $answer = $business_score['answer'];
// }
// else if($bsk == 'no_of_years_business_run')
// {
// $answer = isset($business_score['answer']) ? $business_score['answer'].' Yrs' : '';
// }
// else if($bsk == 'business_seasonality')
// {
// $answer = isset($business_score['answer']) ? ((!strcasecmp($business_score['answer'], 'yes')) ? 'Seasonal': 'Not Seasonal') : '';
// }
// else
// {
// $answer = isset($business_score['answer']) ? $business_score['answer'] : '';
// }
if(strcasecmp($answer,'Not Applicable'))
{
echo '<tr> <td style="width:70%;">'. $business_captions[$bsk] .'</td> <td style="width:30%;">'. '<div id="'. $class .'"></div></td> <td class="customtd">'. ucfirst($answer).'</td> </tr>';
}
}
echo '</tbody>';
echo '</table>';
echo '<br><br><br>';
// if(strcasecmp($answer,'Not Applicable'))
// {
// echo '<tr> <td style="width:70%;">'. $business_captions[$bsk] .'</td> <td style="width:30%;">'. '<div id="'. $class .'"></div></td> <td class="customtd">'. ucfirst($answer).'</td> </tr>';
// }
// }
// echo '</tbody>';
// echo '</table>';
// echo '<br><br><br>';
echo '<table class="mini_scorecard_table">';
echo '<tr> <th style="width:70%;font-size:16px;" colspan="2">Other Parameters Impacting Score</th><th style="width:30%;font-size:16px;">Response</th> </tr>';
// echo '<table class="mini_scorecard_table">';
// echo '<tr> <th style="width:70%;font-size:16px;" colspan="2">Other Parameters Impacting Score</th><th style="width:30%;font-size:16px;">Response</th> </tr>';
echo '<tbody>';
foreach($pd_score['general'] as $gsk => $general_score)
{
$class = null;
$per = $general_score['attributed_score'] > 0 && $general_score['max_score'] > 0 ? ( ($general_score['attributed_score'] / $general_score['max_score']) * 100) : 0;
// echo '<tbody>';
// foreach($pd_score['general'] as $gsk => $general_score)
// {
// $class = null;
// $per = $general_score['attributed_score'] > 0 && $general_score['max_score'] > 0 ? ( ($general_score['attributed_score'] / $general_score['max_score']) * 100) : 0;
$class = ( $per >= 80 ? 'rcorners_green' : ($per >= 65 && $per < 80 ? 'rcorners_light_green' : ($per >= 50 && $per < 65 ? 'rcorners_amber' : 'rcorners_red')));
// $class = ( $per >= 80 ? 'rcorners_green' : ($per >= 65 && $per < 80 ? 'rcorners_light_green' : ($per >= 50 && $per < 65 ? 'rcorners_amber' : 'rcorners_red')));
$answer = ucfirst($general_score['answer']);
if(strcasecmp($answer,'Not Applicable'))
{
echo '<tr> <td style="width:70%;">'. $general_captions[$gsk] .'</td> <td style="width:30%;">'. '<div id="'. $class .'"></div></td> <td class="customtd">'. $answer.'</td> </tr>';
}
}
echo '</tbody>';
echo '</table>';
// $answer = ucfirst($general_score['answer']);
// if(strcasecmp($answer,'Not Applicable'))
// {
// echo '<tr> <td style="width:70%;">'. $general_captions[$gsk] .'</td> <td style="width:30%;">'. '<div id="'. $class .'"></div></td> <td class="customtd">'. $answer.'</td> </tr>';
// }
// }
// echo '</tbody>';
// echo '</table>';
// echo '<div id="page_break"> </div>';
}?>
//}?>
<div id="page_break"> </div>
<table class="scorecard_table">