feat: [bill,loan] 어음 V8 확장 필드 및 가지급금 상품권 카테고리 지원

- Bill 모델: V8 확장 필드 54개 추가 (증권종류, 할인, 배서, 추심, 개서, 부도 등)
- Bill 상태: 수취/발행 어음·수표별 세분화된 상태 체계
- BillService: assignV8Fields/syncInstallments 헬퍼 추출, instrument_type/medium 필터
- BillInstallment: type/counterparty 필드 추가
- Loan 모델: holding/used/disposed 상태 + metadata(JSON) 필드 추가
- LoanService: 상품권 카테고리 지원 (summary 상태별 집계, store 기본상태 holding)
- FormRequest: V8 확장 필드 검증 규칙 추가
- 마이그레이션: bills V8 필드 + loans metadata 컬럼

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
유병철
2026-03-05 20:45:54 +09:00
parent f41605ca73
commit 8c9f2fcfb5
13 changed files with 743 additions and 59 deletions

View File

@@ -17,6 +17,7 @@ public function rules(): array
$tenantId = app('tenant_id') ?? 0;
return [
// === 기존 필드 ===
'bill_number' => [
'nullable',
'string',
@@ -30,16 +31,99 @@ public function rules(): array
'client_name' => ['nullable', 'string', 'max:100'],
'amount' => ['required', 'numeric', 'min:0'],
'issue_date' => ['required', 'date'],
'maturity_date' => ['required', 'date', 'after_or_equal:issue_date'],
'status' => ['nullable', 'string', 'in:stored,maturityAlert,maturityResult,paymentComplete,dishonored,collectionRequest,collectionComplete,suing'],
'maturity_date' => ['nullable', 'date', 'after_or_equal:issue_date'],
'status' => ['nullable', 'string', 'max:30'],
'reason' => ['nullable', 'string', 'max:255'],
'installment_count' => ['nullable', 'integer', 'min:0'],
'note' => ['nullable', 'string', 'max:1000'],
'is_electronic' => ['nullable', 'boolean'],
'bank_account_id' => ['nullable', 'integer', 'exists:bank_accounts,id'],
// === V8 증권종류/매체/구분 ===
'instrument_type' => ['nullable', 'string', 'in:promissory,exchange,cashierCheck,currentCheck'],
'medium' => ['nullable', 'string', 'in:electronic,paper'],
'bill_category' => ['nullable', 'string', 'in:commercial,other'],
// === 전자어음 ===
'electronic_bill_no' => ['nullable', 'string', 'max:100'],
'registration_org' => ['nullable', 'string', 'in:kftc,bank'],
// === 환어음 ===
'drawee' => ['nullable', 'string', 'max:100'],
'acceptance_status' => ['nullable', 'string', 'in:accepted,pending,refused'],
'acceptance_date' => ['nullable', 'date'],
'acceptance_refusal_date' => ['nullable', 'date'],
'acceptance_refusal_reason' => ['nullable', 'string', 'max:50'],
// === 받을어음 전용 ===
'endorsement' => ['nullable', 'string', 'in:endorsable,nonEndorsable'],
'endorsement_order' => ['nullable', 'string', 'max:5'],
'storage_place' => ['nullable', 'string', 'in:safe,bank,other'],
'issuer_bank' => ['nullable', 'string', 'max:100'],
// 할인
'is_discounted' => ['nullable', 'boolean'],
'discount_date' => ['nullable', 'date'],
'discount_bank' => ['nullable', 'string', 'max:100'],
'discount_rate' => ['nullable', 'numeric', 'min:0', 'max:100'],
'discount_amount' => ['nullable', 'numeric', 'min:0'],
// 배서양도
'endorsement_date' => ['nullable', 'date'],
'endorsee' => ['nullable', 'string', 'max:100'],
'endorsement_reason' => ['nullable', 'string', 'in:payment,guarantee,collection,other'],
// 추심
'collection_bank' => ['nullable', 'string', 'max:100'],
'collection_request_date' => ['nullable', 'date'],
'collection_fee' => ['nullable', 'numeric', 'min:0'],
'collection_complete_date' => ['nullable', 'date'],
'collection_result' => ['nullable', 'string', 'in:success,partial,failed,pending'],
'collection_deposit_date' => ['nullable', 'date'],
'collection_deposit_amount' => ['nullable', 'numeric', 'min:0'],
// === 지급어음 전용 ===
'settlement_bank' => ['nullable', 'string', 'max:100'],
'payment_method' => ['nullable', 'string', 'in:autoTransfer,currentAccount,other'],
'actual_payment_date' => ['nullable', 'date'],
// === 공통 ===
'payment_place' => ['nullable', 'string', 'max:30'],
'payment_place_detail' => ['nullable', 'string', 'max:200'],
// 개서
'renewal_date' => ['nullable', 'date'],
'renewal_new_bill_no' => ['nullable', 'string', 'max:50'],
'renewal_reason' => ['nullable', 'string', 'in:maturityExtension,amountChange,conditionChange,other'],
// 소구
'recourse_date' => ['nullable', 'date'],
'recourse_amount' => ['nullable', 'numeric', 'min:0'],
'recourse_target' => ['nullable', 'string', 'max:100'],
'recourse_reason' => ['nullable', 'string', 'in:endorsedDishonor,discountDishonor,other'],
// 환매
'buyback_date' => ['nullable', 'date'],
'buyback_amount' => ['nullable', 'numeric', 'min:0'],
'buyback_bank' => ['nullable', 'string', 'max:100'],
// 부도/법적절차
'dishonored_date' => ['nullable', 'date'],
'dishonored_reason' => ['nullable', 'string', 'max:30'],
'has_protest' => ['nullable', 'boolean'],
'protest_date' => ['nullable', 'date'],
'recourse_notice_date' => ['nullable', 'date'],
'recourse_notice_deadline' => ['nullable', 'date'],
// 분할배서
'is_split' => ['nullable', 'boolean'],
// === 차수 관리 ===
'installments' => ['nullable', 'array'],
'installments.*.date' => ['required_with:installments', 'date'],
'installments.*.amount' => ['required_with:installments', 'numeric', 'min:0'],
'installments.*.type' => ['nullable', 'string', 'max:30'],
'installments.*.counterparty' => ['nullable', 'string', 'max:100'],
'installments.*.note' => ['nullable', 'string', 'max:255'],
];
}