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) |