sparqapi/api/application/helpers/loanform_helper.php

90 lines
6.5 KiB
PHP

<?php
class Loanform
{
public static function getanchordetails($loan_form){
$anchor_details_display = array();
$rupee_symbol = "<span style='font-family: DejaVu Sans; sans-serif;font-size:10px'>₹</span>";
$facility_amt = MYUTIL::customIndianNumberFormat($loan_form['facility_amount']);
$monthly_business_anchor_amt = MYUTIL::customIndianNumberFormat($loan_form['monthly_business_anchor']);
$average_invoicevalue_amt = MYUTIL::customIndianNumberFormat($loan_form['average_invoicevalue']);
$stock_related_amt = MYUTIL::customIndianNumberFormat($loan_form['stock_related_anchor']);
// $facility_amt = $loan_form['facility_amount'];
// $monthly_business_anchor_amt = $loan_form['monthly_business_anchor'];
// $average_invoicevalue_amt = $loan_form['average_invoicevalue'];
// $stock_related_amt = $loan_form['stock_related_anchor'];
$payment_mechanism_arr = array('bill_wise' => 'Bill Wise','open_account' => 'Open Account');
$sales_low_months=SELF::getMonths($loan_form['sales_low_months']);
if((int)$loan_form['vintage_anchor_year'] > 1 ){ $yr = $loan_form['vintage_anchor_year']." Years";}
else if((int)$loan_form['vintage_anchor_year'] == 1 ){ $yr = $loan_form['vintage_anchor_year']." Year"; }
else{ $yr = ''; }
if((int)$loan_form['vintage_anchor_month'] > 1 ){ $mnt = $loan_form['vintage_anchor_month']." Months";}
else if((int)$loan_form['vintage_anchor_month'] == 1 ){ $mnt = $loan_form['vintage_anchor_month']." Month"; }
else{ $mnt = ''; }
if($mnt != '' && $yr != '' ){ $yrandmnt = $yr.' and '.$mnt; }
else if($mnt == '' && $yr != ''){ $yrandmnt = $yr; }
else if($mnt != '' && $yr == ''){ $yrandmnt = $mnt; }
else{ $yrandmnt = '-';}
$anchor_details_display[] = array('particulars' => "Facility Amount Applied For (".$rupee_symbol.")",'details' => $rupee_symbol." ".$facility_amt.' ('.MYUTIL::numtowords($loan_form['facility_amount']).')');
$anchor_details_display[] = array('particulars' => "Name of Anchor",'details' => $loan_form['anchor_name']);
// $anchor_details_display[] = array('particulars' => "Applicant's association vintage with the Anchor Year",'details' => $loan_form['vintage_anchor_year']);
// $anchor_details_display[] = array('particulars' => "Applicant's association vintage with the Anchor Month",'details' => $loan_form['vintage_anchor_month']);
$anchor_details_display[] = array('particulars' => "Applicant's association vintage with the Anchor Year and Month",'details' => $yrandmnt );
$anchor_details_display[] = array('particulars' => "Monthly business (sale/purchase) with the Anchor (".$rupee_symbol.")",'details' => $rupee_symbol." ".$monthly_business_anchor_amt.' ('.MYUTIL::numtowords($loan_form['monthly_business_anchor']).')');
$anchor_details_display[] = array('particulars' => "Business concentration with Anchor",'details' => $loan_form['business_concentration'].' %');
$anchor_details_display[] = array('particulars' => "Credit period with the Anchor (Days)",'details' => $loan_form['credit_period_days']);
$anchor_details_display[] = array('particulars' => "Payment Mechanism",
'details' => $payment_mechanism_arr[$loan_form['payment_mechanism']]);
$anchor_details_display[] = array('particulars' => "Average Invoice Value (".$rupee_symbol.")",'details' => $rupee_symbol." ".$average_invoicevalue_amt.' ('.MYUTIL::numtowords($loan_form['average_invoicevalue']).')');
$anchor_details_display[] = array('particulars' => "Are there peak seasons for the business with Anchor",'details' => ucfirst($loan_form['peakseasons_anchor']));
if($loan_form['peakseasons_anchor']=='yes')
{
$anchor_details_display[] = array('particulars' => "Months in which sales/service is low?",'details' => $sales_low_months );
$anchor_details_display[] = array('particulars' => "Comments",'details' => $loan_form['peak_season_comment'] );
}
$anchor_details_display[] = array('particulars' => "Are there debit/credit notes being issued to/by Anchor",'details' => ucfirst($loan_form['anchor_notes']));
if($loan_form['anchor_notes']=='yes'){
$anchor_details_display[] = array('particulars' => "Reason for such debit/credit notes",'details' => ucfirst($loan_form['debitcredit_notes']) );
}
$anchor_details_display[] = array('particulars' => "Value of stock related to Anchor (".$rupee_symbol.")",'details' => $rupee_symbol." ".$stock_related_amt.' ('.MYUTIL::numtowords($loan_form['stock_related_anchor']).')');
$anchor_details_display[] = array('particulars' => "Observations on Sample Invoices",'details' => ucfirst($loan_form['sample_invoices']) );
if($loan_form['sample_invoices']=='yes'){
$anchor_details_display[] = array('particulars' => "Observations on Invoice and lorry receipts",'details' => ucfirst($loan_form['sampleinvoices_yes']) );
}
if($loan_form['sample_invoices']=='no'){
$anchor_details_display[] = array('particulars' => "Reason for no sample invoices",'details' => ucfirst($loan_form['sampleinvoices_no']) );
}
return $anchor_details_display;
// print_r($anchor_details_display);
}
public static function getMonths($details) {
foreach($details as $key=>$value){
$getRow=$getRow;
$getRow .= ($key==0) ? "":($key==count($details)-1 ? ' and ' : ",");
switch($value) {
case 1:$getRow .='January';break;
case 2:$getRow .='February';break;
case 3:$getRow .='March';break;
case 4:$getRow .='April';break;
case 5:$getRow .='May';break;
case 6:$getRow .='June';break;
case 7:$getRow .='July';break;
case 8:$getRow .='August';break;
case 9:$getRow .='September';break;
case 10:$getRow .='October';break;
case 11:$getRow .='November';break;
case 12:$getRow .='December';break;
}
}
return $getRow;
}
}
?>