sparqapi/api/application/views/report_templates/JSONTOREPORT.php
2019-05-09 23:14:41 +05:30

2389 lines
101 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<link href="https://fonts.googleapis.com/css?family=Merriweather" rel="stylesheet">
<style type="text/css">
.page_break { page-break-before: always; }
@page {
margin: 100px 50px;
/*font-family:Helvetica,Arial;*/
font-family:Merriweather;
}
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;*/
/*font-family: Merriweather;*/
border-collapse: collapse;
width: 100%;
}
.scorecard_table td, .scorecard_table th {
border: 1px solid #000;
padding: 8px;
}
.scorecard_table tr:nth-child(even){background-color: #f2f2f2;}
.scorecard_table tr:hover {background-color: #ddd;}
.scorecard_table th {
padding-top: 8px;
padding-bottom: 8px;
text-align: center;
background-color: #0191ed;
color: white;
}
.customth { width: 10%; }
/* #########Score Card Table Styles######### */
.customtd { text-align:center; }
.customtd_leftalign { text-align:left; }
.customtd_rightalign { text-align:right; }
#boxstyle1 {
box-sizing: border-box;
width: 60px;
height: 20px;
padding: 5px;
border: 2px outset black;
}
#boxstyle2 {
box-sizing: border-box;
width: 200px;
height: 20px;
padding: 5px;
border: 2px outset black;
}
#boxstyle3 {
box-sizing: border-box;
width: 120px;
height: 20px;
padding: 5px;
border: 2px outset black;
}
</style>
</head>
<body style="font-size:12px;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);
$main_applicant_name = $pd_master_details[0]['title_name'].' '.$pd_master_details[0]['main_applicant'];
$rupee_symbol = "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>";
?>
<?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>".$main_applicant_name."</center></h2>";
echo "</div>";
echo "<br><br><br><br>";
?>
<table>
<tbody>
<?php
echo "<tr><td>PD Initiated Date </td> <td> </td> <td> ".$pd_master_details[0]['pd_date_of_initiation']."</td></tr>";
echo "<tr><td>PD Vist Date </td> <td> </td> <td> ".$pd_master_details[0]['scheduled_on']."</td></tr>";
echo "<tr><td>PD Report Date </td> <td> </td> <td>".$pd_master_details[0]['pd_report_generated_date']."</td>";
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>";
?>
<!-- GENERAL INFORMATIN -->
<?php
$general_form = json_decode($pd_processed_forms[18][0]['processed_json'],true);
$total_no_of_business = count($general_form['companies']);
$persons_met = "Default";
$all_company_details = null;
if(array_key_exists('companies',$general_form))
{
$all_company_details = $general_form['companies'];
}
?>
<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.'<br>' ;
$company_relationship_data = null;
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
$company_relationship_data .= $company_with_relationship['company_relationship_master'].' '.$company_with_relationship['company_name'];
$company_relationship_data.='<br><center>and</center><br>';
}
}
//print_r($general_form['persons_with_relationships']);die();
$personal_relationship_data = null;
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']))
{
$RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : " Could Not Find";
if(isset($persons_with_relationship['relationship_master']))
{
$personal_relationship_data .= $persons_with_relationship['relationship_master'] .' Of '. $RSNA;
$personal_relationship_data.='<br><center>and</center><br>';
}
}
}
$company_relationship_data .= $personal_relationship_data;
//echo $company_relationship_data;
echo substr_replace($company_relationship_data, '', strrpos($company_relationship_data, '<br><center>and</center><br>'),strlen($company_relationship_data));
}
}
?>
</td></tr>
</tbody>
</table>
<!-- sdfs
<table class="scorecard_table">
<tr> <th>Name</th> <th>Age(Years)</th> <th>Qualification</th> <th>Relationships</th> <tr>
<tbody>
<tr> <td>Name</td> <td>Age</td> <td>Qualification</td> <td>Relationship</td> <tr>
<tr> <td>Name2</td> <td>Age2</td> <td>Qualification2</td> <td>Relationship2</td> <tr>
</tbody>
</table>-->
<br><br><br>
<p>Loan Applicants</p>
<table class="scorecard_table">
<tr> <th>Name</th> <th>Age<br>(Yrs)</th> <th>Qualification</th> <th>Relationships</th> </tr>
<tbody>
<?php
//print_r($general_form['individuals']);
foreach($general_form['individuals'] as $ind_key => $individual)
{
if($individual['is_applicant'] == true)
{
$education_qualification = $individual['qualification_master'];
$education_qualification = $individual['course_name'] != "" || $individual['course_name'] != null ? $education_qualification.'<br>('.$individual['course_name'].')' : $education_qualification;
$applicant_name = array_key_exists('pd_co_applicant_id_master',$individual) ? $individual['pd_co_applicant_id_master'] : " Could Not Find" ;
//echo $applicant_name.'**************************';
echo "<tr><td>".$individual['applicant_title_name_master'].' '.$applicant_name."</td><td>".$individual['age']."</td><td>".$education_qualification."</td><td>";
$company_relationship_data = null;
//print_r($general_form['company_with_relationships']);
foreach($general_form['company_with_relationships'] as $company_with_relationship)
{
//print_r($company_with_relationship);
if($individual['pd_co_applicant_id'] == $company_with_relationship['applicant_name'])
{
//FInd Company Name from JSON
//echo "ONCE";
$company_relationship_data = ($company_with_relationship['company_relationship_master'] .' '.$company_with_relationship['company_name']);
$company_relationship_data.='<br><center>and</center><br>';
}
}
//echo '*********'.$company_relationship_data.'*********';
//echo strrpos($company_relationship_data, '');
// $company_relationship_data = substr_replace($company_relationship_data, '', strrpos($company_relationship_data, '<br><center>and</center><br>'),strlen($company_relationship_data));
// echo $company_relationship_data;
$personal_relationship_data = null;
foreach($general_form['persons_with_relationships'] as $persons_with_relationship)
{
if(($individual['pd_co_applicant_id'] == $persons_with_relationship['pd_co_applicant_id'] || !strcasecmp($applicant_name,$persons_with_relationship['applicant_name']))&& isset($persons_with_relationship['relationship']))
{
$RSNA = isset($persons_with_relationship['relation_to_master']) ? $persons_with_relationship['relation_to_master'] : " Could Not Find";
if(isset($persons_with_relationship['relationship_master']))
{
$personal_relationship_data .= $persons_with_relationship['relationship_master'] .' of '. $RSNA;
$personal_relationship_data.='<br><center>and</center><br>';
}
}
}
$company_relationship_data .= $personal_relationship_data;
echo substr_replace($company_relationship_data, '', strrpos($company_relationship_data, '<br><center>and</center><br>'),strlen($company_relationship_data));
echo "</td></tr>";
}
}
?>
</tbody>
</table>
<div class='page_break'></div>
<?php
// if($general_form['general_remark'] != "") { ?>
<!-- <p>PD Officers Note (About General Section) :</p> --><?php //echo $general_form['general_remark'];
// }
?>
<!-- ########################### End of Cover Page Section ####################################-->
<!-- ########################### Score Card Section ############################################### -->
<?php
$is_show_scorecard = 1;
if($is_show_scorecard)
{
echo "<h2>PD Score Summary</h2>";
?>
<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> <?php echo number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',')?></td> <td><?php echo number_format($pd_score['score_summary']['general']['max_score'],2,'.',',')?></td> <td> <?php echo round($pd_score['score_summary']['general']['score_per'],2)?></td></tr>
<tr> <td>Business Section Score</td> <td> <?php echo number_format($pd_score['score_summary']['business']['actual_score'],2,'.',',')?></td> <td><?php echo number_format($pd_score['score_summary']['business']['max_score'],2,'.',',')?></td> <td> <?php echo round($pd_score['score_summary']['business']['score_per'],2)?></td></tr>
<tr> <td>Final Remarks Score</td> <td> <?php echo number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',')?></td> <td><?php echo number_format($pd_score['score_summary']['final_remarks']['max_score'],2,'.',',')?></td><td> <?php echo round($pd_score['score_summary']['final_remarks']['score_per'],2)?></td></tr>
<tr> <td>Final PD Score</td> <td> <?php echo number_format($pd_score['score_summary']['overall_score']['overall_actual_score'],2,'.',',')?></td> <td><?php echo number_format($pd_score['score_summary']['overall_score']['overall_max_score'],2,'.',',')?></td> <td> <?php echo round($pd_score['score_summary']['overall_score']['final_score'],2)?></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 ###########################
}
?>
<!-- ####################### Address Details Section Statred ############################-->
<?php
$address_form = json_decode($pd_processed_forms[5][0]['processed_json'],true);
$final_remark_data = json_decode($pd_processed_forms[20][0]['processed_json'],true) ;
$business_assets_details = json_decode($pd_processed_forms[22][0]['processed_json'],true);
?>
<p><b>PD LOCATION</b></p>
<p><?php
$pd_address = $address_form['addresses'][0];
$pincode = $pd_address['pincode_others'] != "" || $pd_address['pincode_others'] != null ? $pd_address['pincode_others'] : $pd_address['pincode_master'];
echo '<b>PD Location Address : </b>'.$pd_address['address'].' ,'.$pd_address['city_master'].' ,'.$pd_address['state_master'].' - '.$pincode;
echo '<br><br><b> GPS Coordinates of location where PD Visit was done : </b>'.$pd_master_details[0]['start_location'];
?>
<img src =<?php echo $pd_master_details[0]['satellite_image_base64_blob'];?> alt="Satellite Image of location of Where PD was Done" style="width:400;height:200px;" /><br><br><br>
<!-- <img src ='http://ssa.sineedge.com/sparqapi/logo/sinelogo.png' alt="Approch to PD Location" style="width:150;height:50px;" />
<img src ='http://ssa.sineedge.com/sparqapi/logo/sinelogo.png' alt="Name Board" style="width:150;height:50px;" /> -->
<br><p><b>Location Summary</b></p>
<?php
$address_type = $pd_address['address_type_master'];
$estimated_area = $pd_address['estimated_area'].' ';
$estimated_area .= $pd_address['uom_others'] != "" || $pd_address['uom_others'] != null ? $pd_address['uom_others'] : $pd_address['uom_master'];
$locality = $pd_address['locality_master'];
$locality = preg_match("/^[aeiouAEIOU]/U", $locality) ? 'an '.$locality : 'a '.$locality;
$property_owner_type = $business_assets_details['business_assets_for_address'][0]['business_ownership_type'];
if($property_owner_type == 'rented') { $property_owner_type ='Rented (Rent Rs'.$business_assets_details['business_assets_for_address'][0]['business_monthly_rented_amt'].' Per Month)'; }else{$property_owner_type = 'Owned'; }
$yrs_being_run = $business_assets_details['business_assets_for_address'][0]['business_years'].' Years';
if($business_assets_details['business_assets_for_address'][0]['business_month'] != ""){ $yrs_being_run.= ' and '.$business_assets_details['business_assets_for_address'][0]['business_month'].' Months';}
echo "The PD visit was done at ". $address_type. " of the loan applicants.";
echo "The ".$address_type." is ".$property_owner_type." and the business has
been operation here for the last $yrs_being_run.";
echo "<br><br>The ".$address_type." is located in ".$locality." and the estimated area of the office is ".$estimated_area." .";
echo "<br><br>The PD location was ". $pd_address['pd_location_master'].", and the locality in which the ".$address_type ." is situated is ".$pd_address['comment_locality_master'] .", as per the general observations made during the visit by PD officer.";
echo "<br><br>The PD officer also made the following observations:" ;
echo "<br><ul>";
echo "<li> The location of the ".$address_type." is ".$final_remark_data['is_service_provided']." to the nature of business. </li>";
if($business_assets_details['business_assets_for_address'][0]['business_is_pd_visited'] == 'yes')
{
echo "<li>Business Activity was seen during visit.</li>";
}
else{
echo "<li>No business activity was seen during the PD visit</li>";
}
if(isset($business_assets_details['business_assets_form_remark'])){
echo "<li>".$business_assets_details['business_assets_form_remark'] ."</li>";}
echo "</ul>";
if($address_form['address_form_remark'])
{
echo $address_form['address_form_remark'];}
echo "<div class='page_break'></div>";
//die();
?>
<!-- ####################### End of Address Details Section ############################-->
<!-- ####################### Loan Details Details Section ############################-->
<p><b>LOAN DETAILS:</b></p>
<?php
//print_r($loan_form);
$loan_amount = MYUTIL::customIndianNumberFormat($loan_form['loan_amount']);
echo "During the PD visit,".$main_applicant_name.", provided the following information about the loan applied for:";
$loan_table_dispaly_rows = array();
$loan_table_dispaly_rows[] = array('particulars' => 'Total Loan Amount applied for','details' => "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".$loan_amount.'('."<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".MYUTIL::numtowords($loan_form['loan_amount']).')');
$loan_table_dispaly_rows[] = array('particulars' => 'Loan Tenure expected','details' => $loan_form['loan_tenure'].' Months');
$end_use = 'For ';
foreach($loan_form['end_use_master'] as $enduse)
{
if(strpos(strval($enduse), 'Others') === false) { $end_use.= $enduse.' and ';}else{ $end_use.=$loan_form['end_use_other'].' and'; }
}
$end_use = substr_replace($end_use, '', strrpos($end_use, 'and'),strlen($end_use));
$loan_table_dispaly_rows[] = array('particulars' => 'Loan Purpose','details' => $end_use);
if(strcasecmp($loan_form['is_transfer'],'no'))
{
$loan_table_dispaly_rows[] = array('particulars' => 'Balance Transfer Amount','details' => "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".MYUTIL::customIndianNumberFormat($loan_form['balance_transfer_amount']).'('."<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".MYUTIL::numtowords($loan_form['balance_transfer_amount']).')');
$loan_table_dispaly_rows[] = array('particulars' => 'Top Up Amount applied for','details' => "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".MYUTIL::customIndianNumberFormat($loan_form['topup_amount']).'('."<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".MYUTIL::numtowords($loan_form['topup_amount']).')');
$loan_table_dispaly_rows[] = array('particulars' => 'Balance Transfer from','details' => $loan_form['lender_master']);
}
else{
$loan_table_dispaly_rows[] = array('particulars' => 'Amount of Own Contribution','details' =>"<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".MYUTIL::customIndianNumberFormat($loan_form['own_contribution']).'('."<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>".MYUTIL::numtowords($loan_form['own_contribution']).')' );
$source_of_own_contribution = null;
foreach($loan_form['source_of_own_contribution_master'] as $own_source)
{
if(strpos(strval($own_source), 'Others') === false) { $source_of_own_contribution.= $own_source.' and ';}else{ $source_of_own_contribution.=$loan_form['other_source'].' and'; }
}
$source_of_own_contribution = substr_replace($source_of_own_contribution, '', strrpos($source_of_own_contribution, 'and'),strlen($source_of_own_contribution));
$loan_table_dispaly_rows[] = array('particulars' => 'Source of Own Contribution','details' => $source_of_own_contribution);
}
$loan_table_dispaly_rows[] = array('particulars' => 'EMI Comfortable Paying','details' => $rupee_symbol.MYUTIL::customIndianNumberFormat($loan_form['emi_level']).'('.$rupee_symbol.MYUTIL::numtowords($loan_form['emi_level']).')' );
$loan_table_dispaly_rows[] = array('particulars' => 'Type of Property Being Mortgaged','details' => $loan_form['property_type_master']);
$owners_list = null;foreach($loan_form['owners_list_master'] as $owner){ $owners_list.=$owner.' and'; }
$owners_list = substr_replace($owners_list, '', strrpos($owners_list, 'and'),strlen($owners_list));
$loan_table_dispaly_rows[] = array('particulars' => 'Name of the current / proposed owner(s) of the Property being Mortgaged','details' => $owners_list);
$loan_table_dispaly_rows[] = array('particulars' => 'Status of Construction','details' => $loan_form['construction_status_master']);
$loan_table_dispaly_rows[] = array('particulars' => 'Estimated Market Value of the property being mortgaged','details' => $rupee_symbol.MYUTIL::customIndianNumberFormat($loan_form['emv_per_customer']).'('.MYUTIL::numtowords($loan_form['emv_per_customer']).')');
//print_r($loan_table_dispaly_rows);die();
?>
<br><br>
<table class="scorecard_table">
<tr> <th style="text-align:center;">S.No</th> <th>Loan Particulars</th> <th>Loan Particular Details</th> </tr>
<tbody>
<?php
foreach($loan_table_dispaly_rows as $row_key => $row)
{
echo '<tr> <td style="text-align:center;width:25px;">'.($row_key + 1)."</td> <td>".$row['particulars']."</td> <td>".$row['details'] ."</td> </tr>";
}
?>
</tbody>
</table>
<?php
echo "<br><br>".$loan_form['loandetails_remarks'];
?>
<!-- ####################### End of Loan Details Details Section ############################-->
<!-- ###########################Business section start#####################################-->
<?php if($total_no_of_business > 0) {
for($business_count = 0;$business_count < $total_no_of_business; $business_count++)
{
?>
<div class='page_break'></div>
<?php
$businessResult=array();
$bRow = $pd_processed_forms[13][$business_count];
$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_details"]=$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
if(isset($businessRow['employees_permanent']) && $businessRow['employees_permanent'] <= 0) {
$bindEachResult['company_empployees']='As per person met there are no permanent';
}
else{
$bindEachResult['company_empployees']='As per person met there are '.$businessRow['employees_permanent'].' permanent ';
}
if(isset($businessRow['employees_temporary']) && $businessRow['employees_temporary'] > 0)
{
$bindEachResult['company_empployees'].= 'and '.$businessRow['employees_temporary'].' temporary employee(s) with company.';
}else{
$bindEachResult['company_empployees'].= ' and no temporary employess found';
}
if(isset($businessRow['officer_total']) && $businessRow['officer_total'] > 0)
{
$bindEachResult['officer_visit_company_empployees']='At the time of PD visit, approximately '.$businessRow['officer_total'] .' employee(s) during the visit at the business premises.';
}
else{
$bindEachResult['officer_visit_company_empployees']='At the time of PD visit, PD officer could not able to see any of employees at the business premises.';
}
//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);
//print_r($businessResult);
?>
<h3>BUSINESS INFORMATION:</h3>
<?php
foreach($businessResult as $bKey=>$fetchRow){
?>
<p>
<br><strong>Company / Firm Name:</strong><span><?php echo $fetchRow['company_details']['company_name'];?></span><br>
<br><strong>Business Entity Type:</strong><span><?php echo $fetchRow['company_details']['type_of_activity'];?></span><br>
<br><strong>Date of Incorporation:</strong><span><?php echo $fetchRow['company_details']['formed_on'];?></span><br>
<br><strong>Business Vintage:</strong><span><?php echo $fetchRow['company_details']['year_and_month'];?></span>
</p>
<div><p><span><?php echo $fetchRow['company_details']['partners_title_name'];?></span></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>
<th>Started Business</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>
<td><?php echo $partRow['started_business']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<!--this is for family members involved in business -->
<?php if(count($fetchRow['family_members_involved']) >0){ ?>
<div>
<p>Other Family Members involved in business :</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Name</th>
<th>Individual Relationship</th>
<th>Related to</th>
<th>Relationship to Company / Firm</th>
<th>Started Business (Yes / No)</th>
</tr>
</thead>
<tbody>
<?php foreach($fetchRow['family_members_involved'] as $familyRow){
?>
<tr>
<td><?php echo $familyRow['name'] ?></td>
<td><?php echo $familyRow['individual_relation'] ?></td>
<td><?php echo $familyRow['relation_to'] ?></td>
<td><?php echo $familyRow['relation_to_company'] ?></td>
<td><?php echo $familyRow['started_business']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }?>
<!-- end family members -->
<!-- start manufacturing -->
<?php
//die();
if(count($fetchRow['manufacturing']) >0){ ?>
<div>
<p> Type of Business Activity : Manufacturing</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Key Products</th>
<th>Area of Operations</th>
<th>Area of Sale / Service</th>
<th>Area where Max Sale / Service 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>
<div class='page_break'></div>
<p><strong>Brief of the Business / Service Model </strong></p>
<table class="scorecard_table">
<thead>
<tr> <th>Product / Service</th> <th>Process Brief</th> </tr>
</thead>
<tbody>
<?php foreach($fetchRow['manufacturing'] as $process_brief){?>
<tr> <td><?php echo $process_brief['products']; ?></td> <td><?php echo $process_brief['description']; ?></td> </tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end manufacturing -->
<!-- start retail -->
<?php if(count($fetchRow['retail']) >0){ ?>
<div>
<p> Type of Business Activity : Retail Trading</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Key Products</th>
<th>Area of Operations</th>
<th>Area of Sale / Service</th>
<th>Area where Max Sale / Service 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>
<div class='page_break'></div>
<p><strong>Brief of the Business / Service Model </strong></p>
<table class="scorecard_table">
<thead>
<tr> <th>Product / Service</th> <th>Process Brief</th> </tr>
</thead>
<tbody>
<?php foreach($fetchRow['retail'] as $retailRow){?>
<tr> <td><?php echo $retailRow['products']; ?></td> <td><?php echo $retailRow['description']; ?></td> </tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end retail -->
<!-- start serviceprovider -->
<?php if(count($fetchRow['serviceprovider']) >0){ ?>
<div>
<p> Type of Business Activity : Service Provider</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Services</th>
<th>Area of Operations</th>
<th>Area of Sale / Service</th>
<th>Area where Max Sale / Service done</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>
<div class='page_break'></div>
<p><strong>Brief of the Business / Service Model </strong></p>
<table class="scorecard_table">
<thead>
<tr> <th>Product / Service</th> <th>Process Brief</th> </tr>
</thead>
<tbody>
<?php foreach($fetchRow['serviceprovider'] as $serviceproviderRow){?>
<tr> <td><?php echo $serviceproviderRow['products']; ?></td> <td><?php echo $serviceproviderRow['description']; ?></td> </tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- end wholesale -->
<!-- serviceprovider start wholesale -->
<?php if(count($fetchRow['wholesale']) >0){ ?>
<div>
<p> Type of Business Activity : Wholesale Trading</p>
</div>
<table class="scorecard_table">
<thead>
<tr>
<th>Key Products</th>
<th>Area of Operations</th>
<th>Area of Sale / Service</th>
<th>Area where Max Sale / Service 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>
<div class='page_break'></div>
<p><strong>Brief of the Business / Service Model </strong></p>
<table class="scorecard_table">
<thead>
<tr> <th>Product / Service</th> <th>Process Brief</th> </tr>
</thead>
<tbody>
<?php foreach($fetchRow['wholesale'] as $wholesaleRow){?>
<tr> <td><?php echo $wholesaleRow['products']; ?></td> <td><?php echo $wholesaleRow['description']; ?></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
//die();
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 asset #################-->
<?php
$businessAssetResult=array();
$baRow = $pd_processed_forms[22][$business_count];
$businessAssetRow = json_decode($baRow['processed_json'],true);
//print_r($businessAssetRow);die();
$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);
//print_r($businessAssetResult);
?>
<?php
//print_r($businessAssetResult);die();
if(count($businessAssetResult)>0){ ?>
<h3>Assets used in Buisness</h3>
<?php foreach($businessAssetResult as $iterateAsset){ ?>
<p><?php echo $iterateAsset['company_name']; ?></p>
<table class="scorecard_table">
<thead>
<tr>
<th>S.No</th>
<th>Asset Type</th>
<th>Asset Description</th>
<th>Ownership</th>
<th>Monthly Rent</th>
</tr>
</thead>
<tbody>
<?php
foreach($iterateAsset['details'] as $business_asset_key => $baRow){
if(isset($baRow['business_assets_mode_master']))
{
$rent_amount = isset($baRow['rent_amount']) ? $rupee_symbol.MYUTIL::customIndianNumberFormat((double)$baRow['rent_amount']): '0.00';
?>
<tr>
<td><?php echo ($business_asset_key+1);?></td>
<td><?php echo $baRow['business_assets_mode_master']; ?></td>
<td><?php echo $baRow['about_business_assets']; ?></td>
<td><?php echo $baRow['ownership']; ?></td>
<td><?php echo $baRow['ownership'] == 'RENTED' ? $rent_amount : "NA";?></td>
</tr>
<?php }} ?>
</tbody>
</table>
<?php } ?>
<?php }
else {?>
<p>Business asset is not available.</p>
<?php }
//die();?>
<!-- #################end business asset #################-->
<!-- #################start business financial #################-->
<div class='page_break'></div>
<?php
$businessFinancialResult=array();
$profit_loss_symbal = '<span style="font-family:DejaVu Sans; sans-serif;color:green;">↑</span> /<span style="font-family:DejaVu Sans; sans-serif;color:red;">↓</span>';
$baRow = $pd_processed_forms[14][$business_count];
$businessFinancialRow = json_decode($baRow['processed_json'],true);
//print_r($businessFinancialRow);die();
// statementdate_per_financial
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["years_data_provided"] = count($businessFinancialRow['date_per_financial']);
$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' && (!isset($businessFinancialRow['estimated_value']))){
$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();
}
$bindBusinessFinancial['working_capital_receive'] = $businessFinancialRow['receive_the_money_in_days'];
$bindBusinessFinancial['working_capital_pay'] = $businessFinancialRow['pay_the_money_in_days'];
$bindBusinessFinancial['working_capital_unsold_stock'] = $businessFinancialRow['unsold_stock_lies_in_days'] != "" || $businessFinancialRow['unsold_stock_lies_in_days'] != null ? $businessFinancialRow['unsold_stock_lies_in_days'] != "" : 'Data Not Provided';
$bindBusinessFinancial['is_working_capital_facility'] = $businessFinancialRow['is_there_working_capital_available'];
foreach($businessFinancialRow['select_working_capital_facilities_availed'] as $k => $v)
{
switch($v['id'])
{
case 1:
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['name'] = $businessFinancialRow['other_reason_for_working_capital_facilities_availed'];
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['details'] = $businessFinancialRow['reason_for_working_capital_facilities_availed'];
break;
case 2:
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['details'] = $businessFinancialRow['bank_guarantee'];
break;
case 3:
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['details'] = $businessFinancialRow['cash_credit_limit'];
break;
case 4:
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['details'] = $businessFinancialRow['factoring'];
break;
case 5:
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['details'] = $businessFinancialRow['factoring'];
break;
case 6:
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['details'] = $businessFinancialRow['letter_of_credit'];
break;
case 7:
$businessFinancialRow['select_working_capital_facilities_availed'][$k]['details'] = $businessFinancialRow['od_limit'];
break;
}
}
$bindBusinessFinancial['working_capital_facilites'] = $businessFinancialRow['select_working_capital_facilities_availed'];
//print_r($bindBusinessFinancial['select_working_capital_facilities_availed']);die(); //FINANCIALFORM::getAvailableFacilities($businessFinancialRow[-'"working_capital_facilities_availed']);
array_push($businessFinancialResult,$bindBusinessFinancial);
?>
<?php if(count($businessFinancialResult)>0){ ?>
<h3>Financial Information</h3>
<?php foreach($businessFinancialResult as $iterateFinance){
//print_r($iterateFinance);die();
?>
<p><?php echo "<strong>Company / Firm Name :</strong>" . $iterateFinance['company_name']; ?></p>
<p><?php echo "<strong>No of Years of Financial Statements provided :</strong>" . $iterateFinance['years_data_provided']; ?></p>
<p><?php echo "<strong>Snapshot of Financials as per Books of Account Provided:</strong>"; ?></p>
<?php if(count($iterateFinance['statements'])>0){ ?>
<table class="scorecard_table">
<thead>
<tr>
<th>Particulars</th><?php foreach($iterateFinance['statements'] as $bfRow){ echo "<th>"."FY ".$bfRow['financial_year']."</th>";}?>
</tr>
</thead>
<tbody>
<tr><td>Sales / Revenue (Rs)</td> <?php foreach($iterateFinance['statements'] as $bfRow){ echo '<td style="text-align:center;">'.$bfRow['financial_sales_revenue'].'</td>';}?> </tr>
<tr><td>Net Profit / <span style="color:red;">(Net Loss)</span> (Rs)</td> <?php foreach($iterateFinance['statements'] as $bfRow){ if($bfRow['financial_net_profit_mode'] == 1){ echo '<td style="text-align:center;color:green;">'.$bfRow['financial_net_profit'].'</td>';}else{ echo '<td style="text-align:center;color:red;">('.$bfRow['financial_net_loss'].')</td>'; } }?></tr>
<tr><td>Net Profit or <span style="color:red;">(Net Loss)</span> to Sales %</td> <?php foreach($iterateFinance['statements'] as $bfRow){ if($bfRow['financial_net_profit_mode'] == 1) {echo '<td style="text-align:center;color:green;">'.$bfRow['financial_margin_of_profit'].' %</td>';}else { echo '<td style="text-align:center;color:red;">('.$bfRow['financial_margin_of_loss'].' %)</td>'; } }?></tr>
<tr><td>% (<?php echo $profit_loss_symbal;?>) in Sales over PY</td>
<?php foreach($iterateFinance['statements'] as $bfRow)
{
if($bfRow['sale_variation'] != "" || $bfRow['sale_variation'] != null)
{
echo $bfRow['sale_variation'] >= 0 ? '<td style="text-align:center;color:green;">'.$bfRow['sale_variation'].' %</td>' : '<td style="text-align:center;color:red;">('.$bfRow['sale_variation'].' %)</td>';
}else { echo '<td style="text-align:center;">NA</td>';}?>
<?php }?>
</tr>
<tr><td>% (<?php echo $profit_loss_symbal;?>) in Net Profit over PY</td>
<?php
foreach($iterateFinance['statements'] as $bfRow)
{
if($bfRow['profit_variation'] != "" || $bfRow['profit_variation'] != null)
{ echo $bfRow['profit_variation'] >= 0 ? '<td style="text-align:center;color:green;">'.$bfRow['profit_variation'].' %</td>' :'<td style="text-align:center;color:red;">('.$bfRow['profit_variation'].')</td>';
}else
{echo '<td style="text-align:center;">NA</td>';} }?> </tr>
<tr><td>% (<?php echo $profit_loss_symbal;?>) in Net Profit % over PY</td>
<?php
foreach($iterateFinance['statements'] as $bfRow)
{
if($bfRow['financial_profit_to_sale_variation'] != "" || $bfRow['financial_profit_to_sale_variation'] != null)
{
echo $bfRow['financial_profit_to_sale_variation'] >= 0 ? '<td style="text-align:center;color:green">'.$bfRow['financial_profit_to_sale_variation'].' %</td>' : '<td style="text-align:center;color:red">('.$bfRow['financial_profit_to_sale_variation'].' %)</td>';
}else { echo '<td style="text-align:center;">NA</td>';}}?> </tr>
</tbody>
</table>
<?php } ?>
<!-- customer finance statements-->
<p><?php echo $iterateFinance['financial_customer']; ?></p>
<?php if(count($iterateFinance['customer_statements'])>0){
//print_r($iterateFinance['customer_statements']);die();
?>
<table class="scorecard_table">
<thead>
<tr>
<th rowspan=2>Particulars</th> <th colspan=2>Range provided</th> <th rowspan=2>Final Considered</th>
</tr>
<tr> <th>From</th> <th>To</th> </tr>
</thead>
<tbody>
<?php foreach($iterateFinance['customer_statements'] as $csRow){
if(!strcasecmp($csRow['estimate_net_margin_availablity'],'yes')){
?>
<tr>
<td>Sales / Revenue (Rs)</td> <td><?php echo MYUTIL:: customIndianNumberFormat($csRow['estimate_sales_from']) ?></td><td><?php echo MYUTIL:: customIndianNumberFormat($csRow['estimate_sales_to']) ?></td><td><?php echo MYUTIL:: customIndianNumberFormat($csRow['estimate_sales_average']) ?></td>
</tr>
<tr>
<td>Net Profit or (Net Loss) to Sales %</td> <td><?php echo MYUTIL:: customIndianNumberFormat($csRow['net_profit_loss_sales_per_from']).'%' ?></td><td><?php echo MYUTIL:: customIndianNumberFormat($csRow['net_profit_loss_sales_per_to']).'%' ?></td><td <?php echo $csRow['estimate_profit_or_loss'] ? "style='color:green'" : "style='color:green'";?> ><?php echo MYUTIL:: customIndianNumberFormat($csRow['net_profit_loss_sales_final_per']).'%' ?></td>
</tr>
<tr>
<td colspan=3>Net Profit / (Net Loss) (Rs) >>>></td> <td <?php echo $csRow['estimate_profit_or_loss'] ? "style='color:green'" : "style='color:green'";?>><?php echo MYUTIL::customIndianNumberFormat($csRow['net_profit_loss_sales_final_rs']) ?></td>
</tr>
<?php }else{ ?>
<tr>
<td>Sales / Revenue (Rs)</td> <td><?php echo MYUTIL:: customIndianNumberFormat($csRow['estimate_sales_from']) ?></td><td><?php echo MYUTIL:: customIndianNumberFormat($csRow['estimate_sales_to']) ?></td><td><?php echo MYUTIL:: customIndianNumberFormat($csRow['estimate_sales_average']) ?></td>
</tr>
<tr>
<td>Net Profit or (Net Loss) to Sales (Rs) </td> <td><?php echo MYUTIL:: customIndianNumberFormat($csRow['net_profit_loss_sales_per_from']) ?></td><td><?php echo MYUTIL:: customIndianNumberFormat($csRow['net_profit_loss_sales_per_to']) ?></td><td <?php echo $csRow['estimate_profit_or_loss']? "style='color:green'" : "style='color:green'";?> ><?php echo MYUTIL:: customIndianNumberFormat($csRow['net_profit_loss_sales_final_per']) ?></td>
</tr>
<tr>
<td colspan=3>Net Profit / (Net Loss)% >>>></td> <td <?php echo $csRow['estimate_profit_or_loss'] ? "style='color:green'" : "style='color:green'";?>><?php echo MYUTIL:: customIndianNumberFormat($csRow['net_profit_loss_sales_final_rs']).'%' ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<?php } ?>
<?php } ?>
<p><strong>Working Capital Cycle:</strong></p>
<table class="scorecard_table">
<thead> <tr> <th>S.No</th> <th>Particulars</th> <th>Days</th> </tr> </thead>
<tbody>
<tr> <td class="customtd">1</td> <td class="customtd">Debtor Days</td> <td class="customtd"><?php echo $iterateFinance['working_capital_receive']?></td> </tr>
<tr> <td class="customtd">2</td> <td class="customtd">Creditor Days</td> <td class="customtd"><?php echo $iterateFinance['working_capital_pay']?></td></tr>
<tr> <td class="customtd">3</td> <td class="customtd">Stock Days</td> <td class="customtd"><?php echo $iterateFinance['working_capital_unsold_stock']?></td></tr>
</tbody>
</table>
<p><strong>Working Capital Facilities:</strong></p>
<?php if(strcasecmp($iterateFinance['is_working_capital_facility'],'no')){?>
<table class="scorecard_table">
<thead> <tr> <th>S.No</th> <th>Facility Type</th> <th>Facility Details</th> </tr> </thead>
<tbody>
<?php foreach($iterateFinance['working_capital_facilites'] as $fk => $facility){
echo '<tr> <td class="customtd">'.(++$fk) .'</td><td td class="customtd">'.$facility['name'].'</td> <td td class="customtd">'.$facility['details'].'</td></tr';
}?>
</tbody>
</table>
<?php }else{echo "<p>The Loan Applicants have not availed any Working Capital Facilities from any financial institution<p>";} ?>
<?php }
else {?>
<p>Financial information is not available.</p>
<?php } //die();?>
<!--################# end business financial #################-->
<div class='page_break'></div>
<!-- start business banking section -->
<?php
$bankingResult=array();
// business banking
$bbRow = $pd_processed_forms[21][$business_count] ;
$businessBankRow = json_decode($bbRow['processed_json'],true);
//print_r($businessBankRow);die();
if(count($businessBankRow['banking_details'])>0){
$getEachValues['is_od_cc'] = null;
foreach($businessBankRow['banking_details'] as $bd){ if($bd['account_type']== 4 || $bd['account_type']== 3){ $getEachValues['is_od_cc'] = true; } }
$getEachValues['bankDetails']=BANKINGFORM::getBusinessBankingDetails($businessBankRow['banking_details']);
$bankingResult = array_merge($bankingResult,$getEachValues);
}
?>
<?php if(count($bankingResult)>0){ ?>
<p><strong>Business Banking:</strong></p>
<table class="scorecard_table">
<thead>
<tr>
<th>Account Name</th>
<th>Bank Name</th>
<th>Account Type</th>
<th>Account Vintage</th>
<?php if($getEachValues['is_od_cc']){?>
<th>OD/CC Limit(Rs)</th>
<?php }?>
</tr>
</thead>
<tbody>
<?php foreach($bankingResult['bankDetails'] 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['vintage'] ?></td>
<?php if($getEachValues['is_od_cc']){?>
<td><?php echo $bdRow['od_cc_limit'] ?></td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
?>
<!-- #################end business banking section #################-->
<!-- #################client section start #################-->
<?php
$clientResult=array();
// this is for manufacturing
//global $client_first_row;
$client_first_row = '';
$client_second_row = '';
$client_third_row = '';
$client_fourth_row = '';
$client_fifth_row = '';
$client_sixth_row = '';
$client_seventh_row = '';
$to_no_of_clients = 0;
$done_on_credit = 0;
$name_of_the_company = '';
$cRow = $pd_processed_forms[2][$business_count];
$clientRow = json_decode($cRow['processed_json'],true);
$name_of_the_company = MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1);
// $bindEachResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1);
// $getmanufacturing = array();
// $getTrading=array();
// $getService=array();
//$getTotalPaymentsPercentonCredit=array();
$client_first_row = '<tr><td class="customtd">1</td><td class="customtd_leftalign">Product / Service </td>';
$client_second_row = '<tr><td class="customtd">2</td><td class="customtd_leftalign">Contact Person </td>';
$client_third_row = '<tr><td class="customtd">3</td><td class="customtd_leftalign">Mobile Number </td>';
$client_fourth_row = '<tr><td class="customtd">4</td><td class="customtd_leftalign">Landline No</td>';
$client_fifth_row = '<tr><td class="customtd">5</td><td class="customtd_leftalign">Payment Terms</td>';
$client_sixth_row = '<tr><td class="customtd">6</td><td class="customtd_leftalign">Payment Mode</td>';
$client_seventh_row = '<tr><td class="customtd">7</td><td class="customtd_leftalign">No of Days Credit</td>';
// this is for manufacturing
if(array_key_exists('manufacturing_details',$clientRow)){
$done_on_credit += $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
foreach($clientRow['manufacturing_details'] as $manuRow){
if(isset($manuRow['main_raw_materials'])){
$to_no_of_clients += count($manuRow['main_raw_materials']);
foreach($manuRow['main_raw_materials'] as $main_raw_material_key => $main_raw_material)
{
//print_r($main_raw_material);
$client_first_row .= '<td class="customtd">'.$main_raw_material['manufacturing_product_name'].'</td>';
$client_second_row .= $main_raw_material['person_title_name_master'] ? '<td class="customtd">' . $main_raw_material['person_title_name_master']: '<td class="customtd">' . '';
$client_second_row .= $main_raw_material['manufacturing_contact_person_name'] ;
$client_second_row .= isset($main_raw_material['person_designation']) && $main_raw_material['person_designation']== 1 ? ' '.$main_raw_material['other_person_designation'] : ' ';//
$client_second_row .= isset($main_raw_material['person_designation_master']) ? $main_raw_material['person_designation_master'] : '' ;
$client_second_row .= ' '.$main_raw_material['manufacturing_client_name'].'</td>';
$client_third_row .= '<td class="customtd">'. $main_raw_material['manufacturing_contact_person_mobile_number'] .'</td>';
$client_fourth_row .= $main_raw_material['person_stdcode'] && $main_raw_material['person_landline'] ? '<td class="customtd">'. $main_raw_material['person_stdcode'].' '.$main_raw_material['person_landline'].'</td>' : '<td class="customtd">'.'Not Provided'.'</td>';
$client_fifth_row .= $main_raw_material['manufacturing_payment_type_master'] ? '<td class="customtd">'. $main_raw_material['manufacturing_payment_type_master'] .'</td>' : '<td class="customtd">NA</td>';
$client_sixth_row .= $main_raw_material['manufacturing_payment_mode'] ? '<td class="customtd">'. $main_raw_material['manufacturing_payment_mode'] .'</td>' : '<td class="customtd">NA</td>';;
$client_seventh_row .= $main_raw_material['manufacturing_credit_days_from'] && $main_raw_material['manufacturing_credit_days_to'] ? '<td class="customtd">'. $main_raw_material['manufacturing_credit_days_from'].' to '. $main_raw_material['manufacturing_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NIL </td>' ;
}
}
}
}
// this is for trading
if(array_key_exists('trade_details',$clientRow)){
$done_on_credit += $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
foreach($clientRow['trade_details'] as $tradeRow){
if(isset($tradeRow['trading_products'])){
$to_no_of_clients += count($tradeRow['trading_products']);
foreach($tradeRow['trading_products'] as $trading_product_key => $trading_product)
{
$client_first_row .= '<td class="customtd">'.$trading_product['trade_product_name'].'</td>';
$client_second_row .= $trading_product['person_title_name_master'] ? '<td class="customtd">' . $trading_product['person_title_name_master']: '<td class="customtd">' . '';
$client_second_row .= $trading_product['trade_product_contact_person_name'] ;
$client_second_row .= isset($trading_product['person_designation']) && $trading_product['person_designation']== 1 ? ' '.$trading_product['other_person_designation'] : ' ';//
$client_second_row .= isset($trading_product['person_designation_master']) ? $trading_product['person_designation_master'] : '' ;
$client_second_row .= ' '.$trading_product['trade_client_name'].'</td>';
$client_third_row .= '<td class="customtd">'. $trading_product['trade_product_contact_person_mobile_number'] .'</td>';
$client_fourth_row .= $trading_product['person_stdcode'] && $trading_product['person_landline'] ? '<td class="customtd">'. $trading_product['person_stdcode'].' '.$trading_product['person_landline'].'</td>' : '<td class="customtd">'.'Not Provided'.'</td>';
$client_fifth_row .= $trading_product['trade_product_payment_type_master'] ? '<td class="customtd">'. $trading_product['trade_product_payment_type_master'] .'</td>' : '<td class="customtd">NA</td>';
$client_sixth_row .= $trading_product['trade_product_payment_mode'] ? '<td class="customtd">'. $trading_product['trade_product_payment_mode'] .'</td>' : '<td class="customtd">NA</td>';;
$client_seventh_row .= $trading_product['trade_product_credit_days_from'] && $trading_product['trade_product_credit_days_to']? '<td class="customtd">'. $trading_product['trade_product_credit_days_from'].' to '. $trading_product['trade_product_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NIL </td>' ;
}
}
}
}
//this is for service
if(array_key_exists('service_provider_details',$clientRow)){
$done_on_credit += $clientRow['service_provider_details'][0]['service_products_total_payments_percent_on_credit'];
foreach($clientRow['service_provider_details'] as $serviceRow){
if(isset($serviceRow['service_products'])){
$to_no_of_clients += count($serviceRow['service_products']);
foreach($serviceRow['service_products'] as $service_product_key => $service_product)
{
$client_first_row .= '<td class="customtd">'.$service_product['service_provider_product_name'].'</td>';
$client_second_row .= $service_product['person_title_name_master'] ? '<td class="customtd">' . $service_product['person_title_name_master']: '<td class="customtd">' . '';
$client_second_row .= $service_product['service_provider_product_contact_person_name'] ;
$client_second_row .= isset($service_product['person_designation']) && $service_product['person_designation']== 1 ? ' '.$service_product['other_person_designation'] : ' ';//
$client_second_row .= isset($service_product['person_designation_master']) ? $service_product['person_designation_master'] : '' ;
$client_second_row .= ' '.$service_product['service_provider_client_name'].'</td>';
$client_third_row .= '<td class="customtd">'. $service_product['service_provider_product_contact_person_mobile_number'] .'</td>';
$client_fourth_row .= $service_product['person_stdcode'] && $service_product['person_landline'] ? '<td class="customtd">'. $service_product['person_stdcode'].' '.$service_product['person_landline'].'</td>' : '<td class="customtd">'.'Not Provided'.'</td>';
$client_fifth_row .= $service_product['service_provider_product_payment_type_master'] ? '<td class="customtd">'. $service_product['service_provider_product_payment_type_master'] .'</td>' : '<td class="customtd">NA</td>';
$client_sixth_row .= $service_product['service_provider_product_payment_mode'] ? '<td class="customtd">'. $service_product['service_provider_product_payment_mode'] .'</td>' : '<td class="customtd">NA</td>';
$client_seventh_row .= $service_product['service_provider_product_credit_days_from'] && $service_product['service_provider_product_credit_days_to']? '<td class="customtd">'. $service_product['service_provider_product_credit_days_from'].' to '. $service_product['service_provider_product_credit_days_to'].' days'.'</td>' :'<td class="customtd"> NIL </td>' ;
}
}
}
}
$client_first_row .= '</tr>';
$client_second_row .= '</tr>';
$client_third_row .= '</tr>';
$client_fourth_row .= '</tr>';
$client_fifth_row .= '</tr>';
$client_sixth_row .= '</tr>';
$client_seventh_row .= '</tr>';
?>
<?php
if($to_no_of_clients > 0 )
{
echo "<h3>Client Details</h3>";
?>
<table class="scorecard_table">
<thead>
<tr>
<th>Sr.No</th>
<th>Particulars</th>
<?php for($i = 1; $i <= $to_no_of_clients; $i++){
echo "<th>Client $i</th>";
}?>
</tr>
</thead>
<tbody>
<?php echo $client_first_row?>
<?php echo $client_second_row?>
<?php echo $client_third_row?>
<?php echo $client_fourth_row?>
<?php echo $client_fifth_row?>
<?php echo $client_sixth_row?>
<?php echo $client_seventh_row?>
</tbody>
</table>
<?php if($done_on_credit != 0) { echo "<p> Out of total sales done by ".$name_of_the_company .", ".$done_on_credit."% is done on credit.</p>"; }?>
<?php } ?>
<!-- #################client section end #################-->
<!-- #################supplier section start #################-->
<?php
//die();
$supplierResult=array();
// this is for manufacturing
$supplier_details = $pd_processed_forms[1][$business_count];
$clientRow = json_decode($supplier_details['processed_json'],true);
$company_name = MYUTIL::findCompanyName($all_company_details,$clientRow['company_id'],1);
$total_no_of_suppliers = count($clientRow['manufacturing_details']);
$total_payments_percent_on_credit_for_supplier = 0;
foreach($clientRow['manufacturing_details'] as $manuRow){
$total_payments_percent_on_credit_for_supplier = $clientRow['manufacturing_details'][0]['main_raw_materials_total_payments_percent_on_credit'];
if(isset($manuRow['main_raw_materials'])){
foreach($manuRow['main_raw_materials'] as $raw){
$temp['supplier_first_row'] = '<tr><td class="customtd">1</td><td class="customtd_leftalign">Item Purchased </td>'.'<td class="customtd">'.$raw['manufacturing_raw_material_name'].'</td></tr>';
$supplier_second_row = '<tr><td class="customtd">2</td><td class="customtd_leftalign">Contact Person </td>';
$supplier_second_row .= $raw['person_title_name_master'] ? '<td class="customtd">' . $raw['person_title_name_master']: '<td class="customtd">' . '';
$supplier_second_row .= $raw['manufacturing_contact_person_name'] ;
$supplier_second_row .= isset($raw['person_designation']) && $raw['person_designation']== 1 ? ' '.$raw['other_person_designation'] : ' ';//
$supplier_second_row .= isset($raw['person_designation_master']) ? $raw['person_designation_master'] : '' ;
$supplier_second_row .= ' '.$raw['manufacturing_supplier_name'].'</td>';
$temp['supplier_second_row'] = $supplier_second_row.'</tr>';
$temp['supplier_third_row'] = '<tr><td class="customtd">3</td><td class="customtd_leftalign">Mobile Number </td>'.'<td class="customtd">'. $raw['manufacturing_contact_person_mobile_number'] .'</td></tr>';
$temp['supplier_fourth_row'] = '<tr><td class="customtd">4</td><td class="customtd_leftalign">Landline No</td>';
$temp['supplier_fourth_row'] .= $raw['person_stdcode'] && $raw['person_landline'] ? '<td class="customtd">'. $raw['person_stdcode'].' '.$raw['person_landline'].'</td></tr>' : '<td class="customtd">'.'Not Provided'.'</td></tr>';
$temp['supplier_fifth_row'] = '<tr><td class="customtd">5</td><td class="customtd_leftalign">Payment Terms</td>';
$temp['supplier_fifth_row'] .= $raw['manufacturing_payment_type_master'] ? '<td class="customtd">'. $raw['manufacturing_payment_type_master'] .'</td></tr>' : '<td class="customtd">NA</td></tr>';
$temp['supplier_sixth_row'] = '<tr><td class="customtd">6</td><td class="customtd_leftalign">Payment Mode</td>';
$temp['supplier_sixth_row'] .= $raw['manufacturing_payment_mode'] ? '<td class="customtd">'. $raw['manufacturing_payment_mode'] .'</td></tr>' : '<td class="customtd">NA</td></tr>';
$temp['supplier_seventh_row'] = '<tr><td class="customtd">7</td><td class="customtd_leftalign">No of Days Credit</td>';
$temp['supplier_seventh_row'] .= $raw['manufacturing_credit_days_from'] && $raw['manufacturing_credit_days_to'] ? '<td class="customtd">'. $raw['manufacturing_credit_days_from'].' to '. $raw['manufacturing_credit_days_to'].'</td></tr>' : '<td class="customtd">NA</td></tr>';
array_push($supplierResult,$temp);
}
}
}
// this is for trading
foreach($clientRow['trade_details'] as $tradeRow){
$total_payments_percent_on_credit_for_supplier = $clientRow['trade_details'][0]['trading_products_total_payments_percent_on_credit'];
if(isset($tradeRow['trading_products'])){
foreach($tradeRow['trading_products'] as $trade){
$temp['supplier_first_row'] = '<tr><td class="customtd">1</td><td class="customtd_leftalign">Item Purchased </td>'.'<td class="customtd">'.$trade['trade_product_name'].'</td></tr>';
$supplier_second_row = '<tr><td class="customtd">2</td><td class="customtd_leftalign">Contact Person </td>';
$supplier_second_row .= $trade['person_title_name_master'] ? '<td class="customtd">' . $trade['person_title_name_master']: '<td class="customtd">' . '';
$supplier_second_row .= $trade['trade_product_contact_person_name'] ;
$supplier_second_row .= isset($trade['person_designation']) && $trade['person_designation']== 1 ? ' '.$trade['other_person_designation'] : ' ';//
$supplier_second_row .= isset($trade['person_designation_master']) ? $trade['person_designation_master'] : '' ;
$supplier_second_row .= ' '.$trade['trade_supplier_name'].'</td>';
$temp['supplier_second_row'] = $supplier_second_row.'</tr>';
$temp['supplier_third_row'] = '<tr><td class="customtd">3</td><td class="customtd_leftalign">Mobile Number </td>'.'<td class="customtd">'. $trade['trade_product_contact_person_mobile_number'] .'</td></tr>';
$temp['supplier_fourth_row'] = '<tr><td class="customtd">4</td><td class="customtd_leftalign">Landline No</td>';
$temp['supplier_fourth_row'] .= $trade['person_stdcode'] && $trade['person_landline'] ? '<td class="customtd">'. $trade['person_stdcode'].' '.$trade['person_landline'].'</td></tr>' : '<td class="customtd">'.'Not Provided'.'</td></tr>';
$temp['supplier_fifth_row'] = '<tr><td class="customtd">5</td><td class="customtd_leftalign">Payment Terms</td>';
$temp['supplier_fifth_row'] .= $trade['trade_product_payment_type_master'] ? '<td class="customtd">'. $trade['trade_product_payment_type_master'] .'</td></tr>' : '<td class="customtd">NA</td></tr>';
$temp['supplier_sixth_row'] = '<tr><td class="customtd">6</td><td class="customtd_leftalign">Payment Mode</td>';
$temp['supplier_sixth_row'] .= $trade['trade_product_payment_mode'] ? '<td class="customtd">'. $trade['trade_product_payment_mode'] .'</td></tr>' : '<td class="customtd">NA</td></tr>';
$temp['supplier_seventh_row'] = '<tr><td class="customtd">7</td><td class="customtd_leftalign">No of Days Credit</td>';
$temp['supplier_seventh_row'] .= $trade['trade_product_credit_days_from'] && $trade['trade_product_credit_days_to'] ? '<td class="customtd">'. $trade['trade_product_credit_days_from'].' to '. $trade['trade_product_credit_days_to'].' days</td></tr>' : '<td class="customtd">NA</td></tr>';
array_push($supplierResult,$temp);
}
}
}
if(count($supplierResult))
{
?>
<h3>Supplier Details</h3>
<?php
foreach($supplierResult as $k => $fetchRow){
echo '<br>Supplier '.($k+1).':';
?>
<table class="scorecard_table">
<thead>
<tr>
<th>Sr.No</th>
<th>Particulars</th>
<th>Details</th>
</tr>
</thead>
<tbody>
<?php //foreach($fetchRow['details'] as $productRow){
echo $fetchRow['supplier_first_row'];
echo $fetchRow['supplier_second_row'];
echo $fetchRow['supplier_third_row'];
echo $fetchRow['supplier_fourth_row'];
echo $fetchRow['supplier_fifth_row'];
echo $fetchRow['supplier_sixth_row'];
echo $fetchRow['supplier_seventh_row'];
?>
</tbody>
</table>
<?php }//} ?>
<?php if($total_payments_percent_on_credit_for_supplier > 0)
{
echo "<p>Have to make payment of about ". $total_payments_percent_on_credit_for_supplier ." % in advance rest on delivery.</p>";
}
}?>
<!-- #################supplier section end ##################################-->
<!-- #################start stock section #################-->
<?php
//die();
$stockResult=array();
$stRow = $pd_processed_forms[11][$business_count];
$stockRow = json_decode($stRow['processed_json'],true);
//print_r($stockRow);die();
$is_stock_sufficient_enough = $stockRow['is_sufficiant_finished_and_traded_goods'];
$is_raw_materials_sufficient_enough = null;
$bindStockResult["company_name"]=MYUTIL::findCompanyName($all_company_details,$stockRow['company_id'],1);
// this is for stock manufacturing details
if(count($stockRow['manufacturing_details'] && (count($stockRow['manufacturing_details'][0]['manufacturing_raw_materials']) > 0 || count($stockRow['manufacturing_details'][0]['manufacturing_finished_goods']) > 0))){
$is_raw_materials_sufficient_enough = $stockRow['manufacturing_details'][0]['is_sufficiant_raw'];
$bindStockResult["manufacturing"]=Stockform::getStockManufacturingDetails($stockRow['manufacturing_details'][0]['manufacturing_raw_materials'], $stockRow['manufacturing_details'][0]['manufacturing_finished_goods']);
//print_r($bindStockResult["manufacturing"]);
}
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,$bindStockResult) : $stockResult;
//print_r($stockResult);die();
?>
<?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) { ?>
<table class="scorecard_table">
<thead>
<tr>
<th>Sr.No</th>
<th>Type of Stock</th>
<th>Stock Item</th>
<th>Stock Value (Rs)</th>
<th>Stock Quantity</th>
</tr>
</thead>
<tbody>
<?php
$stock_sr_no = 0;
foreach($getstRow['manufacturing'] as $pstRow){
if($pstRow['name']){
?>
<tr>
<td class="customtd"><?php echo (++$stock_sr_no) ?></td>
<td><?php echo $pstRow['type'] ?></td>
<td><?php echo $pstRow['name'] ?></td>
<td><?php echo $pstRow['value'] ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pstRow['value']) : 'Not Observed'?></td>
<td><?php echo $pstRow['quantity'] ? $pstRow['quantity'].' '.$pstRow['uom'] : 'Not Observed' ?></td>
<!-- <td><?php //echo $pstRow['is_sufficiant'] ?></td> -->
</tr>
<?php }} ?>
<?php } ?>
<!-- Retail -->
<?php if(count($getstRow['retail'])>0) { ?>
<?php foreach($getstRow['retail'] as $reRow){
if($reRow['name']){
?>
<tr>
<td class="customtd"><?php echo (++$stock_sr_no) ?></td>
<td><?php echo $reRow['type'] ?></td>
<td><?php echo $reRow['name'] ?></td>
<td><?php echo $reRow['value'] ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($reRow['value']) : 'Not Observed' ?></td>
<td><?php echo $reRow['quantity'] ? $reRow['quantity'].' '.$reRow['uom'] : 'Not Observed' ?></td>
</tr>
<?php }} ?>
<?php } ?>
<!-- wholesale -->
<?php if(count($getstRow['wholesale'])>0) { ?>
<?php foreach($getstRow['wholesale'] as $wsRow){
if($wsRow['name']){
?>
<tr>
<td class="customtd"><?php echo (++$stock_sr_no) ?></td>
<td><?php echo $wsRow['type'] ?></td>
<td><?php echo $wsRow['name'] ?></td>
<td><?php echo $wsRow['value'] ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($wsRow['value']): 'Not Observed' ?></td>
<td><?php echo $wsRow['quantity'] ? $wsRow['quantity'].' '.$wsRow['uom'] : 'Not Observed' ?></td>
</tr>
<?php }} ?>
<?php } ?>
</tbody>
</table>
<?php }
if(!strcasecmp($is_stock_sufficient_enough,'yes')){
echo "<p>Considering the size of operations, the stock of goods maintained is sufficient as per the PD Officers observations.</p>";
}else if(!strcasecmp($is_stock_sufficient_enough,'no')){
echo "<p>Considering the size of operations, the stock of goods maintained is not sufficient as per the PD Officers observations.</p>";
}
if(!strcasecmp($is_raw_materials_sufficient_enough,'yes'))
{
echo "<p>Considering the size of operations, the stock of raw materials maintained is sufficient as per the PD Officers observations.</p>";
}else if(!strcasecmp($is_raw_materials_sufficient_enough,'no'))
{
echo "<p>Considering the size of operations, the stock of raw materials maintained is not sufficient as per the PD Officers observations.</p>";
}
?>
<?php }
else {?>
<!-- <p> Stock details is not available.</p> -->
<?php } ?>
<!-- #################end stock section #################-->
<?php }
} // end of total_no_of_business count if condition ?>
<!-- ######################END OF OVERALL BUSINESS SECTION ########################-->
<!-- #################start other asset section #################-->
<?php
$otherAssetResult=array();
foreach($pd_processed_forms[4] as $rowKey=> $oaRow) {
$otherAssetRow = json_decode($oaRow['processed_json'],true);
//print_r($otherAssetRow);
//echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
if(count($otherAssetRow['assets_details'])>0){
$otherAssetResult=ASSETSFORM::getOthersAssetsDetails($otherAssetRow['assets_details']);
//print_r($otherAssetResult);die();
}
}
?>
<h3>Personal Assets</h3>
<?php
//print_r($otherAssetResult);die();
if(count($otherAssetResult)>0){ ?>
<table class="scorecard_table">
<thead>
<tr>
<th>Sr.No</th>
<th>Asset Type</th>
<th>Asset Description</th>
<th>Asset Owned By</th>
<th>Approx Market Value(Rs)</th>
<th>Purchase Year</th>
<th>Loan Again Assest</th>
</tr>
</thead>
<tbody>
<?php foreach($otherAssetResult as $oakey => $paRow){
?>
<tr>
<td class="customtd"><?php echo (++$oakey); ?></td>
<td><?php echo $paRow['assets_mode']; ?></td>
<td><?php echo $paRow['about_assets']; ?></td>
<td><?php echo $paRow['name_of_the_owner']; ?></td>
<td><?php echo isset($paRow['is_sum_assured']) ? 'Sum Assured -<br> '. $rupee_symbol.''.MYUTIL::customIndianNumberFormat($paRow['approximate_market_value']) : $rupee_symbol.''.MYUTIL::customIndianNumberFormat($paRow['approximate_market_value']); ?></td>
<td class="customtd"><?php echo $paRow['purchase_year'] ? $paRow['purchase_year'] : 'NA'; ?></td>
<td><?php echo ($paRow['emi']) ? 'Yes' : 'No'; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
else {?>
<p>Personal asset is not available.</p>
<?php } ?>
<!-- end other asset section -->
<!-- start individual banking section -->
<?php
$bankingResult=array();
// individual banking
foreach($pd_processed_forms[7] as $rowKey=> $ibRow) {
$individualBankRow = json_decode($ibRow['processed_json'],true);
//print_r($individualBankRow);
if(count($individualBankRow['banking_details'])>0){
$getIndividualEachValues=BANKINGFORM::getIndividualBankingDetails($individualBankRow['banking_details']);
$bankingResult = array_merge($bankingResult,$getIndividualEachValues);
}
}
?>
<h3>Personal Banking: </h3>
<?php if(count($bankingResult)>0){
//print_r($bankingResult);
?>
<p>Below bank account details were shared :</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Sr.No</th>
<th>Account Name</th>
<th>Bank Name</th>
<th>Account Type</th>
<th>OD / CC Limit</th>
<th>Vintage</th>
</tr>
</thead>
<tbody>
<?php foreach($bankingResult as $pbkey => $bdRow){
?>
<tr>
<td class="customtd"><?php echo (++$pbkey); ?></td>
<td><?php echo $bdRow['account_name'] ?></td>
<td><?php echo $bdRow['bank_name'] ?></td>
<td><?php echo $bdRow['account_type'] ?></td>
<td class="customtd"><?php echo $bdRow['od_cc_limit'] ? $bdRow['od_cc_limit'] : "NA" ?></td>
<td><?php echo $bdRow['vintage'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php } ?>
<!-- #################end business / individual banking section #################-->
<!-- start other income section -->
<?php
//die();
$is_show_common_section = true;
if($is_show_common_section)
{
$otherIncomeResult=array();
foreach($pd_processed_forms[9] as $rowKey=> $iRow) {
$otherIcomeRow = json_decode($iRow['processed_json'],true);
// print_r($otherIcomeRow);
// echo "@@@@@@@@@@@@@@@@@@@@@";
if(strtoupper($otherIcomeRow['other_income'])=='YES' && count($otherIcomeRow['income_details'])>0){
$otherIncomeResult=OTHERINCOMEFORM::getIncomeDetails($otherIcomeRow['income_details']);
}
}
?>
<?php if(count($otherIncomeResult)>0){
//print_r($otherIncomeResult);
?>
<h3>Other Sources of Income of Individual Loan Applicants:</h3>
<table class="scorecard_table">
<thead>
<tr>
<th>Sr.No</th>
<th>Income Source</th>
<th>Earned by</th>
<th>Amount(Rs)</th>
</tr>
</thead>
<tbody>
<?php foreach($otherIncomeResult as $oidkey =>$oiRow){
?>
<tr>
<td class="customtd"><?php echo (++$oidkey) ?></td>
<td class="customtd"><?php echo $oiRow['source'] ?></td>
<td class="customtd"><?php echo $oiRow['earned_by'] ?></td>
<td class="customtd"><?php echo $rupee_symbol.''.MYUTIL::customIndianNumberFormat($oiRow['amount']).' '.$oiRow['frequency'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }
else {?>
<p>As per the loan applicants met by PD officer, they do not have any other source of Income.</p>
<?php } ?>
<!-- end other income section -->
<!-- #################start family section #################-->
<?php
$familyResult=array();
foreach($pd_processed_forms[6] as $rowKey=> $fRow) {
$familyRow = json_decode($fRow['processed_json'],true);
//print_r($familyRow);
if(array_key_exists('family_details',$familyRow) && count($familyRow['family_details'])>0){
$familyResult=OTHERFAMILYFORM::getFamilyDetails($familyRow['family_details']);
}
}
?>
<?php if(count($familyResult)>0){
//print_r($familyResult);die();
?>
<h3>Family Information:</h3>
<?php foreach($familyResult as $fmKey=>$fmValue) { ?>
<!-- <p><strong><?php //echo ($fmKey+1).'. '.$fmValue['selected_person']; ?></strong></p> -->
<?php
$intro_text = $fmValue['selected_person'].", who is an applicant in the case resides ".$fmValue['residency_address'].'.';
$residence_text = "This is a ". $fmValue['residence_ownership']." residence, where the applicant has been staying for ". $fmValue['residence_No_of_years'].'.';
$residence_text .= (!strcasecmp($fmValue['residence_ownership'],'rented')) ? 'The rent paid Rs.'.$fmValue['rent'].'per month.' : '';
echo $intro_text;echo "<br>";echo $residence_text;
?>
<p>The table below provides details of other family members of <?php echo $fmValue['selected_person']." :";?></p>
<table class="scorecard_table">
<thead>
<tr>
<th>Sr.No</th>
<th>Name</th>
<th>Relation</th>
<th>Age</th>
<th>Earning Status</th>
<th>Occupation Details</th>
</tr>
</thead>
<tbody>
<?php foreach($fmValue['family_members_details'] as $fmdkey => $fmRow){
?>
<tr>
<td class="customtd"><?php echo (++$fmdkey) ?></td>
<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>
<td><?php echo $fmRow['family_member_occupation'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php }?>
<?php }
else{?>
<p>Other Family Members is not available.</p>
<?php }?>
<!-- #################end family section #################-->
<!-- #################start Existing Loan obligations section################# -->
<?php
//die();
$existLoanResult=array();
foreach($pd_processed_forms[8] as $rowKey=> $elRow) {
$otherLoanRow = json_decode($elRow['processed_json'],true);
$total_no_of_data = 0;
if(strtoupper($otherLoanRow['existing_loan'])=='YES' && count($otherLoanRow['loan_details'])>0){
$total_no_of_data = count($otherLoanRow['loan_details']);
$existLoanResult=FINANCIALFORM::getOtherLoanDetails($otherLoanRow['loan_details']);
}
}
?>
<?php if(count($existLoanResult)>0){
//print_r($existLoanResult);die();
?>
<h3>Existing Loan Obligation</h3>
<p>The table below lists the details of Existing Loan Obligations of the Loan Applicants.</p>
<table class="scorecard_table">
<thead>
<tr>
<th>Particulars</th>
<?php for($header = 1;$header <= $total_no_of_data; $header++ ) {echo "<th>Loan $header</th>";}?>
</tr>
</thead>
<tbody>
<?php
echo $existLoanResult['first_row'];
echo $existLoanResult['second_row'];
//echo $existLoanResult['third_row'];
echo $existLoanResult['fourth_row'];
echo $existLoanResult['fifth_row'];
echo $existLoanResult['sixth_row'];
echo $existLoanResult['seventh_row'];
echo $existLoanResult['eigth_row'];
echo $existLoanResult['ninth_row'];
echo $existLoanResult['tenth_row'];
?>
</tbody>
</table>
<?php
//die();
}
else {?>
<p>As per loan applicant he doesnt have any existing obligations</p>
<?php } ?>
<!-- #################end Existing Loan obligations section ################# -->
<!-- #################start neighbourhood/reference check #################-->
<?php
$existNeighRefCheck=array();
$pd_offiecer_status_about_neighbor = "";
foreach($pd_processed_forms[19] as $rowKey=> $nrcRow) {
$neighbourRefRow = json_decode($nrcRow['processed_json'],true);
//print_r($neighbourRefRow);
//die();
if(strcasecmp($neighbourRefRow['neighbourhood_status'],'could not verify')){
$pd_offiecer_status_about_neighbor = $neighbourRefRow['neighbourhood_status'];
if(count($neighbourRefRow['neighbourhood_list'])>0){
$company_name = MYUTIL::findCompanyName($all_company_details,1,1);
$existNeighRefCheck=NEIGHBOURREFERENCECHECKFORM::getNeighbourhoodDetails($company_name,$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){
//print_r($existNeighRefCheck);die();
?>
<?php foreach($existNeighRefCheck as $nkey => $nfValue) {
echo '<br>Neighbour '.(++$nkey);
?>
<ul>
<li style="margin: 15px 0;"><?php echo $nfValue['neighbourhood_name']; ?></li>
<li style="margin: 15px 0;"><?php echo $nfValue['neighbourhood_do_know']; ?></li>
<li style="margin: 15px 0;"><?php echo $nfValue['neighbourhood_business_running_yr']; ?></li>
<li style="margin: 15px 0;"><?php echo $nfValue['ownership']; ?>
<?php if(count($existNeighRefCheck) == $nkey){?>
<li style="margin: 15px 0;"> Neighbourhood Check Status is <?php echo $pd_offiecer_status_about_neighbor;}?> </li>
</li>
</ul>
<?php }
?>
<?php }
else{?>
<p>Neighbour Check was not possible due to Could not verify</p>
<?php }?>
<!-- #################end neighbourhood/reference check #################-->
<!-- #################Final Remarks Section#################-->
<div class="page_break"></div>
<h3>PD OFFICERS REMARKS ON CUSTOMER BEHAVOUR, BUSINESS LOCATION & OVERALL PD STATUS</h3>
<?php
//print_r($final_remark_data);
$polite = null;$rude = null; $other_behaviour = null;$other_behaviour_remarks = null;
$fair = null;$well = null;$not = null;
$positive = null;$negative = null;$refer_to_credit = null;$fo_diplay = null;
$other_pd_officer_command = null;$other_command_remark = null;
$other_pd_officer_recommandation = null;$other_pd_officer_recommandation_remark = null;
if($final_remark_data['final_custormer_remark_type'] == 3){$polite = 1;}
else if($final_remark_data['final_custormer_remark_type'] == 2){$rude = 1;}
else if($final_remark_data['final_custormer_remark_type'] == 1){$other_behaviour = 1;
$other_behaviour_remarks = $final_remark_data['final_other_customer_behaviour'];
}
if(!strcasecmp($final_remark_data['is_service_provided'],'fairly_suited')){ $fair = 1;}
else if(!strcasecmp($final_remark_data['is_service_provided'],'well_suited')){$well = 1;}
else if(!strcasecmp($final_remark_data['is_service_provided'],'not_suited')){$not = 1;}
}
if($final_remark_data['pd_officers_recommendation'] == 2){$positive = 1;$fo_diplay = "Positive";}
else if($final_remark_data['pd_officers_recommendation'] == 3){$negative = 1;$fo_diplay = "Negative";}
else if($final_remark_data['pd_officers_recommendation'] == 4){$refer_to_credit = 1;$fo_diplay = "Refer to credit";}
else if($final_remark_data['pd_officers_recommendation'] == 1){
$other_pd_officer_command = 1;
$other_command_remark = $final_remark_data['others_pd_officers_recommendation'];
}
$pd_officer_final_remark = $final_remark_data['final_form_remarks'];
?>
<div>
<ul>
<li>Customer Behaviour: </li>
<br>
<table cellspacing="25">
<tr>
<td><div id="boxstyle1">polite&nbsp;&nbsp;&nbsp;<?php if($polite){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
<td><div id="boxstyle1">Rude&nbsp;&nbsp;&nbsp;<?php if($rude){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>✔</span><?php } ?></div></td>
<td><div id="boxstyle2">Others as mentioned below &nbsp;&nbsp;&nbsp;<?php if($other_behaviour){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>✔</span><?php } ?></div></td>
</tr>
</table>
<?php if($other_behaviour){
echo "Behaviour Details : ".$other_behaviour_remarks;
}?>
<br>
<li>Suitability of Business Location: </li>
<br>
<table cellspacing="25">
<tr>
<td><div id="boxstyle3">Well Suited&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($well){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
<td><div id="boxstyle3">Fairly Suited&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($fair){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
<td><div id="boxstyle3">Not Suited&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($not){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
</tr>
</table>
<li>PD Officers overall assessment: </li>
<br>
<table cellspacing="25">
<tr>
<td><div id="boxstyle3">Positive&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($positive){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
<td><div id="boxstyle3">Refer to Credit&nbsp;&nbsp;&nbsp;&nbsp;<?php if($refer_to_credit){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
<td><div id="boxstyle3">Negative&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($negative){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
</tr>
<?php if($other_pd_officer_command){?>
<td><div id="boxstyle3">Others&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<?php if($other_pd_officer_command){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></td>
<?php } ?>
</tr>
</table>
</ul>
</div>
<?php if(!$other_pd_officer_command){?>
<p>PD officer recommendation is <?php echo $fo_diplay;?>. The following points were considered while arriving at the aforementioned status.</p>
<?php
if($positive){ echo "<ul>"; foreach($final_remark_data['recommendation_positive'] as $pos){ echo "<li>".$pos['reason_for_positive']."</li>";}
}else if($negative){ echo "<ul>"; foreach($final_remark_data['recommendation_negative'] as $neg){ echo "<li>".$neg['recommendation_negative']."</li>";}
}
else if($refer_to_credit){ echo "<ul>"; foreach($final_remark_data['recommendation_positive'] as $rtc){ echo "<li>".$rtc['reason_for_refer_to_credit']."</li>";}
}
echo "</ul>";
?>
<?php }else{ echo "<p>".$other_command_remark."</p>";} ?>
<div class="page_break"></div>
<!-- #################End Final Remarks Section#################-->
<?php
$i = null;
if($i)
{
echo "<h3>Details Score Card Section</h3>" ;
// *** 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>