Add membership fee system with disability discount and fix document permissions

Features:
- Implement two fee types: entrance fee and annual fee (both NT$1,000)
- Add 50% discount for disability certificate holders
- Add disability certificate upload in member profile
- Integrate disability verification into cashier approval workflow
- Add membership fee settings in system admin

Document permissions:
- Fix hard-coded role logic in Document model
- Use permission-based authorization instead of role checks

Additional features:
- Add announcements, general ledger, and trial balance modules
- Add income management and accounting entries
- Add comprehensive test suite with factories
- Update UI translations to Traditional Chinese

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-01 09:56:01 +08:00
parent 83ce1f7fc8
commit 642b879dd4
207 changed files with 19487 additions and 3048 deletions

View File

@@ -0,0 +1,92 @@
<?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('incomes', function (Blueprint $table) {
$table->id();
// 基本資訊
$table->string('income_number')->unique(); // 收入編號INC-2025-0001
$table->string('title'); // 收入標題
$table->text('description')->nullable(); // 說明
$table->date('income_date'); // 收入日期
$table->decimal('amount', 12, 2); // 金額
// 收入分類
$table->string('income_type'); // 收入類型
$table->foreignId('chart_of_account_id') // 會計科目
->constrained('chart_of_accounts');
// 付款資訊
$table->string('payment_method'); // 付款方式
$table->string('bank_account')->nullable(); // 銀行帳戶
$table->string('payer_name')->nullable(); // 付款人姓名
$table->string('receipt_number')->nullable(); // 收據編號
$table->string('transaction_reference')->nullable(); // 銀行交易參考號
$table->string('attachment_path')->nullable(); // 附件路徑
// 會員關聯
$table->foreignId('member_id')->nullable()
->constrained()->nullOnDelete();
// 審核流程
$table->string('status')->default('pending'); // pending, confirmed, cancelled
// 出納記錄
$table->foreignId('recorded_by_cashier_id')
->constrained('users');
$table->timestamp('recorded_at');
// 會計確認
$table->foreignId('confirmed_by_accountant_id')->nullable()
->constrained('users');
$table->timestamp('confirmed_at')->nullable();
// 關聯出納日記帳
$table->foreignId('cashier_ledger_entry_id')->nullable()
->constrained('cashier_ledger_entries')->nullOnDelete();
$table->text('notes')->nullable();
$table->timestamps();
// 索引
$table->index('income_date');
$table->index('income_type');
$table->index('status');
$table->index(['member_id', 'income_type']);
});
// 在 accounting_entries 表新增 income_id 欄位
Schema::table('accounting_entries', function (Blueprint $table) {
if (!Schema::hasColumn('accounting_entries', 'income_id')) {
$table->foreignId('income_id')->nullable()
->after('finance_document_id')
->constrained('incomes')->nullOnDelete();
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('accounting_entries', function (Blueprint $table) {
if (Schema::hasColumn('accounting_entries', 'income_id')) {
$table->dropForeign(['income_id']);
$table->dropColumn('income_id');
}
});
Schema::dropIfExists('incomes');
}
};