Files
sam-manage/database/seeders/FundScheduleSeeder.php
2026-02-25 11:45:01 +09:00

161 lines
6.5 KiB
PHP

<?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).'개 생성');
}
}