fix:예정 세액 계산 시 vat_records tax_type 컬럼 미존재 오류 수정

vat_records 테이블에 tax_type 컬럼이 없어 DB 쿼리 실패.
index 메서드와 동일하게 인메모리 컬렉션 필터링으로 변경.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-11 12:45:41 +09:00
parent efb0c23aef
commit 69ade17900

View File

@@ -451,18 +451,19 @@ private function calculatePeriodNetVat(int $tenantId, string $period): int
}
}
// 수동입력 매출세액 (과세+영세)
$manualSalesVat = (int) VatRecord::forTenant($tenantId)
// 수동입력 세액 (면세 제외한 과세+영세만 합산, index와 동일하게 인메모리 필터링)
$manualRecords = VatRecord::forTenant($tenantId)
->where('period', $period)
->get();
$manualSalesVat = (int) $manualRecords
->where('type', 'sales')
->whereIn('tax_type', ['taxable', 'zero_rated'])
->whereIn('tax_type', ['taxable', 'zero_rated', null])
->sum('vat_amount');
// 수동입력 매입세액 (과세+영세)
$manualPurchaseVat = (int) VatRecord::forTenant($tenantId)
->where('period', $period)
$manualPurchaseVat = (int) $manualRecords
->where('type', 'purchase')
->whereIn('tax_type', ['taxable', 'zero_rated'])
->whereIn('tax_type', ['taxable', 'zero_rated', null])
->sum('vat_amount');
$totalSalesVat = $salesVat + $manualSalesVat;