{% extends "base.html" %} {% block content %}

Business Analytics & Reports

Clear
{% if selected_year or selected_month %}
Active Filter: {% if selected_year and selected_month %} Year: {{ selected_year }} | Month: {{ ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'][selected_month|int] }} {% elif selected_year %} Year: {{ selected_year }} (Full Year) {% endif %}
{% endif %}
Monthly Sales Revenue
Financial Summary{% if selected_year or selected_month %} ({{ period_label }}){% endif %}
💰 Total Revenue: AED {{ "{:,.2f}".format(total_revenue) }}
📦 Product Cost: AED {{ "{:,.2f}".format(product_cost) }}
💸 Total Expenses: AED {{ "{:,.2f}".format(total_expenses) }}

📊 Total Cost: AED {{ "{:,.2f}".format(total_cost) }}
💵 Net Profit: AED {{ "{:,.2f}".format(net_profit) }}
📈 Profit Margin: {{ profit_margin }}%
Monthly Expenses
Expense Breakdown by Category
{% if expense_breakdown %} {% else %}

No expense data available

Add Expenses
{% endif %}
{% if expense_breakdown %}
Expense Category Details{% if selected_year or selected_month %} ({{ period_label }}){% endif %}
{% set total_expense_sum = expense_breakdown | sum(attribute='total_amount') %} {% for expense in expense_breakdown %} {% endfor %}
🏷️ Category 💸 Total Amount 📊 Percentage
{{ expense.category }} AED {{ "{:,.2f}".format(expense.total_amount or 0) }} {% if total_expense_sum > 0 %} {% set percentage = (expense.total_amount / total_expense_sum * 100) %}
{{ "%.1f"|format(percentage) }}%
{% else %} 0% {% endif %}
{% endif %}
Product Profitability Analysis{% if selected_year or selected_month %} ({{ period_label }}){% endif %}
{% for product in profit_analysis %} {% endfor %}
📦 Product 🛒 Total Sold 💰 Total Revenue 💸 Total Cost 💵 Profit 📈 Margin
{{ product.product_name }} {{ product.total_sold }} AED {{ "{:,.2f}".format(product.total_revenue or 0) }} AED {{ "{:,.2f}".format(product.total_cost or 0) }} AED {{ "{:,.2f}".format(product.profit or 0) }} {% if product.total_revenue and product.total_cost and product.total_cost > 0 %} {% set margin = ((product.total_revenue - product.total_cost) / product.total_cost * 100) %} {{ "%.1f"|format(margin) }}% {% elif product.total_revenue and product.total_cost == 0 %} N/A {% else %} 0.0% {% endif %}
{% endblock %} {% block scripts %} {% endblock %}