update
This commit is contained in:
parent
173954b0f6
commit
387b787f8d
@ -20,6 +20,10 @@
|
|||||||
use app\adminapi\lists\financial\FinancialBudgetDocLists;
|
use app\adminapi\lists\financial\FinancialBudgetDocLists;
|
||||||
use app\adminapi\logic\financial\FinancialBudgetDocLogic;
|
use app\adminapi\logic\financial\FinancialBudgetDocLogic;
|
||||||
use app\adminapi\validate\financial\FinancialBudgetDocValidate;
|
use app\adminapi\validate\financial\FinancialBudgetDocValidate;
|
||||||
|
use app\common\model\cost_project\CostApprovedProject;
|
||||||
|
use app\common\model\financial\FinancialBudgetDoc;
|
||||||
|
use app\common\model\financial\FinancialDepartmentIncomeSettlement;
|
||||||
|
use app\common\model\financial\FinancialDepartmentIncomeSettlementDetail;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,4 +115,42 @@
|
|||||||
{
|
{
|
||||||
return $this->data(FinancialBudgetDocLogic::datas());
|
return $this->data(FinancialBudgetDocLogic::datas());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//部门收入明细
|
||||||
|
public function income(): \think\response\Json
|
||||||
|
{
|
||||||
|
$params = $this->request->get();
|
||||||
|
$page_no = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||||
|
$page_size = !empty($params['page_size']) ? $params['page_size'] : 15;
|
||||||
|
$where = [];
|
||||||
|
if (!empty($params['code'])) {
|
||||||
|
$where[] = ['code', 'like', '%' . $params['code'] . '%'];
|
||||||
|
}
|
||||||
|
if (!empty($params['name'])) {
|
||||||
|
$where[] = ['name', 'like', '%' . $params['name'] . '%'];
|
||||||
|
}
|
||||||
|
if (!empty($params['contract_id'])) {
|
||||||
|
$where[] = ['contract_id', '=', $params['contract_id']];
|
||||||
|
}
|
||||||
|
$lists = FinancialBudgetDoc::field('id,contract_id,code,name')
|
||||||
|
->where($where)
|
||||||
|
->where($where)
|
||||||
|
->page($page_no, $page_size)
|
||||||
|
->order('id desc')
|
||||||
|
->select()->each(function ($data) {
|
||||||
|
$contract = CostApprovedProject::field('contract_name,money')->where('id', $data['contract_id'])->findOrEmpty();
|
||||||
|
$data['contract_name'] = $contract['contract_name'];
|
||||||
|
$data['money'] = $contract['money'];
|
||||||
|
$financial_department_income_settlement_ids = FinancialDepartmentIncomeSettlement::where('budget_doc_id', $data['id'])->column('id');
|
||||||
|
//分成金额合计
|
||||||
|
$data['amount'] = FinancialDepartmentIncomeSettlementDetail::where('department_income_settlement_id', 'in', $financial_department_income_settlement_ids)->sum('amount');
|
||||||
|
//结算金额合计
|
||||||
|
$data['settlement_amount'] = FinancialDepartmentIncomeSettlementDetail::where('department_income_settlement_id', 'in', $financial_department_income_settlement_ids)->sum('settlement_amount');
|
||||||
|
//未结算金额
|
||||||
|
$data['not_settlement_amount'] = bcsub($data['amount'], $data['settlement_amount'], 2);
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
$count = FinancialBudgetDoc::where($where)->count();
|
||||||
|
return $this->success('成功', compact('count', 'lists', 'page_no', 'page_size'));
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user