Merge pull request 'zhangwei' (#199) from zhangwei into dev

Reviewed-on: #199
This commit is contained in:
weiz 2024-01-19 17:09:12 +08:00
commit d08b5cfa7f

View File

@ -17,8 +17,10 @@ namespace app\adminapi\lists\project;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\project\Project;
use app\common\model\project\ProjectExpenseReimbursement;
use app\common\model\project\ProjectLoanApply;
use app\common\lists\ListsSearchInterface;
use app\common\model\project\ProjectTravelReimbursement;
/**
@ -64,7 +66,11 @@ class ProjectLoanApplyLists extends BaseAdminDataLists implements ListsSearchInt
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
$data['project_name'] = $project['name'];
$data['project_code'] = $project['project_code'];
$data['has_return_amount'] = 0;
//差旅报销抵扣
$trip_deduction = ProjectTravelReimbursement::where('loan_apply_id',$data['id'])->sum('offset_loan_amount');
//费用报销抵扣
$expense_deduction = ProjectExpenseReimbursement::where('loan_apply_id',$data['id'])->sum('offset_loan_amount');
$data['has_return_amount'] = $trip_deduction + $expense_deduction;
$data['not_return_amount'] = $data['loan_amount'] - $data['has_return_amount'];
return $data;
})