feat(project): 연간 목표 로아스 연간·상반기·하반기 목표/실적 계산

- 기간 로아스 = 기간 매출 ÷ 기간 광고비 — 월 광고비를 매출 ÷ 로아스로 환산해 합친 매출 가중 평균
  (목표는 매출 목표, 실적은 매출 실적으로), 매출이 없는 달이 섞이면 단순 평균. 말풍선에 방식·개월 수
- 화면 계산(저장 안 함), 숫자 칸을 고치면 바로 다시 계산. 캐시 버전 20261001e, 문서 갱신

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-01 11:58:03 +09:00
parent 601971d43d
commit 45a671940b
9 changed files with 46 additions and 19 deletions
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001d" />
<link rel="stylesheet" href="/static/project.css?v=20261001e" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -232,5 +232,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261001d" defer></script>
<script src="/static/project.js?v=20261001e" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001d" />
<link rel="stylesheet" href="/static/project.css?v=20261001e" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -87,7 +87,7 @@
</tr>
</thead>
{# ── 숫자 지표 — 연간·반기 칸은 화면에서 계산(매출 합계·달성률), 로아스는 % 단위 ── #}
{# ── 숫자 지표 — 연간·반기 칸은 화면에서 계산(매출 합계·달성률, 로아스 매출 가중 평균), 로아스는 % 단위 ── #}
<tbody class="pj-goal-kpi">
<tr>
<th class="pj-goal-c1" rowspan="3">매출</th>
@@ -117,18 +117,19 @@
<tr>
<th class="pj-goal-c1" rowspan="2">로아스</th>
<th class="pj-goal-c2">목표</th>
<td class="pj-goal-sum pj-goal-sum-na pj-goal-year-col"></td>
{# 로아스 연간·반기 = 월 매출로 가중한 평균(광고비 = 매출 ÷ 로아스로 환산) — project.js recompute #}
<td class="pj-goal-sum pj-goal-year-col" data-metric="roas" data-kind="target" data-scope="0"></td>
{% for h, hmonths, hm, hname in halves %}
{% for mo in hmonths %}{{ num_cell("roas", "target", rm.target_label, mo) }}{% endfor %}
<td class="pj-goal-sum pj-goal-sum-na pj-goal-half-col"></td>
<td class="pj-goal-sum pj-goal-half-col" data-metric="roas" data-kind="target" data-scope="{{ hm }}"></td>
{% endfor %}
</tr>
<tr>
<th class="pj-goal-c2">실적</th>
<td class="pj-goal-sum pj-goal-sum-na pj-goal-year-col"></td>
<td class="pj-goal-sum pj-goal-year-col" data-metric="roas" data-kind="actual" data-scope="0"></td>
{% for h, hmonths, hm, hname in halves %}
{% for mo in hmonths %}{{ num_cell("roas", "actual", rm.actual_label, mo) }}{% endfor %}
<td class="pj-goal-sum pj-goal-sum-na pj-goal-half-col"></td>
<td class="pj-goal-sum pj-goal-half-col" data-metric="roas" data-kind="actual" data-scope="{{ hm }}"></td>
{% endfor %}
</tr>
</tbody>
@@ -206,5 +207,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261001d" defer></script>
<script src="/static/project.js?v=20261001e" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001d" />
<link rel="stylesheet" href="/static/project.css?v=20261001e" />
<link rel="stylesheet" href="/static/project-help.css?v=20260926v" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001d" />
<link rel="stylesheet" href="/static/project.css?v=20261001e" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -104,5 +104,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261001d" defer></script>
<script src="/static/project.js?v=20261001e" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001d" />
<link rel="stylesheet" href="/static/project.css?v=20261001e" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -100,5 +100,5 @@
"today": {{ today | tojson }}
}
</script>
<script src="/static/project.js?v=20261001d" defer></script>
<script src="/static/project.js?v=20261001e" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001d" />
<link rel="stylesheet" href="/static/project.css?v=20261001e" />
<!-- 구글 머티리얼 심볼(담당자 아이콘 등) — self-host -->
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
<!-- 타임라인 vis-timeline — self-host -->
@@ -496,5 +496,5 @@
</script>
<script src="/static/vendor/vis-timeline/vis-timeline-graph2d.min.js"></script>
<script src="/static/project.js?v=20261001d" defer></script>
<script src="/static/project.js?v=20261001e" defer></script>
{% endblock %}
@@ -1,7 +1,7 @@
{% extends "erp_base.html" %}
{% block head_extra %}
<link rel="stylesheet" href="/static/project.css?v=20261001d" />
<link rel="stylesheet" href="/static/project.css?v=20261001e" />
<link rel="stylesheet" href="/static/vendor/material-symbols/material-symbols.css" />
{% endblock %}
@@ -70,5 +70,5 @@
{% include "project/_side_modals.html" %}
{% include "project/_member_tasks_modal.html" %}
<script src="/static/project.js?v=20261001d" defer></script>
<script src="/static/project.js?v=20261001e" defer></script>
{% endblock %}
+24
View File
@@ -8089,6 +8089,30 @@
rt.dataset.tip = tUpTo ? "실적이 있는 달의 목표 합계 대비" : "";
}
});
// 로아스 연간·반기 — 기간 로아스 = 기간 매출 ÷ 기간 광고비. 광고비를 따로 적지 않으니 월마다 매출 ÷ 로아스로 환산해
// 합친다(매출 가중 평균). 로아스가 있는 달 중 매출(같은 목표/실적)이 없는 달이 있으면 단순 평균.
["target", "actual"].forEach(function (kind) {
const roas = values("roas", kind), sales = kind === "target" ? tg : ac;
SUM_SCOPES.forEach(function (sc) {
const td = table.querySelector('.pj-goal-sum[data-metric="roas"][data-kind="' + kind + '"][data-scope="' + sc[0] + '"]');
if (!td) return;
const months = [];
for (let m = sc[1]; m <= sc[2]; m++) if (roas[m] != null && roas[m] > 0) months.push(m);
if (!months.length) { td.textContent = ""; td.dataset.tip = ""; return; }
const weighted = months.every(function (m) { return sales[m] != null && sales[m] > 0; });
let v;
if (weighted) {
let s = 0, spend = 0;
months.forEach(function (m) { s += sales[m]; spend += sales[m] / roas[m]; });
v = s / spend;
} else {
v = months.reduce(function (a, m) { return a + roas[m]; }, 0) / months.length;
}
td.textContent = (Math.round(v * 10) / 10).toLocaleString("ko-KR") + "%";
td.dataset.tip = (weighted ? "매출 가중 평균(월 광고비 = 매출 ÷ 로아스로 환산)" : "단순 평균(매출이 없는 달이 있어서)") +
" · " + months.length + "개월";
});
});
}
recompute();
+3 -1
View File
@@ -519,7 +519,9 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중
- **열 순서** — 연간 · 1~6월 · **상반기** · 7~12월 · **하반기**. 템플릿 컨텍스트 `halves`
(`(반기, 월 목록, 글 칸 번호 13|14, 이름)`), 월 칸은 `pj-goal-m` + `data-h="1|2"`, 반기 칸은 `pj-goal-half-col`.
- 숫자 지표: 매출 목표·실적의 반기 칸 = 그 반기 월 합계(`data-scope="13|14"`, 연간은 `0`), 달성률은 연간과 같은 규칙
(실적이 있는 달의 목표 합계 대비, `SUM_SCOPES`). 로아스 반기·연간 칸은 계산하지 않는다(회색).
(실적이 있는 달의 목표 합계 대비, `SUM_SCOPES`). **로아스 연간·반기**(목표·실적) = 기간 매출 ÷ 기간 광고비 — 광고비를 따로 적지 않아
월마다 매출 ÷ 로아스로 환산해 합친 **매출 가중 평균**(같은 목표/실적 매출 사용), 로아스가 있는 달 중 매출이 없는 달이 있으면 단순 평균
(말풍선에 방식·개월 수). 화면 계산(저장 안 함), 숫자 칸을 고치면 바로 다시 계산.
- 업무 영역 글: `goal_cells.month` **13 = 상반기, 14 = 하반기**(014 가 CHECK 를 0~14 로 넓힘). 014 미적용이면 반기 글 칸은
보기 전용 빈 칸이고, 저장 API 는 503 "마이그레이션 014 필요"(`store.GoalMigration014Needed`).
- **반기 접기** — 반기 칸 머리의 버튼(`.pj-goal-fold`, 펼침 ‹ / 접힘 뒤집힌 › + 강조색)이 그 반기 월 칸을 접었다 편다.