SMC CHGS 3 REPORT PART

This commit is contained in:
Velz2020 2021-02-15 18:03:26 +05:30
parent f0877e0014
commit 74806f0691
4 changed files with 69 additions and 29 deletions

View File

@ -1406,7 +1406,8 @@ class Common_Masters_Controller extends REST_Controller {
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($pdid);
// print_r($pd_master_details);die();
$addresses = $this->Common_Masters_Model->getSMCTempAddresses($pd_master_details[0]['excel_file_id']);
$file_id = isset($pd_master_details[0]['excel_file_id']) && $pd_master_details[0]['excel_file_id'] != '' ? $pd_master_details[0]['excel_file_id'] : $pdid;
$addresses = $this->Common_Masters_Model->getSMCTempAddresses($file_id);
$addresses[] = array('id' => null,'display' => 'Add New Address', 'is_others' => -1);
if(count($addresses))
{
@ -1438,8 +1439,19 @@ class Common_Masters_Controller extends REST_Controller {
{
$records = $this->post('records');
// print_r($records);
if(isset($records['file_id']))
if(isset($records['pd_id']))
{
$pd_master_details = $this->PD_Model->getPDMasterDetails($records['pd_id']);
if(isset($pd_master_details[0]['excel_file_id']) && $pd_master_details[0]['excel_file_id'] != '')
{
$records['file_id'] = $pd_master_details[0]['excel_file_id'];
}
else
{
$records['file_id'] = $records['pd_id'];
}
unset($records['pd_id']);
$id = $this->Common_Masters_Model->saveRecords($records,SMC_TEMP_ADDRESS);
if($id)
{

View File

@ -601,6 +601,13 @@ class PD_Controller extends REST_Controller {
if($pd_id != null || $pd_id != '')
{
// if it is SMC PD check excel file id , if not store address in smc address
// temprary table against pd id
if(!isset($pd_details[0]['excel_file_id']))// && $pd_details[0]['excel_file_id'] != '')
{
$this->saveSMCTempAddress($pd_id,$addresses);
}
//If PD created sucessfully then create a externa folder named with pd_id
if(!file_exists($this->external_path.'/pd_reports/'.$pd_id))
@ -11150,6 +11157,13 @@ public function getCompaniesListsFromGeneralFormRawJSON_post()
// echo $pd_details['fk_pd_allocated_to'];die();
return $pd_details;
}
function saveSMCTempAddress($pd_id,$addresses)
{
$records = array('file_id' => $pd_id,'addressline' => $addresses[0]['addressline1'],'city' => $addresses[0]['fk_city'],'state' => $addresses[0]['fk_state'],'pincode' => $addresses[0]['pincode']);
$this->PD_Model->saveRecords($records,SMC_TEMP_ADDRESS);
}

View File

@ -1513,13 +1513,13 @@ public function filterSalesPDList_post() {
// die();
//score card part
$html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true);
// echo $html_content;die();
// echo $html_content;die();
$pdf_name = $view_data['pd_master_details'][0]['main_applicant'];
$pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF
$output_file = $this->external_path ."/pd_reports/" . $records['pd_id'] . "/temp.pdf";
$bytes = file_put_contents($output_file, $pdf_doc);
// echo $bytes;die();
// echo $bytes;die();
$bucket_name = LENDER_BUCKET_NAME_PREFIX.(ENVIRONMENT == 'production' ? 7 : 35);
$key = 'pd'.$records['pd_id'].'/pd_reports/'.$pdf_name.'.pdf';
$bucket_data = array('bucket_name'=>$bucket_name,'key'=>$key,'sourcefile'=>$output_file);
@ -1567,16 +1567,16 @@ public function filterSalesPDList_post() {
}
$score_card_questions['no_of_years_business_run'] = array('answer_id' => ( $view_data['pd_section_data'][8]['business_years'].'.'.(isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_months'] : '0') ) ,'answer' => ( $view_data['pd_section_data'][8]['business_years'].'.'.(isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_months'] : '0') ));
$score_card_questions['no_of_years_business_run'] = array('answer_id' => (isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_years'].'.'.(isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_months'] : '0') : 'NA' ) ,'answer' => ( isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_years'].'.'.(isset($view_data['pd_section_data'][8]['business_years']) ? $view_data['pd_section_data'][8]['business_months'] : '0') : 'NA'));
$score_card_questions['business_activity_has_seen'] = array('answer_id' => $view_data['pd_section_data'][8]['business_is_pd_visited'],'answer' => $view_data['pd_section_data'][8]['business_is_pd_visited']);
$score_card_questions['business_activity_has_seen'] = array('answer_id' => isset($view_data['pd_section_data'][8]['business_is_pd_visited']) ? $view_data['pd_section_data'][8]['business_is_pd_visited'] : 'NA','answer' => isset($view_data['pd_section_data'][8]['business_is_pd_visited']) ? $view_data['pd_section_data'][8]['business_is_pd_visited'] : 'NA');
$score_card_questions['employees_total'] = array('answer_id' => ($view_data['pd_section_data'][7]['permanant_employees_person_met'] + $view_data['pd_section_data'][7]['temporary_employees_person_met'] ),'answer' => ($view_data['pd_section_data'][7]['permanant_employees_person_met'] + $view_data['pd_section_data'][7]['temporary_employees_person_met'] ));
$score_card_questions['owned_property'] = array('answer_id' => ($view_data['pd_section_data'][8]['business_ownership_type'] == 'Rented' ? 'No' : 'Yes') ,'answer' => ($view_data['pd_section_data'][8]['business_ownership_type'] == 'Rented' ? 'No' : 'Yes'));
$score_card_questions['owned_property'] = array('answer_id' => (isset($view_data['pd_section_data'][8]['business_ownership_type']) ? ($view_data['pd_section_data'][8]['business_ownership_type'] == 'Rented' ? 'No' : 'Yes') : 'NA') ,'answer' => (isset($view_data['pd_section_data'][8]['business_ownership_type']) ? ($view_data['pd_section_data'][8]['business_ownership_type'] == 'Rented' ? 'No' : 'Yes') : 'NA'));
$score_card_questions['business_activity'] = array('answer_id' => $view_data['pd_section_data'][8]['business_is_pd_visited'],'answer' => $view_data['pd_section_data'][8]['business_is_pd_visited']);
//$score_card_questions['business_activity'] = array('answer_id' => $view_data['pd_section_data'][8]['business_is_pd_visited'],'answer' => $view_data['pd_section_data'][8]['business_is_pd_visited']);
$score_card_questions['stock_visited'] = array('answer_id' => (isset($view_data['pd_section_data'][13]['estimated_uom']) ? $view_data['pd_section_data'][13]['estimated_uom'] : 'NA'),'answer' => (isset($view_data['pd_section_data'][13]['estimated_uom']) ? $view_data['pd_section_data'][13]['estimated_uom'] : 'NA'));
@ -1611,8 +1611,9 @@ public function filterSalesPDList_post() {
$this->response($data,REST_Controller::HTTP_OK);
}
print_r($this->db->last_query());
// print_r($this->db->last_query());
}
}

View File

@ -245,14 +245,15 @@ defined('BASEPATH') OR exit('No direct script access allowed');
}
$ownership_type = '';
if( (strtolower($pd_section_data[8]['business_ownership_type'])) == 'owned')
if( isset($pd_section_data[8]['business_ownership_type']) && (strtolower($pd_section_data[8]['business_ownership_type'])) == 'owned')
{
$ownership_type = '( Owned )';
}
else
else if(isset($pd_section_data[8]['business_ownership_type']) && (strtolower($pd_section_data[8]['business_ownership_type'])) == 'rented')
{
$ownership_type = ' ( Rented ) - Rent paid '.$rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pd_section_data[8]['business_monthly_rented_amt']);
}
echo '<tr> <td colspan="3">Address Type / Ownership</td> <td colspan="7" class = "tdcenteralign">'.$pd_section_data[2]['address_type']['address_type'].$ownership_type.'</td></tr>';
if(isset($pd_section_data[8]['is_business_address']) && strtolower($pd_section_data[8]['is_business_address']) == 'yes')
{
@ -399,9 +400,9 @@ defined('BASEPATH') OR exit('No direct script access allowed');
</tr>
<tr>
<td colspan="3" >Loan Amount Applied for (<?php echo $rupee_symbol?>)</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pd_section_data[3]['loan_amount'])?></td>
<td class = "tdcenteralign" colspan="3" ><?php echo ( isset($pd_section_data[3]['loan_amount']) && $pd_section_data[3]['loan_amount'] != '' ? $rupee_symbol.' '.MYUTIL::customIndianNumberFormat($pd_section_data[3]['loan_amount']) : '-')?></td>
<td colspan="2">Total Fund Requirement (<?php echo $rupee_symbol?>)</td>
<td class = "tdcenteralign" colspan="2"> <?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['total_fund_requirement'])?></td>
<td class = "tdcenteralign" colspan="2"> <?php echo ( isset($pd_section_data[3]['total_fund_requirement']) ? $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['total_fund_requirement']): '-')?></td>
</tr>
<?php if(isset($pd_section_data[3]['remarks_fund_source_balance'])){?>
<tr>
@ -411,16 +412,16 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<?php } ?>
<tr>
<td colspan="3" >Loan tenure</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['loan_tenure']?></td>
<td class = "tdcenteralign" colspan="7" ><?php echo (isset($pd_section_data[3]['loan_tenure']) ? $pd_section_data[3]['loan_tenure'] : '-')?></td>
</tr>
<tr>
<td colspan="3" >End use of Loan</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['end_use']?></td>
<td class = "tdcenteralign" colspan="7" ><?php echo ( isset($pd_section_data[3]['end_use']) ? $pd_section_data[3]['end_use'] : '-')?></td>
</tr>
<?php if($pd_master_details[0]['product_abbr'] == 'LFMP'){ ?>
<tr>
<td colspan="3" >Is There any Balance Transfer</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['is_transfer']?></td>
<td class = "tdcenteralign" colspan="7" ><?php echo isset($pd_section_data[3]['is_transfer']) ? $pd_section_data[3]['is_transfer'] : '-'?></td>
</tr>
<?php if(isset($pd_section_data[3]['is_transfer']) && strtolower($pd_section_data[3]['is_transfer']) == 'yes'){?>
<tr>
@ -437,29 +438,29 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<tr>
<td colspan="3" >Type of Property being Mortaged</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['property_type']?></td>
<td class = "tdcenteralign" colspan="7" ><?php echo isset($pd_section_data[3]['property_type']) ? $pd_section_data[3]['property_type'] : '-'?></td>
</tr>
<tr>
<td colspan="3" >Name of The Owner</td>
<td class = "tdcenteralign" colspan="7" ><?php echo $pd_section_data[3]['owner_name']?></td>
<td class = "tdcenteralign" colspan="7" ><?php echo isset($pd_section_data[3]['owner_name']) ? $pd_section_data[3]['owner_name'] : '-'?></td>
</tr>
<tr>
<td colspan="3" >Estimated Market Value as per Customer</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['emv_per_customer'])?></td>
<td class = "tdcenteralign" colspan="3" ><?php echo isset($pd_section_data[3]['emv_per_customer']) ? $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['emv_per_customer']) : '-'?></td>
<td colspan="2" >Market Value considered for LTV</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['ltv_market_value_calculation'])?></td>
<td class = "tdcenteralign" colspan="2" ><?php echo isset($pd_section_data[3]['ltv_market_value_calculation']) ? $rupee_symbol.' '. MYUTIL::customIndianNumberFormat($pd_section_data[3]['ltv_market_value_calculation']) : ''?></td>
</tr>
<tr>
<td colspan="3" >Addess of property</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $pd_section_data[3]['address'].', '.$pd_section_data[3]['city']['name'].', '.$pd_section_data[3]['state']['name'].', '.$pd_section_data[3]['pincode']?></td>
<td class = "tdcenteralign" colspan="3" ><?php echo isset($pd_section_data[3]['address']) ? $pd_section_data[3]['address'].', '.$pd_section_data[3]['city']['name'].', '.$pd_section_data[3]['state']['name'].', '.$pd_section_data[3]['pincode'] : ''?></td>
<td colspan="2" >Stage of construction</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $pd_section_data[3]['construction_stage']?></td>
<td class = "tdcenteralign" colspan="2" ><?php echo isset($pd_section_data[3]['construction_stage']) ? $pd_section_data[3]['construction_stage'] : ''?></td>
</tr>
<tr>
<td colspan="3" >Property usage</td>
<td class = "tdcenteralign" colspan="3" ><?php echo $pd_section_data[3]['property_usage']?></td>
<td class = "tdcenteralign" colspan="3" ><?php echo isset($pd_section_data[3]['property_usage']) ? $pd_section_data[3]['property_usage'] : ''?></td>
<td colspan="2" >Structure type</td>
<td class = "tdcenteralign" colspan="2" ><?php echo $pd_section_data[3]['structure_type']?></td>
<td class = "tdcenteralign" colspan="2" ><?php echo isset($pd_section_data[3]['structure_type']) ? $pd_section_data[3]['structure_type'] : ''?></td>
</tr>
<?php }?>
<?php if(isset($pd_section_data[3]['common_remarks']) && !empty($pd_section_data[3]['common_remarks'])){?>
@ -630,10 +631,10 @@ defined('BASEPATH') OR exit('No direct script access allowed');
<tbody>
<tr><th class="thlargefont">Activity Observed during Visit (Yes / No)</th></tr>
<?php
$business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_remark']) && $pd_section_data[8]['business_pd_visited_remark'] != '' ? ( '(' . $pd_section_data[8]['business_pd_visited_remark']. ' ) ' ) : '');
$business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_remark']) && $pd_section_data[8]['business_pd_visited_remark'] != '' ? ( '(' . $pd_section_data[8]['business_pd_visited_remark']. ' ) ' ) : 'Not Available');
?>
<tr><td class = "tdcenteralign"><?php echo ($pd_section_data[8]['business_is_pd_visited'].$business_pd_visited_remark)?> </td> </tr>
<tr><td class = "tdcenteralign"><?php echo (isset($pd_section_data[8]['business_is_pd_visited']) ? $pd_section_data[8]['business_is_pd_visited'] : '' . $business_pd_visited_remark)?> </td> </tr>
</tbody></table>
<br>
<table class="scorecard_table">
@ -1075,6 +1076,10 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
else if(isset($pd_section_data[11]['supplier_not_available_reason'])){
echo '<tr><td class="tdcenteralign">Supplier Information Not available. Reason - '.$pd_section_data[11]['supplier_not_available_reason'] .'</td></tr>';}
else
{
echo '<tr><td class="tdcenteralign">Supplier Information Not available</td></tr>';
}
if(isset($pd_section_data[11]['common_remarks']) && !empty($pd_section_data[11]['common_remarks'])){
echo '<tr><td class="tdcenteralign">Remarks - '.$pd_section_data[11]['common_remarks'] .'</td></tr>';}
@ -1108,6 +1113,10 @@ if(isset($pd_section_data[11]['common_remarks']) && !empty($pd_section_data[11][
else if(isset($pd_section_data[12]['client_not_available_reason'])){
echo '<tr><td class="tdcenteralign">Client Information Not available. Reason - '.$pd_section_data[12]['client_not_available_reason'] .'</td></tr>';}
else
{
echo '<tr><td class="tdcenteralign">Client Information Not available</td></tr>';
}
if(isset($pd_section_data[12]['common_remarks']) && !empty($pd_section_data[12]['common_remarks'])){
echo '<tr><td class="tdcenteralign" colspan='.(count($pd_section_data[12]['client_details']) + 1).'>Remarks - '.$pd_section_data[12]['common_remarks'] .'</td></tr>';
}
@ -1155,6 +1164,10 @@ if(isset($pd_section_data[12]['common_remarks']) && !empty($pd_section_data[12][
{
echo '<tr><td class="tdcenteralign" colspan="8">Stock Information Not available. Reason - '.$pd_section_data[13]['stock_not_available_reason'] .'</td></tr>';
}
else
{
echo '<tr><td class="tdcenteralign" colspan="8">Stock Information Not available.</td></tr>';
}
if(isset($pd_section_data[13]['common_remarks']) && !empty($pd_section_data[13]['common_remarks'])){
echo '<tr><td class="tdcenteralign" colspan="8">Remarks - '.$pd_section_data[13]['common_remarks'] .'</td></tr>';}
@ -1189,7 +1202,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<tr>
<th class="thlargefont" colspan="8">Business Banking & Personal Banking</th>
</tr>
<?php if(count($pd_section_data[9]['banking_details']) && ($pd_section_data[9]['banking_details'][0]['applicant_name'] != '' && $pd_section_data[9]['banking_details'][0]['bank_name'] != '') ){?>
<?php if(isset($pd_section_data[9]['banking_details']) && count($pd_section_data[9]['banking_details']) && ($pd_section_data[9]['banking_details'][0]['applicant_name'] != '' && $pd_section_data[9]['banking_details'][0]['bank_name'] != '') ){?>
<tr>
<th colspan="1">Sr. No.</th>
<th colspan="2">Account Holder's Name</th>
@ -1274,7 +1287,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
<tr>
<th colspan="10">Existing Loan Obligations</th>
</tr>
<?php if(count($pd_section_data[15]['existing_loan_details']) && ($pd_section_data[15]['existing_loan_details'][0]['loan_type'] != '' && $pd_section_data[15]['existing_loan_details'][0]['lender_name'] != '' && $pd_section_data[15]['existing_loan_details'][0]['loan_amount'] != '')){?>
<?php if(isset($pd_section_data[15]['existing_loan_details']) && count($pd_section_data[15]['existing_loan_details']) && ($pd_section_data[15]['existing_loan_details'][0]['loan_type'] != '' && $pd_section_data[15]['existing_loan_details'][0]['lender_name'] != '' && $pd_section_data[15]['existing_loan_details'][0]['loan_amount'] != '')){?>
<tr>
<th colspan="1">Sr. No.</th>
<th colspan="1">Loan<br>Type</th>
@ -1301,7 +1314,7 @@ Business run by the applicant</td><td colspan="4"><?php echo $pd_section_data[1
{
echo '<tr> <td colspan="10" class="tdcenteralign"> Existing Loan Obligations Not Available</td> </tr>';
}
if($pd_section_data[15]['common_remarks'])
if(isset($pd_section_data[15]['common_remarks']) && $pd_section_data[15]['common_remarks'])
{
echo '<tr> <td colspan="2">Remarks</td> <td class="tdcenteralign"colspan="8">'. $pd_section_data[15]['common_remarks'] .'</td> </tr>';
}