sparqapi/api/application/views/report_templates/JSONTOREPORT.php
2019-05-21 15:41:53 +05:30

3082 lines
128 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">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
.page_break { page-break-before: always; }
#page_break { page-break-before: always; }
/*.page { width: 100%; height: 95%; }*/
@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;
}
.simpletable, .simpletable th, .simpletable td {
border: 1px solid black;
border-collapse: collapse;
}
/* #########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%; }
/* #########billwise Table Styles######### */
.customtd { text-align:center; }
.customtd_leftalign { text-align:left; }
.customtd_rightalign { text-align:right; }
.billwise_table {
/* font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;*/
/*font-family: Merriweather;*/
border-collapse: collapse;
width: auto;
//display:inline;
}
.billwise_table td, .billwise_table th {
border: 1px solid #000;
padding: 4px;
}
.billwise_table tr:nth-child(even){background-color: #f2f2f2;}
.billwise_table tr:hover {background-color: #ddd;}
.billwise_table th {
padding-top: 4px;
padding-bottom: 4px;
text-align: center;
background-color: #0191ed;
color: white;
}
/* #########billwise 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;
text-align:center;
}
#boxstyle3 {
box-sizing: border-box;
width: 120px;
height: 20px;
padding: 5px;
border: 2px outset black;
}
#billwise {
box-sizing: content-box;
disply:inline;
width: 100%;
height: auto;
padding: 10px;
border: 1px solid #0191ed;
}
#first_div {
width: 150px;
height: 25px;
border: 2px outset #000;
overflow: hidden;
text-align: center;
border-color:red;
color:red;
/*padding-left: 20px;*/
}
#tick_div {
position: relative;
width: 40px;
height: 25px;
margin-left: 100%;
margin-top: -29px;
border: 2px outset #000;
text-align: center;
border-color:red;
color:red;
}
#tick_div_other {
position: relative;
width: 40px;
height: 25px;
margin-left: 93%;
margin-top: -29px;
border: 2px outset #000;
text-align: center;
border-color:red;
color:red;
}
/* #########Person met card css######### */
.chip {
/*display: inline-block;*/
padding: 0 25px;
height: 100px;
width: 600px;
font-size: 14px;
border-radius: 50px;
background-color: #f1f1f1;
}
.chip #img1 {
float: left;
margin: 0 10px 0 -25px;
height: 100px;
width: 100px;
border-radius: 50%;
}
.chip #img2 {
float: right;
margin: 0 -25px 0px -125px;
height: 100px;
width: 100px;
border-radius: 50%;
}
/* #########Person met card css######### */
/* #########Doc sighted gallary css######### ;*/
.gallery {
margin: 5px;
border: 1px solid #ccc;
width: 100px;
}
.gallery:hover {
border: 1px solid #777;
}
.gallery img {
width: 100%;
height: auto;
}
.desc {
padding: 8px;
text-align: center;
color:greenl
}
/* #########Doc sighted gallary css######### */
</style>
</head>
<body style="font-size:12px;margin:15px 30px">
<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>";
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]['pd_visit_date']."</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>".(explode('-',$pd_master_details[0]['customer_segment_name'])[0])."<td></tr>";
?>
</tbody>
</table>
<?php
echo "<p>Loan Amount Applied For : </p>";
echo '<table>
<tr> <td style="text-align:left;">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:left;">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'];
}
$all_applicant_details = $applicants_details;
?>
<!--<p>Person(s) Met: </p>
<table class="simpletable">
<tbody>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <tr><td> --><?php
$person_met_data = array();
foreach($general_form['individuals'] as $ind_key => $individual)
{
if($individual['is_person_met'] == true)
{
//array_push($person_met_images);
$temp_person_met = array();
$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>' ;
$temp_person_met['name'] = $individual['applicant_title_name_master'] .' '. $applicant_name;
$temp_person_met['photo'] = isset($individual['is_person_met_pic']) ? $individual['is_person_met_pic'] : null;
$temp_person_met['id_proof'] = isset($individual['is_person_met_id_proof']) ? $individual['is_person_met_id_proof'] : null;
$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>';
$company_relationship_data.=', ';
}
}
//$temp_person_met['name'] =
//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>';
$personal_relationship_data.=', ';
}
}
}
$company_relationship_data .= $personal_relationship_data;
$temp_person_met['relations'] = $company_relationship_data;
array_push($person_met_data,$temp_person_met);
//echo $company_relationship_data;
//echo substr_replace($company_relationship_data, '<br><center></center><br>', strrpos($company_relationship_data, '<br><center>and</center><br>'),strlen($company_relationship_data));
//echo '<hr>';
}
}
//print_r($person_met_data);
// echo '<table class="scorecard_table">';
// echo '<thead> <tr> <th>Name</th> <th>Photo</th> <th>ID Proof</th> <th>Relationships</th></tr> </thead>';
// echo '<tbody>';
// foreach($person_met_data as $person)
// {
// echo '<tr><td>'.$person['name'].'</td><td>'.'<img src='.$person['photo'].' width="100px" height="100px" alt="NA"/>'.'</td><td>'.'<img src='.$person['id_proof'].' width="100px" height="100px" alt="NA"/>'.'</td><td>'.$person['relations'].'</td></tr>';
// }
// echo '</tbody>';
// echo '</table>';
// echo '<br><br><br>';
echo '<p><strong>Person(s) Met:</strong> </p>';
echo '<div id="billwise">';
foreach($person_met_data as $pk => $person)
{
echo '<p>'.$person['name'].'</p>';
echo '<p>'.$person['relations'].'</p>';
echo '<br><p>';
if($person['photo'])
{
echo '<img src='.$person['photo'].' width="100px" height="100px" alt=""/>';
}
echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
if($person['id_proof'])
{
echo '<img src='.$person['id_proof'].' width="100px" height="100px" alt=""/>';
}
echo '</p>';
echo count($person_met_data) != ($pk+1)? '<hr>':'';
}
echo '</div>';
echo '<br>';
?>
<?php
// echo '<h3>Person(s) Met: </h3>';
// foreach($person_met_data as $person)
// {?>
<!--<div class="chip">
<img id="img1" src="<?php //echo $person['photo']?>" alt="Person" width="150" height="150">
<img id="img2" src="<?php //echo $person['id_proof']?>" alt="Person" width="150" height="150">
<center>
<div>
<br><b><?php //echo $person['name']?></b>
<br>
<div style="word-wrap:break-word;width:65%;"><?php //echo $person['relations']?></div>
</div></center>
</div>
<br><br> -->
<?php //}?>
<!--</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>
<p><b>Loan Applicants:</b></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 class="customtd">'.$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 id="page_break"> </div>
<?php
//die();
// 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 class="customtd"> <?php echo number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['general']['max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['general']['score_per'],1).'%'?></td></tr>
<tr> <td>Business Section Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['business']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['business']['max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['business']['score_per'],1).'%'?></td></tr>
<tr> <td>Final Remarks Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['final_remarks']['max_score'],2,'.',',')?></td><td class="customtd"> <?php echo round($pd_score['score_summary']['final_remarks']['score_per'],1).'%'?></td></tr>
<tr> <td>Final PD Score</td> <td class="customtd"> <?php echo number_format($pd_score['score_summary']['overall_score']['overall_actual_score'],2,'.',',')?></td> <td class="customtd"><?php echo number_format($pd_score['score_summary']['overall_score']['overall_max_score'],2,'.',',')?></td> <td class="customtd"> <?php echo round($pd_score['score_summary']['overall_score']['final_score'],1).'%'?></td></tr>
</table>
<?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>"; }
//######################### CHART ###########################
if(isset($dsc_cards['base64_dsc_business']))
{
echo "<br><br>";
echo '<p><img src="'.$dsc_cards['base64_dsc_business'].'" style="width:600px;height:350px;"/></p>';
}
else
{ echo "<b>Score Chart Not Generated</b>"; }
if(isset($dsc_cards['base64_dsc_general']))
{
echo "<br><br>";
echo '<p><img src="'.$dsc_cards['base64_dsc_general'].'" style="width:600px;height:350px;"/></p>';
}
else
{ echo "<b>Score Chart Not Generated</b>"; }
echo "<div id='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'];
echo '<br><br>';
?>
<img border="3" src =<?php echo $pd_master_details[0]['satellite_image_base64_blob'];?> alt="Satellite Image of location of Where PD was Done" style="width:500px;height:200px;border-color:#0191ed" /><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_remarks_caption = array('well_suited' => 'well suited','fairly_suited' => 'fairly suited','not_suited' => 'not suited');
$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;
$comment_locality_master = preg_match("/^[aeiouAEIOU]/U", $pd_address['comment_locality_master']) ? 'an '.$pd_address['comment_locality_master'] : 'a '.$pd_address['comment_locality_master'];
$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 '<p style="text-align:justify;">';
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 in operation from 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'].". " . "As Per PD Offcier, the ".$address_type ." is situated in ".$comment_locality_master ." Locality.";
echo "<br><br>The PD officer also made the following observations:" ;
echo "<br><ul>";
echo "<li> The location of the ".$address_type." is ".$address_type_remarks_caption [ $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']) && $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 "</p>";
echo "<div id='page_break'></div>";
//die();
?>
<!-- ####################### End of Address Details Section ############################-->
<!-- ####################### Loan Details Details Section ############################-->
<p><b>LOAN DETAILS:</b></p>
<?php
$loan_amount = MYUTIL::customIndianNumberFormat($loan_form['loan_amount']);
echo "During the PD visit, ".$main_applicant_name.", provided the following information about 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.' ('.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']).' ('.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']).' ('.MYUTIL::numtowords($loan_form['topup_amount']).')');
$loan_table_dispaly_rows[] = array('particulars' => 'End Use Topup','details' => ($loan_form['end_use_topup_master']));
$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']).' ('.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']).' ('.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
//die();
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++)
{
// $temp_show = null;
// if($temp_show == null)
// {
?>
<div id='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_employees']='As per person met, there are '.$businessRow['employees_permanent'].' permanent ';
}
if(isset($businessRow['employees_temporary']) && $businessRow['employees_temporary'] > 0)
{
$bindEachResult['company_employees'].= 'and '.$businessRow['employees_temporary'].' temporary employee(s) with company.';
}else{
$bindEachResult['company_employees'].= ' and no temporary employess with company';
}
if(isset($businessRow['officer_total']) && $businessRow['officer_total'] > 0)
{
$emp = $businessRow['officer_total'] > 1 ? 'employees' : 'employee';
$bindEachResult['officer_visit_company_employees']='At the time of PD visit, the officer sighted '.$businessRow['officer_total'] .' '.$emp.' at the business premises.';
}
else{
$bindEachResult['officer_visit_company_employees']='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,array('name'=>'Shop/Est act Certificate.','img' => isset($businessRow['shop_eat_act_cert_pic']) ? $businessRow['shop_eat_act_cert_pic'] : ''));
}
if(array_key_exists('gst_Regn_cert',$businessRow) && strtoupper($businessRow['gst_Regn_cert'])=='YES'){
array_push($getDocuments,array('name' => 'GST Registration.','img' => isset($businessRow['gst_Regn_cert_pic']) ? $businessRow['gst_Regn_cert_pic'] : '' ));
}
if(array_key_exists('pf_regn',$businessRow) && strtoupper($businessRow['pf_regn'])=='YES'){
array_push($getDocuments,array('name' => 'PF Registration.','img' => isset($businessRow['pf_regn_pic']) ? $businessRow['pf_regn_pic'] : ''));
}
if(array_key_exists('esic_regn',$businessRow) && strtoupper($businessRow['esic_regn'])=='YES'){
array_push($getDocuments,array('name' => 'ESIC Registration.','img' => isset($businessRow['esic_regn_pic']) ? $businessRow['esic_regn_pic'] : ''));
}
if(array_key_exists('export_import_cert',$businessRow) && strtoupper($businessRow['export_import_cert'])=='YES'){
array_push($getDocuments,array('name' => 'Export/Import Certificate.','img' => isset($businessRow['export_import_cert_pic']) ? $businessRow['export_import_cert_pic'] : ''));
}
if(array_key_exists('factory_cert',$businessRow) && strtoupper($businessRow['factory_cert'])=='YES'){
array_push($getDocuments,array('name' => 'Factory Certificate.','img' => isset($businessRow['factory_cert_pic']) ? $businessRow['factory_cert_pic'] : ''));
}
if(strtoupper($businessRow['other_documents'])=='YES' && array_key_exists('documents',$businessRow)){
foreach($businessRow['documents'] as $docValue){
array_push($getDocuments,array('name' => $docValue['document'].'.', 'img' => ''));
}
}
$bindEachResult['visit_documents']=$getDocuments;
array_push($businessResult,$bindEachResult);
//print_r($businessResult['visit_documents']);die();
?>
<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>
<?php if($fetchRow['company_details']['formed_on']){ ?>
<br><strong>Date of Incorporation : </strong><span><?php echo $fetchRow['company_details']['formed_on'];?></span><br>
<?php } ?>
<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 class="customtd"><?php echo $partRow['share_holding'] ?></td>
<td class="customtd"><?php echo $partRow['no_years_business'] ?></td>
<td class="customtd"><?php echo $partRow['total_experience']?></td>
<td class="customtd"><?php echo $partRow['previous_experience']?></td>
<td class="customtd"><?php echo $partRow['started_business']?></td>
</tr>
<?php } ?>
</tbody>
</table>
<!--this is for family members involved in business -->
<?php
//print_r($fetchRow['family_members_involved']);die();
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){
if($familyRow['name'] != "" || $familyRow['name'] != null){
?>
<tr>
<td class="customtd"><?php echo $familyRow['name'] ?></td>
<td class="customtd"><?php echo $familyRow['individual_relation'] ?></td>
<td class="customtd"><?php echo $familyRow['relation_to'] ?></td>
<td class="customtd"><?php echo $familyRow['relation_to_company'] ?></td>
<td class="customtd"><?php echo $familyRow['started_business']?></td>
</tr>
<?php } ?>
<?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 class="customtd"><?php echo $manuRow['products'] ?></td>
<td class="customtd"><?php echo $manuRow['area_of_sale'] ?></td>
<td class="customtd"><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 class="customtd"><?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 class="customtd"><?php echo $retailRow['products'] ?></td>
<td class="customtd"><?php echo $retailRow['area_of_sale'] ?></td>
<td class="customtd"><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 class="customtd"><?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 class="customtd"><?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 class="customtd"><?php echo $serviceproviderRow['products'] ?></td>
<td class="customtd"><?php echo $serviceproviderRow['area_of_sale'] ?></td>
<td class="customtd"><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 class="customtd"><?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 class="customtd"><?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 class="customtd"><?php echo $wholesaleRow['products'] ?></td>
<td class="customtd"><?php echo $wholesaleRow['area_of_sale'] ?></td>
<td class="customtd"><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 class="customtd"><?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 class="customtd"><?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_employees'];?></p>
<p><?php echo $fetchRow['officer_visit_company_employees'];?></p>
<!-- end company employee details -->
<!-- start documents details -->
<?php if(count($fetchRow['visit_documents'])){
//print_r($fetchRow['visit_documents']);die();
?>
<p>The below documents were sighted during the visit :</p>
<table>
<!--Gallary Started -->
<tr>
<?php
foreach($fetchRow['visit_documents'] as $dValue) {
?>
<td>
<div class="gallery">
<img src="<?php echo $dValue['img']; ?>" alt="" width="200" height="200">
<div class="desc"><?php echo $dValue['name']?></div>
</div>
</td>
<?php } ?>
</tr>
</table>
<!--Gallary Ended -->
<?php } ?>
<!-- end documents details -->
<?php } //die();?>
<div class="page_break"> </div>
<!-- #################End OF Business section############################### -->
<!-- #################start business asset #################-->
<?php
//die();
$businessAssetResult=array();
$baRow = $pd_processed_forms[22][$business_count];
$businessAssetRow = json_decode($baRow['processed_json'],true);
//print_r($businessAssetRow);
$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);die();
?>
<?php
//print_r($businessAssetResult);die();
if(count($businessAssetResult)>0){ ?>
<div class="page_break"> <div>
<br>
<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 class="customtd"><?php echo ($business_asset_key+1);?></td>
<td class="customtd"><?php echo $baRow['business_assets_mode_master']; ?></td>
<td class="customtd"><?php echo $baRow['about_business_assets']; ?></td>
<td class="customtd"><?php echo $baRow['ownership']; ?></td>
<td class="customtd"><?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 Loan Applicant(s) met, 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 Loan Applicant(s) met, 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 Loan Applicant(s) met, 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;">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($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;">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($bfRow['financial_net_profit']).'</td>';}else{ echo '<td style="text-align:center;color:red;">('.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($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
//print_r($bankingResult);die();
if(count($bankingResult)>0){ ?>
<div class="page_break"></div>
<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 }?>
<th>Main Business AC</th>
</tr>
</thead>
<tbody>
<?php foreach($bankingResult['bankDetails'] as $bdRow){
?>
<tr>
<td><?php echo $bdRow['account_name'] ?></td>
<td class="customtd"><?php echo $bdRow['bank_name'] ?></td>
<td class="customtd"><?php echo $bdRow['account_type'] ?></td>
<td class="customtd"><?php echo $bdRow['vintage'] ?></td>
<?php if($getEachValues['is_od_cc']){?>
<td class="customtd"><?php echo $bdRow['od_cc_limit'] ?></td>
<?php } ?>
<td class="customtd"><?php echo $bdRow['main_business'] ?></td>
</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];
$supplierRow = json_decode($supplier_details['processed_json'],true);
//print_r($supplierRow);
$company_name = MYUTIL::findCompanyName($all_company_details,$supplierRow['company_id'],1);
$total_no_of_suppliers = count($supplierRow['manufacturing_details']);
$total_payments_percent_on_credit_for_supplier = 0;
foreach($supplierRow['manufacturing_details'] as $manuRow){
$total_payments_percent_on_credit_for_supplier = $supplierRow['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'].' days</td></tr>' : '<td class="customtd">NA</td></tr>';
array_push($supplierResult,$temp);
}
}
}
// this is for trading
foreach(isset($clientRow['trade_details']) && $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 class="customtd"><?php echo $pstRow['type'] ?></td>
<td class="customtd"><?php echo $pstRow['name'] ?></td>
<td class="customtd"><?php echo $pstRow['value'] ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pstRow['value']) : 'Not Observed'?></td>
<td class="customtd"><?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 class="customtd"><?php echo $reRow['type'] ?></td>
<td class="customtd"><?php echo $reRow['name'] ?></td>
<td class="customtd"><?php echo $reRow['value'] ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($reRow['value']) : 'Not Observed' ?></td>
<td class="customtd"><?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 class="customtd"><?php echo $wsRow['type'] ?></td>
<td class="customtd"><?php echo $wsRow['name'] ?></td>
<td class="customtd"><?php echo $wsRow['value'] ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($wsRow['value']): 'Not Observed' ?></td>
<td class="customtd"><?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 style="text-align:justify;">Considering the size of operations, the stock of finished goods maintained is sufficient as per the PD Officers observations.</p>';
}else if(!strcasecmp($is_stock_sufficient_enough,'no')){
echo '<p style="text-align:justify;">Considering the size of operations, the stock of finished goods maintained is not sufficient as per the PD Officers observations.</p>';
}
if(!strcasecmp($is_raw_materials_sufficient_enough,'yes'))
{
echo '<p style="text-align:justify;">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 style="text-align:justify;">Considering the size of operations, the stock of raw materials maintained is not sufficient as per the PD Officers observations.</p>';
}
$stock_photo_count = $pd_images[11];
// echo count($pd_images[11]);
// die();
$stock_img_row_count = ceil(count($stock_photo_count) / 5);
//echo $stock_img_row_count;
if(count($stock_photo_count)){
echo '<br>';
echo '<p>Stock Photograph`s :</p>';
echo '<br>';
echo '<table border="1" height="100%" width="50%">';
//echo '<tbody>';
// echo '<div style="border:1px;">';
// foreach($stock_photo_count as $stock)
// {
// echo $stock['pd_document_title'];
// echo '<img src="'.$stock['doc_url'].'" alt="" width="200" height="200"/>';
// echo '&nbsp;&nbsp;&nbsp;';
// }
//echo '</tr>';
for($img_row = 1; $img_row <= $stock_img_row_count; $img_row++)
{
echo '<tr>';
$from = $img_row == 1 ? $img_row : ($img_row+4);
$to = ($from + 4);
for($stock_photo_iter = $from; $stock_photo_iter <= $to;$stock_photo_iter++)
{
if(isset($stock_photo_count[$stock_photo_iter]) &&$stock_photo_count[$stock_photo_iter]['company_id'] == ($business_count+1))
{
echo '<td>';
echo '<div class="gallery">';
echo '<img src="'.$stock_photo_count[$stock_photo_iter]['doc_url'].'" alt="" width="200" height="200">';
echo '<div class="desc">'.$stock_photo_count[$stock_photo_iter]['pd_document_title'].'</div>';
echo '</div>';
echo '</td>';
//unset($stock_photo_count[$stock_photo_iter]);
}
}
//echo "<br><br><hr>";
echo '</tr>';
}
//echo '</tbody>';
echo '</table>';
}
//die();
?>
<?php
//die();
}
else {?>
<!-- <p> Stock details is not available.</p> -->
<?php }
//} for stop cell map error, un commet when lot of form data not available but have to test PDF
?>
<!-- #################end stock section #################-->
<!-- #################Start of AI #################-->
<?php
//echo "AI*******************##############@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@";
if(count($assessed_income_details) && isset($assessed_income_details[ ($business_count+1) ] ))
{
$ai_core_details = ($assessed_income_details[ ($business_count+1) ]['core_details']);
//print_r($ai_core_details);
$ai_core_details_processed = ASSESSEDINCOME::getCoreDetails($ai_core_details);
// echo "######################################";
// print_r($ai_core_details_processed);
// die();
$ai_summary_details = ($assessed_income_details[ ($business_count+1) ]['summary_details']);
$ai_summary_details_processed = ASSESSEDINCOME::getSummaryTable($ai_summary_details,$ai_core_details);
echo "<h2>Assessed Income - ".MYUTIL::findCompanyName($all_company_details,($business_count+1),1)."</h2>";
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1)
{
echo '<br><p style="text-align:justify;">As per person met, the following Purchase details were shared:</p><br>';
}
else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
{
echo '<br><p>As per person met, Purchase details were not shared, income calculated by Net magin percentage.</p><br>';
}
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1 && $ai_core_details['gross_profit_calculation_type'][0]['purchase_type'] == 1)
{
echo '<p>Itemwise Purchase Details :</p>';
echo '<table class="scorecard_table">';
echo '<thead>';
echo '<tr> <th>Raw Material/Trading Item </th> <th class="customtd">Purchase Quantity</th> <th class="customtd">UOM</th> <th class="customtd">Rate/Unit of Purchase</th> <th>Frequency</th> <th>Annual Purchase(Rs)</th> </tr>';
echo '</thead>';
echo '<tbody>';
foreach($ai_core_details_processed['purchase_to_display'] as $dat)
{
echo '<tr> <td>'.$dat['material_name'] .'</td> <td class="customtd">'.$dat['qty'] .'</td> <td class="customtd">'.$dat['uom'] .'</td> <td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['rate']) .'</td> <td class="customtd">'.$dat['frequency'] .'</td> <td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($dat['annual_value']) .'</td> </tr>';
}
echo '</tbody>';
echo '</table>';
}
else if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 1 &&$ai_core_details['gross_profit_calculation_type'][0]['purchase_type'] == 2)
{
echo '<p>Billwise Purchase Details :</p>';
foreach($ai_core_details_processed['purchase_to_display'] as $billwise)
{
echo '<div id="billwise">';
echo 'Item name : <b>' . $billwise['item_name'].'</b><br>';
echo '<b>'.$billwise['month_count'].'</b> month(s) purchase value : <b>'.MYUTIL::customIndianNumberFormat($billwise['annual_purchase_value']).'</b> Annual Purchase value:<b>'. MYUTIL::customIndianNumberFormat($billwise['annual_purchase_value'] * (12 / $billwise['month_count']) ).'</b>';
echo '<hr>';
foreach($billwise['months'] as $month_data)
{
//echo '<span style="display:inline;width:auto;height:auto;padding: 5px;">';
echo '<br>';
echo '<table class="billwise_table">';
echo '<thead>';
echo '<tr> <th colspan="2">'.$month_data['month_to_dispaly'].'</th> </tr>';
echo '<tr> <th>Date</th> <th>Value</th></tr>';
echo '</thead>';
echo '<tbody>';
foreach($month_data['month_data'] as $month)
{
echo '<tr> <td>'.$month['date'] .'</td> <td>'.$month['value'] .'</td> </tr>';
}
echo '</tbody>';
echo '</table>';
//echo '</span>';
}
echo '</div>';
}
}
}
echo '<p style="text-align:justify;">';
if(isset($ai_core_details) && count($ai_core_details['sales_declared_by_customer']))
{
$str = 'As per person met, '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($ai_core_details['sales_declared_by_customer'][0]['sales_declared_by_customer']).' ( '.MYUTIL::numtowords($ai_core_details['sales_declared_by_customer'][0]['sales_declared_by_customer']).' ) declared as annual sale value.';
if($ai_core_details['gross_profit_calculation_type'][0]['mode'] == 2)
{
$str .= '<br>Also '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($ai_core_details['sales_declared_by_customer'][0]['margin_value']).' ( '.MYUTIL::numtowords( $ai_core_details['sales_declared_by_customer'][0]['margin_value']).' )'.'( '.$ai_core_details['sales_declared_by_customer'][0]['margin_per'].'% sales declared ) as net margin amount.';
}
echo $str;
echo '</p><br>';
}
//die();
if(isset($ai_core_details) && count($ai_core_details['sales_calculated_by_itemwise']))
{
echo '<p>Sales Itemwise : </p>';
echo '<table class="scorecard_table">';
echo '<thead>';
echo $ai_core_details_processed['sales_calculated_by_itemwise_header'];
echo '</thead>';
echo '<tbody>';
foreach($ai_core_details_processed['sales_item_wise_to_diaplay'] as $sid)
{
echo '<tr>';
echo '<td>'.$sid['sale_item'].'</td><td class="customtd">'.$sid['sales_qty'].'</td><td class="customtd">'.$sid['uom'].'</td><td>'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['rate_per_unit']).'</td><td class="customtd">'.$sid['frequency'].'</td><td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['annual_sale_value']).'</td>';
if(isset($sid['margin_per'])){echo '<td class="customtd">'.$sid['margin_per'].'</td>'; }
if(isset($sid['margin_per_uom'])){echo '<td class="customtd">'.$sid['margin_per_uom'].'</td>'; }
if(isset($sid['margin_final_value'])){echo '<td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($sid['margin_final_value']).'</td>'; }
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
}
if(isset($ai_core_details) && count($ai_core_details['sales_items_by_monthwise']))
{
echo "<br>";
echo "<p>Kuchha Sales Book/Bills : </p>";
foreach($ai_core_details_processed['sales_month_wise_to_display'] as $sale_month_wise)
{
// if($sale_month_wise['sales_type'] == 1)
// {
echo '<div id="billwise">';
echo 'Item name : <b>' . $sale_month_wise['sales_item'].'</b><br>';
if($sale_month_wise['sales_type'] == 1)
{
echo '<b>'.$sale_month_wise['month_count'].'</b> month purchase value : <b>'.$rupee_symbol.''.MYUTIL::customIndianNumberFormat($sale_month_wise['total_months_value']).'</b> Annual Purchase value:<b>'.$rupee_symbol.'' .MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] * (12 / $sale_month_wise['month_count']) )).'</b>';
}
else
{
echo 'Annual Purchase value:<b>'. $rupee_symbol.' '.MYUTIL::customIndianNumberFormat(($sale_month_wise['total_months_value'] )).'</b>';
}
echo '<hr>';
$row_count = ceil(count($sale_month_wise['months']) / 5);
echo '<table>';
for($i = 1; $i <= $row_count; $i++)
{
$from = $i==1 ? $i : ($i + 4);
$to = ($from + 4);
echo '<tr>';
for($j = $from ; $j <= $to ;$j++)
{
//$sale_month_wise['months'] as $sale_month_data
//echo '<span style="display:inline;width:auto;height:auto;padding: 5px;">';
if(isset($sale_month_wise['months'][$j]))
{
echo '<td>';
echo '<table class="billwise_table">';
echo '<thead>';
if($sale_month_wise['sales_type'] == 1)
{
echo '<tr> <th colspan="2">'.$sale_month_wise['months'][$j]['month_to_dispaly'].'</th> </tr>';
}
if($sale_month_wise['sales_type'] == 1)
{
echo '<tr> <th>Date</th> <th>Value</th></tr>';
}else if($sale_month_wise['months'][$j]['sales_type'] == 2)
{
echo '<tr> <th>Frequncy</th> <th>Value</th></tr>';
}
echo '</thead>';
echo '<tbody>';
foreach($sale_month_wise['months'][$j]['month_data'] as $month)
{
if($sale_month_wise['sales_type'] == 1)
{
echo '<tr> <td>'.$month['date'] .'</td> <td>'.$month['value'] .'</td> </tr>';
}
else if($sale_month_wise['sales_type'] == 2)
{
echo '<tr> <td>'.$month['frequency_name'] .'</td> <td>'.$month['frequency_value'] .'</td> </tr>';
}
}
echo '</tbody>';
echo '</table>';
echo '</td>';
}
}
echo '</tr>';
}
echo '</table>';
echo '</div>';
//}
}
}
//die();
if(isset($ai_core_details) && count($ai_core_details['business_expenses']))
{
echo '<p>Business Expenses Details :</p>';
echo '<table class="scorecard_table">';
echo '<thead>';
echo '<tr> <th>Business Expense </th> <th>Amount</th> <th>Frequency </th> <th>Annual Expenses</th></tr>';
echo '</thead>';
echo '<tbody>';
foreach($ai_core_details_processed['business_expenses_to_diaplay'] as $b_exp)
{
echo '<tr> <td>'.$b_exp['expense_item'] .'</td> <td class="customtd">'.$rupee_symbol." ".MYUTIL::customIndianNumberFormat($b_exp['expense_value']) .'</td> <td class="customtd">'.$b_exp['frequency_name'] .'</td> <td class="customtd">'.$rupee_symbol." ".MYUTIL::customIndianNumberFormat($b_exp['annual_expenses_value']).'</td></tr>';
}
echo '</tbody>';
echo '</table>';
}
if(isset($ai_core_details) && count($ai_core_details['house_hold_expenses']))
{
echo '<p>Household Expenses Details :</p>';
echo '<table class="scorecard_table">';
echo '<thead>';
echo '<tr> <th>Expense Particulars </th> <th>Amount (Rs) </th> <th>Frequency </th> <th>Annual Expenses(Rs)</th></tr>';
echo '</thead>';
echo '<tbody>';
foreach($ai_core_details_processed['household_expenses_to_diaplay'] as $h_exp)
{
echo '<tr> <td>'.$h_exp['expense_item'] .'</td> <td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($h_exp['expense_value']) .'</td> <td class="customtd">'.$h_exp['frequency_name'] .'</td> <td class="customtd">'.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($h_exp['annual_expense_value']) .'</td></tr>';
}
echo '</tbody>';
echo '</table>';
}
if(isset($ai_core_details) && count($ai_summary_details_processed))
{
echo '<p>The Summary of Income :</p>';
echo '<table class="scorecard_table">';
echo '<thead>';
echo $ai_summary_details_processed['ai_table_header_row'];
echo '</thead>';
echo '<tbody>';
echo $ai_summary_details_processed['sale_revenue_row'];
echo $ai_summary_details_processed['purchase_row'];
echo $ai_summary_details_processed['gross_profit_loss_row'];
echo $ai_summary_details_processed['business_expense_row'];
echo $ai_summary_details_processed['net_profit_loss_row'];
echo $ai_summary_details_processed['house_hold_expense_row'];
echo $ai_summary_details_processed['disposable_income_row'];
echo $ai_summary_details_processed['net_margin_row'];
echo '</tbody>';
echo '</table>';
echo '<br>';
echo '<table class="scorecard_table">';
echo '<thead>';
echo '<tr> <th>Particulars</th> <th>Details</th> </tr>';
echo '</thead>';
echo '<tbody>';
echo $ai_summary_details_processed['considered_sales_revenue_row'];
echo $ai_summary_details_processed['considered_net_profit_row'];
echo $ai_summary_details_processed['considered_net_margint_row'];
echo '</tbody>';
echo '</table>';
}
echo "<div class='page_break'></div>";
//die();
?>
<!-- #################End of AI #################-->
<?php } // end of total_no_of_business for loop
} // 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);die();
//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 class="customtd"><?php echo $paRow['assets_mode']; ?></td>
<td class="customtd"><?php echo $paRow['about_assets']; ?></td>
<td class="customtd"><?php echo $paRow['name_of_the_owner']; ?></td>
<td class="customtd"><?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 class="customtd"><?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 Holder's 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 class="customtd"><?php echo $bdRow['account_name'] ?></td>
<td class="customtd"><?php echo $bdRow['bank_name'] ?></td>
<td class="customtd"><?php echo $bdRow['account_type'] ?></td>
<td class="customtd"><?php echo $bdRow['od_cc_limit'] ? $bdRow['od_cc_limit'] : "NA" ?></td>
<td class="customtd"><?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);die();
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_title'].$fmValue['selected_person'].", who is an applicant in the case, resides at ".$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 class="customtd"><?php echo $fmRow['name'] ?></td>
<td class="customtd"><?php echo $fmRow['family_member_relationship'] ?></td>
<td class="customtd"><?php echo $fmRow['family_member_age'] ?></td>
<td class="customtd"><?php echo $fmRow['family_member_earning'] ?></td>
<td class="customtd"><?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);
//print_r($otherLoanRow);die();
$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($applicants_details);die();
//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],$applicants_details);//applicants_details comes from controller
}
}
// 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 <span style="font-size:16px;font-weight:bold;"><?php echo $pd_offiecer_status_about_neighbor;}?> </span></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['recommendation_negative']);die();
$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="boxstyle2">polite&nbsp;&nbsp;&nbsp;<div class="ver_line"><?php if($polite){?><span style='font-family: DejaVu Sans; sans-serif;font-size:12px'>&#10004;</span><?php } ?></div></div></td>
<td><div id="boxstyle2">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 $tick_mark ='<span style="font-family: DejaVu Sans; sans-serif;font-size:12px">✔</span>';
?>
<table>
<tr>
<td >
<div id="first_div" style="border-color:green;color:green;">Polite</div> <div id="tick_div" style="border-color:green;color:green;"><?php if($polite){ echo $tick_mark; } ?></div>
</td>
<td style="padding-left:50px;">
<div id="first_div" style="border-color:red;color:red;">Rude</div> <div id="tick_div" style="border-color:red;color:red;"><?php if($rude){ echo $tick_mark; } ?></div>
</td>
<td style="padding-left:50px;">
<div id="first_div" style="border-color:red;color:red;">Others mentioned as below</div> <div id="tick_div_other" style="border-color:red;color:red;"><?php if($other_behaviour){ echo $tick_mark; } ?></div>
</td>
</tr>
</table>
<?php if($other_behaviour){
echo "Behaviour Details : ".$other_behaviour_remarks;
}?>
<br>
<li>Suitability of Business Location: </li>
<table>
<!-- <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>-->
<tr>
<td >
<div id="first_div" style="border-color:green;color:black;">Well Suited</div> <div id="tick_div" style="border-color:green;color:black;"><?php if($well){ echo $tick_mark; } ?></div>
</td>
<td style="padding-left:50px;">
<div id="first_div" style="border-color:#ffff00;color:black;">Fairly Suited</div> <div id="tick_div" style="border-color:#ffff00;color:black;"><?php if($fair){ echo $tick_mark; } ?></div>
</td>
<td style="padding-left:50px;">
<div id="first_div" style="border-color:red;color:black;">Not Suited</div> <div id="tick_div" style="border-color:red;color:black;"><?php if($not){ echo $tick_mark; } ?></div>
</td>
</tr>
</table>
<li>PD Officers overall assessment: </li>
<table >
<!-- <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> -->
<tr>
<td >
<div id="first_div" style="border-color:green;color:black;">Positive</div> <div id="tick_div" style="border-color:green;color:black;"><?php if($positive){ echo $tick_mark; } ?></div>
</td>
<td style="padding-left:50px;">
<div id="first_div" style="border-color:#ffff00;color:black;">Refer to Credit</div> <div id="tick_div" style="border-color:#ffff00;color:black;"><?php if($refer_to_credit){ echo $tick_mark; } ?></div>
</td>
<td style="padding-left:50px;">
<div id="first_div" style="border-color:red;color:black;">Negative</div> <div id="tick_div" style="border-color:red;color:black;"><?php if($negative){ echo $tick_mark; } ?></div>
</td>
<?php if($other_pd_officer_command){?>
<td style="padding-left:50px;">
<div id="first_div" style="border-color:red;color:black;">Others</div> <div id="tick_div" style="border-color:red;color:black;"><?php if($other_pd_officer_command){ echo $tick_mark; } ?></div>
</td>
<?php } ?>
</tr>
</table>
</ul>
</div>
<?php if(!$other_pd_officer_command){?>
<p>PD officer recommendation is <?php
if($positive){ $color_for_pd_offcier_recom = 'green';} else if($negative) { $color_for_pd_offcier_recom = 'red';}else{ $color_for_pd_offcier_recom = 'black';}
echo '<strong><span style="font-size:15px;color:'.$color_for_pd_offcier_recom.';">'.$fo_diplay.'</span></strong>';?>. The following key points were considered while arriving at the aforementioned status.</p>
<?php
//die();
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['reason_for_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
$show_detailed_scorecard = null;
if($show_detailed_scorecard)
{
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 class="customtd">'.$general['l2_weightage'] .'%</td><td class="customtd">'.$general['answer'].
'</td><td class="customtd">'.$general['score_band'].'</td><td class="customtd">'.$general['attributed_score'].'<br>'.$span.'</td><td class="customtd">'.$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 class="customtd">'.number_format($pd_score['score_summary']['general']['actual_score'],2,'.',',').'</td> <td class="customtd">'.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 class="customtd">'.$final_remark['l2_weightage'].'%</td><td class="customtd">'.$final_remark['answer'].'</td><td class="customtd">'.$final_remark['score_band'].'</td><td class="customtd">'.$final_remark['attributed_score'].'<br>'.$span.'</td><td class="customtd">'.$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 class="customtd">'.number_format($pd_score['score_summary']['final_remarks']['actual_score'],2,'.',',').'</td> <td class="customtd">'.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' || $key != 'location_suited_for_busienss')
{
echo '<tr>'.'<td>'.$question.'</td><td class="customtd">'.$business['l2_weightage'].'%</td><td class="customtd">'.$business['answer'].'</td><td class="customtd">'.$business['score_band'].'</td><td class="customtd">'.$business['attributed_score'].'<br>'.$span.'</td><td class="customtd">'.$business['max_score'].'<br>'.$max_span.'</td></tr>';
}
if($key == 'location_suited_for_busienss')
{
echo '<tr>'.'<td>'.$question.'</td><td class="customtd">'.$business['l2_weightage'].'%</td><td class="customtd">'.$address_type_remarks_caption[ $business['answer'] ].'</td><td class="customtd">'.$business['score_band'].'</td><td class="customtd">'.$business['attributed_score'].'<br>'.$span.'</td><td class="customtd">'.$business['max_score'].'<br>'.$max_span.'</td></tr>';
}
if($key == 'cerificates')
{
$certificates = $business;
echo '<tr>'.'<td> Certificates </td><td class="customtd">'.round($business['l2_weightage'],2).'%</td><td class="customtd">'.'Refer Cert Table'.'</td><td class="customtd">'.$business['score_band'].'</td><td class="customtd">'.$business['attributed_score'].'</td><td class="customtd">'.$business['max_score'].'</td></tr>';
}
}
echo '<tr> <td colspan="4">Business Section Sum of Attributed Score | Sum of Max Score </td> <td class="customtd">'.number_format($pd_score['score_summary']['business']['actual_score'],2,'.',',').'</td> <td class="customtd">'.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 class="customtd">'.$cerificate['answer'].'</td><td class="customtd">'.$cerificate['score_band'].'</td><td class="customtd">'.round($cerificate['attributed_score'],3).'<br>'.$span.'</td><td class="customtd">'.round($cerificate['max_score'],3).'<br>'.$max_span.'</td></tr>';
}
}
echo "<table>";
}
// ########################### End Of Score Card Section #########################################
?>
</body>
</html>