{% extends './layout/default' %} {% block breadcrumbs %} {{ Breadcrumbs.render(Route.getCurrentRoute.getName) }} {% endblock %} {% block content %}

{{ 'budget_period_navigator'|_ }}

{% if availableBudgets|length == 0 %}

{{ trans('firefly.total_available_budget_in_currency', {currency: primaryCurrency.name}) }}
{{ trans('firefly.between_dates_breadcrumb', {start: start.isoFormat(monthAndDayFormat), end: end.isoFormat(monthAndDayFormat)}) }}

{# info about the amount budgeted #}
{{ 'budgeted'|_ }} ({{ 'see_below'|_ }}): {{ formatAmountBySymbol(budgeted, primaryCurrency.symbol, primaryCurrency.decimal_places) }}
{# info about the amount spent #}
{{ trans('firefly.available_between', {start: start.isoFormat(monthAndDayFormat), end: end.isoFormat(monthAndDayFormat) }) }} : {{ formatAmountBySymbol(0, primaryCurrency.symbol, primaryCurrency.decimal_places, true) }}
{# info text to show how much is spent (in currency). #}
{{ trans('firefly.spent_between', {start: start.isoFormat(monthAndDayFormat), end: end.isoFormat(monthAndDayFormat)}) }} : {{ formatAmountBySymbol(spent, primaryCurrency.symbol, primaryCurrency.decimal_places) }}
{% endif %} {% set boxSize = 12 %} {% if availableBudgets|length > 1 %} {% set boxSize = 6 %} {% endif %} {% if availableBudgets|length > 0 %}
{% for budget in availableBudgets %}

{{ trans('firefly.total_available_budget_in_currency', {currency: budget.transaction_currency.name}) }}
{{ trans('firefly.between_dates_breadcrumb', {start: budget.start_date.isoFormat(monthAndDayFormat), end: budget.end_date.isoFormat(monthAndDayFormat)}) }}

{# info about the amount budgeted #}
{{ 'budgeted'|_ }}: {{ formatAmountBySymbol(budget.budgeted, budget.transaction_currency.symbol, budget.transaction_currency.decimal_places, false) }} {% if null != budget.pc_budgeted %} ({{ formatAmountBySymbol(budget.pc_budgeted, primaryCurrency.symbol, primaryCurrency.decimal_places, false) }}) {% endif %}
{# info about the amount spent #}
{{ trans('firefly.available_between', {start: budget.start_date.isoFormat(monthAndDayFormat), end: budget.end_date.isoFormat(monthAndDayFormat) }) }} : {{ formatAmountBySymbol(budget.amount, budget.transaction_currency.symbol, budget.transaction_currency.decimal_places, true) }} {% if(convertToPrimary and 0 != budget.pc_amount) %} ({{ formatAmountBySymbol(budget.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places, true) }}) {% endif %}
{# progress bar to visualise available vs budgeted. #}
{# red: the exact amount of the available budget, if more has budgeted. #}
{# orange: overbudgeted amount #}
{# budgeted amount if enough or les #}
{# info text to show how much is spent (in currency). #}
{{ trans('firefly.spent_between_left', { start: budget.start_date.isoFormat(monthAndDayFormat), end: budget.end_date.isoFormat(monthAndDayFormat), spent: formatAmountBySymbol(budget.spent, budget.transaction_currency.symbol, budget.transaction_currency.decimal_places), left: formatAmountBySymbol(budget.budgeted + budget.spent, budget.transaction_currency.symbol, budget.transaction_currency.decimal_places), })|raw }}
{# bar to visualise spending in budget . #}
{% endfor %}
{% endif %} {% if budgets|length == 0 and inactive.count() == 0 %} {% include 'partials.empty' with {objectType: 'default', type: 'budgets',route: route('budgets.create')} %} {# make FF ignore demo for now. #} {% set shownDemo = true %} {% else %}

{{ 'budgets'|_ }}

{{ 'createBudget'|_ }}
{# START OF BUDGET ROW #} {% for budget in budgets %} {# this cell displays the amount left in the budget, per budget limit. #} {% endfor %} {# END OF BUDGET ROW #}
{{ 'budget'|_ }} {{ 'budgeted'|_ }} {{ 'left'|_ }} ({{ 'per_day'|_|lower }})
{% if 0 == budget.budgeted|length %} {{ budget.name }} {% endif %} {% if 1 == budget.budgeted|length %} {% for budgetLimit in budget.budgeted %} {{ budget.name }} {% endfor %} {% endif %} {% if budget.budgeted|length > 1 %} {% for budgetLimit in budget.budgeted %} {{ budget.name }} ({{ budgetLimit.currency_name }})
{% endfor %} {% endif %} {% if budget.auto_budget %} {% if 1 == budget.auto_budget.auto_budget_type %} {% endif %} {% if 2 == budget.auto_budget.auto_budget_type %} {% endif %} {% if 3 == budget.auto_budget.auto_budget_type %} {% endif %} {% endif %} {% if budget.attachments.count() > 0 %} {% endif %}
{% if 0==budget.budgeted|length %}
{{ primaryCurrency.symbol }}
{% endif %} {% if budget.budgeted|length > 0 %} {% for budgetLimit in budget.budgeted %} {% if not budgetLimit.in_range %} {{ trans('firefly.budget_limit_not_in_range', {start: budgetLimit.start_date, end: budgetLimit.end_date}) }}
{% endif %}
{{ budgetLimit.currency_symbol }}
{% endfor %} {% endif %} {% if budget.budgeted|length < currencies.count() %} {% endif %}
{% for spentInfo in budget.spent %} {% set countLimit = 0 %} {% for budgetLimit in budget.budgeted %} {# now looping a single budget limit. #} {% if spentInfo.currency_id == budgetLimit.currency_id and budgetLimit.in_range %} {# the code below is used for budget limits INSIDE the current view range. #} {% set countLimit = countLimit + 1 %} {# the amount left is automatically calculated. #} {{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }} {% if spentInfo.spent + budgetLimit.amount > 0 %} {% if 0 == activeDaysLeft %} ({{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }}) {% else %} ({{ formatAmountBySymbol((spentInfo.spent + budgetLimit.amount) / activeDaysLeft, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }}) {% endif %} {% else %} ({{ formatAmountBySymbol(0, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }}) {% endif %}
{% endif %} {% if spentInfo.currency_id == budgetLimit.currency_id and not budgetLimit.in_range %} {{ formatAmountBySymbol(spentInfo.spent + budgetLimit.amount, spentInfo.currency_symbol, spentInfo.currency_decimal_places) }} ({{ 'unknown'|_ }}) {% endif %} {% endfor %} {% if countLimit == 0 %} {# display nothing #} {% endif %} {% endfor %} {% for budgetLimit in budget.budgeted %} {% if null == budget.spent[budgetLimit.currency_id] %} {{ formatAmountBySymbol(budgetLimit.amount, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }} {% if budgetLimit.in_range %} {% if 0 == activeDaysLeft %} ({{ formatAmountBySymbol(budgetLimit.amount, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}) {% else %} ({{ formatAmountBySymbol(budgetLimit.amount / activeDaysLeft, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}) {% endif %} {% endif %} {% if not budgetLimit.in_range %} {# For issue #10441, add per day if the budget limit is out of range. #} ({{ formatAmountBySymbol(budgetLimit.amount / budgetLimit.total_days, budgetLimit.currency_symbol, budgetLimit.currency_decimal_places) }}) {% endif %}
{% endif %} {% endfor %}
{% if paginator.count() > 0 and inactive.count() > 0 %}

{{ 'createBudget'|_ }}

{% endif %} {% if inactive|length > 0 %}

{{ 'inactiveBudgets'|_ }}

{% for budget in inactive %} {% if loop.index == inactive.count() %} {{ budget.name }} {% else %} {{ budget.name }}, {% endif %} {% endfor %}
{% endif %}
{% endif %} {% endblock %} {% block styles %} {% endblock %} {% block scripts %} {% endblock %}