{% if app_logo is not defined %}
{% set app_logo = societe.logo_path %}
{% endif %}
<table>
<tr>
{% if format_ndf in ['by-id','by-projet-salarie-mois'] %}
{% set document = document_list[0] %}
{% set salarie = document.getSalarie %}
<td class="100p text-center" colspan="3"><strong>Note de frais de {{ salarie.getPrenomTiers }} {{ salarie.getNomTiers }}</strong></td>
{% elseif format_ndf in ['by-mois'] %}
<td class="100p text-center" colspan="3"><strong>Note de frais de {{ periode }}</strong></td>
{% elseif format_ndf in ['by-salarie-mois'] %}
{% set document = document_list[0] %}
{% set salarie = document.getSalarie %}
<td class="100p text-center" colspan="3"><strong>Note de frais de {{ salarie.getPrenomTiers }} {{ salarie.getNomTiers }} du {{ periode }}</strong></td>
{% elseif format_ndf in ['by-projet'] %}
<td class="100p text-center" colspan="3"><strong>Note de frais du projet {{ projet }}</strong></td>
{% endif %}
</tr>
<tr>
<td class="25p">
<table>
<tr>
<td>
<img class="brand-logo" alt="stack admin logo" src="../assets/images/logo/{{ app_logo }}" height="80">
<p style="padding-top: 30px">{{ societe.rue }} - {{ societe.code_postal }} {{ societe.ville }}</p>
<p style="padding-top: -2px">{{ societe.telephone }}</p>
<p style="padding-top: -2px">{{ societe.site_web }}</p>
</td>
</tr>
</table>
</td>
<td class="50p">
<table>
{% if format_ndf in ['by-id','by-projet-salarie-mois'] %}
{% set document = document_list[0] %}
{% set salarie = document.getSalarie %}
<tr>
<td class="15p">Client :</td>
<td class="66p">{{ document.getProjet.getSociete.getLibSociete }}</td>
</tr>
<tr>
<td class="15p">Production :</td>
<td class="66p">{{ document.getProjet.getNumProd }}</td>
</tr>
<tr>
<td class="15p">Projet :</td>
<td class="66p">{{ document.getProjet.getLibProjet }}</td>
</tr>
<tr>
<td class="15p">Demandeur :</td>
<td class="66p">{{ salarie.getPrenomTiers }} {{ salarie.getNomTiers }}</td>
</tr>
<tr>
<td class="15p">Date :</td>
</tr>
{% endif %}
</table>
</td>
<td class="25p">
<table>
<tr><td> </td></tr><tr><td> </td></tr>
<tr>
<td class="50p"></td>
<td class="50p text-right">Imprimer en 2 exemplaires</td>
</tr>
</table>
</td>
</tr>
</table>
{% set tva_list = [0, 5.5, 10, 20] %}
{% set totaux = {} %}
{% set total_0 = 0 %}
{% set total_55 = 0 %}
{% set total_10 = 0 %}
{% set total_20 = 0 %}
{% set total_ht = 0 %}
{% set total_tva = 0 %}
{% set total_ttc = 0 %}
{% set total_avance = 0 %}
<table class="table-bordered font-size-small mt-50">
<thead>
<tr>
<th class="8p" rowspan="2">Date</th>
<th class="15p" rowspan="2">Désignation</th>
{# 7 th type #}
{% for type in type_list %}
{% set totaux = totaux|merge({(type): 0}) %}
<th class="5p text-center" rowspan="2">{{ type }}</th>
{% endfor %}
<th class="10p text-center" colspan="4">Montant TVA</th>
<th class="10p text-right" rowspan="2">Montant TTC</th>
</tr>
<tr>
{% for taux_tva in tva_list %}
<th class="text-right">{{ taux_tva }}%</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for document in document_list %}
{% set ventilation_tva = {'A':0,'B':0,'C':0,'D':0} %}
{{ document.orderDocLigneByTauxTva() }}
<tr>
<td class="text-center" style="vertical-align: middle;">{{ document.getDateNdf|date('d/m/Y') }}</td>
<td class="">{{ document.libelle }}</td>
{# <td class="">{{ document.libelle }} - {{ ligne.getTauxTva * 100 }}%</td>#}
{% for row, ligne in document.getDocumentLignes %}
{% if row == 0 %}
{% for type in type_list %}
{% if ligne.getLibelle == type %}
{% set totaux = totaux|merge({(type): totaux[type] + document.getMontantHt}) %}
<td class="text-center">{{ document.getMontantHt|format_euro }}</td>
{% else %}
<td class="text-center">{{ 0|format_euro }}</td>
{% endif %}
{% endfor %}
{% endif %}
{% for i in 'A'..'D' %}
{% set lettre = '' %}
{% if ligne.getTauxTva == 0 %}{% set lettre = 'A' %}{% endif %}
{% if ligne.getTauxTva == 0.055 %}{% set lettre = 'B' %}{% endif %}
{% if ligne.getTauxTva == 0.1 %}{% set lettre = 'C' %}{% endif %}
{% if ligne.getTauxTva == 0.2 %}{% set lettre = 'D' %}{% endif %}
{% if lettre == i %}
{% set ventilation_tva = ventilation_tva|merge({(i): ventilation_tva[i] + ligne.getMontantTva}) %}
{% endif %}
{% endfor %}
{% if ligne.getTauxTva == 0 %}{% set total_0 = total_0 + ligne.getMontantTva %}{% endif %}
{% if ligne.getTauxTva == 0.055 %}{% set total_55 = total_55 + ligne.getMontantTva %}{% endif %}
{% if ligne.getTauxTva == 0.1 %}{% set total_10 = total_10 + ligne.getMontantTva %}{% endif %}
{% if ligne.getTauxTva == 0.2 %}{% set total_20 = total_20 + ligne.getMontantTva %}{% endif %}
{% set total_ht = total_ht + ligne.getMontantHt %}
{% set total_tva = total_tva + ligne.getMontantTva %}
{% set total_ttc = total_ttc + (ligne.getMontantHt + ligne.getMontantTva) %}
{% if ligne.getLibelle == 'Avance' %}
{% set total_avance = total_avance + ligne.getPuht %}
{% endif %}
{% endfor %}
{% for montant_tva in ventilation_tva %}
<td class="text-center">{{ montant_tva|format_euro }}</td>
{% endfor %}
<td class="text-right" style="vertical-align: middle;">{{ (document.getMontantHt + document.getMontantTva)|format_euro }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<td class="text-center" colspan="2" style="vertical-align: middle;">TOTAUX</td>
{% for total in totaux %}
<td class="text-center">{{ total|format_euro }}</td>
{% endfor %}
<td class="text-right" style="vertical-align: middle;">{{ total_0|format_euro }}</td>
<td class="text-right" style="vertical-align: middle;">{{ total_55|format_euro }}</td>
<td class="text-right" style="vertical-align: middle;">{{ total_10|format_euro }}</td>
<td class="text-right" style="vertical-align: middle;">{{ total_20|format_euro }}</td>
<td class="text-right" style="vertical-align: middle;">{{ total_ttc|format_euro }}</td>
</tr>
</tfoot>
</table>
<table class="table-bordered mt-1">
<tbody>
<tr>
<td class="25p" rowspan="3">Signature Demandeur :
{% if format_ndf in ['by-id','by-projet-salarie-mois'] %}
{% set document = document_list[0] %}
{% set salarie = document.getSalarie %}<br>{{ salarie.getPrenomTiers }} {{ salarie.getNomTiers }}
{% endif %}
</td>
<td class="15p" rowspan="3">Signature Production :</td>
<td class="15p" rowspan="3">Signature Gestion :</td>
<td class="10p">TOTAL HT :</td>
<td class="10p">{{ total_ht|format_euro }}</td>
<td class="15p">Montant avance :</td>
<td class="10p">{{ total_avance|format_euro }}</td>
</tr>
<tr>
<td class="">TOTAL TVA :</td>
<td class="">{{ total_tva|format_euro }}</td>
<td class="" rowspan="2">Montant à devoir :</td>
<td class="" rowspan="2">{{ (total_ttc-total_avance)|format_euro }}</td>
</tr>
<tr>
<td class="">TOTAL TTC :</td>
<td class="">{{ total_ttc|format_euro }}</td>
</tr>
</tbody>
</table>