sparqapi/api/application/views/report_templates/JSONTOREPORT.php
2019-02-19 13:41:40 +05:30

297 lines
10 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
.page_break { page-break-before: always; }
@page {
margin: 50px 25px;
}
header {
position: fixed;
top: 10px;
left: 0px;
right: 0px;
height: 30px;
/** Extra personal styles **/
/*background-color: #03a9f4;
color: white;*/
text-align: center;
/* line-height: 35px;*/
}
footer {
position: fixed;
bottom: 5px;
left: 0px;
right: 0px;
height: 30px;
/** Extra personal styles **/
/*background-color: #03a9f4;
color: white;*/
text-align: right;
/*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;
}
</style>
</head>
<body >
<!-- Define header and footer blocks before your content
<header>
Our Code World
</header> -->
<footer>
<hr>
<div><img style="width:150;height:40px;" src='http://ssa.sineedge.com/sparqapi/logo/sinelogo.png' /></div>
</footer>
<!-- Wrap the content of your PDF inside a main tag -->
<?php
//echo "<br><br><br><br><br><br><br><br><br>";
setlocale(LC_MONETARY, 'en_IN');
echo "<div style='background-color:#add1eb;font-style:italic'>";
echo "<h1><center><data>PERSONAL DISCUSSION REPORT</data></center></h1> ";
echo "<center style='font-size:15px;font-style:italic;font-weight:bold'>for the case of</center>";
echo "<h2><center><data >".$pd_master_details[0]['title_name'].$pd_master_details[0]['main_applicant']."</data></center></h2>";
echo "</div>";
echo "<br><br><br><br>";
?>
<table>
<tbody>
<?php
echo "<tr><td>PD Report Date </td><td><data>".$pd_master_details[0]['updatedon']."</data></td>";
echo "<tr><td>PD Vist Date </td><td> <data>".$pd_master_details[0]['scheduled_on']."</data></td></tr>";
echo "<tr><td>PD Initiated by </td><td><data>".$pd_master_details[0]['branch_name']." </data>Branch</td></tr>";
echo "<tr><td>Loan Applicant ID </td><td> <data>".$pd_master_details[0]['lender_applicant_id']."</data></td></tr>";
echo "<tr><td>Product </td><td>".$pd_master_details[0]['product_name']."</td></tr>";
echo "<tr><td>Customer Segment </td><td>".$pd_master_details[0]['customer_segment_name']."<td></tr>";
?>
</tbody>
</table>
<?php
echo "<p>Loan Amount Applied For </p>";
echo "<p>
<table border=1 style='border-collapse:collapse;text-align:center;'>
<thead> <tr> <th>As Per PD Initiation</th> <th>As Per Loan Applicants during PD</th> </tr></thead>
<tbody>
<tr> <td>Rs " . number_format($pd_master_details[0]['loan_amount'],2). ".</td> <td> #### </td> </tr>
</tbody>
</table>
</p>";
echo "<div class='page_break'></div>";
//####################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'];
}
// echo MYUITIL::findCompanyName($all_company_details,2);
//print_r($all_company_details);
?>
<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)
{
echo ($individual['applicant_title_name_master'] .$individual['pd_co_applicant_id_master']);
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'];
}
}
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>'.$persons_with_relationship['relationship_master'] .' Of '.$persons_with_relationship['relation_to_master'];
//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)
{
echo "<tr><td>".$individual['applicant_title_name_master'].$individual['pd_co_applicant_id_master']."</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
print_r($company_with_relationship['company_relationship_master'] .' Of '.$company_with_relationship['company_name']);
}
}
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><br>";
print_r($persons_with_relationship['relationship_master'] .' Of '.$persons_with_relationship['relation_to_master']);
//print_r($persons_with_relationship);
}
}
echo "</tr>";
}
}
?>
</table>
<p>PD Officer's Note (About General Section) :</p> <?php echo $general_form['general_remark']; ?>
<?php $address_form = json_decode($pd_processed_forms[5][0]['processed_json'],true);
?>
<p><b>Location Details :</b></p>
<p><?php echo "The applicants were met at their ".$address_form['address_type_master']." at ".$address_form['address'].". The PD location is situated in an area that can be classified as ".$address_form['locality_master'].", and the approach was ".$address_form['pd_location_master'].". The locality was ".$address_form['comment_locality_master'].".";?></p>
<p><b>PD Officer's Note (About Location Details) :</b></p> <?php echo $address_form['address_form_remark']; ?>
<?php $loan_form = json_decode($pd_processed_forms[10][0]['processed_json'],true);?>
<br>
<p><b>Loan Details :</b></p>
<?php echo "A loan for Rs ".number_format($loan_form['loan_amount'])." (".MYUITIL::numtowords($loan_form['loan_amount']).") has been applied by the applicant for ".$loan_form['end_use_master'][0].".";
if($loan_form['is_transfer'] == 'yes')
{
echo "There is a balance transfer of Rs. ".number_format($loan_form['balance_transfer_amount'])." (".MYUITIL::numtowords($loan_form['balance_transfer_amount']).")from ".$loan_form['lender_master']."),and the balance top up of Rs.".$loan_form['topup_amount']." is to be used for ".$loan_form['end_use_topup_master'].". The applicants are comfortable to pay an EMI of Rs.".number_format($loan_form['emi_level'])." per month.";
}
else
{
$own_contribution_string = "";
if(count($loan_form['source_of_own_contribution_master']))
{
$own_contribution_string = implode(" , ",$loan_form['source_of_own_contribution_master']);
}
// echo $own_contribution_string;
// echo "#################".strripos($own_contribution_string,',');
if($loan_form['other_source'] != "")
{
$own_contribution_string = substr_replace($own_contribution_string,"and",strripos($own_contribution_string,','),1);
}
echo "The amount of Rs.".number_format($loan_form['own_contribution'])." as own contribution from ".$own_contribution_string.". The applicants are comfortable to pay an EMI of Rs.".number_format($loan_form['emi_level'])." per month.";
}
//print_r($loan_form['owners_list_master']);
$owners_list = "";
if(count($loan_form['owners_list_master']))
{
foreach($loan_form['owners_list_master'] as $owner)
{
$owners_list .= $owner." , ";
}
$owners_list = substr($owners_list,0,(strlen($owners_list)-2));
}
//echo "#################".strripos($owners_list,',');
$owners_list = substr_replace($owners_list," and ",strripos($owners_list,','),1);
echo "The property being mortgaged is a ".$loan_form['property_type_master']." owned by ".$owners_list.", and is ".$loan_form['construction_status_master']." with an estimated market value of Rs ".number_format($loan_form['emv_per_customer'])."(".MYUITIL::numtowords($loan_form['emv_per_customer']).")";
?>
<br>
<p><b>PD Officer's Note (About Loan Details) :<b></p> <?php echo $loan_form['loandetails_remarks']; ?>
<!-- ####################End Of General Section Statred########################-->
<!-- ####################Business Form Section Statred########################-->
<?php
echo "<div class='page_break'></div>";
echo "<h3>Business Related Information</h3>";
echo "count-".count($pd_processed_forms[13]);
if(count($pd_processed_forms[13]))
{
foreach($pd_processed_forms[13] as $pd_processed_form_key => $pd_processed_form)
{
//print_r($pd_processed_form['processed_json']);
$pd_processed_form = json_decode($pd_processed_form['processed_json'],true);
//print_r($pd_processed_form);
if($pd_processed_form != null || $pd_processed_form != "")
{
$name_of_the_business_entity = MYUITIL::findCompanyName($all_company_details,($pd_processed_form_key + 1));
echo "Name of the Business Entity : $name_of_the_business_entity";
}
}
}
?>
</body>
</html>