From ac59464612464e14f3fa6c4d40b634a11ddaaf65 Mon Sep 17 00:00:00 2001 From: thug0bin Date: Wed, 25 Feb 2026 20:10:28 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20POS=20GUI=EC=97=90=20=EA=B2=B0=EC=A0=9C?= =?UTF-8?q?=EC=88=98=EB=8B=A8(=EC=B9=B4=EB=93=9C/=ED=98=84=EA=B8=88)=20?= =?UTF-8?q?=EB=B0=8F=20=EC=88=98=EB=82=A9=20=EC=97=AC=EB=B6=80=20=EC=BB=AC?= =?UTF-8?q?=EB=9F=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CD_SUNAB 테이블을 OUTER APPLY로 조인하여 결제 정보 표시 - 결제 컬럼: 카드(파랑), 현금(주황), 카드+현금(보라) - 수납 컬럼: 수납완료(✓) / 미수납(-) Co-Authored-By: Claude Opus 4.6 --- backend/gui/pos_sales_gui.py | 61 ++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/backend/gui/pos_sales_gui.py b/backend/gui/pos_sales_gui.py index 1bb1838..ef34a27 100644 --- a/backend/gui/pos_sales_gui.py +++ b/backend/gui/pos_sales_gui.py @@ -67,14 +67,24 @@ class SalesQueryThread(QThread): sqlite_conn = db_manager.get_sqlite_connection() sqlite_cursor = sqlite_conn.cursor() - # 메인 쿼리: SALE_MAIN에서 오늘 판매 내역 조회 + # 메인 쿼리: SALE_MAIN + CD_SUNAB(수납) 조인 + # CD_SUNAB.PRESERIAL = SALE_MAIN.SL_NO_order (주문번호 기준) query = """ SELECT M.SL_NO_order, M.InsertTime, M.SL_MY_sale, - ISNULL(M.SL_NM_custom, '[비고객]') AS customer_name + ISNULL(M.SL_NM_custom, '[비고객]') AS customer_name, + ISNULL(S.card_total, 0) AS card_total, + ISNULL(S.cash_total, 0) AS cash_total FROM SALE_MAIN M + OUTER APPLY ( + SELECT TOP 1 + ISNULL(ETC_CARD, 0) + ISNULL(OTC_CARD, 0) AS card_total, + ISNULL(ETC_CASH, 0) + ISNULL(OTC_CASH, 0) AS cash_total + FROM CD_SUNAB + WHERE PRESERIAL = M.SL_NO_order + ) S WHERE M.SL_DT_appl = ? ORDER BY M.InsertTime DESC """ @@ -84,7 +94,7 @@ class SalesQueryThread(QThread): sales_list = [] for row in rows: - order_no, insert_time, sale_amount, customer = row + order_no, insert_time, sale_amount, customer, card_total, cash_total = row # 품목 수 조회 (SALE_SUB) mssql_cursor.execute(""" @@ -121,11 +131,26 @@ class SalesQueryThread(QThread): claimed_phone = "" claimed_points = 0 + # 결제수단 판별 + card_amt = float(card_total) if card_total else 0.0 + cash_amt = float(cash_total) if cash_total else 0.0 + if card_amt > 0 and cash_amt > 0: + pay_method = '카드+현금' + elif card_amt > 0: + pay_method = '카드' + elif cash_amt > 0: + pay_method = '현금' + else: + pay_method = '' + paid = (card_amt + cash_amt) > 0 + sales_list.append({ 'order_no': order_no, 'time': insert_time.strftime('%H:%M') if insert_time else '--:--', 'amount': float(sale_amount) if sale_amount else 0.0, 'customer': customer, + 'pay_method': pay_method, + 'paid': paid, 'item_count': item_count, 'claimed_name': claimed_name, 'claimed_phone': claimed_phone, @@ -575,6 +600,8 @@ class POSSalesGUI(QMainWindow): ('주문번호', 150, 'order_no'), ('시간', 70, 'time'), ('금액', 100, 'amount'), + ('결제', 80, 'pay_method'), + ('수납', 50, 'paid'), ('고객명', 80, 'customer'), ('품목수', 55, 'item_count'), ('적립자', 90, 'claimed_name'), @@ -811,6 +838,34 @@ class POSSalesGUI(QMainWindow): amount_item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter) self.sales_table.setItem(row, COL['amount'], amount_item) + # 결제수단 + pay_item = QTableWidgetItem(sale['pay_method']) + pay_item.setTextAlignment(Qt.AlignCenter) + if sale['pay_method'] == '카드': + pay_item.setForeground(QColor('#1976D2')) + elif sale['pay_method'] == '현금': + pay_item.setForeground(QColor('#E65100')) + elif sale['pay_method']: + pay_item.setForeground(QColor('#7B1FA2')) + else: + pay_item.setText('-') + pay_item.setForeground(QColor('#BDBDBD')) + self.sales_table.setItem(row, COL['pay_method'], pay_item) + + # 수납 여부 + paid_item = QTableWidgetItem() + paid_item.setTextAlignment(Qt.AlignCenter) + if sale['paid']: + paid_item.setText('✓') + paid_item.setForeground(QColor('#4CAF50')) + f = QFont() + f.setBold(True) + paid_item.setFont(f) + else: + paid_item.setText('-') + paid_item.setForeground(QColor('#BDBDBD')) + self.sales_table.setItem(row, COL['paid'], paid_item) + # 고객명 (MSSQL POS) self.sales_table.setItem(row, COL['customer'], QTableWidgetItem(sale['customer']))