update
This commit is contained in:
parent
1d1f915411
commit
ddcfe13594
app/adminapi
lists/project
logic/project
validate/project
@ -17,6 +17,7 @@ namespace app\adminapi\lists\project;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\contract\ContractNegotiation;
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\project\Project;
|
||||
@ -61,7 +62,7 @@ class ProjectSubcontractSettlementLists extends BaseAdminDataLists implements Li
|
||||
public function lists(): array
|
||||
{
|
||||
return ProjectSubcontractSettlement::where($this->searchWhere)
|
||||
->field(['id', 'settlement_code', 'project_id', 'contract_id', 'settlement_amount', 'settlement_amount_uppercase', 'remaining_amount', 'settlement_date', 'remark', 'add_user'])
|
||||
->field(['id', 'settlement_code', 'project_id', 'contract_id', 'settlement_amount', 'settlement_date', 'remark', 'add_user'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
@ -72,7 +73,12 @@ class ProjectSubcontractSettlementLists extends BaseAdminDataLists implements Li
|
||||
$item['supplier_name'] = $supplier['supplier_name'];
|
||||
$item['project_name'] = $project['name'];
|
||||
$item['contract_code'] = $contract['contract_no'];
|
||||
//合同金额
|
||||
$item['contract_amount'] = SubcontractingContractDetail::where('contract_id',$item['contract_id'])->sum('amount_including_tax');
|
||||
//洽商金额
|
||||
$item['negotiation_amount'] = ContractNegotiation::where('contract_id',$item['contract_id'])->sum('negotiation_amount');
|
||||
//结算差异
|
||||
$item['settlement_difference'] = bcsub(($item['contract_amount']+$item['negotiation_amount']),$item['settlement_amount']);
|
||||
$item['add_user_name'] = $admin['name'];
|
||||
unset($item['project_id'],$item['contract_id'],$item['add_user']);
|
||||
return $item;
|
||||
|
@ -131,7 +131,6 @@ class ProjectSettlementLogic extends BaseLogic
|
||||
$data['negotiation_amount'] = ContractNegotiation::where('contract_id',$data['contract_id'])->sum('negotiation_amount');
|
||||
//结算差异
|
||||
$data['settlement_difference'] = bcsub(($data['contract_amount']+$data['negotiation_amount']),$data['settlement_amount']);
|
||||
$data['contract_amount_uppercase'] = $contract['amount_daxie'];
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ namespace app\adminapi\logic\project;
|
||||
|
||||
use app\common\model\contract\SubcontractingContract;
|
||||
use app\common\model\contract\SubcontractingContractDetail;
|
||||
use app\common\model\contract\SubcontractingContractNegotiation;
|
||||
use app\common\model\project\Project;
|
||||
use app\common\model\project\ProjectSubcontractSettlement;
|
||||
use app\common\logic\BaseLogic;
|
||||
@ -48,8 +49,6 @@ class ProjectSubcontractSettlementLogic extends BaseLogic
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'settlement_amount' => $params['settlement_amount'],
|
||||
'settlement_amount_uppercase' => $params['settlement_amount_uppercase'],
|
||||
'remaining_amount' => $params['remaining_amount'],
|
||||
'settlement_date' => strtotime($params['settlement_date']),
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
@ -81,8 +80,6 @@ class ProjectSubcontractSettlementLogic extends BaseLogic
|
||||
'project_id' => $params['project_id'],
|
||||
'contract_id' => $params['contract_id'],
|
||||
'settlement_amount' => $params['settlement_amount'],
|
||||
'settlement_amount_uppercase' => $params['settlement_amount_uppercase'],
|
||||
'remaining_amount' => $params['remaining_amount'],
|
||||
'settlement_date' => strtotime($params['settlement_date']),
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex']? json_encode($params['annex']) : null,
|
||||
@ -121,7 +118,7 @@ class ProjectSubcontractSettlementLogic extends BaseLogic
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
$data = ProjectSubcontractSettlement::field('id,settlement_code,project_id,contract_id,settlement_amount,settlement_amount_uppercase,remaining_amount,settlement_date,remark,annex')->findOrEmpty($params['id'])->toArray();
|
||||
$data = ProjectSubcontractSettlement::field('id,settlement_code,project_id,contract_id,settlement_amount,settlement_date,remark,annex')->findOrEmpty($params['id'])->toArray();
|
||||
$project = Project::field('name,project_code')->where('id',$data['project_id'])->findOrEmpty();
|
||||
$contract = SubcontractingContract::field('supplier_id,contract_no,contract_name')->where('id',$data['contract_id'])->findOrEmpty();
|
||||
$supplier = Supplier::field('supplier_code,supplier_name')->where('id',$contract['supplier_id'])->findOrEmpty();
|
||||
@ -131,7 +128,12 @@ class ProjectSubcontractSettlementLogic extends BaseLogic
|
||||
$data['contract_code'] = $contract['contract_no'];
|
||||
$data['supplier_name'] = $supplier['supplier_name'];
|
||||
$data['supplier_code'] = $supplier['supplier_code'];
|
||||
//合同金额
|
||||
$data['contract_amount'] = SubcontractingContractDetail::where('contract_id',$data['contract_id'])->sum('amount_including_tax');
|
||||
//合同洽商金额
|
||||
$data['negotiation_amount'] = SubcontractingContractNegotiation::where('contract_id',$data['contract_id'])->sum('negotiation_amount');
|
||||
//结算差异
|
||||
$data['settlement_difference'] = bcsub(($data['contract_amount']+$data['negotiation_amount']),$data['settlement_amount']);
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -36,8 +36,6 @@ class ProjectSubcontractSettlementValidate extends BaseValidate
|
||||
'project_id' => 'require|checkProject',
|
||||
'contract_id' => 'require|checkContract',
|
||||
'settlement_amount' => 'require|float|egt:0',
|
||||
'settlement_amount_uppercase' => 'require',
|
||||
'remaining_amount' => 'require|float|egt:0',
|
||||
'settlement_date' => 'require|dateFormat:Y-m-d',
|
||||
'annex' => 'checkAnnex'
|
||||
];
|
||||
@ -49,10 +47,6 @@ class ProjectSubcontractSettlementValidate extends BaseValidate
|
||||
'settlement_amount.require' => '请填写结算金额',
|
||||
'settlement_amount.float' => '结算金额值必须是数字',
|
||||
'settlement_amount.egt' => '结算金额值必须大于等于0',
|
||||
'settlement_amount_uppercase.require' => '请填写合同金额大写',
|
||||
'remaining_amount.require' => '请填写结算差异',
|
||||
'remaining_amount.float' => '结算差异值必须是数字',
|
||||
'remaining_amount.egt' => '结算差异值必须大于等于0',
|
||||
'settlement_date.require' => '请选择结算日期',
|
||||
'settlement_date.dateFormat' => '结算日期格式错误',
|
||||
];
|
||||
@ -66,7 +60,7 @@ class ProjectSubcontractSettlementValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->only(['project_id','contract_id','settlement_amount','settlement_amount_uppercase','remaining_amount','settlement_date']);
|
||||
return $this->remove('id',true);
|
||||
}
|
||||
|
||||
|
||||
@ -77,9 +71,7 @@ class ProjectSubcontractSettlementValidate extends BaseValidate
|
||||
* @date 2023/12/29 13:59
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id','project_id','contract_id','settlement_amount','settlement_amount_uppercase','remaining_amount','settlement_date']);
|
||||
}
|
||||
{}
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user