diff --git a/app/modules/project/router.py b/app/modules/project/router.py index 5b5488b..8a0beb9 100644 --- a/app/modules/project/router.py +++ b/app/modules/project/router.py @@ -2868,26 +2868,40 @@ def _meeting_view(request: Request, st: Any, *, year: int, month: int, week: dat } if meeting: # 줄마다 전주 결과 — 쇼핑몰 연결이면 그 주 실적(자동), 아니면 직접 입력한 결과 + all_codes = [m["code"] for m in markets] by_week: dict[str, dict[str, int] | None] = {} + + def week_sales(ws: str) -> dict[str, int] | None: + """그 주(월~일, 오늘까지) 쇼핑몰별 실적 — 아직 시작 안 한 주는 None.""" + if ws not in by_week: + a = date.fromisoformat(ws) + by_week[ws] = _perf_sum(perf, a, min(a + timedelta(days=6), today), all_codes) if a <= today else None + return by_week[ws] + for it in meeting["items"]: prev = it.get("prev") if not prev: continue auto = None code = prev.get("marketplace_code") or "" - if code: - ws = prev["week_start"] - if ws not in by_week: - a = date.fromisoformat(ws) - by_week[ws] = _perf_sum(perf, a, min(a + timedelta(days=6), today), - [m["code"] for m in markets]) if a <= today else {} - got = by_week[ws] + a = date.fromisoformat(prev["week_start"]) + prev["period"] = f"{a.month}/{a.day}~{(a + timedelta(days=6)).month}/{(a + timedelta(days=6)).day}" + prev["not_started"] = bool(code) and a > today + # 실적 모듈에서 사용 중이 아닌 쇼핑몰(설정에서 사용 OFF·없는 코드)은 늘 0 이라 자동으로 보지 않고 직접 입력 + prev["market_off"] = bool(code) and code not in names + if code and perf is not None and not prev["not_started"] and not prev["market_off"]: + got = week_sales(prev["week_start"]) auto = None if got is None else got.get(code, 0) prev["auto_result"] = auto prev["result"] = auto if auto is not None else prev.get("result_amount") prev["market_name"] = names.get(code, code) for it in meeting["items"]: - it["market_name"] = names.get(it["marketplace_code"], it["marketplace_code"]) if it["marketplace_code"] else "" + code = it["marketplace_code"] + it["market_name"] = names.get(code, code) if code else "" + it["market_off"] = bool(code) and code not in names + # 이번 주 진행 중 실적(쇼핑몰 연결 줄) — 목표 금액 칸 아래에 "이번주 실적" + got = week_sales(meeting["week_start"]) if code and perf is not None and not it["market_off"] else None + it["week_auto"] = None if got is None else got.get(code, 0) p = it.get("prev") it["rate"] = (round(p["result"] / p["target_amount"] * 100, 1) if p and p.get("result") is not None and p.get("target_amount") else None) diff --git a/app/modules/project/templates/project/goal_meeting.html b/app/modules/project/templates/project/goal_meeting.html index d5a145d..92b4985 100644 --- a/app/modules/project/templates/project/goal_meeting.html +++ b/app/modules/project/templates/project/goal_meeting.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -169,7 +169,8 @@ {% endif %} {{ it.label }} - {% if it.market_name %}{{ it.market_name }}{% endif %} + {% if it.market_off %}{{ it.market_name }} · 실적 미사용 + {% elif it.market_name %}{{ it.market_name }}{% endif %} {% if edit %}{% endif %} @@ -179,13 +180,16 @@ {% if edit %} {% else %}{{ won(it.target_amount) }}{% endif %} + {% if it.week_auto is not none %}이번주 실적 {{ won(it.week_auto) }}{% if it.target_amount %} · {{ "%.0f" | format(it.week_auto / it.target_amount * 100) }}%{% endif %}{% endif %} {% if p %}
{{ p.content }}
{{ won(p.target_amount) }} - {% if p.auto_result is not none %} - {{ won(p.auto_result) }} + {% if p.not_started %} + 진행 전 + {% elif p.auto_result is not none %} + {{ won(p.auto_result) }} {% elif edit %} {% else %}{{ won(p.result_amount) }}{% endif %} @@ -228,5 +232,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/goals.html b/app/modules/project/templates/project/goals.html index 0316687..1d9e873 100644 --- a/app/modules/project/templates/project/goals.html +++ b/app/modules/project/templates/project/goals.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -206,5 +206,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/help.html b/app/modules/project/templates/project/help.html index 04f861e..36426cf 100644 --- a/app/modules/project/templates/project/help.html +++ b/app/modules/project/templates/project/help.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} diff --git a/app/modules/project/templates/project/inbox.html b/app/modules/project/templates/project/inbox.html index 55afd16..6bdc1df 100644 --- a/app/modules/project/templates/project/inbox.html +++ b/app/modules/project/templates/project/inbox.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -104,5 +104,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/modules/project/templates/project/mytasks.html b/app/modules/project/templates/project/mytasks.html index 6845c3e..e3bd752 100644 --- a/app/modules/project/templates/project/mytasks.html +++ b/app/modules/project/templates/project/mytasks.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -100,5 +100,5 @@ "today": {{ today | tojson }} } - + {% endblock %} diff --git a/app/modules/project/templates/project/project.html b/app/modules/project/templates/project/project.html index dfe4083..6136178 100644 --- a/app/modules/project/templates/project/project.html +++ b/app/modules/project/templates/project/project.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + @@ -496,5 +496,5 @@ - + {% endblock %} diff --git a/app/modules/project/templates/project/trash.html b/app/modules/project/templates/project/trash.html index 526fa64..570adf4 100644 --- a/app/modules/project/templates/project/trash.html +++ b/app/modules/project/templates/project/trash.html @@ -1,7 +1,7 @@ {% extends "erp_base.html" %} {% block head_extra %} - + {% endblock %} @@ -70,5 +70,5 @@ {% include "project/_side_modals.html" %} {% include "project/_member_tasks_modal.html" %} - + {% endblock %} diff --git a/app/static/project.css b/app/static/project.css index 988a99a..b3d0fa4 100644 --- a/app/static/project.css +++ b/app/static/project.css @@ -2267,6 +2267,8 @@ input.pj-meet-amount { input.pj-meet-amount:focus { outline: 2px solid var(--pj-accent); outline-offset: -2px; background: #fff; } input.pj-meet-amount::placeholder { color: rgba(0, 0, 0, .28); } .pj-meet-auto { color: #1d4ed8; font-weight: 600; } +.pj-meet-market.is-off { background: #fdecec; color: #b42318; } +.pj-meet-week-auto { display: block; padding: 0 4px 5px; font-size: 11px; color: #1d4ed8; text-align: right; white-space: nowrap; } .pj-meet-auto::before { content: "자동 "; font-size: 10.5px; font-weight: 700; color: #6b8fd6; } .pj-meet-c-rate { text-align: right; vertical-align: middle !important; padding: 0 6px !important; font-weight: 700; } .pj-meet-c-rate .is-good { color: #1f8a4c; } diff --git a/docs/PROJECT_MODULE.md b/docs/PROJECT_MODULE.md index ce6e47a..491f30a 100644 --- a/docs/PROJECT_MODULE.md +++ b/docs/PROJECT_MODULE.md @@ -576,6 +576,9 @@ description 을 항상 HTML로 취급하기 때문). 두 번 실행하면 이중 지난주 목표 | **결과** | 달성률 | **평가**(— · 완료 · 일부 · 미달). 지난주 칸 = 이 줄의 `carry_from`(지난 회의록 같은 줄). 결과는 그 줄이 **쇼핑몰 연결**(`marketplace_code`)이면 실적 모듈의 그 주(지난 회의록 주 월~일) 그 쇼핑몰 매출 **자동**("자동" 표시), 아니면 직접 입력 — **지난 회의록 줄의 `result_amount`·`status` 에 저장**(그 주 결과는 그 주 줄에 남는다). 달성률은 저장 즉시 화면 계산. + 지난 회의록 주가 아직 시작 전이면 "진행 전"(0 으로 보이지 않게), 연결한 쇼핑몰이 실적 모듈에서 사용 중이 아니면(사용 OFF·없는 코드) + "실적 미사용" 표시 + 직접 입력. 자동 결과 말풍선 = 쇼핑몰·기간, 0 이면 "그 기간 실적 없음 — [매출 업데이트]" 안내. + 쇼핑몰 연결 줄은 목표 금액 아래에 **이번주 실적**(이 주 월요일~오늘, 목표 대비 %)도 보인다. - 참석자 · **결정 사항·메모**. 인쇄 버튼(인쇄용 CSS — 사이드바·탭·도구 숨김). - 데이터: `goal_meetings(week_start 월요일 PK, week_target 원, attendees, notes)` · `goal_meeting_items(week_start FK CASCADE, section, section_color, label, content, target_amount, result_amount, status '', done, partial, miss, marketplace_code, carry_from FK SET NULL,