'date', 'settlement_date' => 'date', 'amount' => 'decimal:2', 'client_id' => 'integer', 'bank_account_id' => 'integer', ]; /** * 거래유형 목록 */ public const TRANSACTION_TYPES = [ 'purchase' => '매입', 'advance' => '선급금', 'suspense' => '가지급금', 'rent' => '임대료', 'salary' => '급여', 'insurance' => '보험료', 'tax' => '세금', 'utilities' => '공과금', 'other' => '기타', ]; /** * 지급상태 목록 */ public const PAYMENT_STATUSES = [ 'pending' => '미지급', 'partial' => '부분지급', 'paid' => '지급완료', 'overdue' => '연체', ]; /** * 결재상태 목록 */ public const APPROVAL_STATUSES = [ 'none' => '미신청', 'pending' => '결재대기', 'approved' => '결재완료', 'rejected' => '반려', ]; /** * 거래처 관계 */ public function client(): BelongsTo { return $this->belongsTo(\App\Models\Orders\Client::class); } /** * 계좌 관계 */ public function bankAccount(): BelongsTo { return $this->belongsTo(BankAccount::class); } /** * 생성자 관계 */ public function creator(): BelongsTo { return $this->belongsTo(\App\Models\Members\User::class, 'created_by'); } /** * 거래처명 조회 (회원/비회원 통합) */ public function getDisplayClientNameAttribute(): string { if ($this->client) { return $this->client->name; } return $this->client_name ?? ''; } /** * 거래유형 라벨 */ public function getTransactionTypeLabelAttribute(): string { return self::TRANSACTION_TYPES[$this->transaction_type] ?? $this->transaction_type; } /** * 지급상태 라벨 */ public function getPaymentStatusLabelAttribute(): string { return self::PAYMENT_STATUSES[$this->payment_status] ?? $this->payment_status; } /** * 결재상태 라벨 */ public function getApprovalStatusLabelAttribute(): string { return self::APPROVAL_STATUSES[$this->approval_status] ?? $this->approval_status; } }