{% extends 'admin/hub/layout.html.twig' %} {% set hub_title = 'Facture ' ~ (facture.numeroFacture ?? facture.fichierOriginalNom ?? 'en cours') %} {% set hub_breadcrumbs = [ { label: 'Fournisseurs', url: path('app_fournisseurs_hub') }, { label: 'Factures', url: path('app_factures_hub') }, { label: facture.numeroFacture ?? 'En cours' } ] %} {% block title %}Facture {{ facture.numeroFacture }} — Mercuriale.io{% endblock %} {% block stylesheets %} {{ parent() }} {% endblock %} {% block hub_content %}
{# Flash messages #} {% for type, messages in app.flashes %} {% for message in messages %}
{{ message }}
{% endfor %} {% endfor %} {# Header #}

{{ facture.numeroFacture ?? facture.fichierOriginalNom ?? 'Facture en cours de traitement' }}

{{ facture.fournisseur ? facture.fournisseur.nom : (facture.fournisseurNom ?? 'Fournisseur inconnu') }} {% if facture.dateEmission %}— {{ facture.dateEmission|date('d/m/Y') }}{% endif %}

{% include 'components/_status_badge.html.twig' with { label: facture.source.label, variant: facture.source.color } only %} {% include 'components/_status_badge.html.twig' with { label: facture.statut.label, variant: facture.statut.color } only %}
{# BROUILLON / OCR pending notice #} {% if facture.statut.value == 'BROUILLON' %}
Cette facture est en cours de traitement par OCR. Les données seront extraites automatiquement. {% if facture.fichierOriginalNom %} Fichier : {{ facture.fichierOriginalNom }} {% endif %}
{% endif %} {# Info grid #}
Numero
{{ facture.numeroFacture ?? '—' }}
Date emission
{{ facture.dateEmission ? facture.dateEmission|date('d/m/Y') : '—' }}
Source
{% include 'components/_status_badge.html.twig' with { label: facture.source.label, variant: facture.source.color, size: 'sm' } only %}
Fournisseur
{% if facture.fournisseur %} {{ facture.fournisseur.nom }} {% else %} {{ facture.fournisseurNom ?? '—' }} {% endif %}
TVA fournisseur
{{ facture.fournisseurTva ?? '—' }}
SIREN
{{ facture.fournisseurSiren ?? '—' }}
Devise
{{ facture.devise }}
Montant HT
{{ facture.montantHt ? facture.montantHt|number_format(2, ',', ' ') ~ ' €' : '—' }}
TVA
{{ facture.montantTva ? facture.montantTva|number_format(2, ',', ' ') ~ ' €' : '—' }}
Montant TTC
{{ facture.montantTtc ? facture.montantTtc|number_format(2, ',', ' ') ~ ' €' : '—' }}
Statut
{% include 'components/_status_badge.html.twig' with { label: facture.statut.label, variant: facture.statut.color, size: 'sm' } only %}
{% if facture.accepteeLe %}
Acceptee le
{{ facture.accepteeLe|date('d/m/Y H:i') }}
{% endif %} {% if facture.payeeLe %}
Payee le
{{ facture.payeeLe|date('d/m/Y H:i') }}
{% endif %} {% if facture.validatedBy %}
Traitee par
{{ facture.validatedBy.email }}
{% endif %} {% if facture.rapprocheLe %}
Rapprochee le
{{ facture.rapprocheLe|date('d/m/Y H:i') }}
{% endif %} {% if facture.documentOriginalPath %} {% endif %} {% if facture.ocrProcessedAt %}
OCR traite le
{{ facture.ocrProcessedAt|date('d/m/Y H:i') }}
{% endif %} {% if facture.createdBy %}
Uploade par
{{ facture.createdBy.email }}
{% endif %}
{# Rapprochement BL #} {% if facture.bonLivraison %}
Rapprochement BL
Rapprochée avec le BL {{ facture.bonLivraison.numeroBl ?? 'BL #' ~ facture.bonLivraison.id }} du {{ facture.bonLivraison.dateLivraison|date('d/m/Y') }} {% if facture.scoreRapprochement %} — Score : {{ facture.scoreRapprochement }}% {% endif %} {% if facture.ecartMontantHt and facture.ecartMontantHt != '0.00' %} — Écart HT : {{ facture.ecartMontantHt|number_format(2, ',', ' ') }} € {% endif %}
{% endif %} {# Motif refus #} {% if facture.motifRefus %}
Motif du refus
{{ facture.motifRefus }}
{% endif %} {# Lignes #}
Lignes ({{ facture.lignes|length }})
{% if facture.lignes is empty %}
Aucune ligne pour cette facture.
{% else %}
{% for ligne in facture.lignes %} {% endfor %}
Code Designation Unite Qte PU TVA Total
{{ ligne.codeArticle ?? '—' }} {{ ligne.designation }} {{ ligne.unite ?? '—' }} {{ ligne.quantite }} {{ ligne.prixUnitaire|number_format(4, ',', ' ') }} {{ ligne.tauxTva ? ligne.tauxTva ~ '%' : '—' }} {{ ligne.montantLigne|number_format(2, ',', ' ') }} €
Total HT {{ facture.montantHt|number_format(2, ',', ' ') }} €
{% endif %}
{# Actions #} {% if can_accepter or can_refuser or can_payer or can_contester %}
{% if can_accepter %}
{% endif %} {% if can_payer %} {% endif %} {% if can_contester %} {% endif %} {% if can_refuser %} {% endif %}
{% if can_payer %}
{% endif %} {% if can_contester %}
{% endif %} {% if can_refuser %}
{% endif %} {% endif %} {# Transition timeline #} {% if transitions is defined and transitions is not empty %}
Historique des transitions
{% for transition in transitions %}
{{ transition.fromStatut.label }} {{ transition.toStatut.label }}
{{ transition.user.email }} — {{ transition.createdAt|date('d/m/Y H:i') }}
{% if transition.motif %}
{{ transition.motif }}
{% endif %}
{% endfor %}
{% endif %}
{% endblock %}