付款与收款

This commit is contained in:
2025-09-23 15:14:08 +08:00
parent 36d1d333b1
commit 4717bb01ca
8 changed files with 102 additions and 8 deletions
+11 -3
View File
@@ -40,7 +40,7 @@ class FinReceipt extends Model
/**
* 允许自动填充模型字段
*/
protected $fillable = ['id', 'receipt_no', 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'discount_amount', 'total_amount_cny', 'exchange_rate', 'arrived_at', 'received_at', 'voucher_no', 'fx_receipt_file', 'is_domestic_return', 'created_at', 'updated_at'];
protected $fillable = ['id', 'receipt_no', 'payment_apply_id', 'country_id', 'remitter', 'account_id', 'currency_id', 'amount', 'discount_amount', 'total_amount_cny', 'exchange_rate', 'arrived_at', 'received_at', 'voucher_no', 'fx_receipt_file', 'is_domestic_return', 'created_by', 'updated_by', 'created_at', 'updated_at'];
/**
* 不允许自动填充模型字段
@@ -48,11 +48,11 @@ class FinReceipt extends Model
protected $guarded = [];
/**
* 获取付款申请
* 对应的付款申请(1-1,可为空)
*/
public function payment()
{
return $this->hasOne(FinPaymentApply::class, 'id', 'payment_apply_id');
return $this->belongsTo(FinPaymentApply::class, 'payment_apply_id', 'id');
}
/**
@@ -62,4 +62,12 @@ class FinReceipt extends Model
{
return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id');
}
/**
* 关联的备货单(通过中间表)
*/
public function stocks()
{
return $this->belongsToMany(StockOrders::class, 'fin_payment_stock', 'receipt_id', 'stock_id');
}
}