{% extends "base.html" %} {% block contenido %} {# Filtro de compañía #}
{{ _("Vista de líneas") }}
{% if not groups %}
{{ _("No hay conciliaciones activas para esta compañía.") }}
{% endif %} {# Macro: badge coloreado según el estado de conciliación #} {% macro status_badge(status) %} {% if status == "reconciled" %} {{ _("Conciliado") }} {% elif status == "partial" %} {{ _("Parcial") }} {% elif status in ("pending_receipt", "pending_invoice") %} {{ _("Pendiente") }} {% elif status == "disputed" %} {{ _("En Disputa") }} {% else %} {{ status }} {% endif %} {% endmacro %} {# Grupos colapsables por OC #} {% for group in groups %}
{# Encabezado del grupo — clic para colapsar #}
{% if group.purchase_order_id %} {{ group.purchase_order_id }} {% else %} {{ _("Sin Orden de Compra") }} {% endif %} {# Contadores #} {{ _("Recepciones:") }} {{ group.receipt_count }} {{ _("Facturas:") }} {{ group.invoice_count }} {# Estado global del grupo #} {{ status_badge(group.worst_status) }}
{# Cuerpo colapsable #}
{% for rec in group.reconciliations %} {% endfor %}
{{ _("Conciliaciones del grupo") }}
{{ _("Recepción") }} {{ _("Factura") }} {{ _("Tipo matching") }} {{ _("Monto conciliado") }} {{ _("Fecha") }} {{ _("Estado") }}
{% if rec.purchase_receipt_id %} {{ rec.purchase_receipt_id }} {% else %} {% endif %} {% if rec.purchase_invoice_id %} {{ rec.purchase_invoice_id }} {% else %} {% endif %} {% if rec.matching_type == "3-way" %} 3-way {% else %} 2-way {% endif %} {{ rec.matched_amount or "—" }} {{ rec.matched_date or "—" }} {{ status_badge(rec.status) }}
{% endfor %} {% endblock %}