diff --git a/resources/views/barobill/hometax/index.blade.php b/resources/views/barobill/hometax/index.blade.php index dc172961..6c7c9e58 100644 --- a/resources/views/barobill/hometax/index.blade.php +++ b/resources/views/barobill/hometax/index.blade.php @@ -169,7 +169,8 @@ className={`px-6 py-3 text-sm font-medium rounded-lg transition-all ${ loading, type, onExport, - onRequestCollect + onRequestCollect, + summary // 합계 정보 }) => { const formatCurrency = (val) => new Intl.NumberFormat('ko-KR').format(val || 0); @@ -313,6 +314,24 @@ className="flex items-center gap-2 px-3 py-1.5 bg-blue-100 text-blue-700 rounded ); }) )} + {/* 합계행 */} + {invoices.length > 0 && summary && ( + + + 합계 ({invoices.length}건) + + + {formatCurrency(summary.supplyAmount)} + + + {formatCurrency(summary.taxAmount)} + + + {formatCurrency(summary.totalAmount)} + + + + )} @@ -696,10 +715,41 @@ className="flex items-center gap-2 px-3 py-1.5 bg-blue-100 text-blue-700 rounded }; const formatCurrency = (val) => new Intl.NumberFormat('ko-KR').format(val || 0) + '원'; + const formatNumber = (val) => new Intl.NumberFormat('ko-KR').format(val || 0); + + // 과세/면세 합계 계산 + const calculateTaxTypeSummary = (invoices) => { + let taxableAmount = 0; // 과세 공급가액 + let exemptAmount = 0; // 면세 공급가액 + let taxableCount = 0; + let exemptCount = 0; + + invoices.forEach(inv => { + const amount = inv.supplyAmount || 0; + if (inv.taxTypeName === '면세') { + exemptAmount += amount; + exemptCount++; + } else { + taxableAmount += amount; + taxableCount++; + } + }); + + return { taxableAmount, exemptAmount, taxableCount, exemptCount }; + }; const currentData = activeTab === 'sales' ? salesData : purchaseData; const filteredInvoices = filterByCorpName(currentData.invoices); + // 매입 과세/면세 합계 + const purchaseTaxSummary = calculateTaxTypeSummary(purchaseData.invoices); + // 현재 탭 인보이스 합계 (테이블 합계용) + const currentInvoiceSummary = { + supplyAmount: filteredInvoices.reduce((sum, inv) => sum + (inv.supplyAmount || 0), 0), + taxAmount: filteredInvoices.reduce((sum, inv) => sum + (inv.taxAmount || 0), 0), + totalAmount: filteredInvoices.reduce((sum, inv) => sum + (inv.totalAmount || 0), 0), + }; + return (
{/* Page Header */} @@ -911,7 +961,7 @@ className="flex items-center gap-2 text-sm font-semibold rounded-md disabled:opa )} {/* Dashboard */} -
+
} color="red" /> + } + color="purple" + />