/** * 견적서 (Quote Document) * * 공통 컴포넌트 사용: * - DocumentHeader: simple 레이아웃 * - SignatureSection: 서명/도장 영역 */ import { QuoteFormData } from "./QuoteRegistration"; import type { CompanyFormData } from "@/components/settings/CompanyInfoManagement/types"; import { DocumentHeader, SignatureSection } from "@/components/document-system"; interface QuoteDocumentProps { quote: QuoteFormData; companyInfo?: CompanyFormData | null; } export function QuoteDocument({ quote, companyInfo }: QuoteDocumentProps) { const formatAmount = (amount: number | undefined) => { if (amount === undefined || amount === null) return '0'; return amount.toLocaleString('ko-KR'); }; const formatDate = (dateStr: string) => { if (!dateStr) return ''; const date = new Date(dateStr); return `${date.getFullYear()}년 ${String(date.getMonth() + 1).padStart(2, '0')}월 ${String(date.getDate()).padStart(2, '0')}일`; }; // 품목 내역 생성 const quoteItems = quote.items?.map((item, index) => ({ no: index + 1, itemName: item.productName || '스크린셔터', spec: `${item.openWidth}×${item.openHeight}`, quantity: item.quantity || 1, unit: item.unit || '', // 각 품목의 단위 사용, 없으면 빈 문자열 unitPrice: item.unitPrice || 0, totalPrice: item.totalAmount || 0, })) || []; // 합계 계산 const subtotal = quoteItems.reduce((sum, item) => sum + item.totalPrice, 0); const vat = Math.round(subtotal * 0.1); const totalAmount = subtotal + vat; return ( <> {/* 견적서 내용 */}
{/* 문서 헤더 (공통 컴포넌트) */} {/* 수요자 정보 */}
수 요 자
업체명 {quote.clientName || '-'}
프로젝트명 {quote.siteName || '-'} 담당자 {quote.manager || '-'}
견적일자 {formatDate(quote.registrationDate || '')} 연락처 {quote.contact || '-'}
유효기간 {formatDate(quote.dueDate || '')}
{/* 공급자 정보 */}
공 급 자
상호 {companyInfo?.companyName || '-'} 사업자등록번호 {companyInfo?.businessNumber || '-'}
대표자 {companyInfo?.representativeName || '-'} 업태 {companyInfo?.businessType || '-'}
종목 {companyInfo?.businessCategory || '-'}
사업장주소 {companyInfo?.address || '-'}
전화 {companyInfo?.managerPhone || '-'} 이메일 {companyInfo?.email || '-'}
{/* 총 견적금액 */}
총 견적금액
₩ {formatAmount(totalAmount)}
※ 부가가치세 포함
{/* 제품구성 정보 */} {quote.items && quote.items.length > 0 && ( <>
제 품 구 성 정 보
모델 {quote.items[0]?.productName || '스크린셔터'} 총 수량 {quote.items[0]?.quantity || ''}{quote.unitSymbol ? ` ${quote.unitSymbol}` : ''}
오픈사이즈 {quote.items[0]?.openWidth}×{quote.items[0]?.openHeight} 설치유형 {quote.items[0]?.installType || '-'}
)} {/* 품목 내역 */} {quoteItems.length > 0 && ( <>
품 목 내 역
{quoteItems.map((item) => ( ))}
No. 품목명 규격 수량 단위 단가 금액
{item.no} {item.itemName} {item.spec || '-'} {item.quantity} {item.unit} {formatAmount(item.unitPrice)} {formatAmount(item.totalPrice)}
공급가액 합계 {formatAmount(subtotal)}
부가가치세 (10%) {formatAmount(vat)}
총 견적금액 {formatAmount(totalAmount)}
)} {/* 비고사항 */} {quote.remarks && ( <>
비 고 사 항
{quote.remarks}
)} {/* 서명란 (공통 컴포넌트) */} {/* 하단 안내사항 */}

【 유의사항 】

1. 본 견적서는 {formatDate(quote.registrationDate || '')} 기준으로 작성되었으며, 자재 가격 변동 시 조정될 수 있습니다.

2. 견적 유효기간은 {formatDate(quote.dueDate || '')}까지이며, 기간 경과 시 재견적이 필요합니다.

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

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

문의: {companyInfo?.managerName || quote.writer || '담당자'} | {companyInfo?.managerPhone || '-'}

); }