% extends "admin/base_site.html" %} {% block extrastyle %} {% endblock %} {% block content %}
← Back to Admin
🕐 Last sync: {{ last_sync|date:"H:i" }}

Stock Command Center

Real-time inventory intelligence & predictive analytics

📅 Showing: {{ period_range }}
💰
Total Sales {{ period_label }}
KSh {{ total_sales_today|floatformat:0 }}
📈
Gross Profit {{ period_label }}
KSh {{ gross_profit_today|floatformat:0 }}
(Sales - Cost of Goods)
💸
Total Expenses {{ period_label }}
KSh {{ total_expenses|floatformat:0 }}
Business: KSh {{ business_expenses|floatformat:0 }} | Personal: KSh {{ personal_expenses|floatformat:0 }}
💎
NET PROFIT {{ period_label }}
KSh {{ net_profit|floatformat:0 }}
{{ profit_status_text }}

📦 Stock Valuation Overview

{% for location_name, data in stock_valuation_by_location.items %}
🏪
{{ location_name }}
KSh {{ data.total_value|floatformat:0 }}
{{ data.total_units }} Units in Stock
✅ Paid
KSh {{ data.paid_purchases|floatformat:0 }}
💳 Credit
KSh {{ data.credit_purchases|floatformat:0 }}
{% endfor %}
🏆
Total Profit (All Time)
KSh {{ total_profit_overall|floatformat:0 }}
🚐

Matatu Business

Showing {{ period_label }} — {{ period_range }}

💰
Income {{ period_label }}
KSh {{ matatu_income|floatformat:0 }}
📉
Expenses {{ period_label }}
KSh {{ matatu_expense|floatformat:0 }}
{% if matatu_net >= 0 %}✅{% else %}⚠️{% endif %}
Net {{ period_label }}
KSh {{ matatu_net|floatformat:0 }}
{% if matatu_net >= 0 %}✅ Profitable{% else %}🔴 Running at loss{% endif %}
All-time Income
KSh {{ matatu_income_alltime|floatformat:0 }}
All-time Expenses
KSh {{ matatu_expense_alltime|floatformat:0 }}
All-time Net
KSh {{ matatu_net_alltime|floatformat:0 }}
{% if profit_status == 'loss' %}

⚠️ ALERT: Operating at a Loss

Your expenses exceed your gross profit by KSh {{ net_profit|floatformat:0 }} this period.

💡 Consider reviewing your expenses in the Expenses tab to identify areas for cost reduction.

{% endif %}
💸
Total Expenses {{ period_label }}
KSh {{ total_expenses|floatformat:0 }}
💼
Business Expenses
KSh {{ business_expenses|floatformat:0 }}
👤
Personal Expenses
KSh {{ personal_expenses|floatformat:0 }}

💼 Business Expenses Breakdown

{% if business_expense_breakdown %} {% for item in business_expense_breakdown %} {% endfor %}
Category Amount
{{ item.category__name }} -KSh {{ item.total_amount|floatformat:2 }}
TOTAL BUSINESS KSh {{ business_expenses|floatformat:2 }}
{% else %}
💼
No business expenses for this period
{% endif %}

👤 Personal Expenses Breakdown

{% if personal_expense_breakdown %} {% for item in personal_expense_breakdown %} {% endfor %}
Category Amount
{{ item.category__name }} -KSh {{ item.total_amount|floatformat:2 }}
TOTAL PERSONAL KSh {{ personal_expenses|floatformat:2 }}
{% else %}
👤
No personal expenses for this period
{% endif %}
🚐

Matatu Business — {{ period_label }}

Income
KSh {{ matatu_income|floatformat:0 }}
Expenses
KSh {{ matatu_expense|floatformat:0 }}
Net
KSh {{ matatu_net|floatformat:0 }}
{% if matatu_expense_breakdown %}

🚐 Matatu Expense Breakdown — {{ period_label }}

{% for row in matatu_expense_breakdown %} {% endfor %}
Category Amount % of Total
{{ row.category_label }} KSh {{ row.total|floatformat:2 }} {% if matatu_expense > 0 %} {% widthratio row.total matatu_expense 100 %}% {% else %} — {% endif %}
TOTAL KSh {{ matatu_expense|floatformat:2 }}
{% else %}
🚐
No matatu expenses for this period
{% endif %}
➕ Add Matatu Expense ➕ Add Matatu Income
➕ Add New Expense
TOTAL CASH ON HAND
KSh {{ grand_total_cash|floatformat:0 }}
Across all locations and payment methods
{% if cash_by_location %}
{% for location_name, data in cash_by_location.items %}
{{ data.icon }} {{ location_name }}
Total Balance
KSh {{ data.total|floatformat:0 }}
{% for method in data.methods %}
{{ method.icon }} {{ method.method }} KSh {{ method.amount|floatformat:0 }}
{% endfor %}
{% endfor %}
{% else %}
💰
No cash balance data available
{% endif %}
{% if profit_per_product %}
{% for item in profit_per_product %} {% endfor %}
# Product Name Total Profit
{{ forloop.counter }} {{ item.product__name }} KSh {{ item.total_profit|floatformat:2 }}
{% else %}
💸
No profit data available
{% endif %}
{% if stock_levels %}
{% for stock in stock_levels %}
{{ stock.location.name }} {% if stock.quantity > 20 %}Healthy{% elif stock.quantity > 10 %}Moderate{% else %}Low{% endif %}
{{ stock.quantity }}
units
{{ stock.product.name }}
{% endfor %}
{% else %}
📍
No location-specific stock data available
{% endif %}

🎯 Sales Targets & Bonuses

{% if location_targets %}
{% for location_name, data in location_targets.items %}
{{ location_name }}
KSh {{ data.current_sales|floatformat:0 }}
Target: KSh {{ data.target_amount|floatformat:0 }}
{% if data.target_met %}
✅ TARGET MET
{% endif %}
{{ data.progress|floatformat:1 }}% Complete
{% if data.target_met %}
🎉 Bonus Earned
KSh {{ data.bonus_amount|floatformat:0 }}
({{ data.bonus_percentage }}% of total sales)
{% else %}
💰 Amount Remaining
KSh {{ data.remaining|floatformat:0 }}
Earn {{ data.bonus_percentage }}% bonus when you hit the target!
{% endif %}
{% endfor %}
{% else %}
🎯
No sales targets configured
{% endif %}

📦 Stock Valuation by Location

{% for location_name, data in stock_valuation_by_location.items %}
🏪
{{ location_name }}
KSh {{ data.total_value|floatformat:0 }}
Total Units: {{ data.total_units }}
✅ Paid Purchases KSh {{ data.paid_purchases|floatformat:0 }}
💳 Credit Purchases KSh {{ data.credit_purchases|floatformat:0 }}
{% endfor %}

💳 Credit Purchases & Interest (This Month)

💳
Total Credit Purchases
KSh {{ credit_summary.total_credit|floatformat:0 }}
{{ credit_summary.count }} purchase{{ credit_summary.count|pluralize }}
📊
Interest (1%)
KSh {{ credit_summary.total_interest|floatformat:2 }}
Additional cost of credit
💰
Original Amount (Before Interest)
KSh {{ credit_summary.net_credit|floatformat:0 }}
Before 1% interest
{% if credit_summary.purchases %}

📋 Credit Purchases This Month

{% for purchase in credit_summary.purchases %} {% endfor %}
Date Supplier Destination Original Amount Interest (1%) Total with Interest
{{ purchase.purchase_date|date:"M d, Y" }} {{ purchase.supplier_name }} {{ purchase.destination_location.name }} KSh {% widthratio purchase.total_amount 101 100 %} +KSh {% widthratio purchase.total_amount 101 1 %} KSh {{ purchase.total_amount|floatformat:2 }}
TOTAL KSh {% widthratio credit_summary.total_credit 101 100 %} +KSh {{ credit_summary.total_interest|floatformat:2 }} KSh {{ credit_summary.total_credit|floatformat:2 }}
{% else %}
💳
No credit purchases this month
{% endif %}
{% endblock %}