From 496a99ff98c7296189702b5f1b0aa1d258d42e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=9C=EA=B3=A8=EC=95=BD=EC=82=AC?= Date: Sun, 15 Feb 2026 11:31:20 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20=EC=9E=AC=EA=B3=A0=20=EC=9B=90=EC=9E=A5?= =?UTF-8?q?=20=EC=B0=B8=EA=B3=A0=EB=B2=88=ED=98=B8=EC=97=90=20=EC=B2=98?= =?UTF-8?q?=EB=B0=A9=EB=AA=85=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 개선사항 - 출고시 참고번호에 처방명 표시 - 기존: 조제#1 - 변경: 조제#1 (직접조제) - 처방이 있는 경우: 조제#2 (쌍화탕) ## 표시 형식 - 입고: PR-20260211-0001 (입고장번호) - 출고(처방전O): RX-2024-001 (쌍화탕) - 출고(처방전X): 조제#1 (직접조제) 이제 입출고 내역에서 어떤 처방으로 소비되었는지 바로 확인 가능 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index fba31a9..5ff6f63 100644 --- a/app.py +++ b/app.py @@ -1102,7 +1102,11 @@ def get_stock_ledger(): s.name as supplier_name, CASE WHEN sl.event_type = 'PURCHASE' OR sl.event_type = 'RECEIPT' THEN pr.receipt_no - WHEN sl.event_type = 'CONSUME' THEN COALESCE(c.prescription_no, '조제#' || c.compound_id) + WHEN sl.event_type = 'CONSUME' THEN + CASE + WHEN c.prescription_no IS NOT NULL THEN c.prescription_no || ' (' || COALESCE(f.formula_name, '직접조제') || ')' + ELSE '조제#' || c.compound_id || ' (' || COALESCE(f.formula_name, '직접조제') || ')' + END ELSE NULL END as reference_no, CASE @@ -1116,6 +1120,7 @@ def get_stock_ledger(): LEFT JOIN purchase_receipts pr ON sl.reference_table = 'purchase_receipts' AND sl.reference_id = pr.receipt_id LEFT JOIN compounds c ON sl.reference_table = 'compounds' AND sl.reference_id = c.compound_id LEFT JOIN patients p ON c.patient_id = p.patient_id + LEFT JOIN formulas f ON c.formula_id = f.formula_id WHERE sl.herb_item_id = ? ORDER BY sl.event_time DESC LIMIT ? @@ -1136,7 +1141,11 @@ def get_stock_ledger(): s.name as supplier_name, CASE WHEN sl.event_type = 'PURCHASE' OR sl.event_type = 'RECEIPT' THEN pr.receipt_no - WHEN sl.event_type = 'CONSUME' THEN COALESCE(c.prescription_no, '조제#' || c.compound_id) + WHEN sl.event_type = 'CONSUME' THEN + CASE + WHEN c.prescription_no IS NOT NULL THEN c.prescription_no || ' (' || COALESCE(f.formula_name, '직접조제') || ')' + ELSE '조제#' || c.compound_id || ' (' || COALESCE(f.formula_name, '직접조제') || ')' + END ELSE NULL END as reference_no, CASE @@ -1150,6 +1159,7 @@ def get_stock_ledger(): LEFT JOIN purchase_receipts pr ON sl.reference_table = 'purchase_receipts' AND sl.reference_id = pr.receipt_id LEFT JOIN compounds c ON sl.reference_table = 'compounds' AND sl.reference_id = c.compound_id LEFT JOIN patients p ON c.patient_id = p.patient_id + LEFT JOIN formulas f ON c.formula_id = f.formula_id ORDER BY sl.event_time DESC LIMIT ? """, (limit,))