{# 상태 배지 — 발주서(open·partial·done·over·closed·cancelled) / 품목(none·partial·done·over) #} {% macro status_badge(status, label) -%} {{ label }} {%- endmacro %} {# 진행률 막대 — 입고 ÷ 발주 #} {% macro progress(summary) -%} {{ summary.pct }}% {%- endmacro %} {# 입고 예정일 — 지났는데 남은 게 있으면 빨강 "지연 N일" #} {% macro due(due_date, today, active) -%} {% if due_date %}{{ due_date.strftime('%Y-%m-%d') }}{% 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 %}