{# 상태 배지 — 발주서(open·partial·done·over·closed·cancelled) / 품목(none·partial·done·over) #} {% macro status_badge(status, label) -%} {{ label }} {%- endmacro %} {# 진행률 막대 — 입고 ÷ 발주 #} {% macro progress(summary) -%} {{ summary.pct }}% {%- endmacro %} {# 날짜 서식 — 2026.10.17(토) / 2026.10.17(토) 15:14 (2026-10-17 요청, 메일·JSON 은 store.fmt_date·fmt_datetime) #} {% macro ymd(d) -%}{% if d %}{{ d.strftime('%Y.%m.%d') }}({{ '월화수목금토일'[d.weekday()] }}){% endif %}{%- endmacro %} {% macro ymdhm(d) -%}{% if d %}{{ ymd(d) }} {{ d.strftime('%H:%M') }}{% endif %}{%- endmacro %} {# 발주서 상태 — 모든 품목이 입고완료·초과입고면 초록 "✓ 전체 입고 완료"(초과가 있으면 "초과 포함"), 나머지는 상태 배지 #} {% macro order_badge(status, label) -%} {% if status in ('done', 'over') %}✓ {{ label }}{% if status == 'over' %}초과 포함{% endif %} {%- else %}{{ status_badge(status, label) }}{% endif %} {%- endmacro %} {# 입고 예정일 — 지났는데 남은 게 있으면 빨강 "지연 N일" #} {% macro due(due_date, today, active) -%} {% if due_date %}{{ ymd(due_date) }}{% if active and due_date < today %} 지연 {{ (today - due_date).days }}일{% elif active %} D-{{ (due_date - today).days }}{% endif %}{% else %}-{% endif %} {%- endmacro %} {% macro n(v) -%}{{ '{:,}'.format(v or 0) }}{%- endmacro %} {# 색상 사각형(006) — 색이 칠해진 네모. 색없음은 빗금 없는 흰 네모 + 테두리. colors = store.COLORS #} {% macro swatch(key, colors) -%} {%- endmacro %}