This commit is contained in:
weiz 2024-01-23 16:39:16 +08:00
parent e26631e90b
commit 92f97fde98

View File

@ -4,7 +4,9 @@
use app\adminapi\controller\BaseAdminController;
use app\common\model\contract\ProcurementContract;
use app\common\model\contract\ProcurementContractDetail;
use app\common\model\contract\SubcontractingContract;
use app\common\model\contract\SubcontractingContractDetail;
use app\common\model\contract\SubcontractingContractNegotiation;
use app\common\model\finance\FinancePaymentPlan;
use app\common\model\finance\FinanceReceiptRecord;
@ -26,7 +28,7 @@
if(isset($params['contract_no']) && $params['contract_no']){
$where[] = ['contract_no','like','%'.$params['contract_no'].'%'];
}
$data = ProcurementContract::field('id,supplier_id,project_id,contract_no,signing_date,contract_amount')->where($where)->page($pageNo,$pageSize)
$data = ProcurementContract::field('id,supplier_id,project_id,contract_no,signing_date')->where($where)->page($pageNo,$pageSize)
->order(['id' => 'desc'])
->select()->each(function($item){
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
@ -35,6 +37,8 @@
$item['project_code'] = $project['project_code'];
$item['supplier_name'] = $supplier['supplier_name'];
$item['supplier_code'] = $supplier['supplier_code'];
//合同金额
$item['contract_amount'] = ProcurementContractDetail::where('contract_id',$item['id'])->sum('amount_including_tax');
//已付款金额
$item['has_payment_amount'] = FinancePaymentPlan::where('contract_id',$item['id'])->where('contract_type',1)->sum('amount');
//已收票金额
@ -68,7 +72,7 @@
if(isset($params['contract_no']) && $params['contract_no']){
$where[] = ['contract_no','like','%'.$params['contract_no'].'%'];
}
$data = SubcontractingContract::field('id,supplier_id,project_id,contract_no,signing_date,contract_amount')->where($where)->page($pageNo,$pageSize)
$data = SubcontractingContract::field('id,supplier_id,project_id,contract_no,signing_date')->where($where)->page($pageNo,$pageSize)
->order(['id' => 'desc'])
->select()->each(function($item){
$project = Project::field('name,project_code')->where('id',$item['project_id'])->findOrEmpty();
@ -77,6 +81,8 @@
$item['project_code'] = $project['project_code'];
$item['supplier_name'] = $supplier['supplier_name'];
$item['supplier_code'] = $supplier['supplier_code'];
//合同金额
$item['contract_amount'] = SubcontractingContractDetail::where('contract_id',$item['id'])->sum('amount_including_tax');
//洽商金额
$negotiate_amount = SubcontractingContractNegotiation::where('subcontracting_contract_id',$item['id'])->sum('negotiation_amount');
//实际合同金额