sparqapi/api/application/views/report_templates/JSONTOREPORT.php
2019-04-10 19:34:20 +05:30

1822 lines
69 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: 20px;
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>";
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;padding:30px;'>
<tr> <td style='text-align:right;'>As Per PD Initiation </td> <td> </td><td> </td><td> </td><td><span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>" . MYUTIL::customIndianNumberFormat($pd_master_details[0]['loan_amount']). "<br><span style='font-size:10px;'>(". MYUTIL::numtowords($pd_master_details[0]['loan_amount']) .")</span></td> </tr>
<tr> <td style='text-align:right;'>As Per Loan Applicants during PD</td> <td> </td><td> </td><td> </td> <td><span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>" . MYUTIL::customIndianNumberFormat($loan_form['loan_amount']). "<br><span style='font-size:10px;'>(". MYUTIL::numtowords($loan_form['loan_amount']) .")</span></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><img src="'.$base64_pdscore_chart_url.'" style="width:600px;height:350px;"/></p>';
}
else
{ echo "<b>Score Chart Not Generated</b>"; }
echo "<div class='page_break'></div>";
//######################### CHART ###########################
?>
<?php
// ####################### General Section Statred ############################-->
$general_form = json_decode($pd_processed_forms[18][0]['processed_json'],true);
//print_r($general_form);
$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>';
}
}
//print_r($general_form['persons_with_relationships']);die();
foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
{
if($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] && isset($persons_with_relationship['relationship']))
{
//echo '<br>'. isset($persons_with_relationship['relationship_master']) ? $persons_with_relationship['relationship_master'] : " Could Not Find" .' Of '.$persons_with_relationship['relation_to_master'] . '<br>';
//print_r($persons_with_relationship);
$RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : " Could Not Find";
isset($persons_with_relationship['relationship_master']) ? print_r($persons_with_relationship['relationship_master'] .' Of '. $RSNA) : "";
}
}
}
}
?>
</td></tr>
</tbody>
</table>
<p>Loan Applicants</p>
<!-- <table border=1 style='border-collapse:collapse;'> -->
<table class="scorecard_table" >
<?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'] : " Could Not Find" ;
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'] && isset($persons_with_relationship['relationship']))
{
echo "<br><br>";
$RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : " Could Not Find";
isset($persons_with_relationship['relationship_master']) ? 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 ############################-->
<!-- ####################### Address Details Section Statred ############################-->
<?php $address_form = json_decode($pd_processed_forms[5][0]['processed_json'],true);
//print_r($address_form);
?>
<p><b>Location Details :</b></p>
<p><?php
foreach($address_form['addresses'] as $address_key => $address)
{
$address_key == 0? $paragraph_starting_text = "The applicants were met at their ": $paragraph_starting_text = "The applicants were also met at their ";
$address_type = $address['address_type_others'] != "" ? $address['address_type_others'] : $address['address_type_master'];
$locality_type = $address['locality_others'] != "" ? $address['locality_others'] : $address['locality_master'];
echo $paragraph_starting_text.$address_type." at ".$address['address'].". The PD location is situated in an area that can be classified as ".$locality_type.", and the approach was ".$address['pd_location_master'].". The locality was ".$address['comment_locality_master'].".<br><br>";
}
if( $address_form['address_form_remark'] != "")
{
?></p>
<p><b>PD Officer's Note (About Location Details) :</b></p> <?php echo $address_form['address_form_remark'];
}
?>
<!-- ####################### End of Address Details Section ############################-->
<!-- ####################### Loan Details Details Section ############################-->
<br>
<p><b>Loan Details :</b></p>
<?php echo "<p>A loan for Rs ".MYUTIL::customIndianNumberFormat($loan_form['loan_amount'])." (".MYUTIL::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. ".MYUTIL::customIndianNumberFormat($loan_form['balance_transfer_amount'])." (".MYUTIL::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.".MYUTIL::customIndianNumberFormat($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.".MYUTIL::customIndianNumberFormat($loan_form['own_contribution'])." as own contribution from ".$own_contribution_string.". The applicants are comfortable to pay an EMI of Rs.".MYUTIL::customIndianNumberFormat($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 = count($loan_form['owners_list_master']) > 1 ? substr_replace($owners_list," and ",strripos($owners_list,','),1) : $owners_list ;
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'])."(".MYUTIL::numtowords($loan_form['emv_per_customer']).")</p>";
if($loan_form['loandetails_remarks'] != "" || $loan_form['loandetails_remarks'] != null)
{
?>
<br>
<p><b>PD Officer's Note (About Loan Details) :<b></p> <?php echo $loan_form['loandetails_remarks'];
}
?>
<!-- ####################### End of Loan Details Details Section ############################-->
<!-- ###########################Business section start#####################################-->
<div class='page_break'></div>
<?php
$businessResult=array();
foreach($pd_processed_forms[13] as $browKey=> $bRow) {
$businessRow = json_decode($bRow['processed_json'],true);
$companyList = MYUTIL::findCompanyName($all_company_details,$businessRow['company_id'],2);
//$companyList .=' The director details are as under :';
$bindEachResult["company_name"]=$companyList;
// this is for partner details
if(array_key_exists('partners',$businessRow)){
$bindEachResult["partner"]=Businessform::getPartnerDetails($businessRow['partners']);
}
else {
$getPartner=array();
$bindEachResult["partner"]=$getPartner;
}
// this is for person with relationship
if(array_key_exists('persons_with_relationships',$businessRow)){
$bindEachResult["family_members_involved"]=Businessform::getFamilyMemberDetails($businessRow['persons_with_relationships']);
}
else {
$getFamilyMembers=array();
$bindEachResult["family_members_involved"]=$getFamilyMembers;
}
// this is for manufacturing activities
if(array_key_exists('manufacturing_activity_details',$businessRow)){
$bindEachResult['manufacturing'] = Businessform::getActivityDetails($businessRow['manufacturing_activity_details'],1);
}
else{
$getManufacturingRow=array();
$bindEachResult['manufacturing']=$getManufacturingRow;
}
// this is for retail activites
if(array_key_exists('retail_trading_activity_details',$businessRow)){
$bindEachResult['retail'] = Businessform::getActivityDetails($businessRow['retail_trading_activity_details'],2);
}
else{
$getRetailRow=array();
$bindEachResult['retail']=$getRetailRow;
}
// this is for whole sale activites
if(array_key_exists('wholesale_trading_activity_details',$businessRow)){
$bindEachResult['wholesale'] = Businessform::getActivityDetails($businessRow['wholesale_trading_activity_details'],3);
}
else{
$getWholesaleRow=array();
$bindEachResult['wholesale']=$getWholesaleRow;
}
// this is for service provider
if(array_key_exists('service_provider_activity_details',$businessRow)){
$bindEachResult['serviceprovider']=Businessform::getActivityDetails($businessRow['service_provider_activity_details'],4);
}
else{
$getServiceproviderRow=array();
$bindEachResult['serviceprovider']=$getServiceproviderRow;
}
// this is for other activity details
if(array_key_exists('others_activity_details',$businessRow)){
$bindEachResult['otheractivity']=Businessform::getActivityDetails($businessRow['others_activity_details'],5);
}
else{
$getOtheractivityRow=array();
$bindEachResult['otheractivity']=$getOtheractivityRow;
}
// this if for get business peak period
if(strtoupper($businessRow['seasonality'])=='YES' && array_key_exists('peak_period_of_business',$businessRow)){
$bindEachResult['business_peak_details']=Businessform::getBusinessPeakDetails($businessRow['peak_period_of_business']);
}
else{
$bindEachResult['business_peak_details']='The Business has no major changes in sales across season.';
}
// this is for no of employess details
$bindEachResult['company_empployees']='As per person met there are '.$businessRow['employees_permanent'].' permanent and '.$businessRow['employees_temporary'].' temporary employees with company.';
$bindEachResult['officer_visit_company_empployees']='The PD Officer could notice approximately '.$businessRow['officer_total'] .' employees during the visit.';
//this is documents visited
$getDocuments=array();
if(array_key_exists('shop_eat_act_cert',$businessRow) && strtoupper($businessRow['shop_eat_act_cert'])=='YES'){
array_push($getDocuments,'Shop/Est act Certificate.');
}
if(array_key_exists('gst_Regn_cert',$businessRow) && strtoupper($businessRow['gst_Regn_cert'])=='YES'){
array_push($getDocuments,'GST Registration.');
}
if(array_key_exists('pf_regn',$businessRow) && strtoupper($businessRow['pf_regn'])=='YES'){
array_push($getDocuments,'PF Registration.');
}
if(array_key_exists('esic_regn',$businessRow) && strtoupper($businessRow['esic_regn'])=='YES'){
array_push($getDocuments,'ESIC Registration.');
}
if(array_key_exists('export_import_cert',$businessRow) && strtoupper($businessRow['export_import_cert'])=='YES'){
array_push($getDocuments,'Export/Import Certificate.');
}
if(array_key_exists('factory_cert',$businessRow) && strtoupper($businessRow['factory_cert'])=='YES'){
array_push($getDocuments,'Factory Certificate.');
}
if(strtoupper($businessRow['other_documents'])=='YES' && array_key_exists('documents',$businessRow)){
foreach($businessRow['documents'] as $docValue){
array_push($getDocuments,$docValue['document'].'.');
}
}
$bindEachResult['visit_documents']=$getDocuments;
array_push($businessResult,$bindEachResult);
}
?>
<h3>Business Details</h3>
<?php
foreach($businessResult as $bKey=>$fetchRow){
?>
<div><p><strong>About Company :</strong><span><?php echo $fetchRow['company_name'];?></span></p></div>
<div><p>The director details are as under :</p></div>
<table class="scorecard_table">
<thead>
<tr>
<th>Name</th>
<th>Share Holding</th>
<th>No.of Years in Current Business</th>
<th>Total Work Experience</th>
<th>Previous Experience</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['partner'] as $partRow){
?>
<tr>
<td><?php echo $partRow['name'] ?></td>
<td><?php echo $partRow['share_holding'] ?></td>
<td><?php echo $partRow['no_years_business'] ?></td>
<td><?php echo $partRow['total_experience']?></td>
<td><?php echo $partRow['previous_experience']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<!--this is for family members involved in business -->
<?php if(count($fetchRow['family_members_involved']) >0){ ?>
<div>
<p>Besides the above, the below family members are also involved in the business :</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Name</th>
<th>Relation</th>
<th>Designation</th>
<th>Started Business</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['family_members_involved'] as $familyRow){
?>
<tr>
<td><?php echo $familyRow['name'] ?></td>
<td><?php echo $familyRow['relation'] ?></td>
<td><?php echo $familyRow['designation'] ?></td>
<td><?php echo $familyRow['started_business']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }?>
<!-- end family members -->
<!-- start manufacturing -->
<?php if(count($fetchRow['manufacturing']) >0){ ?>
<div>
<p> The Manufacturing details are as under :</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Products</th>
<th>Area of Sale</th>
<th>Sales Done</th>
<th>Max Sales Done</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['manufacturing'] as $manuRow){
?>
<tr>
<td><?php echo $manuRow['products'] ?></td>
<td><?php echo $manuRow['area_of_sale'] ?></td>
<td><div><?php echo $manuRow['sales_done'] ?></div>
<?php if(array_key_exists('both_sales_done',$manuRow)) { ?>
<div><?php echo $manuRow['both_sales_done'] ?></div>
<?php } ?>
</td>
<td><?php echo $manuRow['max_sales_done']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end manufacturing -->
<!-- start retail -->
<?php if(count($fetchRow['retail']) >0){ ?>
<div>
<p> The Retail Trading details are as under :</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Products</th>
<th>Area of Sale</th>
<th>Sales Done</th>
<th>Max Sales Done</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['retail'] as $retailRow){
?>
<tr>
<td><?php echo $retailRow['products'] ?></td>
<td><?php echo $retailRow['area_of_sale'] ?></td>
<td><div><?php echo $retailRow['sales_done'] ?></div>
<?php if(array_key_exists('both_sales_done',$retailRow)) { ?>
<div><?php echo $retailRow['both_sales_done'] ?></div>
<?php } ?>
</td>
<td><?php echo $retailRow['max_sales_done']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end retail -->
<!-- start serviceprovider -->
<?php if(count($fetchRow['serviceprovider']) >0){ ?>
<div>
<p> The Service Provider details are as under :</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Services</th>
<th>Area of Sale</th>
<th>Services At</th>
<th>Max Revenue From</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['serviceprovider'] as $serviceproviderRow){
?>
<tr>
<td><?php echo $serviceproviderRow['products'] ?></td>
<td><?php echo $serviceproviderRow['area_of_sale'] ?></td>
<td><div><?php echo $serviceproviderRow['sales_done'] ?></div>
<?php if(array_key_exists('both_sales_done',$serviceproviderRow)) { ?>
<div><?php echo $serviceproviderRow['both_sales_done'] ?></div>
<?php } ?>
</td>
<td><?php echo $serviceproviderRow['max_sales_done']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end wholesale -->
<!-- serviceprovider start wholesale -->
<?php if(count($fetchRow['wholesale']) >0){ ?>
<div>
<p> The Wholesale Trading details are as under :</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Products</th>
<th>Area of Sale</th>
<th>Sales Done</th>
<th>Max Sales Done</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['wholesale'] as $wholesaleRow){
?>
<tr>
<td><?php echo $wholesaleRow['products'] ?></td>
<td><?php echo $wholesaleRow['area_of_sale'] ?></td>
<td><div><?php echo $wholesaleRow['sales_done'] ?></div>
<?php if(array_key_exists('both_sales_done',$wholesaleRow)) { ?>
<div><?php echo $wholesaleRow['both_sales_done'] ?></div>
<?php } ?>
</td>
<td><?php echo $wholesaleRow['max_sales_done']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end wholesale -->
<!-- start other activity-->
<?php if(count($fetchRow['otheractivity']) >0){ ?>
<div>
<p> Other activity details are as under :</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Other Business Activity</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['otheractivity'] as $otherRow){
?>
<tr>
<td><?php echo $otherRow['products'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end other avtivity -->
<!-- start this is business peak details -->
<?php if(array_key_exists('business_peak_details',$fetchRow)){ ?>
<div><p><?php echo $fetchRow['business_peak_details'];?></p></div>
<?php } ?>
<!-- end business peak period details -->
<!-- start company employee details -->
<p><?php echo $fetchRow['company_empployees'];?></p>
<p><?php echo $fetchRow['officer_visit_company_empployees'];?></p>
<!-- end company employee details -->
<!-- start documents details -->
<?php if(count($fetchRow['visit_documents'])){ ?>
<p>The below documents were sighted during the visit :</p>
<ol>
<?php foreach($fetchRow['visit_documents'] as $dValue) { ?>
<li><?php echo $dValue; ?></li>
<?php }?>
</ol>
<?php } ?>
<!-- end documents details -->
<?php } ?>
<!-- #################End OF Business section############################### -->
<!-- #################start business financial #################-->
<?php
$businessFinancialResult=array();
foreach($pd_processed_forms[14] as $rowKey=> $baRow) {
$businessFinancialRow = json_decode($baRow['processed_json'],true);
// statement
if(strtoupper($businessFinancialRow['is_financial_statements'])=='YES' && count($businessFinancialRow['date_per_financial'])>0){
$bindBusinessFinancial["company_name"] =MYUTIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1);
$bindBusinessFinancial["company_name"] .= count($businessFinancialRow['date_per_financial'])>1 ? ' provided with last '.count($businessFinancialRow['date_per_financial']).' years of financial statements and the snapshot is as below :' : ' we were provided with last '.count($businessFinancialRow['date_per_financial']).' year of financial statements and the snapshot is as below :';
$bindBusinessFinancial['statements']=FINANCIALFORM::getBusinessFinancialDetails($businessFinancialRow['date_per_financial']);
}
else {
$bindBusinessFinancial["company_name"] =MYUTIL::findCompanyName($all_company_details,$businessFinancialRow['company_id'],1);
$bindBusinessFinancial["company_name"] .=' not provided the financial statements :';
$bindBusinessFinancial['statements']=array();
}
// customer
if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && count($businessFinancialRow['estimated_value'])==0){
$bindBusinessFinancial["financial_customer"] ="As per customers, the financials are as below :";
$bindBusinessFinancial['customer_statements']=array();
$bindBusinessFinancial['customer_statements_header']=array();
}
else if(strtoupper($businessFinancialRow['is_financial_customer'])!='YES' && count($businessFinancialRow['estimated_value'])>0){
$bindBusinessFinancial["financial_customer"] ="As per customers, the financials are as below :";
$bindBusinessFinancial['customer_statements']=FINANCIALFORM::getBusinessCustomerFinancialDetails($businessFinancialRow['estimated_value']);
$bindBusinessFinancial['customer_statements_header']=FINANCIALFORM::getBusinessCustomerHeader($businessFinancialRow['estimated_value']);
}
else {
$bindBusinessFinancial["financial_customer"] ="As per customers, the financials are same as financial statement.";
$bindBusinessFinancial['customer_statements']=array();
$bindBusinessFinancial['customer_statements_header']=array();
}
array_push($businessFinancialResult,$bindBusinessFinancial);
}
?>
<h3>Financial Information</h3>
<?php if(count($businessFinancialResult)>0){ ?>
<?php foreach($businessFinancialResult as $iterateFinance){ ?>
<p><?php echo $iterateFinance['company_name']; ?></p>
<?php if(count($iterateFinance['statements'])>0){ ?>
<table class="scorecard_table">
<thead>
<tr>
<th>Year</th>
<th>Sales</th>
<th>Net Profit</th>
<th>Net Profit to Sales %</th>
<th>Net Loss</th>
<th>Net Loss to Sales %</th>
<th>% Variation in PY Sales</th>
<th>% Variation in PY Profit</th>
</tr>
</thead>
<tbody>
<?php foreach($iterateFinance['statements'] as $bfRow){
?>
<tr>
<td><?php echo $bfRow['financial_year'] ?></td>
<td><?php echo $bfRow['financial_annual_sale'] ?></td>
<td><?php echo $bfRow['financial_net_profit'] ?></td>
<td><?php echo $bfRow['financial_margin_of_profit'] ?></td>
<td><?php echo $bfRow['financial_net_loss'] ?></td>
<td><?php echo $bfRow['financial_margin_of_loss'] ?></td>
<td><?php echo $bfRow['sale_variation'] ?></td>
<td><?php echo $bfRow['profit_variation'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- customer finance statements-->
<p><?php echo $iterateFinance['financial_customer']; ?></p>
<?php if(count($iterateFinance['customer_statements'])>0){ ?>
<table class="scorecard_table">
<thead>
<tr>
<?php foreach($iterateFinance['customer_statements_header'] as $heRow){ ?>
<th><?php echo $heRow; ?></th>
<?php } ?>
</tr>
</thead>
<tbody>
<?php foreach($iterateFinance['customer_statements'] as $csRow){
?>
<tr>
<td>
<div><?php echo $csRow['estimate_sales_average'] ?></div>
<div><?php echo $csRow['estimate_sales_from_to'] ?></div>
</td>
<td>
<div><?php echo $csRow['estimate_net_margin'] ?></div>
<div><?php echo $csRow['estimate_net_margin_from_to']; ?></div>
</td>
<td>
<div><?php echo $csRow['estimate_net_margin_range'] ?></div>
<div><?php echo $csRow['estimate_net_margin_range_from_to']; ?></div>
</td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php } ?>
<?php }
else {?>
<p>Financial information is not available.</p>
<?php } ?>
<!--################# end business financial #################-->
<!-- #################client section start #################-->
<?php
$clientResult=array();
// this is for manufacturing
foreach($pd_processed_forms[2] as $rowKey=> $cRow) {
$clientRow = json_decode($cRow['processed_json'],true);
$bindEachResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1);
$getmanufacturing = array();
$getTrading=array();
$getService=array();
$getTotalPaymentsPercentonCredit=array();
if(array_key_exists('manufacturing_details',$clientRow)){
foreach($clientRow['manufacturing_details'] as $manuRow){
if(isset($manuRow['main_raw_materials'])){
$getmanufacturing = array_map(function($tag) {
return array(
'product' => $tag['manufacturing_product_name'],
'client_name' => $tag['manufacturing_client_name'],
'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '',
'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''),
'contact_person_name' => $tag['manufacturing_contact_person_name'],
'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'],
'payment_type_master' => array_key_exists('manufacturing_payment_type_master',$tag) ? $tag['manufacturing_payment_type_master'] : '',
);
}, $manuRow['main_raw_materials']);
array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']);
}
}
}
// this is for trading
if(array_key_exists('trade_details',$clientRow)){
foreach($clientRow['trade_details'] as $tradeRow){
if(isset($tradeRow['trading_products'])){
$getTrading = array_map(function($tag) {
return array(
'product' => $tag['trade_product_name'],
'client_name' => $tag['trade_client_name'],
'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '',
'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''),
'contact_person_name' => $tag['trade_product_contact_person_name'],
'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'],
'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'',
);
}, $tradeRow['trading_products']);
array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']);
}
}
}
//this is for service
if(array_key_exists('service_provider_details',$clientRow)){
foreach($clientRow['service_provider_details'] as $serviceRow){
if(isset($serviceRow['service_products'])){
$getService = array_map(function($tag) {
return array(
'product' => $tag['service_provider_product_name'],
'client_name' => $tag['service_provider_client_name'],
'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '',
'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''),
'contact_person_name' => $tag['service_provider_product_contact_person_name'],
'contact_person_mobile_number' => $tag['service_provider_product_contact_person_mobile_number'],
'payment_type_master' => array_key_exists('service_provider_product_payment_type_master',$tag) ? $tag['service_provider_product_payment_type_master'] :'',
);
}, $serviceRow['service_products']);
array_push($getTotalPaymentsPercentonCredit,$serviceRow['service_products_total_payments_percent_on_credit']);
}
}
}
$bindEachResult["details"]=array_merge($getmanufacturing,$getTrading,$getService);
$bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit;
array_push($clientResult,$bindEachResult);
}
?>
<h3>Client Details</h3>
<?php
foreach($clientResult as $fetchRow){
?>
<table class="scorecard_table">
<caption><?php echo $fetchRow['company_name'];?></caption>
<thead>
<tr>
<th>Product/Service</th>
<th>Client</th>
<th>Contact</th>
<th>Payment</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['details'] as $productRow){
?>
<tr>
<td><?php echo $productRow['product'] ?></td>
<td><?php echo $productRow['client_name'] ?></td>
<td><div><?php echo $productRow['person_title_name']. $productRow['contact_person_name']?></div>
<div><?php echo $productRow['person_designation']?></div>
<div><?php echo $productRow['contact_person_mobile_number']?></div>
</td>
<td><?php echo $productRow['payment_type_master'] ?></td>
</tr>
<?php } ?>
</tbody>
<?php foreach($fetchRow['total_payments_percent_on_credit'] as $creditRow){
if($creditRow != "" || $creditRow != null)
{
?>
<tfoot>
<tr>
<td colspan="4"><?php echo 'Approximately '.$creditRow.'%'.' of the business is running on credit to customers.' ?></td>
</tr>
</tfoot>
<?php }} ?>
</table>
<?php } ?>
<!-- #################client section end #################-->
<!-- #################supplier section start #################-->
<?php
$supplierResult=array();
// this is for manufacturing
foreach($pd_processed_forms[1] as $rowKey=> $row) {
$clientRow = json_decode($row['processed_json'],true);
$bindEachResult = array();
$bindEachResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1);
$getmanufacturing = array();
$getTrading=array();
$getTotalPaymentsPercentonCredit=array();
foreach($clientRow['manufacturing_details'] as $manuRow){
if(isset($manuRow['main_raw_materials'])){
$getmanufacturing = array_map(function($tag) {
return array(
'product' => $tag['manufacturing_raw_material_name'],
'supplier_name' => $tag['manufacturing_supplier_name'],
'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '',
'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''),
'contact_person_name' => $tag['manufacturing_contact_person_name'],
'contact_person_mobile_number' => $tag['manufacturing_contact_person_mobile_number'],
'payment_type_master' => $tag['manufacturing_payment_type_master'],
);
}, $manuRow['main_raw_materials']);
array_push($getTotalPaymentsPercentonCredit,$manuRow['main_raw_materials_total_payments_percent_on_credit']);
}
}
// this is for trading
foreach($clientRow['trade_details'] as $tradeRow){
if(isset($tradeRow['trading_products'])){
$getTrading = array_map(function($tag) {
return array(
'product' => $tag['trade_product_name'],
'supplier_name' => $tag['trade_supplier_name'],
'person_title_name' => array_key_exists('person_title_name_master',$tag) ? $tag['person_title_name_master'] : '',
'person_designation' => ($tag['person_designation']==1) ? $tag['other_person_designation'] : ($tag['person_designation']>1 ? $tag['person_designation_master']: ''),
'contact_person_name' => $tag['trade_product_contact_person_name'],
'contact_person_mobile_number' => $tag['trade_product_contact_person_mobile_number'],
'payment_type_master' => array_key_exists('trade_product_payment_type_master',$tag) ? $tag['trade_product_payment_type_master'] :'',
);
}, $tradeRow['trading_products']);
array_push($getTotalPaymentsPercentonCredit,$tradeRow['trading_products_total_payments_percent_on_credit']);
}
}
$bindEachResult["details"]=array_merge($getmanufacturing,$getTrading);
$bindEachResult['total_payments_percent_on_credit'] = $getTotalPaymentsPercentonCredit;
count($bindEachResult['details'])? array_push($supplierResult,$bindEachResult) : $supplierResult;
}
if(count($supplierResult))
{
?>
<h3>Supplier Details</h3>
<?php
foreach($supplierResult as $fetchRow){
?>
<table class="scorecard_table">
<caption><?php echo $fetchRow['company_name']; ?></caption>
<thead>
<tr>
<th>Raw Material/Trading</th>
<th>Supplier</th>
<th>Contact</th>
<th>Payment</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['details'] as $productRow){
?>
<tr>
<td><?php echo $productRow['product'] ?></td>
<td><?php echo $productRow['supplier_name'] ?></td>
<td><div><?php echo $productRow['person_title_name']. $productRow['contact_person_name']?></div>
<div><?php echo $productRow['person_designation']?></div>
<div><?php echo $productRow['contact_person_mobile_number']?></div>
</td>
<td><?php echo $productRow['payment_type_master'] ?></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<?php foreach($fetchRow['total_payments_percent_on_credit'] as $creditRow){ ?>
<tr>
<td colspan="4"><?php echo 'Approximately '.$creditRow.'%'.' of the business is running on credit to customers.' ?></td>
</tr>
<?php } ?>
</tfoot>
</table>
<?php }} ?>
<!-- #################supplier section end ##################################-->
<!-- #################start stock section #################-->
<?php
$stockResult=array();
foreach($pd_processed_forms[11] as $browKey=> $stRow) {
$stockRow = json_decode($stRow['processed_json'],true);
$bindStockResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$stockRow['company_id'],1);
// this is for stock manufacturing details
if(count($stockRow['manufacturing_details'][0]['manufacturing_raw_materials']) > 0 || count($stockRow['manufacturing_details'][0]['manufacturing_finished_goods']) > 0){
$bindStockResult["manufacturing"]=Stockform::getStockManufacturingDetails($stockRow['manufacturing_details'][0]['manufacturing_raw_materials'], $stockRow['manufacturing_details'][0]['manufacturing_finished_goods']);
}
else {
$bindStockResult["manufacturing"]=array();
}
// this is for stock retail details
if(count($stockRow['retail_details'][0]['retail_traded_goods']) > 0){
$bindStockResult["retail"]=Stockform::getStockRetailDetails($stockRow['retail_details'][0]['retail_traded_goods']);
}
else {
$bindStockResult["retail"]=array();
}
// this is for stock whole sale details
if(count($stockRow['trade_details'][0]['trading_traded_goods']) > 0){
$bindStockResult["wholesale"]=Stockform::getStockWholesaleDetails($stockRow['trade_details'][0]['trading_traded_goods']);
}
else {
$bindStockResult["wholesale"]=array();
}
count($bindStockResult['wholesale']) || count($bindStockResult['retail']) || count($bindStockResult['manufacturing'])? array_push($stockResult,$bindEachResult) : $stockResult;
}
?>
<?php if(count($stockResult)){ ?>
<h3>Stock Details</h3>
<?php foreach($stockResult as $getstRow) { ?>
<h3><?php echo $getstRow['company_name']; ?></h3>
<!-- manufacturing -->
<?php if(count($getstRow['manufacturing'])>0) { ?>
<p>The Manufacturing stock details are as under :</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Qty</th>
<th>UOM</th>
<th>Value</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php foreach($getstRow['manufacturing'] as $pstRow){
?>
<tr>
<td><?php echo $pstRow['type'] ?></td>
<td><?php echo $pstRow['name'] ?></td>
<td><?php echo $pstRow['quantity'] ?></td>
<td><?php echo $pstRow['uom'] ?></td>
<td><?php echo $pstRow['value'] ?></td>
<!-- <td><?php echo $pstRow['is_sufficiant'] ?></td> -->
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- Retail -->
<?php if(count($getstRow['retail'])>0) { ?>
<p>The Retail trading stock details are as under :</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Name</th>
<th>Qty</th>
<th>UOM</th>
<th>Value</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php foreach($getstRow['retail'] as $reRow){
?>
<tr>
<td><?php echo $reRow['name'] ?></td>
<td><?php echo $reRow['quantity'] ?></td>
<td><?php echo $reRow['uom'] ?></td>
<td><?php echo $reRow['value'] ?></td>
<td><?php echo $reRow['is_sufficiant'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- wholesale -->
<?php if(count($getstRow['wholesale'])>0) { ?>
<p>The Wholesale trading stock details are as under :</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Name</th>
<th>Qty</th>
<th>UOM</th>
<th>Value</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php foreach($getstRow['wholesale'] as $wsRow){
?>
<tr>
<td><?php echo $wsRow['name'] ?></td>
<td><?php echo $wsRow['quantity'] ?></td>
<td><?php echo $wsRow['uom'] ?></td>
<td><?php echo $wsRow['value'] ?></td>
<td><?php echo $wsRow['is_sufficiant'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php } ?>
<?php }
else {?>
<!-- <p> Stock details is not available.</p> -->
<?php } ?>
<!-- #################end stock section #################-->
<!-- #################start business asset #################-->
<?php
$businessAssetResult=array();
foreach($pd_processed_forms[22] as $rowKey=> $baRow) {
$businessAssetRow = json_decode($baRow['processed_json'],true);
$bindBusinessAsset["company_name"] ='Assets used for ';
$bindBusinessAsset["company_name"] .=MYUTIL::findCompanyName($all_company_details,$businessAssetRow['company_id'],1);
$bindBusinessAsset["company_name"] .=' Business :';
if(count($businessAssetRow['business_assets_details'])>0){
$bindBusinessAsset['details']=ASSETSFORM::getBusinessAssetsDetails($businessAssetRow['business_assets_details']);
}
array_push($businessAssetResult,$bindBusinessAsset);
}
?>
<h3>Asset Details</h3>
<?php
//print_r($businessAssetResult);die();
if(count($businessAssetResult)>0){ ?>
<?php foreach($businessAssetResult as $iterateAsset){ ?>
<p><?php echo $iterateAsset['company_name']; ?></p>
<table class="scorecard_table">
<thead>
<tr>
<th>Asset</th>
<th>Owned By</th>
<th>Details</th>
<th>Market Value</th>
</tr>
</thead>
<tbody>
<?php foreach($iterateAsset['details'] as $baRow){
?>
<tr>
<td><?php echo $baRow['business_assets_mode'] ?></td>
<td><?php echo $baRow['business_name_of_the_owner'] ?></td>
<td><?php echo $baRow['about_business_assets'] ?></td>
<td><?php echo $baRow['business_approximate_market_value'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php }
else {?>
<p>Business asset is not available.</p>
<?php } ?>
<!-- #################end business asset #################-->
<!-- #################start other asset section #################-->
<?php
$otherAssetResult=array();
foreach($pd_processed_forms[4] as $rowKey=> $oaRow) {
$otherAssetRow = json_decode($oaRow['processed_json'],true);
if(count($otherAssetRow['assets_details'])>0){
$otherAssetResult=ASSETSFORM::getOthersAssetsDetails($otherAssetRow['assets_details']);
//print_r($otherAssetResult);die();
}
}
?>
<h3>Personal Assets</h3>
<?php if(count($otherAssetResult)>0){ ?>
<table class="scorecard_table">
<thead>
<tr>
<th>Asset</th>
<th>Owned By</th>
<th>Details</th>
<th>Market Value</th>
</tr>
</thead>
<tbody>
<?php foreach($otherAssetResult as $paRow){
?>
<tr>
<td><?php echo $paRow['assets_mode']; ?></td>
<td><?php echo $paRow['name_of_the_owner']; ?></td>
<td><?php echo $paRow['about_assets']; ?></td>
<td><?php echo $paRow['approximate_market_value']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
else {?>
<p>Personal asset is not available.</p>
<?php } ?>
<!-- end other asset section -->
<!-- start other income section -->
<?php
$otherIncomeResult=array();
foreach($pd_processed_forms[9] as $rowKey=> $iRow) {
$otherIcomeRow = json_decode($iRow['processed_json'],true);
if(strtoupper($otherIcomeRow['other_income'])=='YES' && count($otherIcomeRow['income_details'])>0){
$otherIncomeResult=OTHERINCOMEFORM::getIncomeDetails($otherIcomeRow['income_details']);
}
}
?>
<h3>Other Income Details</h3>
<?php if(count($otherIncomeResult)>0){ ?>
<p>The below mentioned other source of income were shared :</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Income Type</th>
<th>Amount</th>
<th>Frequency</th>
</tr>
</thead>
<tbody>
<?php foreach($otherIncomeResult as $oiRow){
?>
<tr>
<td><?php echo $oiRow['source'] ?></td>
<td><?php echo $oiRow['amount'] ?></td>
<td><?php echo $oiRow['frequency'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
else {?>
<p>Other source of income is not available.</p>
<?php } ?>
<!-- end other income section -->
<!-- start business / individual banking section -->
<?php
$bankingResult=array();
// individual banking
foreach($pd_processed_forms[7] as $rowKey=> $ibRow) {
$individualBankRow = json_decode($ibRow['processed_json'],true);
if(count($individualBankRow['banking_details'])>0){
$getIndividualEachValues=BANKINGFORM::getIndividualBankingDetails($individualBankRow['banking_details']);
$bankingResult = array_merge($bankingResult,$getIndividualEachValues);
}
}
// business banking
foreach($pd_processed_forms[21] as $rowKey=> $bbRow) {
$businessBankRow = json_decode($bbRow['processed_json'],true);
if(count($businessBankRow['banking_details'])>0){
$getEachValues=BANKINGFORM::getBusinessBankingDetails($businessBankRow['banking_details']);
$bankingResult = array_merge($bankingResult,$getEachValues);
}
}
?>
<h3>Banking Details</h3>
<?php if(count($bankingResult)>0){ ?>
<p>Below bank account details were shared :</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Account Name</th>
<th>Bank Name</th>
<th>Account Type</th>
<th>Main Business Account</th>
<th>OD / CC Limit</th>
<th>Vintage</th>
</tr>
</thead>
<tbody>
<?php foreach($bankingResult as $bdRow){
?>
<tr>
<td><?php echo $bdRow['account_name'] ?></td>
<td><?php echo $bdRow['bank_name'] ?></td>
<td><?php echo $bdRow['account_type'] ?></td>
<td><?php echo $bdRow['main_business'] ?></td>
<td><?php echo $bdRow['od_cc_limit'] ?></td>
<td><?php echo $bdRow['vintage'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
else {?>
<p>Bank account details is not available.</p>
<?php } ?>
<!-- #################end business / individual banking section #################-->
<!-- #################start Existing Loan obligations section################# -->
<?php
$existLoanResult=array();
foreach($pd_processed_forms[8] as $rowKey=> $elRow) {
$otherLoanRow = json_decode($elRow['processed_json'],true);
if(strtoupper($otherLoanRow['existing_loan'])=='YES' && count($otherLoanRow['loan_details'])>0){
$existLoanResult=FINANCIALFORM::getOtherLoanDetails($otherLoanRow['loan_details']);
}
}
?>
<?php if(count($existLoanResult)>0){ ?>
<h3>Other Financial Information</h3>
<p>The below current loan obligations were shared :</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Loan Type</th>
<th>Amount</th>
<th>Loan Taken From</th>
<th>Installment</th>
<th>
<div>Tenure</div>
<div>(Original - Current = Elapsed)</div>
</th>
<th>Loan taken by</th>
</tr>
</thead>
<tbody>
<?php foreach($existLoanResult as $elRow){
?>
<tr>
<td><?php echo $elRow['loan_type'] ?></td>
<td><?php echo $elRow['loan_amount'] ?></td>
<td><?php echo $elRow['lender'] ?></td>
<td><?php echo $elRow['emi'] ?></td>
<td>
<?php echo $elRow['original_tenure'].' - '.$elRow['current_balance_tenure'].' = '. $elRow['elapsed_tenure']?> </div>
</td>
<td><?php echo $elRow['loan_taken_by'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
else {?>
<!-- <p>Current loan obligations is not available.</p> -->
<?php } ?>
<!-- #################end Existing Loan obligations section ################# -->
<!-- #################start family section #################-->
<?php
$familyResult=array();
foreach($pd_processed_forms[6] as $rowKey=> $fRow) {
$familyRow = json_decode($fRow['processed_json'],true);
if(array_key_exists('family_details',$familyRow) && count($familyRow['family_details'])>0){
$familyResult=OTHERFAMILYFORM::getFamilyDetails($familyRow['family_details']);
}
}
?>
<h3>Other Family Details</h3>
<?php if(count($familyResult)>0){ ?>
<?php foreach($familyResult as $fmKey=>$fmValue) { ?>
<p><strong><?php echo ($fmKey+1).'. '.$fmValue['selected_person']; ?></strong></p>
<table class="scorecard_table">
<tbody>
<tr>
<td>Address of Residence</td>
<td><?php echo $fmValue['residency_address'] ?></td>
</tr>
<tr>
<td>No.of Years Residing here</td>
<td><?php echo $fmValue['residence_No_of_years'] ?></td>
</tr>
<tr>
<td>Ownership</td>
<td><?php echo $fmValue['residence_ownership'] ?></td>
</tr>
<tr>
<td>No.of Family Members</td>
<td><?php echo $fmValue['no_family_members'] ?></td>
</tr>
</tbody>
</table>
<p>Family of <?php echo $fmValue['selected_person']." :";?></p>
<table class="scorecard_table">
<thead>
<tr>
<th>Name</th>
<th>Relation</th>
<th>Age</th>
<th>Earning Status</th>
</tr>
</thead>
<tbody>
<?php foreach($fmValue['family_members_details'] as $fmRow){
?>
<tr>
<td><?php echo $fmRow['name'] ?></td>
<td><?php echo $fmRow['family_member_relationship'] ?></td>
<td><?php echo $fmRow['family_member_age'] ?></td>
<td><?php echo $fmRow['family_member_earning'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }?>
<?php }
else{?>
<p>Other Family Members is not available.</p>
<?php }?>
<!-- #################end family section #################-->
<!-- #################start neighbourhood/reference check #################-->
<?php
$existNeighRefCheck=array();
foreach($pd_processed_forms[19] as $rowKey=> $nrcRow) {
$neighbourRefRow = json_decode($nrcRow['processed_json'],true);
if(count($neighbourRefRow['neighbourhood_list'])>0){
$existNeighRefCheck=NEIGHBOURREFERENCECHECKFORM::getNeighbourhoodDetails($neighbourRefRow['neighbourhood_list'],$pd_master_details[0]);
}
// if(&& count($neighbourRefRow['referencecheck_list'])>0){
// $existNeighRefCheck=NEIGHBOURREFERENCECHECKFORM::getReferenceDetails($neighbourRefRow['referencecheck_list'],$pd_master_details[0]);
// }
}
?>
<h3>Neighbourhood / Reference Check</h3>
<?php if(count($existNeighRefCheck)>0){ ?>
<ol>
<?php foreach($existNeighRefCheck as $nfValue) { ?>
<li style="margin: 15px 0;"><?php echo $nfValue; ?></li>
<?php }?>
</ol>
<?php }
else{?>
<p>Neighbourhood / Reference Check is not available.</p>
<?php }?>
<!-- #################end neighbourhood/reference check #################-->
<!-- #################Final Remarks Section#################-->
<h3>Final Remarks Section</h3>
<?php $final_remark_data = json_decode($pd_processed_forms[20][0]['processed_json'],true) ;
//echo $final_remark_data['is_service_provided'];
//echo isset($final_remark_data['pd_officers_recommendation_master'])?$final_remark_data['pd_officers_recommendation_master']:'NIL';
//echo isset($final_remark_data['final_custormer_remark_type_master'])?$final_remark_data['final_custormer_remark_type_master']:'NIL';
$Polite = array('url' => "https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/slightly-smiling-face.png",'name_to_display' => 'Polite','selected'=>0);
$Rude = array('url' => "https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/pouting-face.png",'name_to_display' => 'Rude','selected'=>0);
$Others = array('url' => "https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/confused-face.png",'name_to_display' => 'Other Negative','selected'=>0);
//$Polite = ' kjdhflksd dkldnldgdf';
$behavoiur = trim($final_remark_data['final_custormer_remark_type_master']);
$behavoiur = $$behavoiur;
$behavoiur['selected'] = 1;
//print_r($behavoiur);
//print_r($Rude);
$pd_officers_recommendation_data = array();
switch($final_remark_data['pd_officers_recommendation'])
{
case 1: //others
$pd_officers_recommendation_data['comments'] = array($final_remark_data['others_pd_officers_recommendation']);
break;
case 4: //refer to credit
if(count($final_remark_data['recommendation_refer_to_credit']))
{
foreach($final_remark_data['recommendation_refer_to_credit'] as $comment){
$pd_officers_recommendation_data['comments'][] = $comment['reason_for_refer_to_credit'];
}
}
break;
case 3: //refer to credit
if(count($final_remark_data['recommendation_negative']))
{
foreach($final_remark_data['recommendation_negative'] as $comment){
$pd_officers_recommendation_data['comments'][] = $comment['reason_for_negative'];
}
}
break;
case 2: //refer to credit
if(count($final_remark_data['recommendation_positive']))
{
foreach($final_remark_data['recommendation_positive'] as $comment){
$pd_officers_recommendation_data['comments'][] = $comment['reason_for_positive'];
}
}
break;
}
//print_r($pd_officers_recommendation_data);
$fairly_suited = array('url' => 'https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/thumbs-up.png','name_to_display','name_to_display'=>'Fairly Suited');
$well_suited = array('url' => 'https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/ok-hand.png','name_to_display'=>'Well Suited');
$not_suited = array('url' => 'https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/cross-mark.png','name_to_display'=>'Not Suited');
$location = $final_remark_data['is_service_provided'];
$location = $$location;
//recommendation
$_4 = array('url'=>'https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/backhand-index-pointing-right.png','name_to_display'=>'Refer to credit');
$_1 = array('url'=>'https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/o-button-blood-type.png','name_to_display'=>'Others');
$_2 = array('url'=>'https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/heavy-plus-sign.png','name_to_display'=>'Positive');
$_3 = array('url'=>'https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-12/256/heavy-minus-sign.png','name_to_display'=>'Negative');
$recommendation = '_'.$final_remark_data['pd_officers_recommendation'];
$recommendation = $$recommendation;
//print_r($recommendation);
?>
<table>
<tr> <td>Customer Behavior</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><div <?php if($behavoiur['name_to_display'] == $Polite['name_to_display']){ echo "style='border-style: inset;'";}?>><img height="50" width="50" src ="<?php echo $Polite['url'];?>" alt=""></div><?php echo '<span>'.$Polite['name_to_display'].'</span>';?></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><div <?php if($behavoiur['name_to_display'] == $Rude['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $Rude['url'];?>" alt=""></div><?php echo '<span>'.$Rude['name_to_display'].'</span>'?></td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><div <?php if($behavoiur['name_to_display'] == $Others['name_to_display']){ echo "style='border-style: inset;'";}?>><img height="50" width="50" src ="<?php echo $Others['url'];?>" alt=""></div><?php echo '<span>'.$Others['name_to_display'].'</span>'?></td>
</tr>
<tr> <td>PD Officer Status</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><div <?php if($location['name_to_display'] == $fairly_suited['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $fairly_suited['url'];?>" alt=""></div><?php echo '<span>'.$fairly_suited['name_to_display'].'</span>'?><td>
<td><div <?php if($location['name_to_display'] == $well_suited['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $well_suited['url'];?>" alt=""></div><?php echo '<span>'.$well_suited['name_to_display'].'</span>'?><td>
<td><div <?php if($location['name_to_display'] == $not_suited['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $not_suited['url'];?>" alt=""></div><?php echo '<span>'.$not_suited['name_to_display'].'</span>'?><td>
</tr>
<tr> <td>Business Location</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td><div <?php if($recommendation['name_to_display'] == $_2['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $_2['url'];?>" alt=""></div><?php echo '<span>'.$_2['name_to_display'].'</span>'?><td>
<td><div <?php if($recommendation['name_to_display'] == $_3['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $_3['url'];?>" alt=""></div><?php echo '<span>'.$_3['name_to_display'].'</span>'?><td>
<td><div <?php if($recommendation['name_to_display'] == $_4['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $_4['url'];?>" alt=""></div><?php echo '<span>'.$_4['name_to_display'].'</span>'?><td>
<td><div <?php if($recommendation['name_to_display'] == $_1['name_to_display']){ echo "style='border-style: inset;'";}?> ><img height="50" width="50" src ="<?php echo $_1['url'];?>" alt=""></div><?php echo '<span>'.$_1['name_to_display'].'</span>'?><td>
</tr>
<tr> <td>Business Location Comments</td> <td colspan="3"><?php if(count($pd_officers_recommendation_data['comments'])){foreach($pd_officers_recommendation_data['comments'] as $display){ echo '<br>'.$display;}}?></td></tr>
</table>
<div class="page_break"></div>
<!-- #################End Final Remarks Section#################-->
<h3>Details Score Card Section</h3>
<?php
$i = 1;
if($i)
{
// *** General Section Questions Score Table
echo '<table class="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 class="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 class="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 class="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>'.$business['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 class='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;
print_r($certificates);
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 #########################################
?>
</body>
</html>