Company name fixes : ps

This commit is contained in:
Sanjeev 2021-04-28 12:11:28 +05:30
parent 9afac90ea6
commit 09418f5783
4 changed files with 33 additions and 75 deletions

View File

@ -1511,14 +1511,18 @@ public function filterSalesPDList_post() {
// print_r ($view_data['pd_master_details']);die(); // print_r ($view_data['pd_master_details']);die();
// print_r($pd_section_data);die(); // print_r($pd_section_data);die();
$forms_data_to_be_get_direct_from_excel_sheet = array(3,9,10,15); $forms_data_to_be_get_direct_from_excel_sheet = array(3,9,10,15);
// Using borrower_details in $pd_section_data To Get the company name for SMC Credit PD => MWISE;
$companylist = $this->getCompanyName($pd_section_data[0]);
$view_data['company'] = $companylist ;
if(count($pd_section_data)) if(count($pd_section_data))
{ {
foreach ($pd_section_data as $key => $value) foreach ($pd_section_data as $key => $value)
{ {
if(isset($value['json']) && $value['json'] != '') if(isset($value['json']) && $value['json'] != '')
{ {
// $companylist = $this->getCompanyName($value); $value['json'] = smc_creditpd::getSMCCreditPDReportContent($value,$records['pd_id'],$companylist);
$value['json'] = smc_creditpd::getSMCCreditPDReportContent($value,$records['pd_id']);
// if($value['fk_form_id'] == 2){print_r($value['json']);die();} // if($value['fk_form_id'] == 2){print_r($value['json']);die();}
$view_data['pd_section_data'][$value['fk_form_id']] = $value['json']; $view_data['pd_section_data'][$value['fk_form_id']] = $value['json'];
@ -1577,13 +1581,14 @@ public function filterSalesPDList_post() {
//score card part //score card part
// print_r($view_data); // print_r($view_data);
// 25 "product_abbr": "NBFC/MFI", // 25 "product_abbr": "NBFC/MFI",
if($view_data['pd_master_details'][0]['product_abbr'] == "NBFC/MFI"){ if($view_data['pd_master_details'][0]['product_abbr'] == "NBFC/MFI"){
$html_content = $this->load->view('smc_creditpd_reports/NBFC',$view_data,true); $html_content = $this->load->view('smc_creditpd_reports/NBFC',$view_data,true);
}else{ }else{
$html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true); $html_content = $this->load->view('smc_creditpd_reports/MWISE',$view_data,true);
} }
//echo $html_content;exit(); // echo $html_content;exit();
$pdf_name = $view_data['pd_master_details'][0]['main_applicant']; $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"); $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait");
//End of PDF Gen using DOM PDF //End of PDF Gen using DOM PDF

View File

@ -47,22 +47,5 @@ class applicantname_grabber
if($mergered_applicants_name != ''){ $mergered_applicants_name = substr_replace($mergered_applicants_name, '',-2);} if($mergered_applicants_name != ''){ $mergered_applicants_name = substr_replace($mergered_applicants_name, '',-2);}
return $mergered_applicants_name; return $mergered_applicants_name;
} }
public static function getCompanyName($section){
$json = json_decode($section['json'],true);
$cpny = array();
if(!empty($json['borrower_details'])){
$inx = 1;
foreach ($json['borrower_details'] as $key => $value)
{
$entity_type = $value['entity_type'];
if($entity_type != "Individual"){
$cpny[$inx] =$value['borrower_name'];
$inx++;
}
}
}
return $cpny;
}
} }
?> ?>

View File

@ -3,31 +3,12 @@
class smc_creditpd class smc_creditpd
{ {
private static $current_pd_id = null; private static $current_pd_id = null;
public static function getSMCCreditPDReportContent($section,$pd_id)//1 = Di, 2 = SAL public static function getSMCCreditPDReportContent($section,$pd_id,$company)//1 = Di, 2 = SAL
{ {
SELF::$current_pd_id = $pd_id; SELF::$current_pd_id = $pd_id;
// $CI =&get_instance(); // $CI =&get_instance();
// $CI->load->model('PD_Model'); // $CI->load->model('PD_Model');
$return_data =array(); $return_data =array();
// $json = json_decode($section['json'],true);
// $cpny = array();
// if(!empty($json['borrower_details'])){
// $inx = 1;
// foreach ($json['borrower_details'] as $key => $value)
// {
// $entity_type = $value['entity_type'];
// if($entity_type != "Individual"){
// $cpny[$inx] =$value['borrower_name'];
// $inx++;
// }
// }
// }
// SELF::$company = $cpny;
// print_r($company);die();
if($section['fk_form_id'] == 1){
$company = applicantname_grabber::getCompanyName($section);
}
switch($section['fk_form_id']) switch($section['fk_form_id'])
{ {
case 1://borrower case 1://borrower
@ -56,10 +37,10 @@ class smc_creditpd
break; break;
case 11://supplier case 11://supplier
$return_data = SELF::getSupplierSectionData($section); $return_data = SELF::getSupplierSectionData($section,$company);
break; break;
case 12://client case 12://client
$return_data = SELF::getClientSectionData($section); $return_data = SELF::getClientSectionData($section,$company);
break; break;
case 13://stock case 13://stock
@ -247,23 +228,12 @@ class smc_creditpd
return $json; return $json;
} }
static function getSupplierSectionData($section) static function getSupplierSectionData($section,$company)
{ {
// echo "i am in supp Fns";print_r($company);exit();
$json = json_decode($section['json'],true); $json = json_decode($section['json'],true);
// print_r(json_decode($section['clist'],true)); // print_r(json_decode($section['clist'],true));
// $cpny = array();
// if(!empty($json['borrower_details'])){
// $inx = 1;
// foreach ($json['borrower_details'] as $key => $value)
// {
// $entity_type = $value['entity_type'];
// if($entity_type != "Individual"){
// $cpny[$inx] =$value['borrower_name'];
// $inx++;
// }
// }
// }
$payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided'); $payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided');
// print_r($json);//die(); // print_r($json);//die();
@ -292,7 +262,7 @@ class smc_creditpd
$siz_row .= '<td style="text-align:center;"> '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' </td>'; $siz_row .= '<td style="text-align:center;"> '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' </td>';
$seven_row .= '<td style="text-align:center;"> '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' </td>'; $seven_row .= '<td style="text-align:center;"> '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' </td>';
$eigth_row .= '<td style="text-align:center;"> '. (isset($value['credit_total_purchase']) ? $value['credit_total_purchase'].'%' : 'NA') .' </td>'; $eigth_row .= '<td style="text-align:center;"> '. (isset($value['credit_total_purchase']) ? $value['credit_total_purchase'].'%' : 'NA') .' </td>';
$ninth_row .= '<td style="text-align:center;"> '. (isset($value['company_name']) ? $value['company_name']: 'NA') .' </td>'; $ninth_row .= '<td style="text-align:center;"> '. (isset($value['company_name']) ? $company[$value['company_name']] : 'NA') .' </td>';
} }
$header_row .= '</tr>'; $header_row .= '</tr>';
$first_row .= '</tr>'; $first_row .= '</tr>';
@ -311,7 +281,7 @@ class smc_creditpd
} }
static function getClientSectionData($section) static function getClientSectionData($section,$company)
{ {
$json = json_decode($section['json'],true); $json = json_decode($section['json'],true);
$payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided'); $payment_term = array('1' => 'Supply against advance payment','2' => 'Payment on Receipt of goods / service','3' => 'Payment after Credit Period provided');
@ -342,7 +312,7 @@ class smc_creditpd
$siz_row .= '<td style="text-align:center;"> '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' </td>'; $siz_row .= '<td style="text-align:center;"> '. (isset($value['payment_mode']) ? $value['payment_mode'] : 'NA') .' </td>';
$seven_row .= '<td style="text-align:center;"> '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' </td>'; $seven_row .= '<td style="text-align:center;"> '. (isset($value['credit_period_no']) ? $value['credit_period_no'] : 'NA') .' </td>';
$eight_row .= '<td style="text-align:center;"> '. (isset($value['credit_total_purchase']) ? $value['credit_total_purchase'].'%' : 'NA') .' </td>'; $eight_row .= '<td style="text-align:center;"> '. (isset($value['credit_total_purchase']) ? $value['credit_total_purchase'].'%' : 'NA') .' </td>';
$ninth_row .= '<td style="text-align:center;"> '. (isset($value['company_name']) ? $value['company_name']: 'NA') .' </td>'; $ninth_row .= '<td style="text-align:center;"> '. (isset($value['company_name']) ? $company[$value['company_name']] : 'NA') .' </td>';
} }

View File

@ -6,17 +6,17 @@ defined('BASEPATH') OR exit('No direct script access allowed');
$dash = '<span style="color:black;"> </span>'; $dash = '<span style="color:black;"> </span>';
// $product_name = $master[0]['abbr']; // $product_name = $master[0]['abbr'];
$rupee_symbol = "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>"; $rupee_symbol = "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>";
//print_r($master[0]['abbr']);die();
$company = array(); // $company = array();
$arr = $pd_section_data[1]['borrower_details']; // $arr = $pd_section_data[1]['borrower_details'];
if(!empty($arr)){ // if(!empty($arr)){
for($i=0;$i<count($arr);$i++){ // for($i=0;$i<count($arr);$i++){
$entity_type = $arr[$i]['entity_type']; // $entity_type = $arr[$i]['entity_type'];
if($entity_type != "Individual"){ // if($entity_type != "Individual"){
$company[$i+1] =$arr[$i]['borrower_name']; // $company[$i+1] =$arr[$i]['borrower_name'];
} // }
} // }
} // }
?><!DOCTYPE html> ?><!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@ -824,7 +824,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
<?php }else <?php }else
{ {
echo '<tr> <td class = "tdcenteralign" colspan="10">There is no other business asset available</td> </tr>'; echo '<tr> <td class = "tdcenteralign" colspan="11">There is no other business asset available</td> </tr>';
} }
@ -834,7 +834,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
<?php if(isset($pd_section_data[8]['common_remarks']) && !empty($pd_section_data[8]['common_remarks'])) <?php if(isset($pd_section_data[8]['common_remarks']) && !empty($pd_section_data[8]['common_remarks']))
{ {
//echo '<br><br><table class="scorecard_table"><tr> <td class = "tdcenteralign" colspan="1">Business Assets Remarks - '.$pd_section_data[8]['common_remarks'].' </td></tr></table>'; //echo '<br><br><table class="scorecard_table"><tr> <td class = "tdcenteralign" colspan="1">Business Assets Remarks - '.$pd_section_data[8]['common_remarks'].' </td></tr></table>';
echo '<tr> <td class = "tdcenteralign" colspan="10">Business Assets Remarks - '.$pd_section_data[8]['common_remarks'].' </td></tr>'; echo '<tr> <td class = "tdcenteralign" colspan="11">Business Assets Remarks - '.$pd_section_data[8]['common_remarks'].' </td></tr>';
}?> }?>
</tbody> </tbody>
</table> </table>
@ -849,7 +849,7 @@ $business_pd_visited_remark = (isset($pd_section_data[8]['business_pd_visited_re
<?php if(isset($pd_section_data[10]) && strtolower($pd_section_data[10]['financial_info_available']) == 'yes') { ?> <?php if(isset($pd_section_data[10]) && strtolower($pd_section_data[10]['financial_info_available']) == 'yes') { ?>
<tr> <tr>
<td colspan="6" >Name of the Company / Firm whose financials are noted </td> <td colspan="6" >Name of the Company / Firm whose financials are noted </td>
<td class = "tdcenteralign" colspan="4" ><?php echo isset($applicant_details[0]['company_name']) ? $applicant_details[0]['company_name'] : $pd_master_details[0]['main_applicant']?></td> <td class = "tdcenteralign" colspan="4" ><?php echo (isset($pd_section_data[10]['company_name'])) ? $compnay[$pd_section_data[10]['company_name']] : isset($applicant_details[0]['company_name']) ? $applicant_details[0]['company_name'] : $pd_master_details[0]['main_applicant']?></td>
</tr> </tr>
</tbody></table> </tbody></table>
<table class="scorecard_table"><tbody> <table class="scorecard_table"><tbody>
@ -1205,7 +1205,7 @@ if(isset($pd_section_data[12]['common_remarks']) && !empty($pd_section_data[12][
'<td class="tdcenteralign" colspan="3">'.$section13_value['provider_name'].'</td>'. '<td class="tdcenteralign" colspan="3">'.$section13_value['provider_name'].'</td>'.
'<td class="tdcenteralign" colspan="2">'.(isset($section13_value['estimated_stock_value']) ? $rupee_symbol.''.MYUTIL::customIndianNumberFormat($section13_value['estimated_stock_value']) : 'NA').'</td>'. '<td class="tdcenteralign" colspan="2">'.(isset($section13_value['estimated_stock_value']) ? $rupee_symbol.''.MYUTIL::customIndianNumberFormat($section13_value['estimated_stock_value']) : 'NA').'</td>'.
'<td class="tdcenteralign" colspan="1">'.(isset($section13_value['estimated_quantity']) ? $section13_value['estimated_quantity'].' '.$section13_value['estimated_uom'] : 'NA').'</td>'. '<td class="tdcenteralign" colspan="1">'.(isset($section13_value['estimated_quantity']) ? $section13_value['estimated_quantity'].' '.$section13_value['estimated_uom'] : 'NA').'</td>'.
'<td class="tdcenteralign" colspan="2">'.(isset($section13_value['company_name']) ? $section13_value['company_name'] : 'NA').'</td>'.'</tr>'; '<td class="tdcenteralign" colspan="2">'.(isset($section13_value['company_name']) ? $company[$section13_value['company_name']] : 'NA').'</td>'.'</tr>';
// '<td class="tdcenteralign" colspan="1">'.(isset($section13_value['company_name']) ? MYUTIL::getCompanyNameById($section13_value['company_name']) : 'NA').'</td>'.'</tr>'; // '<td class="tdcenteralign" colspan="1">'.(isset($section13_value['company_name']) ? MYUTIL::getCompanyNameById($section13_value['company_name']) : 'NA').'</td>'.'</tr>';