更新分包合同
This commit is contained in:
parent
9798c03888
commit
17cf115de5
@ -41,23 +41,23 @@ class SubcontractingContractLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
SubcontractingContract::create([
|
||||
'project_id' => $params['project_id'],
|
||||
'approve_id' => $params['approve_id'],
|
||||
'contract_no' => $params['contract_no'],
|
||||
'contract_name' => $params['contract_name'],
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => $params['signing_date'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
'amount' => $params['amount'],
|
||||
'amount_daxie' => $params['amount_daxie'],
|
||||
'tax_rate' => $params['tax_rate'],
|
||||
'amount_excluding_tax' => $params['amount_excluding_tax'],
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'retention_money' => $params['retention_money'],
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex'],
|
||||
'project_id' => $params['project_id'] ?? 0,
|
||||
'approve_id' => $params['approve_id'] ?? 0,
|
||||
'contract_no' => $params['contract_no'] ?? '',
|
||||
'contract_name' => $params['contract_name'] ?? '',
|
||||
'supplier_id' => $params['supplier_id'] ?? 0,
|
||||
'contract_type' => $params['contract_type'] ?? 0,
|
||||
'signing_date' => strtitime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'account_period' => $params['account_period'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'amount_daxie' => $params['amount_daxie'] ?? '',
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'amount_excluding_tax' => $params['amount_excluding_tax'] ?? 0,
|
||||
'retention_money_rate' => $params['retention_money_rate'] ?? '',
|
||||
'retention_money' => $params['retention_money'] ?? 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
@ -82,23 +82,23 @@ class SubcontractingContractLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
try {
|
||||
SubcontractingContract::where('id', $params['id'])->update([
|
||||
'project_id' => $params['project_id'],
|
||||
'approve_id' => $params['approve_id'],
|
||||
'contract_no' => $params['contract_no'],
|
||||
'contract_name' => $params['contract_name'],
|
||||
'supplier_id' => $params['supplier_id'],
|
||||
'contract_type' => $params['contract_type'],
|
||||
'signing_date' => $params['signing_date'],
|
||||
'pay_type' => $params['pay_type'],
|
||||
'account_period' => $params['account_period'],
|
||||
'amount' => $params['amount'],
|
||||
'amount_daxie' => $params['amount_daxie'],
|
||||
'tax_rate' => $params['tax_rate'],
|
||||
'amount_excluding_tax' => $params['amount_excluding_tax'],
|
||||
'retention_money_rate' => $params['retention_money_rate'],
|
||||
'retention_money' => $params['retention_money'],
|
||||
'remark' => $params['remark'],
|
||||
'annex' => $params['annex'],
|
||||
'project_id' => $params['project_id'] ?? 0,
|
||||
'approve_id' => $params['approve_id'] ?? 0,
|
||||
'contract_no' => $params['contract_no'] ?? '',
|
||||
'contract_name' => $params['contract_name'] ?? '',
|
||||
'supplier_id' => $params['supplier_id'] ?? 0,
|
||||
'contract_type' => $params['contract_type'] ?? 0,
|
||||
'signing_date' => strtitime($params['signing_date']),
|
||||
'pay_type' => $params['pay_type'] ?? 0,
|
||||
'account_period' => $params['account_period'] ?? 0,
|
||||
'amount' => $params['amount'] ?? 0,
|
||||
'amount_daxie' => $params['amount_daxie'] ?? '',
|
||||
'tax_rate' => $params['tax_rate'] ?? 0,
|
||||
'amount_excluding_tax' => $params['amount_excluding_tax'] ?? 0,
|
||||
'retention_money_rate' => $params['retention_money_rate'] ?? '',
|
||||
'retention_money' => $params['retention_money'] ?? 0,
|
||||
'remark' => $params['remark'] ?? '',
|
||||
'annex' => $params['annex'] ?? '',
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
|
@ -31,7 +31,11 @@ class SubcontractingContractValidate extends BaseValidate
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
'id' => 'require',
|
||||
'project_id' => 'require',
|
||||
'approve_id' => 'require',
|
||||
'supplier_id' => 'require',
|
||||
'contract_name' => 'require',
|
||||
];
|
||||
|
||||
|
||||
@ -40,7 +44,7 @@ class SubcontractingContractValidate extends BaseValidate
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
@ -64,7 +68,7 @@ class SubcontractingContractValidate extends BaseValidate
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
return $this->only(['id', 'project_id', 'approve_id', 'supplier_id', 'contract_name']);
|
||||
}
|
||||
|
||||
|
||||
|
@ -30,5 +30,14 @@ class SubcontractingContract extends BaseModel
|
||||
protected $name = 'subcontracting_contract';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function project()
|
||||
{
|
||||
return $this->belongsTo(\app\common\model\project\Project::class, 'project_id');
|
||||
}
|
||||
|
||||
public function getSigningDateAttr($value)
|
||||
{
|
||||
return empty($value) ? '' : date('Y-m-d H:i:s', $value);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user