feat(cupang): 매출 표에 그룹 줄무늬 — 입고센터(센터 검색 시 출고일) 기준
연속된 같은 그룹은 같은 배경, 그룹이 바뀌면 배경을 번갈아 칠한다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -619,6 +619,17 @@ async def sales_page(request: Request) -> HTMLResponse:
|
||||
for key in extra:
|
||||
extra[key] += float(w.get(key) or 0)
|
||||
|
||||
# 줄무늬 — 기본은 입고센터가 바뀔 때마다, 센터로 검색 중이면 출고일이 바뀔 때마다.
|
||||
band_key = "ship_date" if filters["center_name"] else "center_name"
|
||||
band = 0
|
||||
prev = None
|
||||
for row in rows:
|
||||
value = row.get(band_key)
|
||||
if prev is not None and value != prev:
|
||||
band ^= 1
|
||||
prev = value
|
||||
row["band"] = band
|
||||
|
||||
totals = _sales_totals(rows)
|
||||
totals.update(extra)
|
||||
totals["net_margin"] = (
|
||||
|
||||
Reference in New Issue
Block a user