feat(실적): 매출 실적 표에 카페24(공구 제외) 열 추가
- "카페24 공동구매" 열 바로 오른쪽에 카페24 − 카페24 공동구매 계산 열 (총매출·수수료·차감 매출 각각, 기간·주간 합계 행 포함) - 표 열만 — 일 합계·KPI·그래프엔 안 더함, 클릭·메모 없음 - 공동구매 쇼핑몰은 이름으로 찾음, 그룹 하위면 같은 그룹으로 접힘 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,28 @@ def _group_columns(store_rows: Sequence[Mapping[str, Any]], codes: Sequence[str]
|
||||
return cols, members
|
||||
|
||||
|
||||
# 카페24 − 카페24 공동구매 열(2026-10-30) — 직접 추가 쇼핑몰 "카페24 공동구매" 바로 오른쪽, 표 열만(일 합계·그래프·누적엔 안 더함).
|
||||
# shortcut: 공동구매 쇼핑몰은 이름(띄어쓰기 무시)으로 찾는다 — 설정에서 이름을 바꾸면 이 열이 사라진다, 자주 바뀌면 설정 값으로.
|
||||
CAFE24_GB_NAME = "카페24공동구매"
|
||||
CAFE24_EX_GB = "cafe24_ex_gb"
|
||||
|
||||
|
||||
def _cafe24_ex_gb_column(markets: Sequence[Mapping[str, Any]], codes: Sequence[str], cols: list[dict[str, Any]],
|
||||
names: dict[str, str], short: dict[str, str], table: list[dict[str, Any]]) -> None:
|
||||
"""카페24·공동구매 둘 다 보일 때만 공동구매 열 뒤에 차이 열(kind diff — 공동구매가 그룹 하위면 같은 그룹으로 접힘)."""
|
||||
gb = next((m["code"] for m in markets
|
||||
if m["name"].replace(" ", "") == CAFE24_GB_NAME and m["code"] in codes), None)
|
||||
if gb is None or "cafe24" not in codes:
|
||||
return
|
||||
i = next(i for i, col in enumerate(cols) if col["code"] == gb)
|
||||
cols.insert(i + 1, {"code": CAFE24_EX_GB, "kind": "diff", "group": cols[i]["group"]})
|
||||
names[CAFE24_EX_GB] = f"{names['cafe24']} − {names[gb]}"
|
||||
short[CAFE24_EX_GB] = f"{short['cafe24']}(공구 제외)"
|
||||
for r in table:
|
||||
a, b = r["cells"]["cafe24"], r["cells"][gb]
|
||||
r["cells"][CAFE24_EX_GB] = {k: a[k] - b[k] for k in ("gross", "commission", "net")}
|
||||
|
||||
|
||||
def display_status(marketplace: Mapping[str, Any], status_row: Mapping[str, Any] | None,
|
||||
configured: bool) -> str:
|
||||
if not marketplace.get("enabled"):
|
||||
@@ -242,6 +264,7 @@ def build_dashboard(store: Any, *, kind: str, anchor: date, today: date,
|
||||
for g, members in group_members.items():
|
||||
r["cells"][g] = calc.total(calc.Money(gross=r["cells"][c]["gross"], commission=r["cells"][c]["commission"])
|
||||
for c in members).as_dict()
|
||||
_cafe24_ex_gb_column(markets, codes, cols, names, short, table)
|
||||
|
||||
def url(kind: str, anchor_d: date | None = None, start: date | None = None, end: date | None = None) -> str:
|
||||
if kind == "custom":
|
||||
|
||||
Reference in New Issue
Block a user