feat: POS GUI에 결제수단(카드/현금) 및 수납 여부 컬럼 추가
CD_SUNAB 테이블을 OUTER APPLY로 조인하여 결제 정보 표시 - 결제 컬럼: 카드(파랑), 현금(주황), 카드+현금(보라) - 수납 컬럼: 수납완료(✓) / 미수납(-) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e4ccfd60c9
commit
ac59464612
@ -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']))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user