{% extends "base.html" %} {% block title %}{{ _("Budget") }} · Wealth Dashboard{% endblock %} {% block heading %}{{ _("Budget") }}{% endblock %} {# Set outside every block: a block cannot see what another block set, and the chart card and its script both need this list. Budgeted categories first, then unbudgeted ones with spending. #} {% set charted = report.rows | selectattr('budget') | list + report.rows | rejectattr('budget') | selectattr('spent') | list %} {% block lede %}

{{ _("Measured against how far through the month you are, not against the whole month. Halfway through, everyone is under budget — the useful question is whether you are ahead of the pace.") }} {% if view_person %}{{ _f("The budget itself is the household's; the spending measured against it here is {name}'s alone.", name=view_person.name) }}{% endif %}

{% endblock %} {% block content %} {% macro fx_note(x) %} {% if x.converted %} {% set amounts %}{% for u in x.converted %}{{ money(u.amount, u.currency) }}{{ ", " if not loop.last }}{% endfor %}{% endset %}

{{ _f("Includes {amounts}, converted at ECB rates — each month at its own rate, and months older than the rates on file at the oldest.", amounts=amounts) | safe }}

{% endif %} {% if x.unconverted %}

{{ _("Not counted, because no rate here covers them:") }} {% for u in x.unconverted %}{{ money(u.amount, u.currency) }}{{ ", " if not loop.last }}{% endfor %} {% set settings_link %}{{ _("Settings") }}{% endset %} {{ _f("Fetch rates under {settings}.", settings=settings_link) | safe }}

{% endif %} {% endmacro %} {% set remaining = report.total_budget - report.total_spent %}
{{ _("Budgeted") }}
{{ money(report.total_budget, report.base_currency) }}
{{ _f("for {month}", month=mon(report.month)) }}
{{ _("Spent so far") }}
{{ money(report.total_spent, report.base_currency) }}
{{ _f("day {day} of {days} · {pct}% through the month", day=report.day, days=report.days_in_month, pct=(report.through_month * 100) | round | int) }}
{{ _("Remaining") }}
{{ money(remaining, report.base_currency) }}
{% if report.has_budgets %}{{ _("budget less spending") }}{% else %}{{ _("No budgets set yet — fill some in below.") }}{% endif %}
{{ fx_note(report) }} {% if charted %}

{{ _("Budget against spent") }}

{{ _("this month, per category — the chart follows the fields below as you type") }}
{% endif %}

{{ _("Monthly budget per category") }}

{{ _("leave blank for no budget") }}
{% for r in report.rows %} {% endfor %}
{{ _("Category") }}{{ _("Budget") }} {{ _("Spent") }}{{ _("Typical") }}{{ _("Pace") }}
{{ r.label }} {{ money(r.spent, report.base_currency) }} {{ money(r.typical, report.base_currency) if r.typical else '—' }} {% if r.budget %} {% set tone = 'loss' if r.over else ('warn' if r.ahead_of_pace else 'gain') %} {# The marker is where the bar would be if the month were spent evenly: ahead of it is the question, not over 100%. #}
{{ _f("{pct}% used", pct=r.pct | round | int) }}
{% if r.over %}{{ _("over budget") }} {% elif r.ahead_of_pace %}{{ _("ahead of pace") }} {% else %}{{ _("on track") }}{% endif %} {% else %}{% endif %}
{% endblock %} {% block scripts %} {% if charted %} {% endif %} {% endblock %}