From 29597d55fa7cc81ee1e84bf7e3f7cc7f61fd3595 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Sat, 7 Mar 2026 00:01:02 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=A3=BC=EB=AC=B8=20=EB=AA=A8=EB=8B=AC?= =?UTF-8?q?=EC=97=90=20=EA=B8=88=EC=95=A1=20=ED=91=9C=EC=8B=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/templates/admin_rx_usage.html | 35 +++++++++++++++++++++------ 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/backend/templates/admin_rx_usage.html b/backend/templates/admin_rx_usage.html index 0e83818..54e9fd7 100644 --- a/backend/templates/admin_rx_usage.html +++ b/backend/templates/admin_rx_usage.html @@ -1166,32 +1166,51 @@ const wsIds = Object.keys(itemsByWholesaler); + // 전체 총액 계산 + let grandTotal = 0; + wsIds.forEach(wsId => { + itemsByWholesaler[wsId].forEach(item => { + grandTotal += (item.unit_price || 0) * item.qty; + }); + }); + let html = `
-

- 장바구니에 ${wsIds.length}개 도매상의 품목이 있습니다. -

+
+

+ 장바구니에 ${wsIds.length}개 도매상의 품목이 있습니다. +

+
+ ${grandTotal > 0 ? '₩' + grandTotal.toLocaleString() : ''} +
+
`; // 각 도매상별 품목 표시 wsIds.forEach(wsId => { const ws = WHOLESALERS[wsId]; const items = itemsByWholesaler[wsId]; + + // 도매상별 소계 + const wsTotal = items.reduce((sum, item) => sum + (item.unit_price || 0) * item.qty, 0); + html += `
${ws.icon} ${ws.name} ${items.length}개 품목 + ${wsTotal > 0 ? `₩${wsTotal.toLocaleString()}` : ''}
- ${items.slice(0, 3).map(item => ` -
· ${item.product_name} (${item.qty}개)
- `).join('')} + ${items.slice(0, 3).map(item => { + const itemAmt = (item.unit_price || 0) * item.qty; + return `
· ${item.product_name} (${item.qty}개)${itemAmt > 0 ? ` ${itemAmt.toLocaleString()}원` : ''}
`; + }).join('')} ${items.length > 3 ? `
... 외 ${items.length - 3}개
` : ''}
@@ -2025,6 +2044,7 @@ if (!qty || isNaN(qty)) return; // 장바구니에 추가 + const unitPrice = item.price || item.unit_price || 0; const cartItem = { drug_code: currentWholesaleItem.drug_code, product_name: productName, @@ -2035,7 +2055,8 @@ internal_code: item.internal_code, geoyoung_code: wholesaler === 'geoyoung' ? item.insurance_code : null, sooin_code: wholesaler === 'sooin' ? item.code : null, - baekje_code: wholesaler === 'baekje' ? item.internal_code : null + baekje_code: wholesaler === 'baekje' ? item.internal_code : null, + unit_price: unitPrice // 💰 단가 추가 }; // 🔍 디버그: 장바구니 추가 시 internal_code 확인