Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 작업지시 하위 테이블에 tenant_id 컬럼 추가
|
||||
* - work_order_items
|
||||
* - work_order_bending_details
|
||||
* - work_order_issues
|
||||
*
|
||||
* 기존 데이터는 work_orders 테이블의 tenant_id를 참조하여 업데이트
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// 1. work_order_items
|
||||
Schema::table('work_order_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_items_tenant');
|
||||
});
|
||||
|
||||
// 기존 데이터 업데이트
|
||||
DB::statement('
|
||||
UPDATE work_order_items wi
|
||||
JOIN work_orders wo ON wi.work_order_id = wo.id
|
||||
SET wi.tenant_id = wo.tenant_id
|
||||
');
|
||||
|
||||
// nullable 제거
|
||||
Schema::table('work_order_items', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
|
||||
// 2. work_order_bending_details
|
||||
Schema::table('work_order_bending_details', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_bending_details_tenant');
|
||||
});
|
||||
|
||||
DB::statement('
|
||||
UPDATE work_order_bending_details wbd
|
||||
JOIN work_orders wo ON wbd.work_order_id = wo.id
|
||||
SET wbd.tenant_id = wo.tenant_id
|
||||
');
|
||||
|
||||
Schema::table('work_order_bending_details', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
|
||||
// 3. work_order_issues
|
||||
Schema::table('work_order_issues', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable()->after('id')->comment('테넌트ID');
|
||||
$table->index('tenant_id', 'idx_work_order_issues_tenant');
|
||||
});
|
||||
|
||||
DB::statement('
|
||||
UPDATE work_order_issues woi
|
||||
JOIN work_orders wo ON woi.work_order_id = wo.id
|
||||
SET woi.tenant_id = wo.tenant_id
|
||||
');
|
||||
|
||||
Schema::table('work_order_issues', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('tenant_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('work_order_items', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_work_order_items_tenant');
|
||||
$table->dropColumn('tenant_id');
|
||||
});
|
||||
|
||||
Schema::table('work_order_bending_details', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_work_order_bending_details_tenant');
|
||||
$table->dropColumn('tenant_id');
|
||||
});
|
||||
|
||||
Schema::table('work_order_issues', function (Blueprint $table) {
|
||||
$table->dropIndex('idx_work_order_issues_tenant');
|
||||
$table->dropColumn('tenant_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* 작업지시 담당자 피벗 테이블 (Work Order Assignees)
|
||||
* - 다중 담당자 지원
|
||||
* - 주 담당자 구분 (is_primary)
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('work_order_assignees', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트ID');
|
||||
$table->unsignedBigInteger('work_order_id')->comment('작업지시ID');
|
||||
$table->unsignedBigInteger('user_id')->comment('담당자ID');
|
||||
$table->boolean('is_primary')->default(false)->comment('주담당자 여부');
|
||||
$table->timestamps();
|
||||
|
||||
// Indexes
|
||||
$table->unique(['work_order_id', 'user_id'], 'uq_work_order_assignees');
|
||||
$table->index(['tenant_id', 'work_order_id'], 'idx_wo_assignees_tenant_wo');
|
||||
$table->index(['tenant_id', 'user_id'], 'idx_wo_assignees_tenant_user');
|
||||
|
||||
// Foreign keys
|
||||
$table->foreign('work_order_id')
|
||||
->references('id')
|
||||
->on('work_orders')
|
||||
->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('work_order_assignees');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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('bank_accounts', function (Blueprint $table) {
|
||||
// 예금 종류
|
||||
$table->string('account_type', 30)->default('보통예금')->after('account_holder')->comment('예금종류');
|
||||
|
||||
// 금액 정보
|
||||
$table->decimal('balance', 18, 2)->default(0)->after('account_name')->comment('잔액');
|
||||
$table->string('currency', 3)->default('KRW')->after('balance')->comment('통화');
|
||||
|
||||
// 날짜 정보
|
||||
$table->date('opened_at')->nullable()->after('currency')->comment('개설일자');
|
||||
$table->timestamp('last_transaction_at')->nullable()->after('opened_at')->comment('최종거래일시');
|
||||
|
||||
// 추가 정보
|
||||
$table->string('branch_name', 100)->nullable()->after('last_transaction_at')->comment('지점명');
|
||||
$table->text('memo')->nullable()->after('branch_name')->comment('메모');
|
||||
|
||||
// 정렬 순서
|
||||
$table->unsignedInteger('sort_order')->default(0)->after('is_primary')->comment('정렬순서');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('bank_accounts', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'account_type',
|
||||
'balance',
|
||||
'currency',
|
||||
'opened_at',
|
||||
'last_transaction_at',
|
||||
'branch_name',
|
||||
'memo',
|
||||
'sort_order',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,72 @@
|
||||
<?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('bank_transactions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('tenant_id')->constrained()->cascadeOnDelete();
|
||||
$table->foreignId('bank_account_id')->constrained('bank_accounts')->cascadeOnDelete();
|
||||
|
||||
// 거래 정보
|
||||
$table->string('transaction_type', 20)->comment('거래유형: deposit(입금), withdrawal(출금), transfer(이체)');
|
||||
$table->decimal('amount', 18, 2)->comment('거래금액');
|
||||
$table->decimal('balance_after', 18, 2)->comment('거래 후 잔액');
|
||||
|
||||
// 날짜
|
||||
$table->date('transaction_date')->comment('거래일자');
|
||||
$table->time('transaction_time')->nullable()->comment('거래시간');
|
||||
|
||||
// 상세 정보
|
||||
$table->string('description', 255)->nullable()->comment('적요');
|
||||
$table->string('counterparty', 100)->nullable()->comment('거래상대방');
|
||||
$table->string('reference_number', 100)->nullable()->comment('참조번호');
|
||||
|
||||
// 분류
|
||||
$table->string('category', 50)->nullable()->comment('거래분류');
|
||||
$table->foreignId('related_order_id')->nullable()->comment('관련 주문 ID');
|
||||
$table->foreignId('related_payment_id')->nullable()->comment('관련 결제 ID');
|
||||
|
||||
// 상태
|
||||
$table->boolean('is_reconciled')->default(false)->comment('대사완료 여부');
|
||||
$table->timestamp('reconciled_at')->nullable()->comment('대사완료 일시');
|
||||
|
||||
// 추가 정보
|
||||
$table->text('memo')->nullable()->comment('메모');
|
||||
$table->json('options')->nullable()->comment('추가 옵션');
|
||||
|
||||
// 감사 필드
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('deleted_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// 인덱스
|
||||
$table->index('tenant_id', 'idx_bank_transactions_tenant');
|
||||
$table->index('bank_account_id', 'idx_bank_transactions_account');
|
||||
$table->index('transaction_date', 'idx_bank_transactions_date');
|
||||
$table->index('transaction_type', 'idx_bank_transactions_type');
|
||||
$table->index('is_reconciled', 'idx_bank_transactions_reconciled');
|
||||
$table->index('deleted_at', 'idx_bank_transactions_deleted');
|
||||
$table->index(['tenant_id', 'transaction_date'], 'idx_bank_transactions_tenant_date');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('bank_transactions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,75 @@
|
||||
<?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('fund_schedules', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('tenant_id')->comment('테넌트 ID');
|
||||
|
||||
// 기본 정보
|
||||
$table->string('title', 200)->comment('일정명');
|
||||
$table->text('description')->nullable()->comment('설명');
|
||||
|
||||
// 일정 유형: income(입금예정), expense(지급예정)
|
||||
$table->enum('schedule_type', ['income', 'expense'])->comment('일정유형: income=입금, expense=지급');
|
||||
|
||||
// 일정 정보
|
||||
$table->date('scheduled_date')->comment('예정일');
|
||||
$table->decimal('amount', 18, 2)->default(0)->comment('금액');
|
||||
$table->string('currency', 3)->default('KRW')->comment('통화');
|
||||
|
||||
// 관련 정보
|
||||
$table->unsignedBigInteger('related_bank_account_id')->nullable()->comment('관련 계좌 ID');
|
||||
$table->string('counterparty', 200)->nullable()->comment('거래상대방');
|
||||
$table->string('category', 50)->nullable()->comment('분류');
|
||||
|
||||
// 상태: pending(예정), completed(완료), cancelled(취소)
|
||||
$table->enum('status', ['pending', 'completed', 'cancelled'])->default('pending')->comment('상태');
|
||||
|
||||
// 반복 설정
|
||||
$table->boolean('is_recurring')->default(false)->comment('정기 여부');
|
||||
$table->string('recurrence_rule', 100)->nullable()->comment('반복 규칙 (daily, weekly, monthly, yearly)');
|
||||
$table->date('recurrence_end_date')->nullable()->comment('반복 종료일');
|
||||
|
||||
// 완료 정보
|
||||
$table->date('completed_date')->nullable()->comment('실제 완료일');
|
||||
$table->decimal('completed_amount', 18, 2)->nullable()->comment('실제 완료 금액');
|
||||
|
||||
// 추가 정보
|
||||
$table->text('memo')->nullable()->comment('메모');
|
||||
|
||||
// 감사 필드
|
||||
$table->unsignedBigInteger('created_by')->nullable()->comment('생성자 ID');
|
||||
$table->unsignedBigInteger('updated_by')->nullable()->comment('수정자 ID');
|
||||
$table->unsignedBigInteger('deleted_by')->nullable()->comment('삭제자 ID');
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
// 인덱스
|
||||
$table->index('tenant_id', 'idx_fund_schedules_tenant');
|
||||
$table->index('scheduled_date', 'idx_fund_schedules_date');
|
||||
$table->index('schedule_type', 'idx_fund_schedules_type');
|
||||
$table->index('status', 'idx_fund_schedules_status');
|
||||
$table->index(['tenant_id', 'scheduled_date'], 'idx_fund_schedules_tenant_date');
|
||||
$table->index('deleted_at', 'idx_fund_schedules_deleted');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('fund_schedules');
|
||||
}
|
||||
};
|
||||
282
database/seeders/BankAccountSeeder.php
Normal file
282
database/seeders/BankAccountSeeder.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BankAccountSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// 테넌트 ID 1 (코드보잇지엑스) 기준으로 테스트 데이터 생성
|
||||
$tenantId = 1;
|
||||
$userId = 1; // 관리자
|
||||
|
||||
// 계좌 데이터 (기존 테이블 구조에 맞게 수정)
|
||||
$accounts = [
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_code' => '004',
|
||||
'bank_name' => '국민은행',
|
||||
'account_number' => '123-456-789012',
|
||||
'account_holder' => '주식회사 코드보잇지엑스',
|
||||
'account_name' => '주거래 계좌',
|
||||
'account_type' => '보통예금',
|
||||
'balance' => 450000000, // 4.5억
|
||||
'currency' => 'KRW',
|
||||
'opened_at' => '2023-01-15',
|
||||
'last_transaction_at' => '2026-01-15 14:30:00',
|
||||
'branch_name' => '역삼지점',
|
||||
'memo' => '주거래 계좌',
|
||||
'status' => 'active',
|
||||
'is_primary' => true,
|
||||
'sort_order' => 1,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_code' => '088',
|
||||
'bank_name' => '신한은행',
|
||||
'account_number' => '234-567-890123',
|
||||
'account_holder' => '주식회사 코드보잇지엑스',
|
||||
'account_name' => '법인카드 결제',
|
||||
'account_type' => '법인카드 출금',
|
||||
'balance' => 90000000, // 9천만원
|
||||
'currency' => 'KRW',
|
||||
'opened_at' => '2023-01-15',
|
||||
'last_transaction_at' => '2026-01-15 11:20:00',
|
||||
'branch_name' => '강남지점',
|
||||
'memo' => '법인카드 결제 계좌',
|
||||
'status' => 'active',
|
||||
'is_primary' => false,
|
||||
'sort_order' => 2,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_code' => '020',
|
||||
'bank_name' => '우리은행',
|
||||
'account_number' => '345-678-901234',
|
||||
'account_holder' => '주식회사 코드보잇지엑스',
|
||||
'account_name' => '정기예금',
|
||||
'account_type' => '정기예금',
|
||||
'balance' => 200000000, // 2억
|
||||
'currency' => 'KRW',
|
||||
'opened_at' => '2024-06-01',
|
||||
'last_transaction_at' => '2026-01-01 09:00:00',
|
||||
'branch_name' => '테헤란로지점',
|
||||
'memo' => '정기예금 (만기 2027-06-01)',
|
||||
'status' => 'active',
|
||||
'is_primary' => false,
|
||||
'sort_order' => 3,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_code' => '081',
|
||||
'bank_name' => '하나은행',
|
||||
'account_number' => '456-789-012345',
|
||||
'account_holder' => '주식회사 코드보잇지엑스',
|
||||
'account_name' => '급여계좌',
|
||||
'account_type' => '보통예금',
|
||||
'balance' => 75000000, // 7천5백만원
|
||||
'currency' => 'KRW',
|
||||
'opened_at' => '2023-03-20',
|
||||
'last_transaction_at' => '2026-01-14 16:45:00',
|
||||
'branch_name' => '선릉역지점',
|
||||
'memo' => '급여 지급 계좌',
|
||||
'status' => 'active',
|
||||
'is_primary' => false,
|
||||
'sort_order' => 4,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_code' => '011',
|
||||
'bank_name' => '농협은행',
|
||||
'account_number' => '567-890-123456',
|
||||
'account_holder' => '주식회사 코드보잇지엑스',
|
||||
'account_name' => '퇴직금 적금',
|
||||
'account_type' => '적금',
|
||||
'balance' => 50000000, // 5천만원
|
||||
'currency' => 'KRW',
|
||||
'opened_at' => '2024-01-01',
|
||||
'last_transaction_at' => '2026-01-10 10:00:00',
|
||||
'branch_name' => '강남중앙지점',
|
||||
'memo' => '직원 퇴직금 적립',
|
||||
'status' => 'active',
|
||||
'is_primary' => false,
|
||||
'sort_order' => 5,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
];
|
||||
|
||||
// 계좌 데이터 삽입
|
||||
$accountIds = [];
|
||||
foreach ($accounts as $account) {
|
||||
$id = DB::table('bank_accounts')->insertGetId($account);
|
||||
$accountIds[$account['account_number']] = $id;
|
||||
}
|
||||
|
||||
$this->command->info('계좌 5개 생성 완료');
|
||||
|
||||
// 거래내역 데이터 (국민은행 계좌 기준)
|
||||
$transactions = [
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_account_id' => $accountIds['123-456-789012'],
|
||||
'transaction_type' => 'deposit',
|
||||
'amount' => 50000000,
|
||||
'balance_after' => 450000000,
|
||||
'transaction_date' => '2026-01-15',
|
||||
'transaction_time' => '14:30:00',
|
||||
'description' => '프로젝트 대금 입금',
|
||||
'counterparty' => '주식회사 클라이언트A',
|
||||
'reference_number' => 'INV-2026-0115',
|
||||
'category' => '매출',
|
||||
'is_reconciled' => true,
|
||||
'reconciled_at' => '2026-01-15 15:00:00',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_account_id' => $accountIds['123-456-789012'],
|
||||
'transaction_type' => 'withdrawal',
|
||||
'amount' => 5000000,
|
||||
'balance_after' => 400000000,
|
||||
'transaction_date' => '2026-01-14',
|
||||
'transaction_time' => '11:20:00',
|
||||
'description' => '사무실 임대료',
|
||||
'counterparty' => '강남빌딩관리(주)',
|
||||
'reference_number' => 'RENT-2026-01',
|
||||
'category' => '임대료',
|
||||
'is_reconciled' => true,
|
||||
'reconciled_at' => '2026-01-14 14:00:00',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_account_id' => $accountIds['123-456-789012'],
|
||||
'transaction_type' => 'transfer',
|
||||
'amount' => 30000000,
|
||||
'balance_after' => 405000000,
|
||||
'transaction_date' => '2026-01-13',
|
||||
'transaction_time' => '09:00:00',
|
||||
'description' => '급여계좌 이체',
|
||||
'counterparty' => '하나은행 급여계좌',
|
||||
'reference_number' => 'TRF-2026-0113',
|
||||
'category' => '급여',
|
||||
'is_reconciled' => true,
|
||||
'reconciled_at' => '2026-01-13 10:00:00',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_account_id' => $accountIds['123-456-789012'],
|
||||
'transaction_type' => 'deposit',
|
||||
'amount' => 25000000,
|
||||
'balance_after' => 435000000,
|
||||
'transaction_date' => '2026-01-10',
|
||||
'transaction_time' => '16:45:00',
|
||||
'description' => '유지보수 계약금',
|
||||
'counterparty' => '주식회사 클라이언트B',
|
||||
'reference_number' => 'MAINT-2026-001',
|
||||
'category' => '매출',
|
||||
'is_reconciled' => false,
|
||||
'reconciled_at' => null,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_account_id' => $accountIds['123-456-789012'],
|
||||
'transaction_type' => 'withdrawal',
|
||||
'amount' => 2500000,
|
||||
'balance_after' => 410000000,
|
||||
'transaction_date' => '2026-01-08',
|
||||
'transaction_time' => '14:00:00',
|
||||
'description' => '클라우드 서비스 이용료',
|
||||
'counterparty' => 'AWS Korea',
|
||||
'reference_number' => 'AWS-2026-01',
|
||||
'category' => '운영비',
|
||||
'is_reconciled' => false,
|
||||
'reconciled_at' => null,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
];
|
||||
|
||||
// 거래내역 삽입
|
||||
DB::table('bank_transactions')->insert($transactions);
|
||||
|
||||
$this->command->info('거래내역 5개 생성 완료');
|
||||
|
||||
// 신한은행 거래내역
|
||||
$shinhanTransactions = [
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_account_id' => $accountIds['234-567-890123'],
|
||||
'transaction_type' => 'withdrawal',
|
||||
'amount' => 1500000,
|
||||
'balance_after' => 90000000,
|
||||
'transaction_date' => '2026-01-15',
|
||||
'transaction_time' => '11:20:00',
|
||||
'description' => '법인카드 결제',
|
||||
'counterparty' => '신한카드',
|
||||
'reference_number' => 'CARD-2026-0115',
|
||||
'category' => '카드결제',
|
||||
'is_reconciled' => true,
|
||||
'reconciled_at' => '2026-01-15 12:00:00',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'bank_account_id' => $accountIds['234-567-890123'],
|
||||
'transaction_type' => 'deposit',
|
||||
'amount' => 10000000,
|
||||
'balance_after' => 91500000,
|
||||
'transaction_date' => '2026-01-10',
|
||||
'transaction_time' => '09:30:00',
|
||||
'description' => '카드결제계좌 입금',
|
||||
'counterparty' => '국민은행 주거래계좌',
|
||||
'reference_number' => 'TRF-2026-0110',
|
||||
'category' => '이체',
|
||||
'is_reconciled' => true,
|
||||
'reconciled_at' => '2026-01-10 10:00:00',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
];
|
||||
|
||||
DB::table('bank_transactions')->insert($shinhanTransactions);
|
||||
|
||||
$this->command->info('신한은행 거래내역 2개 생성 완료');
|
||||
|
||||
$this->command->info('BankAccountSeeder 완료: 계좌 5개, 거래내역 7개');
|
||||
}
|
||||
}
|
||||
160
database/seeders/FundScheduleSeeder.php
Normal file
160
database/seeders/FundScheduleSeeder.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class FundScheduleSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// 테넌트 ID 1 (코드보잇지엑스) 기준으로 테스트 데이터 생성
|
||||
$tenantId = 1;
|
||||
$userId = 1; // 관리자
|
||||
|
||||
// 현재 월 기준으로 데이터 생성
|
||||
$year = now()->year;
|
||||
$month = now()->month;
|
||||
|
||||
// 자금계획일정 데이터
|
||||
$schedules = [
|
||||
// 입금 예정
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'title' => '(주)스마트팩토리 개발비 1차',
|
||||
'description' => 'ERP 시스템 개발 프로젝트 1차 중도금',
|
||||
'schedule_type' => 'income',
|
||||
'scheduled_date' => sprintf('%04d-%02d-10', $year, $month),
|
||||
'amount' => 100000000, // 1억원
|
||||
'currency' => 'KRW',
|
||||
'counterparty' => '(주)스마트팩토리',
|
||||
'category' => '매출',
|
||||
'status' => 'pending',
|
||||
'is_recurring' => false,
|
||||
'recurrence_rule' => null,
|
||||
'memo' => '계약서 기준 착수금 30%, 중도금 40%, 잔금 30%',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'title' => '영업파트너 수수료 지급',
|
||||
'description' => '1월 영업 수수료 정산',
|
||||
'schedule_type' => 'expense',
|
||||
'scheduled_date' => sprintf('%04d-%02d-10', $year, $month),
|
||||
'amount' => 20000000, // 2천만원
|
||||
'currency' => 'KRW',
|
||||
'counterparty' => '영업파트너',
|
||||
'category' => '매입',
|
||||
'status' => 'pending',
|
||||
'is_recurring' => false,
|
||||
'recurrence_rule' => null,
|
||||
'memo' => null,
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'title' => '(주)디지털제조 개발비 잔금',
|
||||
'description' => 'MES 시스템 개발 프로젝트 잔금',
|
||||
'schedule_type' => 'income',
|
||||
'scheduled_date' => sprintf('%04d-%02d-15', $year, $month),
|
||||
'amount' => 30000000, // 3천만원
|
||||
'currency' => 'KRW',
|
||||
'counterparty' => '(주)디지털제조',
|
||||
'category' => '매출',
|
||||
'status' => 'pending',
|
||||
'is_recurring' => false,
|
||||
'recurrence_rule' => null,
|
||||
'memo' => '검수 완료 후 지급',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'title' => '직원 급여 지급',
|
||||
'description' => sprintf('%d년 %d월 급여', $year, $month),
|
||||
'schedule_type' => 'expense',
|
||||
'scheduled_date' => sprintf('%04d-%02d-25', $year, $month),
|
||||
'amount' => 25000000, // 2천5백만원
|
||||
'currency' => 'KRW',
|
||||
'counterparty' => '직원',
|
||||
'category' => '급여',
|
||||
'status' => 'pending',
|
||||
'is_recurring' => true,
|
||||
'recurrence_rule' => 'monthly',
|
||||
'memo' => '매월 25일 정기 지급',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'title' => '구독료 CMS 출금',
|
||||
'description' => '클라우드 서비스 월 구독료',
|
||||
'schedule_type' => 'expense',
|
||||
'scheduled_date' => sprintf('%04d-%02d-28', $year, $month),
|
||||
'amount' => 8500000, // 850만원
|
||||
'currency' => 'KRW',
|
||||
'counterparty' => 'AWS/Azure',
|
||||
'category' => '운영비',
|
||||
'status' => 'pending',
|
||||
'is_recurring' => true,
|
||||
'recurrence_rule' => 'monthly',
|
||||
'memo' => 'AWS + Azure 클라우드 비용',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
// 다음 달 일정도 추가
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'title' => '사무실 임대료',
|
||||
'description' => '강남 오피스 임대료',
|
||||
'schedule_type' => 'expense',
|
||||
'scheduled_date' => sprintf('%04d-%02d-05', $month == 12 ? $year + 1 : $year, $month == 12 ? 1 : $month + 1),
|
||||
'amount' => 5000000, // 500만원
|
||||
'currency' => 'KRW',
|
||||
'counterparty' => '강남빌딩관리(주)',
|
||||
'category' => '임대료',
|
||||
'status' => 'pending',
|
||||
'is_recurring' => true,
|
||||
'recurrence_rule' => 'monthly',
|
||||
'memo' => '매월 5일 자동이체',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'tenant_id' => $tenantId,
|
||||
'title' => '유지보수 계약금 입금',
|
||||
'description' => '연간 유지보수 계약 선금',
|
||||
'schedule_type' => 'income',
|
||||
'scheduled_date' => sprintf('%04d-%02d-15', $month == 12 ? $year + 1 : $year, $month == 12 ? 1 : $month + 1),
|
||||
'amount' => 50000000, // 5천만원
|
||||
'currency' => 'KRW',
|
||||
'counterparty' => '(주)테크솔루션',
|
||||
'category' => '매출',
|
||||
'status' => 'pending',
|
||||
'is_recurring' => false,
|
||||
'recurrence_rule' => null,
|
||||
'memo' => '2026년 연간 유지보수 계약',
|
||||
'created_by' => $userId,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
];
|
||||
|
||||
// 데이터 삽입
|
||||
DB::table('fund_schedules')->insert($schedules);
|
||||
|
||||
$this->command->info('FundScheduleSeeder 완료: 자금계획일정 ' . count($schedules) . '개 생성');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user