feat: POS GUI 할인 표시 + 적립자 클릭 버그 수정 + 결제수납 문서
- 할인 적용 건: 주황색 볼드로 "금액 (-할인액)" 표시 + 툴팁 상세 - on_cell_clicked 하드코딩 인덱스 → SALES_COLUMNS 기반 동적 인덱스로 수정 - docs/결제수납구조.md: CD_SUNAB 조인 키, 금액 구조, 결제수단 판별 로직 문서화 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,7 +76,9 @@ class SalesQueryThread(QThread):
|
||||
M.SL_MY_sale,
|
||||
ISNULL(M.SL_NM_custom, '[비고객]') AS customer_name,
|
||||
ISNULL(S.card_total, 0) AS card_total,
|
||||
ISNULL(S.cash_total, 0) AS cash_total
|
||||
ISNULL(S.cash_total, 0) AS cash_total,
|
||||
ISNULL(M.SL_MY_total, 0) AS total_amount,
|
||||
ISNULL(M.SL_MY_discount, 0) AS discount
|
||||
FROM SALE_MAIN M
|
||||
OUTER APPLY (
|
||||
SELECT TOP 1
|
||||
@@ -94,7 +96,7 @@ class SalesQueryThread(QThread):
|
||||
|
||||
sales_list = []
|
||||
for row in rows:
|
||||
order_no, insert_time, sale_amount, customer, card_total, cash_total = row
|
||||
order_no, insert_time, sale_amount, customer, card_total, cash_total, total_amount, discount = row
|
||||
|
||||
# 품목 수 조회 (SALE_SUB)
|
||||
mssql_cursor.execute("""
|
||||
@@ -144,10 +146,15 @@ class SalesQueryThread(QThread):
|
||||
pay_method = ''
|
||||
paid = (card_amt + cash_amt) > 0
|
||||
|
||||
disc_amt = float(discount) if discount else 0.0
|
||||
total_amt = float(total_amount) if total_amount else 0.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,
|
||||
'discount': disc_amt,
|
||||
'total_before_dc': total_amt,
|
||||
'customer': customer,
|
||||
'pay_method': pay_method,
|
||||
'paid': paid,
|
||||
@@ -833,8 +840,20 @@ class POSSalesGUI(QMainWindow):
|
||||
self.sales_table.setItem(row, COL['time'],
|
||||
QTableWidgetItem(sale['time']))
|
||||
|
||||
# 금액 (우측 정렬, 천단위 콤마)
|
||||
amount_item = QTableWidgetItem(f"{sale['amount']:,.0f}원")
|
||||
# 금액 (우측 정렬, 천단위 콤마, 할인 표시)
|
||||
if sale['discount'] > 0:
|
||||
amount_item = QTableWidgetItem(f"{sale['amount']:,.0f}원 (-{sale['discount']:,.0f})")
|
||||
amount_item.setForeground(QColor('#E65100'))
|
||||
f = QFont()
|
||||
f.setBold(True)
|
||||
amount_item.setFont(f)
|
||||
amount_item.setToolTip(
|
||||
f"원가: {sale['total_before_dc']:,.0f}원\n"
|
||||
f"할인: -{sale['discount']:,.0f}원\n"
|
||||
f"결제: {sale['amount']:,.0f}원"
|
||||
)
|
||||
else:
|
||||
amount_item = QTableWidgetItem(f"{sale['amount']:,.0f}원")
|
||||
amount_item.setTextAlignment(Qt.AlignRight | Qt.AlignVCenter)
|
||||
self.sales_table.setItem(row, COL['amount'], amount_item)
|
||||
|
||||
@@ -937,12 +956,14 @@ class POSSalesGUI(QMainWindow):
|
||||
|
||||
def on_cell_clicked(self, row, column):
|
||||
"""테이블 셀 클릭 이벤트 - 적립 사용자 클릭 시 마일리지 내역 표시"""
|
||||
# 컬럼 5(적립자명), 6(전화번호), 7(적립포인트) 중 하나를 클릭했는지 확인
|
||||
if column not in [5, 6, 7]:
|
||||
# SALES_COLUMNS 기반 인덱스 사용
|
||||
COL = {key: i for i, (_, _, key) in enumerate(self.SALES_COLUMNS)}
|
||||
mileage_cols = [COL['claimed_name'], COL['claimed_phone'], COL['claimed_points']]
|
||||
if column not in mileage_cols:
|
||||
return
|
||||
|
||||
# 전화번호 가져오기 (6번 컬럼)
|
||||
phone_item = self.sales_table.item(row, 6)
|
||||
# 전화번호 가져오기
|
||||
phone_item = self.sales_table.item(row, COL['claimed_phone'])
|
||||
if not phone_item or not phone_item.text():
|
||||
# 적립 사용자가 없는 경우
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user