diff --git a/src/components/quotes/PurchaseOrderDocument.tsx b/src/components/quotes/PurchaseOrderDocument.tsx index 0a6fec5f..19cbef22 100644 --- a/src/components/quotes/PurchaseOrderDocument.tsx +++ b/src/components/quotes/PurchaseOrderDocument.tsx @@ -8,12 +8,14 @@ */ import { QuoteFormData } from "./QuoteRegistration"; +import type { CompanyFormData } from "@/components/settings/CompanyInfoManagement/types"; interface PurchaseOrderDocumentProps { quote: QuoteFormData; + companyInfo?: CompanyFormData | null; } -export function PurchaseOrderDocument({ quote }: PurchaseOrderDocumentProps) { +export function PurchaseOrderDocument({ quote, companyInfo }: PurchaseOrderDocumentProps) { const formatDate = (dateStr: string) => { if (!dateStr) return ''; const date = new Date(dateStr); @@ -23,20 +25,17 @@ export function PurchaseOrderDocument({ quote }: PurchaseOrderDocumentProps) { // 발주번호 생성 (견적번호 기반) const purchaseOrderNumber = quote.id?.replace('Q', 'KQ#-SC-') + '-01' || 'KQ#-SC-XXXXXX-01'; - // BOM에서 부자재 목록 추출 (샘플 데이터) - const materialItems = quote.items?.map((item, index) => ({ - no: index + 1, - name: item.productName || '아연도각파이프', - spec: `${item.openWidth}×${item.openHeight}`, - length: Number(item.openHeight) || 3000, - quantity: item.quantity || 1, - note: '' - })) || [ - { no: 1, name: '아연도각파이프', spec: '100-50-2T', length: 3000, quantity: 6, note: '' }, - { no: 2, name: '아연도각파이프', spec: '100-100-2T', length: 3000, quantity: 6, note: '' }, - { no: 3, name: '아연도앵글', spec: '50-50-4T', length: 2500, quantity: 10, note: '' }, - { no: 4, name: '외주 발주 코팅 비비그레스', spec: '', length: 0, quantity: 1, note: '' }, - ]; + // BOM에서 부자재 목록 추출 (견적 품목 데이터 기반) + const materialItems = quote.items?.length > 0 + ? quote.items.map((item, index) => ({ + no: index + 1, + name: item.productName || '스크린셔터', + spec: `${item.openWidth || 0}×${item.openHeight || 0}mm`, + length: Number(item.openHeight) || 0, + quantity: item.quantity || 1, + note: item.guideRailType ? `레일: ${item.guideRailType}` : '' + })) + : []; return ( <> @@ -416,7 +415,7 @@ export function PurchaseOrderDocument({ quote }: PurchaseOrderDocumentProps) {
• 납기 엄수 부탁드리며, 품질 기준에 맞춰 납품해주시기 바랍니다.
• 기타 문의사항은 담당자에게 연락 부탁드립니다.
- 문의: {quote.writer || '담당자'} | {quote.contact || '031-983-5130'} + 문의: {companyInfo?.managerName || quote.writer || '담당자'} | {companyInfo?.managerPhone || '-'}
diff --git a/src/components/quotes/index.ts b/src/components/quotes/index.ts index aa759aea..cd716d8c 100644 --- a/src/components/quotes/index.ts +++ b/src/components/quotes/index.ts @@ -6,7 +6,7 @@ export { QuoteManagementClient } from './QuoteManagementClient'; // 기존 컴포넌트 -export { default as QuoteDocument } from './QuoteDocument'; +export { QuoteDocument } from './QuoteDocument'; export { QuoteRegistration, INITIAL_QUOTE_FORM } from './QuoteRegistration'; export { QuoteCalculationReport } from './QuoteCalculationReport'; export { PurchaseOrderDocument } from './PurchaseOrderDocument';