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

📊 Purchase Report

📥 Export CSV
{% if rows %} {% set total_weight = rows|sum(attribute='weight_kg') %} {% set avg_price = (total / total_weight) if total_weight > 0 else 0 %}
📊
{{ total_weight|kg }}
Total Weight
💰
{{ total|currency }}
Total Spent
📈
{{ avg_price|currency }}
Avg Price/kg
📦
{{ rows|length }}
Total Purchases
{% endif %}

Purchase Details

{% if rows %} Showing {{ rows|length }} purchase{{ 's' if rows|length != 1 else '' }} {% endif %}
{% if rows %}
{% for p in rows %} {% endfor %}
📅 Date 🏭 Farm ⚖️ Weight 💲 Price/kg 💰 Total
{{ p.date|date_format }} {% if p.farm %} {{ p.farm.name }} {% else %} - {% endif %} {{ p.weight_kg|kg }} {{ p.price_per_kg|currency }} {{ p.total_amount|currency }}
📊 Total {{ total_weight|kg }} {{ total|currency }}
{% else %}
📊

No Purchase Data

No purchases found for the selected period.

{% endif %}
{% endblock %}