{% extends "base.html" %} {% block title %}{{ nombre }}{% endblock %} {% block page_title %}{{ nombre }}{% endblock %} {% block topbar_actions %} Volver al inventario {% endblock %} {% block content %} {% if stats %}
Unidades totales
{{ "%.2f"|format(stats.total_unidades) if stats.total_unidades % 1 else "%.0f"|format(stats.total_unidades) }}
Precio medio
{{ "%.2f"|format(stats.precio_medio) }} €
Rango de precios
{{ "%.2f"|format(stats.precio_min) }} – {{ "%.2f"|format(stats.precio_max) }} €
Total gastado
{{ "%.2f"|format(stats.total_gastado) }} €
{% endif %}
Historial de compras {{ compras|length }}
{% for c in compras %} {% else %} {% endfor %} {% if compras %} {% endif %}
Fecha Factura Proveedor Cantidad Precio unit. Dto. Subtotal
{{ c.fecha }} {{ c.factura_numero }} {% if c.proveedor_id %} {{ c.proveedor_nombre }} {% else %}—{% endif %} {{ "%.2f"|format(c.cantidad) if c.cantidad % 1 else "%.0f"|format(c.cantidad) }} {{ "%.2f"|format(c.precio_unitario) }} € {% if c.descuento_pct %}{{ c.descuento_pct }}%{% else %}—{% endif %} {{ "%.2f"|format(c.subtotal) }} €
Sin compras registradas
Total {% if stats %}{{ "%.0f"|format(stats.total_unidades) }}{% endif %} {% if stats %}media {{ "%.2f"|format(stats.precio_medio) }} €{% endif %} {% if stats %}{{ "%.2f"|format(stats.total_gastado) }} €{% endif %}
{% endblock %}