{% extends 'base.html' %} {% load humanize %} {% block title %}Expense Analytics - HAVEN GRAZURI ADVANCE{% endblock %} {% block content %}
Comprehensive expense analysis and trends across all categories and branches
Total Categories
{{ total_expenses }}
Active Branches
{{ total_branches }}
Top Category
{% if category_breakdown %} {% with top=category_breakdown|first %} {% if top.category == 'loan_related' %}Loan-Related{% else %}{{ top.category|title }}{% endif %} {% endwith %} {% else %} N/A {% endif %}
Total Expenses
{% with total=0 %} {% for item in category_breakdown %} {% with total=total|add:item.count %}{% endwith %} {% endfor %} {{ category_breakdown|length|default:0 }} {% endwith %}
Total Amount
KES {{ item.total|floatformat:2|intcomma }}
Average
KES {{ item.average|floatformat:2|intcomma }}
No expense data available
Total Amount
KES {{ item.total|floatformat:2|intcomma }}
Average
KES {{ item.average|floatformat:2|intcomma }}
No branch data available
No trend data available
Highest Category
{% if category_breakdown %} {% with top=category_breakdown|first %} KES {{ top.total|floatformat:2|intcomma }} {% endwith %} {% else %} KES 0.00 {% endif %}
Highest Branch
{% if branch_breakdown %} {% with top=branch_breakdown|first %} KES {{ top.total|floatformat:2|intcomma }} {% endwith %} {% else %} KES 0.00 {% endif %}
Average Expense
{% if category_breakdown %} {% with total_avg=0 count=0 %} {% for item in category_breakdown %} {% with total_avg=total_avg|add:item.average count=count|add:1 %}{% endwith %} {% endfor %} KES {{ total_avg|floatformat:2|intcomma }} {% endwith %} {% else %} KES 0.00 {% endif %}