sparqapi/api/application/views/report_templates/JSONTOREPORT.php
2019-03-20 12:22:06 +05:30

410 lines
17 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet'>
<style type="text/css">
.page_break { page-break-before: always; }
@page {
margin: 100px 50px;
font-family:Helvetica,Arial;
}
header {
position: fixed;
top: -70px;
left: 0px;
right: 0px;
height: 20px;
/** Extra personal styles **/
/*background-color: #03a9f4;
color: white;*/
text-align: right;
/*line-height: 35px;*/
}
footer {
position: fixed;
bottom: 5px;
left: 0px;
right: 0px;
height: 30px;
font-size: 10px;
/** Extra personal styles **/
/*background-color: #03a9f4;
color: white;*/
text-align: left;
/*line-height: 35px;*/
}
.table2 {
border: 1px solid black;
width: 100%;
}
.table2 td {
border: 1px solid black;
height: 50px;
text-align: center;
}
.table2 th {
border: 1px solid black;
height: 50px;
text-align: center;
}
.table2 {
border-collapse: collapse;
}
tfoot{
color:#e00201;
}
/* #########Score Card Table Styles######### */
#scorecard_table {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse: collapse;
width: 100%;
}
#scorecard_table td, #scorecard_table th {
border: 1px solid #ddd;
padding: 8px;
}
#scorecard_table tr:nth-child(even){background-color: #f2f2f2;}
#scorecard_table tr:hover {background-color: #ddd;}
#scorecard_table th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #4CAF50;
color: white;
}
.customth { width: 10%; }
/* #########Score Card Table Styles######### */
</style>
</head>
<body style="font-size:14px;margin:25px 50px">
<footer>
<hr>
Copyright@Sineedge
</footer>
<header>
<div><img style="width:150;height:50px;opacity: 0.5;" src='http://ssa.sineedge.com/sparqapi/logo/sinelogo.png' /></div>
<hr>
</header>
<!-- Wrap the content of your PDF inside a main tag -->
<?php $loan_form = json_decode($pd_processed_forms[10][0]['processed_json'],true);
?>
<?php
echo "<br><br><br><br><br><br><br><br><br>";
setlocale(LC_MONETARY, 'en_IN');
echo "<div>";
echo "<h1><center>PERSONAL DISCUSSION REPORT</center></h1> ";
echo "<center style='font-size:15px;font-style:italic;font-weight:bold'>for the case of</center>";
echo "<h2><center>".$pd_master_details[0]['title_name'].$pd_master_details[0]['main_applicant']."</center></h2>";
echo "</div>";
echo "<br><br><br><br>";
?>
<table>
<tbody>
<?php
echo "<tr><td>PD Report Date </td> <td> </td> <td>".$pd_master_details[0]['updatedon']."</td>";
echo "<tr><td>PD Vist Date </td> <td> </td> <td> ".$pd_master_details[0]['scheduled_on']."</td></tr>";
echo "<tr><td>PD Initiated by </td> <td> </td> <td>".$pd_master_details[0]['branch_name']." Branch</td></tr>";
echo "<tr><td>Loan Application ID </td> <td> </td> <td> ".$pd_master_details[0]['lender_applicant_id']."</td></tr>";
echo "<tr><td>Product </td> <td> </td> <td>".$pd_master_details[0]['product_name']."</td></tr>";
echo "<tr><td>Customer Segment </td> <td> </td> <td>".$pd_master_details[0]['customer_segment_name']."<td></tr>";
?>
</tbody>
</table>
<?php
echo "<p>Loan Amount Applied For : </p>";
echo "<table style='border-collapse:collapse;text-align:right;padding:30px;'>
<tr> <td>As Per PD Initiation </td> <td> </td><td> </td><td> </td><td>Rs " . number_format($pd_master_details[0]['loan_amount'],2,'.',','). ".</td> </tr>
<tr> <td>As Per Loan Applicants during PD</td> <td> </td><td> </td><td> </td> <td>Rs " . number_format($loan_form['loan_amount'],2,'.',','). ".</td> </tr>
</table>
";
echo "<div class='page_break'></div>";
echo "<br><br>";
// ########################### End of Master Details Section ####################################
// ########################### Score Card Section ###############################################
echo "<h2>Executive Summary</h2>";
?>
<table>
<tr> <td>General Section Score</td> <td> </td> <td><?php echo number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',')?></td></tr>
<tr> <td>Business Section Score</td> <td> </td> <td><?php echo number_format($pd_score['score_summary']['business']['actual_score'],2,'.',',')?></td></tr>
<tr> <td>Final Remarks Score</td> <td> </td> <td><?php echo number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',')?></td></tr>
<tr> <td>Final PD Score</td> <td> </td> <td><?php echo number_format($pd_score['score_summary']['overall_score']['final_score'],2,'.',',')?></td> <td style="font-size:9px;">(Over all Acutal score (<?php echo number_format($pd_score['score_summary']['overall_score']['overall_actual_score'],2,'.',',');?>) / over all Maximum Score (<?php echo number_format($pd_score['score_summary']['overall_score']['overall_max_score'],2,'.',',');?> )) * 100)</td></tr>
</table>
<?php
//####################### CHART #############################
if(isset($base64_pdscore_chart_url))
{
echo "<br><br>";
echo '<p style="position:relative;"><img src="'.$base64_pdscore_chart_url.'" style="width:600px;height:350px;"/></p>';
}
else
{ echo "<b>Score Chart Not Generated</b>"; }
echo "<div style='position:relative;'></div>";
echo "<div class='page_break'></div>";
//######################### CHART ###########################
?>
<?php
// *** General Section Questions Score Table
echo '<table id="scorecard_table">';
echo "<tr> <th>General Questions L1(". $pd_score['general']['otp_done']['l1_weightage']."%) </th> <th>L2</th> <th>Answer</th> <th>Score</th> <th>Attributed Score</th> <th>Max Score</th></tr>";
foreach($pd_score['general'] as $key => $general)
{
$question = MYUTIL::findQuestionByKey($score_questions_display,$key);
$span = '<span style="font-size:9px">('.$general['l1_weightage'].'% * '. $general['l2_weightage'].'% * '.$general['score_band'].')</span>';
$max_span = '<span style="font-size:9px">('.$general['l1_weightage'].'% * '. $general['l2_weightage'].'% * '.$general['max_score_band'].')</span>';
echo '<tr>'.'<td>'.$question.'</td><td>'.$general['l2_weightage'] .'%</td><td>'.$general['answer'].
'</td><td>'.$general['score_band'].'</td><td>'.$general['attributed_score'].'<br>'.$span.'</td><td>'.$general['max_score'].'<br>'.$max_span.'</td></tr>';
}
echo "<tr> <td colspan='4'>General Section Sum of Attributed Score | Sum of Max Score </td> <td>".number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',')."</td> <td>".number_format($pd_score['score_summary']['general']['max_score'],2,'.',',')."</td> </tr>";
echo '</table>';
echo '<br><br>';
// *** Asset Caculation Score Table
echo '<table id="scorecard_table">';
echo "<tr> <th colspan='2'>Asset Value Calculaitons</th></tr>";
echo "<tr> <td>Actual Value Of Assets(a)</td><td>". number_format($pd_score['score_summary']['asset_calculation_details']['actual_value_of_assets'],2,'.',',')."</td></tr>";
echo "<tr> <td>Loan Amount(b)</td><td>". number_format($pd_score['score_summary']['asset_calculation_details']['loan_amount'],2,'.',',')."</td></tr>";
echo "<tr> <td>Avg Expected Value Of Assets(c)</td><td>". round($pd_score['score_summary']['asset_calculation_details']['avg_expected_value_of_assets'],2)."%</td></tr>";
echo "<tr> <td>Expected Value Of Assets(d = c*b)</td><td>". number_format($pd_score['score_summary']['asset_calculation_details']['expected_value_of_assets'],2,'.',',')."</td></tr>";
echo "<tr> <td>Actual Value Of Assets Percentage(e = (a/b) * 100)</td><td>". round($pd_score['score_summary']['asset_calculation_details']['actual_value_of_assets_percentage'],2)."%</td></tr>";
echo "<tr> <td>Variance(f = ((e-c)/c) * 100)</td><td>". round($pd_score['score_summary']['asset_calculation_details']['variance'],2)."</td></tr>";
echo "<tr> <td>Score As per Grid</td><td>". round($pd_score['score_summary']['asset_calculation_details']['score'],2)."</td></tr>";
echo '</table>';
echo '<br><br><br>';
// *** Final Remarks Questions Score Table
echo '<table id="scorecard_table">';
echo "<tr> <th>Final Remarks Questions L1(". $pd_score['final_remarks']['pd_officer_recommandations']['l1_weightage']."%)</th> <th>L2</th><th>Answer</th> <th>Score</th><th>Attributed Score</th> <th>Max Score</th></tr>";
foreach($pd_score['final_remarks'] as $key => $final_remark)
{
$question = MYUTIL::findQuestionByKey($score_questions_display,$key);
$span = '<span style="font-size:9px">('.$final_remark['l1_weightage'].'% * '. $final_remark['l2_weightage'].'% * '.$final_remark['score_band'].')</span>';
$max_span = '<span style="font-size:9px">('.$final_remark['l1_weightage'].'% * '. $final_remark['l2_weightage'].'% * '.$final_remark['max_score_band'].')</span>';
echo '<tr>'.'<td>'.$question.'</td><td>'.$final_remark['l2_weightage'].'%</td><td>'.$final_remark['answer'].'</td><td>'.$final_remark['score_band'].'</td><td>'.$final_remark['attributed_score'].'<br>'.$span.'</td><td>'.$final_remark['max_score'].'<br>'.$max_span.'</td></tr>';
}
echo "<tr> <td colspan='4'>Final Remarks Section Sum of Attributed Score | Sum of Max Score </td> <td>".number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',')."</td> <td>".number_format($pd_score['score_summary']['final_remarks']['max_score'],2,'.',',')."</td> </tr>";
echo '</table>';
echo '<br><br><br>';
print_r($pd_score['business']);
echo '<table id="scorecard_table">';
// *** Business Section Questions Score Table
echo "<tr> <th>Business Questions L1(". $pd_score['business']['no_of_years_business_run']['l1_weightage']."%)</th> <th>L2</th><th>Answer</th> <th>Score</th> <th>Attributed Score</th><th>Max Score</th></tr>";
$certificates = array();
foreach($pd_score['business'] as $key => $business)
{
$question = MYUTIL::findQuestionByKey($score_questions_display,$key);
$span = '<span style="font-size:9px">('.$business['l1_weightage'].'% * '. $business['l2_weightage'].'% * '.$business['score_band'].')</span>';
$max_span = '<span style="font-size:9px">('.$business['l1_weightage'].'% * '. $business['l2_weightage'].'% * '.$business['max_score_band'].')</span>';
if($key != 'cerificates')
{
echo '<tr>'.'<td>'.$question.'</td><td>'.$business['l2_weightage'].'%</td><td>'.$business['answer'].'</td><td>'.$business['score_band'].'</td><td>'.$business['attributed_score'].'<br>'.$span.'</td><td>'.$business['max_score'].'<br>'.$max_span.'</td></tr>';
}
if($key == 'cerificates')
{
$certificates = $business;
echo '<tr>'.'<td> Certificates </td><td>'.round($business['l2_weightage'],2).'%</td><td>'.'Refer Cert Table'.'</td><td>'.$business['score_band'].'</td><td>'.$business['attributed_score'].'</td><td>'.$general['max_score'].'</td></tr>';
}
}
echo "<tr> <td colspan='4'>Business Section Sum of Attributed Score | Sum of Max Score </td> <td>".number_format($pd_score['score_summary']['business']['actual_score'],2,'.',',')."</td> <td>".number_format($pd_score['score_summary']['business']['max_score'],2,'.',',')."</td> </tr>";
echo '</table>';
// *** Business Certificates Score Table
echo '</table>';
echo '<br><br>';
echo '<table id="scorecard_table">';
echo "<tr> <th>Business Certificates</th> <th>Answer</th> <th>Score</th> <th>Attributed Score</th> <th>Max Score</th></tr>";
$index = 0;
foreach($certificates as $key => $cerificate)
{
$index++;
if($index <=7)
{
$question = MYUTIL::findQuestionByKey($score_questions_display,$key);
$span = '<span style="font-size:9px">('.$cerificate['l1_weightage'].'% * '. $cerificate['l2_weightage'].'% * '.$cerificate['score_band'].')</span>';
$max_span = '<span style="font-size:9px">('.$cerificate['l1_weightage'].'% * '. $cerificate['l2_weightage'].'% * '.$cerificate['max_score_band'].')</span>';
echo '<tr>'.'<td>'.$question.'</td><td>'.$cerificate['answer'].'</td><td>'.$cerificate['score_band'].'</td><td>'.round($cerificate['attributed_score'],3).'<br>'.$span.'</td><td>'.round($cerificate['max_score'],3).'<br>'.$max_span.'</td></tr>';
}
}
echo "<table>";
// ########################### End Of Score Card Section #########################################
// ####################### General Section Statred ############################-->
$general_form = json_decode($pd_processed_forms[18][0]['processed_json'],true);
$persons_met = "Default";
$all_company_details = null;
if(array_key_exists('companies',$general_form))
{
$all_company_details = $general_form['companies'];
}
?>
<div class='page_break'></div>
<h3>General Section Information</h3>
<table>
<tbody>
<tr>
<td>Person(s) Met&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td><?php
foreach($general_form['individuals'] as $ind_key => $individual)
{
if($individual['is_person_met'] == true)
{
$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "Not Available" ;
echo '<br>'.$individual['applicant_title_name_master'] . $applicant_name ;
foreach($general_form['company_with_relationships'] as $company_with_relationship)
{
if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name'])
{
//FInd Company Name from JSON
echo '<br>'.$company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name'] . '<br>';
}
}
foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
{
if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null)
{
echo '<br>'. isset($persons_with_relationship['relationship_master']) ? $persons_with_relationship['relationship_master'] : "NA" .' Of '.$persons_with_relationship['relation_to_master'] . '<br>';
//print_r($persons_with_relationship);
}
}
}
}
?>
</td></tr>
</tbody>
</table>
<p>Loan Applicants</p>
<!-- <table border=1 style='border-collapse:collapse;'> -->
<table class="table2" >
<?php
foreach($general_form['individuals'] as $ind_key => $individual)
{
if($individual['is_applicant'] == true)
{
$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : "YYYY" ;
echo "<tr><td>".$individual['applicant_title_name_master'].$applicant_name."</td><td>";
foreach($general_form['company_with_relationships'] as $company_with_relationship)
{
if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name'])
{
//FInd Company Name from JSON
echo "<br>";
print_r($company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name']);
}
}
foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
{
//print_r($persons_with_relationship);
if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && $persons_with_relationship['relationship'] != null)
{
echo "<br><br>";
$RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : "RRRR";
print_r($persons_with_relationship['relationship_master'] .' Of '. $RSNA);
//print_r($persons_with_relationship);
}
}
echo "</tr>";
}
}
?>
</table>
<?php if($general_form['general_remark'] != "") { ?>
<p>PD Officer's Note (About General Section) :</p> <?php echo $general_form['general_remark'];
}
?>
<!-- ####################### End Of General Section Statred ############################-->
</body>
</html>