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
57 lines
1.4 KiB
PHP
57 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Inventory\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class GoodsReceipt extends Model
|
|
{
|
|
use HasFactory, SoftDeletes;
|
|
use \Spatie\Activitylog\Traits\LogsActivity;
|
|
|
|
public const STATUS_DRAFT = 'draft';
|
|
public const STATUS_PENDING_AUDIT = 'pending_audit';
|
|
public const STATUS_COMPLETED = 'completed';
|
|
public const STATUS_REJECTED = 'rejected';
|
|
|
|
protected $fillable = [
|
|
'code',
|
|
'type',
|
|
'warehouse_id',
|
|
'purchase_order_id',
|
|
'vendor_id',
|
|
'received_date',
|
|
'status',
|
|
'remarks',
|
|
'user_id',
|
|
];
|
|
|
|
protected $casts = [
|
|
'received_date' => 'date:Y-m-d',
|
|
];
|
|
|
|
public function getActivitylogOptions(): \Spatie\Activitylog\LogOptions
|
|
{
|
|
return \Spatie\Activitylog\LogOptions::defaults()
|
|
->logAll()
|
|
->logOnlyDirty()
|
|
->dontSubmitEmptyLogs();
|
|
}
|
|
|
|
public function items()
|
|
{
|
|
return $this->hasMany(GoodsReceiptItem::class);
|
|
}
|
|
|
|
// Strict Mode: relationships to Warehouse is allowed (same module).
|
|
public function warehouse()
|
|
{
|
|
return $this->belongsTo(Warehouse::class);
|
|
}
|
|
|
|
// Strict Mode: cross-module relationship to Vendor/User/PurchaseOrder is restricted.
|
|
// They are accessed via IDs or Services.
|
|
}
|