All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m8s
1. 新增 AccountPayable (應付帳款) 模組,包含 Migration、Model、Service 與 Controller 2. 修改 GoodsReceipt (進貨單) 流程,在確認進貨時自動產生對應的應付帳款單 (AP-YYYYMMDD-XX) 3. 實作應付帳款詳細頁面 (Show.tsx),包含發票登記與標記付款功能 4. 修正應付帳款 Show 頁面的排版,將發票資訊套用標準的綠色背景區塊,並調整按鈕位置 5. 更新相關的 Service Provider 與 Routes
62 lines
1.4 KiB
PHP
62 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Finance\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class AccountPayable extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const STATUS_PENDING = 'pending';
|
|
public const STATUS_PARTIALLY_PAID = 'partially_paid';
|
|
public const STATUS_PAID = 'paid';
|
|
public const STATUS_CANCELLED = 'cancelled';
|
|
|
|
protected $fillable = [
|
|
'vendor_id',
|
|
'source_document_type',
|
|
'source_document_id',
|
|
'document_number',
|
|
'total_amount',
|
|
'tax_amount',
|
|
'status',
|
|
'due_date',
|
|
'invoice_number',
|
|
'invoice_date',
|
|
'paid_at',
|
|
'payment_method',
|
|
'payment_note',
|
|
'remarks',
|
|
'created_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'total_amount' => 'decimal:2',
|
|
'tax_amount' => 'decimal:2',
|
|
'due_date' => 'date',
|
|
'invoice_date' => 'date',
|
|
'paid_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* 關聯:供應商
|
|
* @return BelongsTo
|
|
*/
|
|
public function vendor(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Modules\Procurement\Models\Vendor::class, 'vendor_id');
|
|
}
|
|
|
|
/**
|
|
* 關聯:建立者
|
|
* @return BelongsTo
|
|
*/
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Modules\Core\Models\User::class, 'created_by');
|
|
}
|
|
}
|