feat: 完成進貨單自動拋轉應付帳款流程與AP介面優化
All checks were successful
ERP-Deploy-Demo / deploy-demo (push) Successful in 1m8s
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
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('account_payables', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('vendor_id')->constrained('vendors');
|
||||
$table->string('source_document_type')->comment('來源單據類型 (e.g. goods_receipt)');
|
||||
$table->unsignedBigInteger('source_document_id')->comment('來源單據 ID');
|
||||
$table->string('document_number')->unique()->comment('應付帳款單號');
|
||||
$table->decimal('total_amount', 15, 2)->comment('總金額 (含稅)');
|
||||
$table->decimal('tax_amount', 15, 2)->default(0)->comment('稅金');
|
||||
$table->string('status')->default('pending')->comment('狀態: pending, partially_paid, paid, cancelled');
|
||||
$table->date('due_date')->nullable()->comment('應付日期');
|
||||
$table->text('remarks')->nullable()->comment('備註');
|
||||
$table->foreignId('created_by')->nullable()->constrained('users');
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['source_document_type', 'source_document_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('account_payables');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('goods_receipts', function (Blueprint $table) {
|
||||
$table->string('status', 20)->default('draft')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('goods_receipts', function (Blueprint $table) {
|
||||
$table->enum('status', ['draft', 'completed', 'cancelled'])->default('draft')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('account_payables', function (Blueprint $table) {
|
||||
$table->string('invoice_number')->nullable()->after('due_date')->comment('發票號碼');
|
||||
$table->date('invoice_date')->nullable()->after('invoice_number')->comment('發票日期');
|
||||
|
||||
$table->timestamp('paid_at')->nullable()->after('status')->comment('付款時間');
|
||||
$table->string('payment_method')->nullable()->after('paid_at')->comment('付款方式');
|
||||
$table->text('payment_note')->nullable()->after('payment_method')->comment('付款備註');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('account_payables', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'invoice_number',
|
||||
'invoice_date',
|
||||
'paid_at',
|
||||
'payment_method',
|
||||
'payment_note'
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user