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 += `
- ${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 확인