feat(실적): 카페24(실적) 열·합계 기준 통일·공통 보기 설정·일 합계 고정

매출 실적
- "카페24" 열 → "카페24(전체)", 바로 오른쪽 "카페24(실적)" = 전체 − 자사몰(공동구매),
  광고비 줄은 카페24(전체)의 구글·메타 그대로 (예전 "공구 제외" 열 대체)
- 합계 기준 통일: 일 합계·ROAS·KPI·추이·비중·월/연 누적 = 카페24(실적) + 공동구매 + 나머지
  (카페24(전체)에 공동구매가 들어 있어 이중 합산 제거, 그래프·누적의 카페24 줄 = 카페24(실적))
- 실적 설정 "공통 보기 설정"(관리자, perf_settings, 모든 사용자 적용):
  매출 단위(예전 브라우저 쿠키 perf_unit 대체), 표 열 숨기기(열만, 합계 그대로)
  표 열 너비는 사람(브라우저)마다 그대로

매출 실적·광고비 공통
- 일 합계 열을 날짜 오른쪽으로, 날짜와 함께 가로 고정
- 이전달·다음달 = 날짜 바로 옆 진한 회색 화살표 SVG(글자 높이)
- 광고비 탭 매출 대비 광고비·합계 ROAS 도 공동구매 이중 합산 제거

CSS·JS 캐시 버전 20261102a. 새 마이그레이션 없음(011 perf_settings 사용).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-02 12:21:33 +09:00
parent ff3b36bf77
commit 884e654bea
15 changed files with 498 additions and 129 deletions
@@ -0,0 +1,6 @@
{# 기간 이동(2026-11-02, 매출 실적·광고비 공통) — 날짜 바로 좌우에 화살표 이미지(SVG, 글자 높이), 글자 버튼 없음 #}
<div class="perf-nav">
<a class="perf-nav-btn" href="{{ nav.prev }}" title="{{ period.prev_label }}" aria-label="{{ period.prev_label }}"><svg viewBox="0 0 10 16" aria-hidden="true"><path d="M8 1.5 2 8l6 6.5"/></svg></a>
<span class="perf-nav-label">{{ period.label }}</span>
<a class="perf-nav-btn" href="{{ nav.next }}" title="{{ period.next_label }}" aria-label="{{ period.next_label }}"><svg viewBox="0 0 10 16" aria-hidden="true"><path d="M2 1.5 8 8l-6 6.5"/></svg></a>
</div>
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261030a" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261102a" />{% endblock %}
{#- ROAS 덧붙임 — "광고비(ROAS%)". 광고비가 없으면 아무것도 안 붙는다. -#}
{%- macro roas(p) -%}{%- if p is not none -%}<span class="perf-roas">({{ "{:,}".format(p) }}%)</span>{%- endif -%}{%- endmacro -%}
@@ -24,11 +24,7 @@
<button type="button" class="perf-seg{% if period_kind == 'custom' %} is-active{% endif %}" id="perf-custom-btn">직접선택</button>
</div>
<div class="perf-nav">
<a class="perf-nav-btn" href="{{ nav.prev }}" title="{{ period.prev_label }}">‹ {{ period.prev_label }}</a>
<span class="perf-nav-label">{{ period.label }}</span>
<a class="perf-nav-btn" href="{{ nav.next }}" title="{{ period.next_label }}">{{ period.next_label }} ›</a>
</div>
{% include "performance/_period_nav.html" %}
<form class="perf-custom" id="perf-custom" method="get" action="/performance/ads"{% if period_kind != 'custom' %} hidden{% endif %}>
<input type="hidden" name="period" value="custom" />
@@ -102,8 +98,8 @@
<thead>
<tr>
<th class="perf-th-label" data-col="label">{% if period_kind == 'year' %}월{% else %}날짜{% endif %}</th>
{% for c in codes %}{% if c in detail_channels %}<th class="perf-th-detail" data-col="{{ c }}" title="{{ names[c] }} — 눌러 일자별 광고 보고서 항목 보기. 괄호 = {% if c == 'google' %}구글 광고 ROAS(전환 가치 ÷ 비용){% elif c == 'meta' %}메타 광고 구매 ROAS(구매 전환값 ÷ 지출 금액){% else %}보고서 ROAS(구매완료 광고수익률){% endif %}"><button type="button" class="perf-detail-btn" data-detail-channel="{{ c }}">{{ names[c] }} <span class="material-symbols-outlined" aria-hidden="true">table_view</span></button></th>{% else %}<th data-col="{{ c }}" title="{{ names[c] }} — 날짜 칸을 눌러 광고비 입력.{% if roas_basis[c] %} 괄호 = ROAS({{ roas_basis[c] }} 매출 ÷ 광고비){% else %} ROAS 는 계산하지 않음(따로 입력){% endif %}">{{ names[c] }} <span class="perf-manual-mark" aria-hidden="true">✎</span></th>{% endif %}{% endfor %}
<th class="perf-th-total" data-col="total">{% if period_kind == 'year' %}월 합계{% else %}일 합계{% endif %}</th>
{% for c in codes %}{% if c in detail_channels %}<th class="perf-th-detail" data-col="{{ c }}" title="{{ names[c] }} — 눌러 일자별 광고 보고서 항목 보기. 괄호 = {% if c == 'google' %}구글 광고 ROAS(전환 가치 ÷ 비용){% elif c == 'meta' %}메타 광고 구매 ROAS(구매 전환값 ÷ 지출 금액){% else %}보고서 ROAS(구매완료 광고수익률){% endif %}"><button type="button" class="perf-detail-btn" data-detail-channel="{{ c }}">{{ names[c] }} <span class="material-symbols-outlined" aria-hidden="true">table_view</span></button></th>{% else %}<th data-col="{{ c }}" title="{{ names[c] }} — 날짜 칸을 눌러 광고비 입력.{% if roas_basis[c] %} 괄호 = ROAS({{ roas_basis[c] }} 매출 ÷ 광고비){% else %} ROAS 는 계산하지 않음(따로 입력){% endif %}">{{ names[c] }} <span class="perf-manual-mark" aria-hidden="true">✎</span></th>{% endif %}{% endfor %}
</tr>
</thead>
<tbody>
@@ -112,6 +108,7 @@
<th class="perf-td-label" scope="row">
{{ r.label }}{% if r.holiday %}<small class="perf-hol">{{ r.holiday }}</small>{% endif %}
</th>
<td class="perf-num perf-td-total"><span class="v v-gross">{{ won(r.total.gross) }}</span>{{ roas(r.roas_total) }}</td>
{% for c in codes %}
{% set v = r.cells[c].gross %}
{% if r.kind == 'day' and not migration_needed %}
@@ -125,7 +122,6 @@
<td class="perf-num"><span class="v v-gross">{{ won(v) }}</span>{{ roas(r.roas[c]) }}</td>
{% endif %}
{% endfor %}
<td class="perf-num perf-td-total"><span class="v v-gross">{{ won(r.total.gross) }}</span>{{ roas(r.roas_total) }}</td>
</tr>
{% endfor %}
</tbody>
@@ -241,4 +237,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261030a" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261102a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261030a" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261102a" />{% endblock %}
{%- macro won(v) -%}
{%- if v is none -%}<span class="perf-na"></span>
@@ -42,11 +42,7 @@
<button type="button" class="perf-seg{% if period_kind == 'custom' %} is-active{% endif %}" id="perf-custom-btn">직접선택</button>
</div>
<div class="perf-nav">
<a class="perf-nav-btn" href="{{ nav.prev }}" title="{{ period.prev_label }}">‹ {{ period.prev_label }}</a>
<span class="perf-nav-label">{{ period.label }}</span>
<a class="perf-nav-btn" href="{{ nav.next }}" title="{{ period.next_label }}">{{ period.next_label }} ›</a>
</div>
{% include "performance/_period_nav.html" %}
<form class="perf-custom" id="perf-custom" method="get" action="/performance/"{% if period_kind != 'custom' %} hidden{% endif %}>
<input type="hidden" name="period" value="custom" />
@@ -142,6 +138,7 @@
<thead>
<tr>
<th class="perf-th-label" data-col="label">{% if period_kind == 'year' %}월{% else %}날짜{% endif %}</th>
<th class="perf-th-total" data-col="total">{% if period_kind == 'year' %}월 합계{% else %}일 합계{% endif %}</th>
{#- 그룹(2026-10-22) — 그룹 열 = 보이는 하위 쇼핑몰 합계, ⊟/⊞ 로 하위 열 접기/펴기(이 브라우저에 기억, 펼치고 접을 때 애니메이션).
하위 열은 .perf-gc 로 내용을 감싼다 — 접을 때 그 너비를 0 으로 줄여 열이 부드럽게 닫힌다. is-glast = 그룹의 마지막 하위 열(오른쪽 묶음 선) -#}
{% for col in cols %}{% set c = col.code %}
@@ -149,7 +146,6 @@
{% if col.kind == 'group' %}<th class="perf-th-group" data-col="{{ c }}" data-group-head="{{ c }}" title="{{ names[c] }} — 하위 쇼핑몰 {{ group_members[c] | length }}곳 매출 합계"><span class="perf-gh"><button type="button" class="perf-gtoggle" data-group-toggle="{{ c }}" aria-expanded="true" aria-label="{{ short_names[c] }} 하위 쇼핑몰 접기" title="하위 쇼핑몰 접기/펴기"><svg viewBox="0 0 18 18" width="18" height="18" aria-hidden="true"><rect class="g-box" x="1" y="1" width="16" height="16" rx="4"/><path class="g-h" d="M5 9h8"/><path class="g-v" d="M9 5v8"/></svg></button><span>{{ short_names[c] }}</span></span></th>
{% else %}<th data-col="{{ c }}"{% if sub %} class="perf-th-child{% if glast %} is-glast{% endif %}" data-group-child="{{ col.group }}"{% endif %} title="{{ names[c] }}{% if c in manual_codes %} — 수동 입력(날짜 칸을 눌러 입력){% endif %}">{% if sub %}<div class="perf-gc">{% endif %}{{ short_names[c] }}{% if c in manual_codes %} <span class="perf-manual-mark" aria-label="수동 입력">✎</span>{% endif %}{% if sub %}</div>{% endif %}</th>{% endif %}
{% endfor %}
<th class="perf-th-total" data-col="total">{% if period_kind == 'year' %}월 합계{% else %}일 합계{% endif %}</th>
</tr>
</thead>
<tbody>
@@ -158,6 +154,7 @@
<th class="perf-td-label" scope="row">
{{ r.label }}{% if r.holiday %}<small class="perf-hol">{{ r.holiday }}</small>{% endif %}
</th>
<td class="perf-num perf-td-total">{{ m3(r.total) }}{% if r.ads_total %}{{ adl_total(r.ads_total) }}{% endif %}</td>
{% for col in cols %}
{% set c = col.code %}
{% set m = r.cells[c] %}
@@ -166,9 +163,9 @@
{% set gc0 %}{% if sub %}<div class="perf-gc">{% endif %}{% endset %}{% set gc1 %}{% if sub %}</div>{% endif %}{% endset %}
{% if col.kind == 'group' %}
<td class="perf-num perf-td-group" data-group-cell="{{ c }}">{{ m3(m) }}</td>
{% elif col.kind == 'diff' %}{#- 카페24 − 카페24 공동구매(2026-10-30, dashboard._cafe24_ex_gb_column) — 계산 열이라 클릭·메모 없음 -#}
{% elif col.kind == 'diff' %}{#- 카페24(실적) = 카페24(전체) − 공동구매(dashboard._cafe24_real_column) — 계산 열이라 클릭·메모 없음, 광고비 줄은 카페24(전체)와 같음 -#}
{%- set b = r.cells[col.base] %}{#- 일 행 = 공동구매 칸 저장 때 performance.js 가 base(카페24 총매출,수수료,차감) − 새 값으로 바로 바꿈 -#}
<td class="perf-num{% if glast %} is-glast{% endif %}"{{ gattr }}{% if r.kind == 'day' %} data-diff-minus="{{ col.minus }}" data-base="{{ b.gross }},{{ b.commission }},{{ b.net }}"{% endif %}>{{ gc0 }}{{ m3(m) }}{{ gc1 }}</td>
<td class="perf-num{% if glast %} is-glast{% endif %}"{{ gattr }}{% if r.kind == 'day' and col.minus %} data-diff-minus="{{ col.minus }}" data-base="{{ b.gross }},{{ b.commission }},{{ b.net }}"{% endif %}>{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[col.base]) }}{{ gc1 }}</td>
{% elif r.kind == 'day' and c in manual_codes %}
{% set is_manual = (r.date ~ '|' ~ c) in manual_cells %}
{% set fx = (formula_cells or {}).get(r.date ~ '|' ~ c) %}
@@ -182,7 +179,6 @@
{% if r['from'] %}data-code="{{ c }}" data-from="{{ r['from'] }}" data-to="{{ r['to'] }}"{% endif %}{% if r.kind == 'day' %} data-memo-code="{{ c }}" data-date="{{ r.date }}"{% endif %}{% if memo %} data-memo="{{ memo }}"{% endif %}>{{ gc0 }}{{ m3(m) }}{{ adl(r.ads[c]) }}{{ gc1 }}</td>
{% endif %}
{% endfor %}
<td class="perf-num perf-td-total">{{ m3(r.total) }}{% if r.ads_total %}{{ adl_total(r.ads_total) }}{% endif %}</td>
</tr>
{% endfor %}
</tbody>
@@ -218,7 +214,7 @@
<tbody>
{% for r in month.rows %}
<tr>
<th class="perf-td-label" scope="row">{{ names[r.code] }}</th>
<th class="perf-td-label" scope="row">{{ summary_names[r.code] }}</th>
<td class="perf-num">{{ won(r.gross) }}</td>
<td class="perf-num">{{ won(r.commission) }}</td>
<td class="perf-num">{{ won(r.net) }}</td>
@@ -277,6 +273,7 @@
<p class="perf-foot perf-muted">
매출 기준: 결제는 결제일, 취소·반품은 발생일에 반영(음수). 수수료는 그날 적용되는 쇼핑몰 수수료율로 계산하며
일·쇼핑몰 단위로 원 미만 반올림합니다. 금액을 누르면 주문 목록을 볼 수 있습니다.
일 합계·상단 금액·그래프·누적 = 카페24(실적) + 자사몰(공동구매) + 나머지 쇼핑몰(카페24(전체)는 더하지 않음).
</p>
</section>
@@ -297,4 +294,4 @@
} | tojson }}</script>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261030a" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261102a" defer></script>{% endblock %}
@@ -1,6 +1,6 @@
{% extends "erp_base.html" %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261030a" />{% endblock %}
{% block head_extra %}<link rel="stylesheet" href="/static/performance.css?v=20261102a" />{% endblock %}
{%- macro when(v) -%}{{ (v or '')[:16] | replace('T', ' ') or '—' }}{%- endmacro -%}
@@ -142,23 +142,12 @@
</p>
</div>
{# 보기 설정(2026-10-19) — 모듈 권한자 누구나, 이 브라우저에만(쿠키 perf_unit). 매출 실적 화면 금액·광고비 줄에 적용 #}
{# 보기 설정(2026-10-19) — 모듈 권한자 누구나, 이 브라우저에만 #}
<div class="erp-card perf-card" id="perf-view-opts">
<div class="perf-card-head">
<h2 class="perf-h">보기 설정</h2>
<span class="perf-muted">매출 실적·광고비 화면을 보는 방식입니다. 이 브라우저에만 적용되며 고르면 바로 저장됩니다.</span>
</div>
<div class="perf-opt-row">
<span class="perf-opt-label">매출 단위</span>
<div class="perf-quick" role="radiogroup" aria-label="매출 단위">
{% for k, label in [('won', '원'), ('thousand', '천원'), ('million', '백만원')] %}
<button type="button" class="perf-seg{% if unit == k %} is-active{% endif %}" role="radio"
aria-checked="{{ 'true' if unit == k else 'false' }}" data-unit="{{ k }}">{{ label }}</button>
{% endfor %}
</div>
<span class="perf-muted" id="perf-unit-example">예: 2,475,300원 →
{% if unit == 'thousand' %}2,475{% elif unit == 'million' %}2.5{% else %}2,475,300{% endif %}</span>
</div>
{# 표 열 너비(2026-10-27, 쿠키 perf_colw) — 매출 실적·광고비 일자별 표. 수동 = 머리글 오른쪽 경계 드래그, 너비는 이 브라우저 localStorage(perf_colw_sales/ads) #}
<div class="perf-opt-row">
<span class="perf-opt-label">표 열 너비</span>
@@ -173,6 +162,36 @@
</div>
</div>
{% if is_admin %}
{# 공통 보기 설정(2026-11-02, 관리자, 마이그레이션 011 perf_settings) — 매출 단위·열 숨기기, 모든 사용자에게 적용 #}
<div class="erp-card perf-card" id="perf-shared-view">
<div class="perf-card-head">
<h2 class="perf-h">공통 보기 설정</h2>
<span class="perf-muted">모든 사용자의 매출 실적 화면에 적용됩니다. 고르면 바로 저장됩니다.</span>
</div>
<div class="perf-opt-row">
<span class="perf-opt-label">매출 단위</span>
<div class="perf-quick" role="radiogroup" aria-label="매출 단위">
{% for k, label in [('won', '원'), ('thousand', '천원'), ('million', '백만원')] %}
<button type="button" class="perf-seg{% if unit == k %} is-active{% endif %}" role="radio"
aria-checked="{{ 'true' if unit == k else 'false' }}" data-unit="{{ k }}">{{ label }}</button>
{% endfor %}
</div>
<span class="perf-muted" id="perf-unit-example">예: 2,475,300원 →
{% if unit == 'thousand' %}2,475{% elif unit == 'million' %}2.5{% else %}2,475,300{% endif %}</span>
</div>
<div class="perf-opt-row">
<span class="perf-opt-label">숨길 쇼핑몰</span>
<div class="perf-hide-list">
{% for m in hide_options %}
<label class="perf-check"><input type="checkbox" data-hide="{{ m.code }}"{% if m.code in hidden_codes %} checked{% endif %} /> {{ m.name }}</label>
{% endfor %}
</div>
<span class="perf-muted">체크한 쇼핑몰은 일자별 표에서 열만 숨겨집니다. 일 합계·그래프·누적 금액은 그대로입니다.</span>
</div>
</div>
{% endif %}
{% if is_admin and auto_sync_settings %}
{# 자동 업데이트 일정(2026-10-26, 마이그레이션 011 perf_settings) — 매출 실적·광고비 따로: 사용·요일·시작/끝 시각(5분 단위)·간격(5분 단위,
기본 30분). [저장] = PUT /api/auto-sync-schedule, 스레드(auto_sync.py)가 1분 안에 반영. #}
@@ -328,4 +347,4 @@
</section>
{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261030a" defer></script>{% endblock %}
{% block scripts %}<script src="/static/performance.js?v=20261102a" defer></script>{% endblock %}