From b52e9c70af9f403a73504e1e9b3cf4ef1c03e0d9 Mon Sep 17 00:00:00 2001 From: kent Date: Tue, 6 Jan 2026 21:20:56 +0900 Subject: [PATCH] =?UTF-8?q?fix(WEB):=20=EC=82=B0=EC=B6=9C=EB=82=B4?= =?UTF-8?q?=EC=97=AD=EC=84=9C=20BOM=20=EC=9E=90=EC=9E=AC=20=ED=91=9C?= =?UTF-8?q?=EC=8B=9C=20=EA=B0=9C=EC=84=A0=20(#5,=20#6)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이슈 #5: 산출내역서 담당자/연락처/단위 표시 이슈 #6: 세부산출내역 vs 소요자재내역 분리 주요 변경: - QuoteCalculationReport.tsx: bomMaterials 사용하여 소요자재 내역 표시 - 세부산출내역과 소요자재내역 데이터 소스 분리 --- .../quotes/QuoteCalculationReport.tsx | 137 +++++++++++------- 1 file changed, 84 insertions(+), 53 deletions(-) diff --git a/src/components/quotes/QuoteCalculationReport.tsx b/src/components/quotes/QuoteCalculationReport.tsx index 53e32063..fb105832 100644 --- a/src/components/quotes/QuoteCalculationReport.tsx +++ b/src/components/quotes/QuoteCalculationReport.tsx @@ -5,9 +5,12 @@ */ import { QuoteFormData } from "./QuoteRegistration"; +import type { BomMaterial } from "./types"; +import type { CompanyFormData } from "@/components/settings/CompanyInfoManagement/types"; interface QuoteCalculationReportProps { quote: QuoteFormData; + companyInfo?: CompanyFormData | null; documentType?: "견적산출내역서" | "견적서"; showDetailedBreakdown?: boolean; showMaterialList?: boolean; @@ -15,6 +18,7 @@ interface QuoteCalculationReportProps { export function QuoteCalculationReport({ quote, + companyInfo, documentType = "견적산출내역서", showDetailedBreakdown = true, showMaterialList = true @@ -30,19 +34,26 @@ 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) => { - return sum + (item.inspectionFee || 0) * (item.quantity || 1); + const itemTotal = item.totalAmount || + (item.unitPrice || 0) * (item.quantity || 1) || + (item.inspectionFee || 0) * (item.quantity || 1); + return sum + itemTotal; }, 0) || 0; - // 소요자재 내역 생성 (샘플 데이터) - const materialItems = quote.items?.map((item, index) => ({ + // 소요자재 내역 - BOM 자재 목록 (quote.bomMaterials)에서 가져옴 + // bomMaterials가 없으면 빈 배열 (BOM 계산 데이터 없음) + const materialItems = (quote.bomMaterials || []).map((material, index) => ({ no: index + 1, - name: item.productName || '가이드레일', - spec: `${item.openWidth || 0}×${item.openHeight || 0}mm`, - quantity: item.quantity || 1, - unit: 'SET' - })) || []; + itemCode: material.itemCode || '-', + name: material.itemName || '-', + spec: material.specification || '-', + quantity: Math.floor(material.quantity || 1), + unit: material.unit || 'EA', + unitPrice: material.unitPrice || 0, + totalPrice: material.totalPrice || 0, + })); return ( <> @@ -316,29 +327,29 @@ export function QuoteCalculationReport({ 상호 - (주)염진건설 + {companyInfo?.companyName || '-'} 사업자등록번호 - 139-87-00353 + {companyInfo?.businessNumber || '-'} 대표자 - 김 용 진 + {companyInfo?.representativeName || '-'} 업태 - 제조 + {companyInfo?.businessType || '-'} 종목 - 방창, 셔터, 금속창호 + {companyInfo?.businessCategory || '-'} 사업장주소 - 경기도 안성시 공업용지 오성길 45-22 + {companyInfo?.address || '-'} 전화 - 031-983-5130 - 팩스 - 02-6911-6315 + {companyInfo?.managerPhone || '-'} + 이메일 + {companyInfo?.email || '-'} @@ -370,17 +381,23 @@ export function QuoteCalculationReport({ - {quote.items.map((item, index) => ( - - {index + 1} - {item.productName} - {`${item.openWidth}×${item.openHeight}mm`} - {item.quantity} - SET - {formatAmount(item.inspectionFee)} - {formatAmount((item.inspectionFee || 0) * (item.quantity || 1))} - - ))} + {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); + return ( + + {index + 1} + {item.productName} + {`${item.openWidth}×${item.openHeight}mm`} + {Math.floor(item.quantity || 0)} + {item.unit || 'SET'} + {formatAmount(unitPrice)} + {formatAmount(itemTotal)} + + ); + })} @@ -416,7 +433,7 @@ export function QuoteCalculationReport({ 수량 - {quote.items?.[0]?.quantity || 1} SET + {Math.floor(quote.items?.[0]?.quantity || 1)} {quote.items?.[0]?.unit || 'SET'} 케이스 2438 × 550 (mm) @@ -426,28 +443,42 @@ export function QuoteCalculationReport({ {/* 자재 목록 테이블 */} - - - - - - - - - - - - {materialItems.map((item, index) => ( - - - - - - + {materialItems.length > 0 ? ( +
No.자재명규격수량단위
{index + 1}{item.name}{item.spec}{item.quantity}{item.unit}
+ + + + + + + + - ))} - -
No.품목코드자재명규격수량단위
+ + + {materialItems.map((item, index) => ( + + {index + 1} + {item.itemCode} + {item.name} + {item.spec} + {item.quantity} + {item.unit} + + ))} + + + ) : ( +
+ 소요자재 정보가 없습니다. (BOM 계산 데이터가 필요합니다) +
+ )} )} @@ -479,7 +510,7 @@ export function QuoteCalculationReport({
{formatDate(quote.registrationDate || '')}
- 공급자: (주)염진건설 (인) + 공급자: {companyInfo?.companyName || '-'} (인)
@@ -499,7 +530,7 @@ export function QuoteCalculationReport({

3. 제작 사양 및 수량 변경 시 견적 금액이 변동될 수 있습니다.

4. 현장 여건에 따라 추가 비용이 발생할 수 있습니다.

- 문의: {quote.manager || '담당자'} | {quote.contact || '031-983-5130'} + 문의: {companyInfo?.managerName || quote.manager || '담당자'} | {companyInfo?.managerPhone || '-'}