{% extends 'app/base.html.twig' %} {% set moisNoms = ['', 'Janvier','Février','Mars','Avril','Mai','Juin','Juillet','Août','Septembre','Octobre','Novembre','Décembre'] %} {% set couleurs = ['#4CAF50','#2196F3','#FF9800','#9C27B0','#F44336','#00BCD4','#8BC34A','#607D8B','#E91E63','#795548'] %} {% block title %}Répartition par Type — {% if mois == 0 %}{{ annee }}{% else %}{{ moisNoms[mois] }} {{ annee }}{% endif %}{% endblock %} {% block body %} {# ── En-tête ─────────────────────────────────────────────────────────────────── #}

Répartition par Type

{% if mois == 0 %}Année complète {{ annee }}{% else %}{{ moisNoms[mois] }} {{ annee }}{% endif %}

PDF CSV Retour
{# ── Filtre de période ────────────────────────────────────────────────────────── #}
{% if stats is empty %}
Aucune vente trouvée pour la période sélectionnée. Vérifiez que les ventes ont bien un type renseigné.
{% else %} {# ── Cartes par type ──────────────────────────────────────────────────────────── #}
{% for stat in stats %} {% set color = couleurs[loop.index0 % couleurs|length] %}
{{ stat.type|capitalize }}
{{ stat.pourcentage_montant }}%

{{ stat.total_montant|number_format(2, ',', ' ') }} €

{{ stat.nb_ventes|number_format(0, ',', ' ') }} repas

Moy. {{ stat.moyenne_par_jour|number_format(1, ',', ' ') }} repas/jour

{% endfor %} {# Carte Total #}
TOTAL

{{ totalMontant|number_format(2, ',', ' ') }} €

{{ totalVentes|number_format(0, ',', ' ') }} repas au total

{# ── Graphiques ───────────────────────────────────────────────────────────────── #}
Répartition du Chiffre d'Affaires
Nombre de Repas par Type
{# ── Tableau détaillé ─────────────────────────────────────────────────────────── #}
Détails par Type
{% for stat in stats %} {% set color = couleurs[loop.index0 % couleurs|length] %} {% set prixMoyen = stat.nb_ventes > 0 ? stat.total_montant / stat.nb_ventes : 0 %} {% endfor %}
Type Nb Repas % Repas Montant Total % Montant Prix Moyen Moy./Jour
{{ stat.type|capitalize }} {{ stat.nb_ventes|number_format(0, ',', ' ') }} {{ stat.pourcentage_ventes }}% {{ stat.total_montant|number_format(2, ',', ' ') }} € {{ stat.pourcentage_montant }}% {{ prixMoyen|number_format(2, ',', ' ') }} € {{ stat.moyenne_par_jour|number_format(1, ',', ' ') }}
TOTAL {{ totalVentes|number_format(0, ',', ' ') }} 100% {{ totalMontant|number_format(2, ',', ' ') }} € 100% {{ totalVentes > 0 ? (totalMontant / totalVentes)|number_format(2, ',', ' ') : '0,00' }} €
{# ── Chart.js ─────────────────────────────────────────────────────────────────── #} {% endif %} {% endblock %}