From bf857b282002b44fb912f5070be9fad307abdeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=B4=EA=B3=A4?= Date: Mon, 23 Feb 2026 17:13:14 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20[quotes]=20QuoteCalculationReport=20item?= =?UTF-8?q?s=20=E2=86=92=20locations=20=ED=94=84=EB=A1=9C=ED=8D=BC?= =?UTF-8?q?=ED=8B=B0=20=EB=A7=A4=ED=95=91=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - QuoteFormDataV2에 맞춰 quote.items를 quote.locations로 전환 - bomMaterials를 locations[].bomResult.materials에서 추출하도록 변경 - 미사용 BomMaterial import 제거 --- .../quotes/QuoteCalculationReport.tsx | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/components/quotes/QuoteCalculationReport.tsx b/src/components/quotes/QuoteCalculationReport.tsx index ba3f7096..2d08d017 100755 --- a/src/components/quotes/QuoteCalculationReport.tsx +++ b/src/components/quotes/QuoteCalculationReport.tsx @@ -5,7 +5,6 @@ */ import { QuoteFormDataV2 } from "./QuoteRegistration"; -import type { BomMaterial } from "./types"; import type { CompanyFormData } from "@/components/settings/CompanyInfoManagement/types"; interface QuoteCalculationReportProps { @@ -34,17 +33,18 @@ export function QuoteCalculationReport({ return `${date.getFullYear()}년 ${String(date.getMonth() + 1).padStart(2, '0')}월 ${String(date.getDate()).padStart(2, '0')}일`; }; - // 총 금액 계산 (totalAmount > unitPrice * quantity > inspectionFee 우선순위) - const totalAmount = quote.items?.reduce((sum, item) => { - const itemTotal = item.totalAmount || - (item.unitPrice || 0) * (item.quantity || 1) || - (item.inspectionFee || 0) * (item.quantity || 1); - return sum + itemTotal; + // 총 금액 계산 (totalPrice > unitPrice * quantity > inspectionFee 우선순위) + const totalAmount = quote.locations?.reduce((sum, loc) => { + const locTotal = loc.totalPrice || + (loc.unitPrice || 0) * (loc.quantity || 1) || + (loc.inspectionFee || 0) * (loc.quantity || 1); + return sum + locTotal; }, 0) || 0; - // 소요자재 내역 - BOM 자재 목록 (quote.bomMaterials)에서 가져옴 - // bomMaterials가 없으면 빈 배열 (BOM 계산 데이터 없음) - const materialItems = (quote.bomMaterials || []).map((material, index) => ({ + // 소요자재 내역 - BOM 자재 목록 (locations[].bomResult.materials)에서 가져옴 + const materialItems = (quote.locations || []).flatMap(loc => + (loc.bomResult?.materials || []) + ).map((material, index) => ({ no: index + 1, itemCode: material.itemCode || '-', name: material.itemName || '-', @@ -310,7 +310,7 @@ export function QuoteCalculationReport({ 제품명 - {quote.items?.[0]?.productName || '-'} + {quote.locations?.[0]?.productName || '-'} 연락처 {quote.contact || '-'} @@ -364,7 +364,7 @@ export function QuoteCalculationReport({ {/* 세부 산출내역서 */} - {showDetailedBreakdown && quote.items && quote.items.length > 0 && ( + {showDetailedBreakdown && quote.locations && quote.locations.length > 0 && (
세 부 산 출 내 역
@@ -381,20 +381,18 @@ export function QuoteCalculationReport({ - {quote.items.map((item, index) => { - // 단가: unitPrice > inspectionFee 우선순위 - const unitPrice = item.unitPrice || item.inspectionFee || 0; - // 금액: totalAmount > unitPrice * quantity 우선순위 - const itemTotal = item.totalAmount || unitPrice * (item.quantity || 1); + {quote.locations.map((loc, index) => { + const unitPrice = loc.unitPrice || loc.inspectionFee || 0; + const locTotal = loc.totalPrice || unitPrice * (loc.quantity || 1); return ( - + {index + 1} - {item.productName} - {`${item.openWidth}×${item.openHeight}mm`} - {Math.floor(item.quantity || 0)} - {item.unit || 'SET'} + {loc.productName} + {`${loc.openWidth}×${loc.openHeight}mm`} + {Math.floor(loc.quantity || 0)} + SET {formatAmount(unitPrice)} - {formatAmount(itemTotal)} + {formatAmount(locTotal)} ); })} @@ -421,19 +419,19 @@ export function QuoteCalculationReport({ 제품구분 - {quote.items?.[0]?.productCategory === 'steel' ? '철재' : '스크린'} + {quote.locations?.[0]?.itemCategory === 'steel' ? '철재' : '스크린'} 부호 - {quote.items?.[0]?.code || '-'} + {quote.locations?.[0]?.code || '-'} 오픈사이즈 - W {quote.items?.[0]?.openWidth || '-'} × H {quote.items?.[0]?.openHeight || '-'} (mm) + W {quote.locations?.[0]?.openWidth || '-'} × H {quote.locations?.[0]?.openHeight || '-'} (mm) 제작사이즈 - W {Number(quote.items?.[0]?.openWidth || 0) + 100} × H {Number(quote.items?.[0]?.openHeight || 0) + 100} (mm) + W {Number(quote.locations?.[0]?.openWidth || 0) + 100} × H {Number(quote.locations?.[0]?.openHeight || 0) + 100} (mm) 수량 - {Math.floor(quote.items?.[0]?.quantity || 1)} {quote.items?.[0]?.unit || 'SET'} + {Math.floor(quote.locations?.[0]?.quantity || 1)} SET 케이스 2438 × 550 (mm)