588 lines
28 KiB
PHP
588 lines
28 KiB
PHP
<?php
|
|
|
|
class smc_creditpd
|
|
{
|
|
private static $current_pd_id = null;
|
|
public static function getSMCCreditPDReportContent($section,$pd_id,$company)//1 = Di, 2 = SAL
|
|
{
|
|
SELF::$current_pd_id = $pd_id;
|
|
// $CI =&get_instance();
|
|
// $CI->load->model('PD_Model');
|
|
$return_data =array();
|
|
switch($section['fk_form_id'])
|
|
{
|
|
case 1://borrower
|
|
$return_data = SELF::getBorrowerSectionData($section);
|
|
break;
|
|
|
|
case 4://General Business
|
|
$json = json_decode($section['json'],true);
|
|
for($i=0;$i<count($json['business_entity']);$i++)
|
|
{
|
|
$value = $json['business_entity'][$i]['company_name'];
|
|
$json['business_entity'][$i]['name_of_the_company'] = (isset($value) ? $company[$value] : 'NA');
|
|
}
|
|
$return_data = $json;
|
|
break;
|
|
case 5://Key Stakeholders
|
|
$json = json_decode($section['json'],true);
|
|
for($i=0;$i<count($json['key_stakeholders']);$i++)
|
|
{
|
|
$value = $json['key_stakeholders'][$i]['company_name'];
|
|
$json['key_stakeholders'][$i]['name_of_the_company'] = (isset($value) ? $company[$value] : 'NA');
|
|
}
|
|
$return_data = $json;
|
|
break;
|
|
case 6://bbusiness brief
|
|
$json = json_decode($section['json'],true);
|
|
for($i=0;$i<count($json['key_products_contribution']);$i++)
|
|
{
|
|
$value = $json['key_products_contribution'][$i]['company_name'];
|
|
$json['key_products_contribution'][$i]['name_of_the_company'] = (isset($value) ? $company[$value] : 'NA');
|
|
}
|
|
$return_data = $json;
|
|
break;
|
|
case 7://emp strength
|
|
case 9://banking
|
|
case 10://finance
|
|
case 14://future
|
|
case 18://credit
|
|
case 19://final remarks
|
|
// $return_data = json_decode($section['json'],true);
|
|
$return_data = SELF::getFinalRemarksSectionData($section);
|
|
break;
|
|
case 3://fund
|
|
$return_data = SELF::getLoanSectionData($section);
|
|
break;
|
|
case 2://address
|
|
$return_data = SELF::getAddressSectionData($section);
|
|
break;
|
|
case 8://assest
|
|
$return_data = SELF::getAssestSectionData($section);
|
|
// print_r($return_data);
|
|
break;
|
|
|
|
case 11://supplier
|
|
$return_data = SELF::getSupplierSectionData($section,$company);
|
|
break;
|
|
case 12://client
|
|
$return_data = SELF::getClientSectionData($section,$company);
|
|
break;
|
|
|
|
case 13://stock
|
|
$return_data = SELF::getStockSectionData($section,$company);
|
|
break;
|
|
|
|
case 15://existing loan
|
|
$return_data = SELF::getExistingLoanSectionData($section);
|
|
break;
|
|
case 16://other family
|
|
$return_data = SELF::getFamilySectionData($section);
|
|
// print_r($return_data);die();
|
|
break;
|
|
case 17://neighborhood
|
|
$return_data = SELF::getNeibourSectionData($section);
|
|
break;
|
|
|
|
case 21://General Section
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 22://Profile
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 23://Size and Geographical Reach
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 24://Product and Process
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 25://Portfolio Health
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 26://Total Overall Debt/Equity Profile
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 27://Financial Analysis
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 28://Overall Plan of Action
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
case 29://Validation Points vide Systems and Books at HQ & Branches
|
|
$return_data = json_decode($section['json'],true);
|
|
break;
|
|
}
|
|
|
|
// print_r($return_data);die();
|
|
return $return_data;
|
|
}
|
|
|
|
|
|
static function getBorrowerSectionData($section)
|
|
{
|
|
$json = json_decode($section['json'],true);
|
|
|
|
$person_met = '';
|
|
$mobile_numbers_array = array();
|
|
// echo "Step 1 Mobile Number Arr Empty";print_r($mobile_numbers_array);
|
|
$inx = 0;
|
|
foreach ($json['borrower_details'] as $key => $value)
|
|
{
|
|
$mobile_numbers = '';
|
|
|
|
if(isset($value['mobile_numbers']) && count($value['mobile_numbers']))
|
|
{
|
|
// echo "Step 2 Incoming Mobile Numbers Checks"; print_r($value['mobile_numbers']);
|
|
foreach ($value['mobile_numbers'] as $k => $smn)
|
|
{
|
|
if((count($value['mobile_numbers']) - 1) == $k){$mobile_numbers .= ($smn['mobile_no']); break;}
|
|
$mobile_numbers .= ($smn['mobile_no'].',<br>');
|
|
}
|
|
$json['borrower_details'][ $key ] ['mobile_numbers'] = $mobile_numbers;
|
|
if($mobile_numbers)
|
|
{
|
|
$mobile_numbers_array[('##'.$inx.'##')] = '( ' . str_replace('<br>', '', $mobile_numbers) . ' ) ';
|
|
}
|
|
// echo "Step 3 Now I have Mobile Arrs"; print_r($mobile_numbers_array);
|
|
}
|
|
|
|
if(isset($value['borrower_met']) && !strcasecmp($value['borrower_met'],'yes'))
|
|
{
|
|
$temp_person_met = $value['borrower_name'].', ';
|
|
// echo "Step 4 In person Met and I have "; print_r($mobile_numbers_array);
|
|
if(isset($value['mobile_numbers']) && count($value['mobile_numbers']))
|
|
{ //echo "Step 5 person met is connected to spec inx ".$value['borrower_name'].'##'.$inx.'##';
|
|
$temp_person_met = $value['borrower_name'].'##'.$inx.'## , ';
|
|
}
|
|
|
|
//$temp_person_met .= ($mobile_numbers != '' ? '(' .$mobile_numbers. ') ,': ',');
|
|
$person_met .= $temp_person_met;
|
|
}
|
|
$mobile_numbers = '';
|
|
$inx++;
|
|
}
|
|
// echo 'Step 6 Visted Person are '.$person_met;
|
|
// if(!isset($json['person_met']))
|
|
// {
|
|
// $json['person_met'] = '';
|
|
// }
|
|
if($person_met != '')
|
|
{
|
|
$person_met = substr_replace($person_met,'',-2);
|
|
// echo 'Step 7 Visted Person are but removed Comma'.$person_met;
|
|
if(substr_count($person_met,','))
|
|
{
|
|
$person_met = substr_replace($person_met,' and ',strrpos($person_met,','),2);
|
|
}
|
|
|
|
}
|
|
// print_r($person_met);
|
|
foreach ($mobile_numbers_array as $key => $value)
|
|
{
|
|
$person_met = str_replace($key, $value, $person_met);
|
|
}
|
|
// echo "Step 8 person with Mobile Number".$person_met;
|
|
$json['person_met'] = $person_met;
|
|
return $json;
|
|
}
|
|
|
|
static function getAssestSectionData($section)
|
|
{
|
|
$json = json_decode($section['json'],true);
|
|
$rupee_symbol = "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>";
|
|
// $CI =&get_instance();
|
|
// $CI->load->model('PD_Model');
|
|
if(isset($json['business_assets_details']) && is_array($json['business_assets_details']) && count($json['business_assets_details']))
|
|
{
|
|
$applicant_details = applicantname_grabber::getLatestApplicantsName($section['fk_pd_id']);
|
|
$asset_type = array('2' => 'Property','3' => 'Vehicle','4' => 'Equipments and machinery','5' => 'Jewellery','6' => 'Life Insurance Policy','7' => 'Investments','1' => 'Others');
|
|
$address_type = array('2' => 'Clinic','3' => 'Factory','4' => 'Warehouse / Godown','5' => 'Shop','6' => 'Residence','7' => 'Residence cum Office','1' => 'Others','8' => 'Industrial Shed','9'=> 'Workshop','10'=> 'Business Centre','11'=> 'Shared Office','12'=> 'Office');
|
|
$vehicle_type = array('2' => 'Car/Jeep','3' => 'Truck/ Bus','4' => 'Rickshaw/Tempo','5' => 'Tractor','6' => 'Two Wheeler','1' => 'Others');
|
|
|
|
// print_r($applicant_details);die();
|
|
|
|
$header_row = '<tr>'.'<th> Particulars </th>';
|
|
$first_row = '<tr>'.'<td> Asset Type </td>';
|
|
$second_row = '<tr>'.'<td> Asset Description </td>';
|
|
$third_row = '<tr>'.'<td> Asset Ownership (Owned / Rented) </td>';
|
|
$fourth_row = '<tr>'.'<td> If Owned then Owner Name </td>';
|
|
$five_row = '<tr>'.'<td> If Owned then Market Value </td>';
|
|
$siz_row = '<tr>'.'<td> Age of the Asset (Years) </td>';
|
|
$seven_row = '<tr>'.'<td> Is there a Loan Against the Asset? (Yes / No) </td>';
|
|
foreach ($json['business_assets_details'] as $key => $value)
|
|
{
|
|
$json['business_assets_details'][$key]['business_assets_mode_name'] = ( $value['business_assets_mode'] == 1 ? $value['other_asset_description'] : $asset_type [ $value['business_assets_mode'] ]);
|
|
$json['business_assets_details'][$key]['business_owner_name'] = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA');
|
|
|
|
$description = $value['other_asset_description'];
|
|
if(isset($value['property_type']))
|
|
{
|
|
|
|
if($value['property_type'] == 1){ $description .= '('. $value['property_type_others'] .')'; }
|
|
else{ $description .= '('. $address_type[ $value['property_type'] ] .')'; }
|
|
}
|
|
if(isset($value['vehicle_type']))
|
|
{
|
|
|
|
|
|
if($value['vehicle_type'] == 1){ $description .= '('. $value['vehicle_type_others'] .')'; }
|
|
else{$description .= '('. $vehicle_type[ $value['vehicle_type'] ] .')';}
|
|
}
|
|
if(isset($value['business_purchase_year']))
|
|
{
|
|
$description .= ' purchased at '.$value['business_purchase_year'];
|
|
}
|
|
if(isset($value['property_address']))
|
|
{
|
|
$description .= ' is in '. $value['property_address'];
|
|
}
|
|
$business_ownership_type = $value['business_ownership_type'] . (isset($value['business_monthly_rented_amt']) ? ' ( '. $rupee_symbol .' '. MYUTIL::customIndianNumberFormat($value['business_monthly_rented_amt']) .' ) ' : '');
|
|
$header_row .= '<th> Assest '. ( $key + 1 ).'</th>';
|
|
$first_row .= '<td style="text-align:center;">'. ( $value['business_assets_mode'] == 1 ? $value['other_asset_description'] : $asset_type [ $value['business_assets_mode'] ]).'</td>';
|
|
$second_row .= '<td style="text-align:center;">'. $description .'</td>';
|
|
$third_row .= '<td style="text-align:center;"> '.$business_ownership_type.' </td>';
|
|
$business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getMultipleApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA');
|
|
$fourth_row .= '<td style="text-align:center;"> '. $business_name_of_the_owner .' </td>';
|
|
$five_row .= '<td style="text-align:center;"> '. (isset($value['business_approximate_market_value']) ? ( $rupee_symbol .' '. MYUTIL::customIndianNumberFormat($value['business_approximate_market_value'])) : 'NA') .' </td>';
|
|
$siz_row .= '<td style="text-align:center;"> '. (isset($value['business_purchase_year']) ? $value['business_purchase_year'] : 'NA') .' </td>';
|
|
$seven_row .= '<td style="text-align:center;"> '. (isset($value['business_emi']) ? $value['business_emi'] : 'NA') .' </td>';
|
|
}
|
|
$header_row .= '</tr>';
|
|
$first_row .= '</tr>';
|
|
$second_row .= '</tr>';
|
|
$third_row .= '</tr>';
|
|
$fourth_row .= '</tr>';
|
|
$five_row .= '</tr>';
|
|
$siz_row .= '</tr>';
|
|
|
|
$json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row);
|
|
}
|
|
return $json;
|
|
}
|
|
|
|
static function getSupplierSectionData($section,$company)
|
|
{
|
|
// echo "i am in supp Fns";print_r($company);exit();
|
|
$json = json_decode($section['json'],true);
|
|
// print_r(json_decode($section['clist'],true));
|
|
|
|
|
|
$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();
|
|
$header_row = '<tr>'.'<th> Particulars </th>';
|
|
$first_row = '<tr>'.'<td> Item Purchased </td>';
|
|
$second_row = '<tr>'.'<td> Contact Person </td>';
|
|
$third_row = '<tr>'.'<td> Mobile Number </td>';
|
|
$fourth_row = '<tr>'.'<td> Landline No </td>';
|
|
$five_row = '<tr>'.'<td> Payment Terms </td>';
|
|
$siz_row = '<tr>'.'<td> Payment Mode </td>';
|
|
$seven_row = '<tr>'.'<td> No of days credit </td>';
|
|
$eigth_row = '<tr>'.'<td>Total purchase done on credit </td>';
|
|
$ninth_row = '<tr>'.'<td>Name of the Company</td>';
|
|
if(isset($json['supplier_details']) && is_array($json['supplier_details']) && count($json['supplier_details']))
|
|
{
|
|
foreach ($json['supplier_details'] as $key => $value)
|
|
{
|
|
$json['supplier_details'][$key]['name_of_the_company'] = (isset($value['company_name']) ? $company[$value['company_name']] : 'NA');
|
|
$json['supplier_details'][$key]['type_of_payment'] = (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: 'NA');
|
|
|
|
$header_row .= '<th>Supplier '.$value['supplier_name'].'</th>';
|
|
$first_row .= '<td style="text-align:center;">'. $value['provider_name'] .'</td>';
|
|
$second_row .= '<td style="text-align:center;">'. $value['contact_person_name'] .'</td>';
|
|
$third_row .= '<td style="text-align:center;"> '. (empty($value['contact_person_mobile_no']) ? '-':$value['contact_person_mobile_no']) .' </td>';
|
|
// $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA');
|
|
$fourth_row .= '<td style="text-align:center;"> '. $value['person_stdcode'].' - '.$value['person_landline'] .' </td>';
|
|
$five_row .= '<td style="text-align:center;"> '. (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: '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>';
|
|
$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']) ? $company[$value['company_name']] : 'NA') .' </td>';
|
|
}
|
|
$header_row .= '</tr>';
|
|
$first_row .= '</tr>';
|
|
$second_row .= '</tr>';
|
|
$third_row .= '</tr>';
|
|
$fourth_row .= '</tr>';
|
|
$five_row .= '</tr>';
|
|
$siz_row .= '</tr>';
|
|
$seven_row .= '</tr>';
|
|
$eigth_row .= '</tr>';
|
|
$ninth_row .= '</tr>';
|
|
|
|
$json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row,'eigth_row' => $eigth_row,'ninth_row'=>$ninth_row);
|
|
}
|
|
return $json;
|
|
}
|
|
|
|
|
|
static function getClientSectionData($section,$company)
|
|
{
|
|
$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');
|
|
// print_r($json);die();
|
|
if(isset($json['client_details']) && is_array($json['client_details']) && count($json['client_details']))
|
|
{
|
|
$header_row = '<tr>'.'<th> Particulars </th>';
|
|
$first_row = '<tr>'.'<td> Product/ Service </td>';
|
|
$second_row = '<tr>'.'<td> Contact Person </td>';
|
|
$third_row = '<tr>'.'<td> Mobile Number </td>';
|
|
$fourth_row = '<tr>'.'<td> Landline No </td>';
|
|
$five_row = '<tr>'.'<td> Payment Terms </td>';
|
|
$siz_row = '<tr>'.'<td> Payment Mode </td>';
|
|
$seven_row = '<tr>'.'<td> No of days credit </td>';
|
|
$eight_row = '<tr>'.'<td>Total sales done on credit</td>';
|
|
$ninth_row = '<tr>'.'<td>Name of the Company</td>';
|
|
|
|
foreach ($json['client_details'] as $key => $value)
|
|
{
|
|
$json['client_details'][$key]['name_of_the_company'] = (isset($value['company_name']) ? $company[$value['company_name']] : 'NA');
|
|
$json['client_details'][$key]['type_of_payment'] = (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: 'NA');
|
|
|
|
$header_row .= '<th>Client '.$value['client_name'].'</th>';
|
|
$first_row .= '<td style="text-align:center;">'. $value['provider_name'] .'</td>';
|
|
$second_row .= '<td style="text-align:center;">'. $value['contact_person_name'] .'</td>';
|
|
$third_row .= '<td style="text-align:center;"> '. (empty($value['contact_person_mobile_no']) ? '-':$value['contact_person_mobile_no']) .' </td>';
|
|
// $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA');
|
|
$fourth_row .= '<td style="text-align:center;"> '. $value['person_stdcode'].' - '.$value['person_landline'] .' </td>';
|
|
$five_row .= '<td style="text-align:center;"> '. (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: '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>';
|
|
$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']) ? $company[$value['company_name']] : 'NA') .' </td>';
|
|
|
|
}
|
|
|
|
$header_row .= '</tr>';
|
|
$first_row .= '</tr>';
|
|
$second_row .= '</tr>';
|
|
$third_row .= '</tr>';
|
|
$fourth_row .= '</tr>';
|
|
$five_row .= '</tr>';
|
|
$siz_row .= '</tr>';
|
|
$seven_row .= '</tr>';
|
|
$eight_row .= '</tr>';
|
|
$ninth_row .= '</tr>';
|
|
$json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row,'eight_row' => $eight_row,'ninth_row'=>$ninth_row);
|
|
}
|
|
return $json;
|
|
}
|
|
|
|
|
|
static function getStockSectionData($section)
|
|
{
|
|
|
|
$json = json_decode($section['json'],true);
|
|
$CI =&get_instance();
|
|
$CI->load->model('PD_Model');
|
|
$uom_master = $CI->PD_Model->selectCustomRecords(array('*'),array('isactive' => 1),UOM);
|
|
// print_r($json);die();
|
|
if(isset($json['stock_details']) && is_array($json['stock_details']) && count($json['stock_details']))
|
|
{
|
|
foreach ($json['stock_details'] as $key => $value)
|
|
{
|
|
if(isset($value['company_name']))
|
|
{
|
|
$json['stock_details'][$key]['name_of_the_company'] = (isset($value['company_name']) ? $company[$value['company_name']] : 'NA');
|
|
}
|
|
if(isset($value['estimated_uom']))
|
|
{
|
|
//echo $value['estimated_uom'];die();
|
|
foreach ($uom_master as $m_key => $mvalue)
|
|
{
|
|
|
|
if($value['estimated_uom'] == $mvalue['uom_id'])
|
|
{ $json['stock_details'][$key]['estimated_uom'] = $mvalue['name'];break; }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//echo 'asfter';
|
|
// print_r($json);die();
|
|
return $json;
|
|
}
|
|
|
|
static function getExistingLoanSectionData($section)
|
|
{
|
|
$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');
|
|
// print_r($json);die();
|
|
$header_row = '<tr>'.'<th> Particulars </th>';
|
|
$first_row = '<tr>'.'<td> Loan Type </td>';
|
|
$second_row = '<tr>'.'<td> Loan Amount </td>';
|
|
$third_row = '<tr>'.'<td> Availed From </td>';
|
|
$fourth_row = '<tr>'.'<td> Borrower`s Name </td>';
|
|
$five_row = '<tr>'.'<td> Instalment Amount (Rs) </td>';
|
|
$install_fre_row = '<tr>'.'<td> Instalment Frequency (Rs) </td>';
|
|
$siz_row = '<tr>'.'<td> Original Tenure (Mnts) </td>';
|
|
$seven_row = '<tr>'.'<td> Elapsed Tenure (Mnts) </td>';
|
|
$eight_row = '<tr>'.'<td> Balance Tenure (Mnts) </td>';
|
|
foreach ($json['existing_loan_details'] as $key => $value)
|
|
{
|
|
$json['existing_loan_details'][$key]['lender_name'] = ((isset($value['lender_name']) && $value['lender_name'] != 0) ? $value['lender_name'] : 'NA');
|
|
$json['existing_loan_details'][$key]['business_owner_name'] = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA');
|
|
|
|
$header_row .= '<th>Loan '.($key + 1).'</th>';
|
|
$first_row .= '<td style="text-align:center;">'. $value['loan_type'] .'</td>';
|
|
$second_row .= '<td style="text-align:center;">'. $value['loan_amount'] .'</td>';
|
|
$third_row .= '<td style="text-align:center;"> '. $value['loan_taken_by'] .' </td>';
|
|
// $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA');
|
|
$fourth_row .= '<td style="text-align:center;"> '. $value['lender_name'] .' </td>';
|
|
$five_row .= '<td style="text-align:center;"> '. (isset($value['instalment_amount']) ? $value['instalment_amount'] : 'NA') .' </td>';
|
|
$install_fre_row .= '<td style="text-align:center;"> '. (isset($value['instalment_frequency']) ? $value['instalment_frequency'] : 'NA') .' </td>';
|
|
$siz_row .= '<td style="text-align:center;"> '. (isset($value['original_tenure_months']) ? $value['original_tenure_months'] : 'NA') .' </td>';
|
|
$seven_row .= '<td style="text-align:center;"> '. (isset($value['elapsed_tenure_months']) ? $value['elapsed_tenure_months'] : 'NA') .' </td>';
|
|
$eight_row .= '<td style="text-align:center;"> '. (isset($value['current_tenure_months']) ? $value['current_tenure_months'] : 'NA') .' </td>';
|
|
}
|
|
$header_row .= '</tr>';
|
|
$first_row .= '</tr>';
|
|
$second_row .= '</tr>';
|
|
$third_row .= '</tr>';
|
|
$fourth_row .= '</tr>';
|
|
$five_row .= '</tr>';
|
|
$install_fre_row .= '</tr>';
|
|
$siz_row .= '</tr>';
|
|
$seven_row .= '</tr>';
|
|
$eight_row .= '</tr>';
|
|
|
|
$json['display_data'] = array('header_row' => $header_row,'first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'siz_row' => $siz_row,'seven_row' => $seven_row,'eight_row' => $eight_row,'install_fre_row' => $install_fre_row);
|
|
return $json;
|
|
}
|
|
|
|
static function getNeibourSectionData($section)
|
|
{
|
|
$json = json_decode($section['json'],true);
|
|
$applicant_details = applicantname_grabber::getLatestApplicantsName(SELF::$current_pd_id);
|
|
$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();
|
|
// $header_row = '<tr>'.'<th> Particulars </th>';
|
|
$first_row = '<tr>'.'<td> Name & brief of Person <br>with whom check done </td>';
|
|
$second_row = '<tr>'.'<td> Does the person met <br>know who operates this business?
|
|
(Yes / NO) </td>';
|
|
$third_row = '<tr>'.'<td> As per person met, how long has the applicants` <br>business been running from this location </td>';
|
|
$owner_row = '<tr>'.'<td> As per person met, Name of the owner(s) </td>';
|
|
$fourth_row = '<tr>'.'<td> Any other remarks </td>';
|
|
$five_row = '<tr>'.'<td> Neighbourhood Check <br>Positive / Negative / Could not verify </td>';
|
|
// $siz_row = '<tr>'.'<td> Payment Mode </td>';
|
|
// $seven_row = '<tr>'.'<td> No of days credit </td>';
|
|
$colspan = 0;
|
|
foreach ($json['neighbourhood_list'] as $key => $value)
|
|
{
|
|
|
|
// $header_row .= '<th>Client '.$value['client_name'].'</th>';
|
|
$first_row .= '<td style="text-align:center;">'. $value['neighbourhood_name'] .'</td>';
|
|
$second_row .= '<td style="text-align:center;">'. ucfirst($value['know_business_operation']) .'</td>';
|
|
$time = isset($value['how_long_do_know_in_year']) ? $value['how_long_do_know_in_year'].'Yr(s)' : '';$time .= (isset($value['how_long_do_know_in_month']) && $value['how_long_do_know_in_month'] != 0 ? (' & '.$value['how_long_do_know_in_month'].' Mnt(s)'): '');
|
|
$time = empty($time) ? '-' : $time;
|
|
$third_row .= '<td style="text-align:center;"> '. $time .' </td>';
|
|
$owner_name = isset($value['organisation_owner']) ? applicantname_grabber::getMultipleApplicantsNameById($value['organisation_owner'],$applicant_details) : '';
|
|
$owner_row .= '<td style="text-align:center;">'.($owner_name != '' ? $owner_name : '-').'</td>';
|
|
$colspan++;
|
|
// $business_name_of_the_owner = (isset($value['business_name_of_the_owner']) ? (applicantname_grabber::getApplicantsNameById($value['business_name_of_the_owner'],$applicant_details)): 'NA');
|
|
// $fourth_row .= '<td style="text-align:center;"> '. $value['how_long_do_know_in_year'].' - '.$value['how_long_do_know_in_month'] .' </td>';
|
|
// $five_row .= '<td style="text-align:center;"> '. (isset($value['payment_type']) ? $payment_term [ $value['payment_type'] ]: '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>';
|
|
}
|
|
// $header_row .= '</tr>';
|
|
$first_row .= '</tr>';
|
|
$second_row .= '</tr>';
|
|
$third_row .= '</tr>';
|
|
$fourth_row .= '<td style="text-align:center;" colspan='.$colspan.'>'.$json['neighbourhood_remarks'].'</td>'.'</tr>';
|
|
$five_row .= '<td style="text-align:center;" colspan='.$colspan.'>'.$json['neighbourhood_status'].'</td>'.'</tr>';
|
|
|
|
// $siz_row .= '</tr>';
|
|
// $seven_row .= '</tr>';
|
|
|
|
$json['display_data'] = array('first_row' => $first_row,'second_row' => $second_row,'third_row' => $third_row,'fourth_row' => $fourth_row,'five_row' => $five_row,'owner_row' => $owner_row);
|
|
return $json;
|
|
}
|
|
|
|
|
|
static function getAddressSectionData($section)
|
|
{
|
|
|
|
$json = json_decode($section['json'],true);
|
|
// print_r($json);//die();
|
|
$json['address_type'] = isset($json['address_type_others']) && ($json['address_type'] == 1) ? (array('address_type' => $json['address_type_others'])):SELF::getDBvalue(ADDRESSTYPE,ADDRESSTYPEID,$json['address_type']);
|
|
$json['pd_locality'] = isset($json['locality_other']) && $json['pd_locality'] == 1 ? (array('locality_name' => $json['locality_other'])) : SELF::getDBvalue(LOCALITY,LOCALITYID,$json['pd_locality']);
|
|
|
|
$json['pd_location'] = SELF::getDBvalue(PDLOCATIONAPPROACH,PDLOCATIONAPPROACHID,$json['pd_location']);
|
|
$json['comment_locality'] = SELF::getDBvalue(COMMENTSONLOCALITY,COMMENTSONLOCALITYID,$json['comment_locality']);
|
|
$json['alternative_address'] = isset($json['alternative_address']) ? $json['alternative_address'] : '';
|
|
// die();
|
|
return $json;
|
|
|
|
}
|
|
|
|
|
|
static function getDBvalue($table_name,$field_name,$pk)
|
|
{
|
|
$CI =&get_instance();
|
|
$CI->load->model('PD_Model');
|
|
$res_data = $CI->PD_Model->selectCustomRecords(array('*'),array('isactive' => 1,$field_name => $pk),$table_name);
|
|
//print_r($CI->db->last_query());
|
|
if(is_array($res_data) && count($res_data))
|
|
{
|
|
return $res_data[0];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static function getFamilySectionData($section)
|
|
{
|
|
$json = json_decode($section['json'],true);
|
|
$applicant_details = applicantname_grabber::getLatestApplicantsName(SELF::$current_pd_id);
|
|
// print_r($json);die();
|
|
if(isset($json['family_details']) && count($json['family_details']))
|
|
{
|
|
foreach ($json['family_details'] as $key => $value)
|
|
{
|
|
$json['family_details'][$key]['relationship'] = SELF::getDBvalue(RELATIONSHIPS,RELATIONSHIPSID,$value['relationship']);
|
|
$json['family_details'][$key]['stakeholder_relation'] = applicantname_grabber::getApplicantsNameById($value['stakeholder_relation'],$applicant_details);
|
|
$json['family_details'][$key]['company_relation'] = SELF::getDBvalue(COMPANYRELATIONSHIPS,COMPANYRELATIONSHIPSID,$value['company_relation']);
|
|
// $json[$key]['comment_locality'] = SELF::getDBvalue(COMMENTSONLOCALITY,COMMENTSONLOCALITYID,$value['comment_locality']);
|
|
// $json['alternative_address'] = isset($json['alternative_address']) ? $json['alternative_address'] : '';
|
|
}
|
|
}
|
|
// print_r($json);die();
|
|
// die();
|
|
return $json;
|
|
}
|
|
|
|
static function getLoanSectionData($section)
|
|
{
|
|
$json = json_decode($section['json'],true);
|
|
$applicant_details = applicantname_grabber::getLatestApplicantsName(SELF::$current_pd_id);
|
|
// print_r($json);die();
|
|
|
|
$json['owner_name'] = isset($json['owner_name']) ? applicantname_grabber::getMultipleApplicantsNameById($json['owner_name'],$applicant_details) : '';
|
|
if(isset($json['lender']))
|
|
{
|
|
$json['lender'] = SELF::getDBvalue(BTLENDERLIST,BTLENDERLISTID,$json['lender']);
|
|
}
|
|
$json['state'] = isset($json['state']) ? SELF::getDBvalue(STATE,STATEID,$json['state']) : '';
|
|
$json['city'] = isset($json['city']) ? SELF::getDBvalue(CITY,CITYID,$json['city']) : '';
|
|
if(isset($json['pincode']))
|
|
{
|
|
$pin = $json['pincode'] != 1 ? SELF::getDBvalue(PINCODE,PINCODEID,$json['pincode']) : $json['pincode_others'];
|
|
$json['pincode'] = is_array($pin) ? $pin['pincode'] : $pin;
|
|
}
|
|
// print_r($json);die();
|
|
|
|
return $json;
|
|
}
|
|
|
|
static function getFinalRemarksSectionData($section)
|
|
{
|
|
$json = json_decode($section['json'],true);
|
|
$customer_behaviour = array("1" => 'Others',"2" => 'Rude',"3" => 'Polite');
|
|
$pd_officer_recommandations = array("2"=>'Positive',"3"=>'Negative',"5"=>'Refer to Credit',"0"=>'Others');
|
|
$json['pd_officer_recommendation_name'] = isset($json['pd_officer_recommendation'])? $pd_officer_recommandations[$json['pd_officer_recommendation']] : 'NA';
|
|
$json['customer_behaviour_name'] = (isset($json['customer_behaviour']) ? $customer_behaviour[ $json['customer_behaviour'] ] : 'NA');
|
|
// echo 'json***';
|
|
// print_r($json);
|
|
return $json;
|
|
}
|
|
|
|
}
|
|
?>
|