{% extends "base.html" %} {% block title %}Expense Twin{% endblock %} {% block page_title %}Expense Twin{% endblock %} {% block content %}
Total Budget
{{ summary.total_budget | format_currency }}
Across {{ dept_perf|length }} departments
Total Spent
{{ summary.total_spent | format_currency }}
{{ "%.1f"|format(summary.overall_utilization) }}% of total budget
Remaining
{{ summary.total_remaining | format_currency }}
Available for allocation
Utilization
{{ "%.1f"|format(summary.overall_utilization) }}%
{% if summary.overall_utilization > 90 %}Critical — review immediately{% elif summary.overall_utilization > 75 %}Elevated — monitor closely{% elif summary.overall_utilization > 50 %}Healthy burn rate{% else %}Conservative spending{% endif %}
CSV Template Excel Template
Department Spending

Real-time budget utilization across all cost centers

{{ dept_perf|length }} departments
{% if dept_perf and dept_perf|selectattr("spent", "gt", 0)|list|length > 0 %}
Spending Insights
{% set sorted_by_util = dept_perf | sort(attribute='utilization', reverse=true) %} {% set highest_util = sorted_by_util | first %} {% set lowest_util = sorted_by_util | last %} {% set over_budget = dept_perf | selectattr("utilization", "gt", 100) | list %}
{{ highest_util.name }} has the highest utilization at {{ "%.1f"|format(highest_util.utilization) }}% {% if highest_util.utilization > 100 %}(over budget by {{ (highest_util.spent - highest_util.budget) | format_currency }}){% endif %}
{% if over_budget | length > 0 %}
{{ over_budget | length }} department{{ 's' if over_budget|length > 1 else '' }} {{ 'have' if over_budget|length > 1 else 'has' }} exceeded budget. Immediate review recommended.
{% endif %}
{{ lowest_util.name }} is the most under-utilized at {{ "%.1f"|format(lowest_util.utilization) }}% with {{ lowest_util.remaining | format_currency }} remaining.
Overall budget health: {{ "%.1f"|format(summary.overall_utilization) }}% utilized. {% if summary.overall_utilization > 90 %}Critical threshold — freeze non-essential spending.{% elif summary.overall_utilization > 75 %}Approaching limit — approve cautiously.{% else %}On track for fiscal period.{% endif %}
{% for d in dept_perf %}
{{ d.name[0] }}
{{ d.name }}
{{ d.code }} · {{ d.employee_count or 0 }} employees
{{ 'Critical' if d.utilization > 90 else 'High' if d.utilization > 70 else 'Normal' if d.utilization > 40 else 'Low' }}
{{ "%.0f"|format(d.utilization) }}% used
Budget {{ d.budget | format_currency }}
Spent {{ d.spent | format_currency }}
Remaining {{ d.remaining | format_currency }}
{% endfor %}
{% else %}

No expense data yet.

Add expenses manually or import from CSV/Excel to see department analytics.

{% endif %}
Department Budget vs Actual
{% for d in dept_perf %} {% endfor %}
Department Budget Spent Remaining Utilization Status
{{ d.name }} ({{ d.code }})
{{ d.budget | format_currency }} {{ d.spent | format_currency }} {{ d.remaining | format_currency }}
{{ "%.1f"|format(d.utilization) }}%
{% if d.utilization > 100 %} Over Budget {% elif d.utilization > 90 %} Critical {% elif d.utilization > 70 %} High {% elif d.utilization > 40 %} Normal {% else %} Low {% endif %}
Recent Expenses
{{ recent_expenses|length }} records
{% if recent_expenses %}
{% for e in recent_expenses %} {% endfor %}
Date Department Category Description Amount Ref # Action
{{ e.transaction_date.strftime('%Y-%m-%d') if e.transaction_date else '-' }} {% set dept = departments|selectattr("id", "equalto", e.department_id)|list|first if e.department_id else None %} {{ dept.name if dept else 'Unassigned' }} {{ e.category or 'General' }} {{ e.description or '-' }} {{ e.amount | format_currency }} {{ e.reference_number or '-' }}
{% else %}

No expense records found.

{% endif %}
{% endblock %} {% block extra_js %} {% endblock %}