113 lines
5.6 KiB
PHP
113 lines
5.6 KiB
PHP
<?php
|
|
|
|
class Financialform
|
|
{
|
|
//other loan obligations
|
|
public static function getOtherLoanDetails($values){
|
|
$values = array_map(function($tag) {
|
|
$setFrequencyType='';
|
|
switch($tag['frequency']) {
|
|
case 1:
|
|
$setFrequencyType = ' per '.$tag['other_frequency'];
|
|
break;
|
|
case 2:
|
|
$setFrequencyType = ' per annum';
|
|
break;
|
|
case 3:
|
|
$setFrequencyType = ' per halfyearly';
|
|
break;
|
|
case 4:
|
|
$setFrequencyType = ' per fortnightly';
|
|
break;
|
|
case 5:
|
|
$setFrequencyType = ' per daily';
|
|
break;
|
|
case 6:
|
|
$setFrequencyType = ' per quarterly';
|
|
break;
|
|
case 7:
|
|
$setFrequencyType = ' per month';
|
|
break;
|
|
default:
|
|
$setFrequencyType = ' per';
|
|
|
|
}
|
|
$loanTaken=$tag['loan_taken_by'];
|
|
return array(
|
|
'loan_type' => $tag['loan_type']==1 ? $tag['others_loan_type'] : $tag['loan_type_master'],
|
|
'loan_amount' => $tag['loan_amount'],
|
|
'frequency' => $tag['frequency']==1 ? $tag['other_frequency'] : $tag['frequency_master'],
|
|
'lender' => $tag['lender']==1 ? $tag['others_lender'] : $tag['lender_master'],
|
|
'original_tenure' => $tag['original_tenure'],
|
|
'current_balance_tenure' => $tag['current_balance_tenure'],
|
|
'elapsed_tenure' => $tag['elapsed_tenure'],
|
|
'emi' => $tag['emi'].$setFrequencyType,
|
|
'loan_taken_by' => $loanTaken['id']==0 ? $tag['others_loan_taken'] : $loanTaken['name'],
|
|
);
|
|
}, $values);
|
|
return $values;
|
|
}
|
|
|
|
// business financial details
|
|
public static function getBusinessFinancialDetails($values){
|
|
$values = array_map(function($tag) {
|
|
return array(
|
|
'financial_year' => $tag['financial_year'],
|
|
'financial_annual_sale' => 'Rs.'.$tag['financial_annual_sale'],
|
|
'financial_net_profit' => $tag['finanical_profit_or_loss']==1 ? 'Rs.'.$tag['financial_net_profit'] : '',
|
|
'financial_margin_of_profit' => $tag['finanical_profit_or_loss']==1 ? $tag['financial_margin_of_profit'] : '',
|
|
'financial_net_loss' => $tag['finanical_profit_or_loss']!=1 ? 'Rs.'.$tag['financial_net_loss'] : '',
|
|
'financial_margin_of_loss' => $tag['finanical_profit_or_loss']!=1 ? $tag['financial_margin_of_loss'] : '',
|
|
'profit_variation' => $tag['financial_variation'],
|
|
'sale_variation' => $tag['financial_profit_to_sale_variation'],
|
|
);
|
|
}, $values);
|
|
return $values;
|
|
}
|
|
// get customer financial
|
|
public static function getBusinessCustomerFinancialDetails($values) {
|
|
$values = array_map(function($tag) {
|
|
if($tag['estimate_profit_or_loss']==1){
|
|
return array(
|
|
'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'],
|
|
'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'],
|
|
'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')',
|
|
'estimate_sales_to' => 'Rs.'.$tag['estimate_sales_to'],
|
|
'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'],
|
|
'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_profit_margin'] : 'Rs.'.$tag['estimate_net_profit'],
|
|
'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_profit_from'].', Rs.'.$tag['estimate_net_profit_to'].')' : '',
|
|
'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_profit_percent'] : $tag['estimate_profit_margin_percent'],
|
|
'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '( '.$tag['estimate_profit_range_from'].', '.$tag['estimate_profit_range_to'].')',
|
|
);
|
|
}
|
|
else if($tag['estimate_profit_or_loss']==2){
|
|
return array(
|
|
'estimate_profit_or_loss' => $tag['estimate_profit_or_loss'],
|
|
'estimate_sales_average' => 'Rs.'.$tag['estimate_sales_average'],
|
|
'estimate_sales_from_to' => '(Rs.'.$tag['estimate_sales_from'].', Rs.'.$tag['estimate_sales_to'].')',
|
|
'estimate_net_margin_availablity' => $tag['estimate_net_margin_availablity'],
|
|
'estimate_net_margin' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? 'Rs.'.$tag['estimate_net_loss'] : 'Rs.'.$tag['estimate_loss_margin'],
|
|
'estimate_net_margin_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '(Rs.'.$tag['estimate_net_loss_from'].', Rs.'.$tag['estimate_net_loss_to'].')' : '',
|
|
'estimate_net_margin_range' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? $tag['estimate_net_loss_percent'] : $tag['estimate_loss_margin_percent'],
|
|
'estimate_net_margin_range_from_to' => strtoupper($tag['estimate_net_margin_availablity'])=='NO' ? '' : '('.$tag['estimate_loss_range_from'].', '.$tag['estimate_loss_range_to'].')',
|
|
);
|
|
}
|
|
|
|
}, $values);
|
|
return $values;
|
|
}
|
|
|
|
// get customer header
|
|
public static function getBusinessCustomerHeader($values){
|
|
if(count($values)>0 && $values[0]['estimate_profit_or_loss']==1){
|
|
return array("Sales","Net Profit","Net Margin %");
|
|
}
|
|
else if(count($values)>0 && $values[0]['estimate_profit_or_loss']==2){
|
|
return array("Sales","Net Loss","Net Margin %");
|
|
}
|
|
else {
|
|
return array();
|
|
}
|
|
}
|
|
}
|
|
?>
|