39 lines
1.4 KiB
PHP
39 lines
1.4 KiB
PHP
<?php
|
|
|
|
class Otherincomeform
|
|
{
|
|
public static function getIncomeDetails($values,$pdid){
|
|
$latest_applicants_names = APPLICANTNAME_GRABBER::getLatestApplicantsName($pdid);
|
|
$result_array = array();
|
|
foreach ($values as $key => $value)
|
|
{
|
|
$earned_by = "";
|
|
foreach ($value['income_earned_by'] as $key1 => $applicant)
|
|
{
|
|
$earned_by .= $applicant['group_id'] == 1 ? $applicant['name'].' , ' : APPLICANTNAME_GRABBER::getApplicantsNameById($applicant['id'],$latest_applicants_names).' , ';
|
|
}
|
|
$earned_by = substr_replace($earned_by,'',-2);
|
|
$earned_by = str_replace(',','and', $earned_by);
|
|
|
|
|
|
|
|
$t['source'] = $value['source']==1 ? $value['others_source'] : $value['source_master'];
|
|
$t['amount'] = $value['amount'];
|
|
$t['frequency'] = $value['frequency']==1 ? $value['others_frequency'] : $value['frequency_master'];
|
|
$t['earned_by'] = $earned_by;
|
|
array_push($result_array,$t);
|
|
}
|
|
// $values = array_map(function($tag) use ($latest_applicants_names){
|
|
// return array(
|
|
// 'source' => $tag['source']==1 ? $tag['others_source'] : $tag['source_master'],
|
|
// 'amount' => $tag['amount'],
|
|
// 'frequency' => $tag['frequency']==1 ? $tag['others_frequency'] : $tag['frequency_master'],
|
|
// 'earned_by' => ( $tag['income_earned_by'][0]['name'])
|
|
// );
|
|
// }, $values);
|
|
return $result_array;
|
|
}
|
|
|
|
|
|
}
|
|
?>
|