sparqapi/api/application/helpers/bankingform_helper.php
2021-12-18 20:20:50 +05:30

80 lines
5.0 KiB
PHP

<?php
class Bankingform
{
//get business Banking
public static function getBusinessBankingDetails($values,$pdid){
// print_r($values);die();
$latest_applicants_names = APPLICANTNAME_GRABBER::getLatestApplicantsName($pdid);
if(count($values)>0){
$values = array_map(function($tag) use ($latest_applicants_names){
$count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :"";
$count_vintage .= ($tag['vintage_year'] == 1) ? " Year" : (($tag['vintage_year'] > 1) ? " Years" : "");
$count_vintage.=' ';
$count_vintage .=$tag['vintage_month'] >0 ? ($tag['vintage_year'] >0 ? ' and ' . $tag['vintage_month'] : $tag['vintage_month']) : "";
$count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : "");
return array(
'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : ($tag['applicant_name']['group_id'] == 2 ? APPLICANTNAME_GRABBER::getApplicantsNameById($tag['applicant_name']['id'],$latest_applicants_names) : $tag['applicant_name']['name']),
'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name_master'],
'account_type' => $tag['account_type_master'],
'main_business' => $tag['is_main'],
'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : 'NA'),
'vintage' => $count_vintage,
);
}, $values);
}
return $values;
}
// get individual banking
public static function getIndividualBankingDetails($values,$pdid){
$latest_applicants_names = APPLICANTNAME_GRABBER::getLatestApplicantsName($pdid);
if(count($values)>0){
$values = array_map(function($tag) use ($latest_applicants_names){
$count_vintage = $tag['vintage_year'] >0 ? $tag['vintage_year'] :"";
$count_vintage .= ($tag['vintage_year'] == 1) ? " Yr" : (($tag['vintage_year'] > 1) ? " Yrs" : "");
$count_vintage.=' ';
$count_vintage .=$tag['vintage_month'] >0 ? $tag['vintage_month'] : "";
$count_vintage .=($tag['vintage_month'] == 1) ? " Month" : (($tag['vintage_month'] > 1) ? " Months" : "");
return array(
'account_name' => $tag['applicant_name']['id']==0 ? $tag['other_applicant'] : ($tag['applicant_name']['group_id'] == 2 ? APPLICANTNAME_GRABBER::getApplicantsNameById($tag['applicant_name']['id'],$latest_applicants_names) : $tag['applicant_name']['name']),
'bank_name' => $tag['bank_name'] ==1 ? $tag['other_bank'] : $tag['bank_name_master'],
'account_type' => $tag['account_type_master'],
'main_business' => $tag['salary'],
'od_cc_limit' => ($tag['account_type']==3) ? $tag['limit'] : (($tag['account_type']==4) ? $tag['limit'] : ''),
'vintage' => $count_vintage,
'same_ac_used_for' => $tag['same_ac_used_for'] != "" ? ucwords($tag['same_ac_used_for']) : "",
'str_flag'=>$tag['applicant_name']['id']==0 ? "applicant" : ($tag['applicant_name']['group_id'] == 2 ? "applicant" : "individual-company"),
);
}, $values);
}
return $values;
}
public static function getNewBuinessBankingDetails($values,$pdid){
$latest_applicants_names = APPLICANTNAME_GRABBER::getLatestApplicantsName($pdid);
if(count($values)>0){
$values = array_map(function($tag) use ($latest_applicants_names){
$count_vintage = $tag['vintage_year_business'] >0 ? $tag['vintage_year_business'] :"";
$count_vintage .= ($tag['vintage_year_business'] == 1) ? " Yr" : (($tag['vintage_year_business'] > 1) ? " Yrs" : "");
$count_vintage.=' ';
$count_vintage .=$tag['vintage_month_business'] >0 ? $tag['vintage_month_business'] : "";
$count_vintage .=($tag['vintage_month_business'] == 1) ? " Month" : (($tag['vintage_month_business'] > 1) ? " Months" : "");
return array(
'account_name' => $tag['applicant_name_business']['id']==0 ? $tag['other_applicant_business'] : ($tag['applicant_name_business']['group_id'] == 2 ? APPLICANTNAME_GRABBER::getApplicantsNameById($tag['applicant_name_business']['id'],$latest_applicants_names) : $tag['applicant_name_business']['name']),
'bank_name' => $tag['bank_name_business'] ==1 ? $tag['other_bank_business'] : $tag['bank_name_business_master'],
'account_type' => $tag['account_type_business_master'],
'main_business' => $tag['is_main'],
'od_cc_limit' => ($tag['account_type_business']==3) ? $tag['limit_business'] : (($tag['account_type_business']==4) ? $tag['limit_business'] : ''),
'vintage' => $count_vintage,
'same_ac_used_for' => "",
'str_flag'=>$tag['applicant_name_business']['id']==0 ? "applicant" : ($tag['applicant_name_business']['group_id'] == 2 ? "applicant" : "buiness-company"),
);
}, $values);
}
return $values;
}
}
?>