{% extends '@Commercial/billing/layout.html.twig' %} {% block commercial_title %}{{ document.number ?: 'Brouillon' }}{% endblock %} {% block billing_toolbar %}{% endblock %} {% block billing_content %} {% set invoice_types = ['invoice', 'deposit_invoice', 'balance_invoice'] %} {% set is_invoice = document.type in invoice_types %} {% set is_credit = document.type == 'credit_note' %} {% set is_quote = document.type == 'quote' %} {% set can_send = 'sent' in available_statuses %} {% set can_validate = 'validated' in available_statuses or 'issued' in available_statuses %} {% set can_accept_quote = is_quote and 'accepted' in available_statuses %} {% set can_refuse_quote = is_quote and 'refused' in available_statuses %} {% set document_label = is_quote ? 'devis' : (is_credit ? 'avoir' : 'facture') %} {% set document_subject = is_credit ? 'l’avoir' : (is_quote ? 'le devis' : 'la facture') %} {% set back_route = is_quote ? 'billing_quote_index' : 'billing_invoice_index' %} {% set currency = document.currency|default('EUR') == 'EUR' ? '€' : document.currency|default('EUR') %} {% set document_type_label = type_labels[document.type]|default(document.type) %}

{{ document_type_label }} {{ document.number ?: 'Brouillon' }}

{{ is_quote and document.status == 'validated' ? 'Validé' : status_labels[document.status]|default(document.status) }} {% if document.issueDate %} Émise le {{ document.issueDate|date('d/m/Y') }}{% endif %} {% if document.dueDate %} Échéance le {{ document.dueDate|date('d/m/Y') }}{% endif %}
{% if document.type == 'quote' and can_view_amounts %} Signature en ligne{% endif %} {% if is_quote and document.status == 'accepted' and is_granted('SALES_ORDER_CREATE') and can_view_amounts %}Créer un bon de commande{% endif %} {% if document.sourceDocument and document.sourceDocument.type == 'order' and is_granted('SALES_ORDER_VIEW', document.sourceDocument) %}Bon de commande source{% endif %} {% if is_editable and is_granted('BILLING_DOCUMENT_EDIT', document) %} Modifier {% endif %} {% if can_view_amounts %} Voir PDF Télécharger PDF {% endif %} {% if can_send %}
{% endif %} Retour

Client

{{ document.customer ? document.customer.nom : document.customerNameSnapshot|default('—') }} {{ document.customer ? document.customer.type|default('Client')|lower : 'client' }}

{{ document.customerSiretSnapshot ?: '—' }}

{% if document.customer and document.customer.email %}

Email: {{ document.customer.email }}

{% endif %}

Projet

{% if document.project %}Voir dossier{% endif %}
{{ document.project ? document.project.titre : 'Aucun projet' }} {{ document.project ? document.project.type|lower : '—' }}

{{ document.project ? document.project.description|default('—') : '—' }}

{% if document.project %}
{{ document.project.statut }} {% if document.dueDate %}Échéance {{ document.dueDate|date('d/m/Y') }}{% endif %}
{% endif %}

Lignes de {{ is_credit ? 'l’avoir' : document_label }}

{% if is_editable %}Modifier{% endif %}
{% if document.introText %}
{{ document.introText|nl2br }}
{% endif %}
Libellé Qté {{ can_view_amounts ? 'PU HT' : 'Montant' }} TVA Total HT Total TTC Origine
{% for line in document.lines %} {% if line.lineType == 'section' %}
{{ line.label }}
{% elseif line.lineType == 'note' %}
{{ line.label }}{% if line.description %}{{ line.description|nl2br }}{% endif %}
{% else %}
{{ line.label }} {% if line.description %}{{ line.description|raw }}{% endif %} {{ line.quantity|number_format(3, ',', ' ') }} {{ can_view_amounts ? line.unitPriceHt|number_format(2, ',', ' ') ~ ' ' ~ currency : 'Masqué' }} {{ line.vatRate|number_format(2, ',', ' ') }} % {{ can_view_amounts ? line.subtotalHt|number_format(2, ',', ' ') ~ ' ' ~ currency : '—' }} {{ can_view_amounts ? line.totalTtc|number_format(2, ',', ' ') ~ ' ' ~ currency : '—' }} {{ line.sourceType == 'product' ? 'Produit' : '—' }}
{% endif %} {% else %}

Aucune ligne.

{% endfor %}

Totaux

{% if can_view_amounts %}
Sous-total HT
{{ document.subtotalHt|number_format(2, ',', ' ') }} {{ currency }}
{% if document.totalDiscountHt > 0 %}
Remises HT
{{ document.totalDiscountHt|number_format(2, ',', ' ') }} {{ currency }}
{% endif %}
TVA
{{ document.totalVat|number_format(2, ',', ' ') }} {{ currency }}
Total TTC
{{ document.totalTtc|number_format(2, ',', ' ') }} {{ currency }}
{% if is_invoice and can_view_payments %}
Acompte versé
{{ document.totalPaid|number_format(2, ',', ' ') }} {{ currency }}
Reste à payer
{{ document.balanceDue|number_format(2, ',', ' ') }} {{ currency }}
{% endif %}
{% else %}

Les montants ne sont pas accessibles avec vos permissions actuelles.

{% endif %}

Paiement & suivi

{% if can_view_payments and is_invoice and document.status != 'draft' and document.balanceDue > 0 %}Enregistrer un paiement{% endif %}
{% if can_view_payments and is_invoice and document.balanceDue > 0 %}
Paiement en attenteSolde restant à encaisser {{ document.balanceDue|number_format(2, ',', ' ') }} {{ currency }}
{% elseif can_view_payments and is_invoice %}
Facture réglée{{ document.totalPaid|number_format(2, ',', ' ') }} {{ currency }}
{% endif %}

Paiements enregistrés

{% if can_view_payments %}{% for allocation in document.paymentAllocations %}

{{ allocation.payment.paymentDate|date('d/m/Y') }} · {{ allocation.allocatedAmount|number_format(2, ',', ' ') }} {{ currency }}

{% else %}

Aucun paiement enregistré.

{% endfor %}{% else %}

Informations de paiement masquées.

{% endif %}
{% if document.footerNotes or document.paymentTerms %}
{% if document.paymentTerms %}

Conditions de règlement

{{ document.paymentTerms|nl2br }}

{% endif %} {% if document.footerNotes %}

Notes au client

{{ document.footerNotes|nl2br }}

{% endif %}
{% endif %} {% if is_invoice and (document.bankIbanSnapshot or document.bankAccount) %}

Coordonnées bancaires

{{ document.bankLabelSnapshot ?: document.bankAccount.nom }}
{{ document.bankHolderSnapshot ?: document.bankAccount.accountHolder }}
IBAN : {{ document.bankIbanSnapshot ?: document.bankAccount.iban }}
BIC : {{ document.bankBicSnapshot ?: document.bankAccount.bic }}

{% endif %}
{% if is_granted('BILLING_DOCUMENT_VALIDATE', document) and can_refuse_quote %} {% endif %} {% endblock %}