This commit is contained in:
weiz 2024-01-22 16:19:51 +08:00
parent f9e726ee92
commit 7b57adc84b
2 changed files with 4 additions and 13 deletions

View File

@ -61,7 +61,7 @@ class ProcurementContractLists extends BaseAdminDataLists implements ListsSearch
public function lists(): array
{
return ProcurementContract::where($this->searchWhere)
->field('id,project_id,supplier_id,contract_no,contract_name,contract_type,signing_date,contract_amount')
->field('id,project_id,supplier_id,contract_no,contract_name,contract_type,signing_date')
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function($data){
@ -72,6 +72,7 @@ class ProcurementContractLists extends BaseAdminDataLists implements ListsSearch
$data['supplier_name'] = $supplier['supplier_name'];
$data['supplier_code'] = $supplier['supplier_code'];
$data['contract_type'] = $data->contract_type_text;
$data['contract_amount'] = ProcurementContractDetail::where('contract_id',$data['id'])->sum('amount_including_tax');
//已付款金额
$data['has_pay_amount'] = FinancePaymentApply::where('contract_id',$data['id'])->where('contract_type',1)->sum('amount');
//未付款金额

View File

@ -54,10 +54,8 @@ class ProcurementContractLogic extends BaseLogic
$tax_rate_dict = DictData::where('type_value','tax_rate')->column('name','value');
//合同金额\不含税金额
$contract_amount = 0;
$amount_excluding_tax = 0;
foreach($procurement_contract_detail as $v){
$contract_amount += $v['price']*$v['num'];
$amount_excluding_tax += $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100);
}
Db::startTrans();
try {
@ -72,10 +70,6 @@ class ProcurementContractLogic extends BaseLogic
'signing_date' => strtotime($params['signing_date']),
'pay_type' => $params['pay_type'],
'account_period' => $params['account_period'],
//合同金额
'contract_amount' => $contract_amount,
//不含税金额
'amount_excluding_tax' => $amount_excluding_tax,
//质保金
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
//质保金比例
@ -138,10 +132,8 @@ class ProcurementContractLogic extends BaseLogic
$tax_rate_dict = DictData::where('type_value','tax_rate')->column('name','value');
//合同金额\不含税金额
$contract_amount = 0;
$amount_excluding_tax = 0;
foreach($procurement_contract_detail as $v){
$contract_amount += $v['price']*$v['num'];
$amount_excluding_tax += $v['num'] * $v['price'] * (1- $tax_rate_dict[$v['tax_rate']] / 100);
}
Db::startTrans();
try {
@ -155,10 +147,6 @@ class ProcurementContractLogic extends BaseLogic
'signing_date' => strtotime($params['signing_date']),
'pay_type' => $params['pay_type'],
'account_period' => $params['account_period'],
//合同金额
'contract_amount' => $contract_amount,
//不含税金额
'amount_excluding_tax' => $amount_excluding_tax,
//质保金
'retention_money' => $contract_amount * ($params['retention_money_rate'] / 100),
//质保金比例
@ -254,6 +242,8 @@ class ProcurementContractLogic extends BaseLogic
$data['contract_type_text'] = $data->contract_type_text;
$data['pay_type_text'] = $data->pay_type_text;
$data['account_period_text'] = $data->account_period_text;
$data['amount_excluding_tax'] = ProcurementContractDetail::where('contract_id',$data['id'])->sum('amount_excluding_tax');
$data['contract_amount'] = ProcurementContractDetail::where('contract_id',$data['id'])->sum('amount_including_tax');
return $data->toArray();
}
}