{% extends 'layout.twig' %}

{% block body %}

    <div class="contenu clearfix"  id="facture">
    
        <h1>{{ 'Vos Bons à Payer à signer' | trad }}</h1>
        
        {{ ariane() }}
        
        <div class="tab-content">

        	<h2>{{ 'Synthèse commande du BAP N°' | trad }} {{ facture.NUM_FACT }}</h2>
        	
        	<div class="block_edition">
            	<div class="titre_block">
                	{{ 'Facture' | trad }}
                </div>
                <div class="colonne3">
                	<div class="informations">
                	    <p>
                        	<span class="champs_label">{{ 'N° facture' | trad }}</span>
                            <span class="resultat">{{ facture.NUM_FACT }}</span>
                        </p>
                	    <p>
                        	<span class="champs_label">{{ 'Fournisseur' | trad }}</span>
                            <span class="resultat">{{ convertLibelleGlobal('Fourniss', '', facture.CODE_FOUR) }} ({{ facture.CODE_FOUR }})</span>
                        </p>
                    </div>
                </div>
                <div class="colonne3">
                	<div class="informations">
                	    <p>
                        	<span class="champs_label">{{ 'Enregistrée le' | trad }}</span>
                            <span class="resultat">{{ facture.DATE_ENR | dateTrad }}</span>
                        </p>
               	    	<p>
                        	<span class="champs_label">{{ 'Validée le' | trad }}</span>
                            <span class="resultat">{{ facture.DATE_BAP | dateTrad }}</span>
                        </p>
                    </div>
                </div>
                <div class="colonne3 last">
                	<div class="informations">
                	    <p>
                        	<span class="champs_label">{{ 'Devise' | trad }}</span>
                            <span class="resultat">{{ convertLibelleGlobal('Devise', '', facture.DEVISE) }} ({{ facture.DEVISE }})</span>
                        </p>
                    </div>
                </div>
            </div>
        
            <table class="table table-hover">
              	<thead class="thead-dark">
              		<tr>
              			<th colspan="7">{{ 'Commande' | trad }}</th>
              			<th colspan="2" class="thread_recap">{{ 'Cumul déjà récéptionné' | trad }}</th>
              			<th colspan="3" class="thread_recap">{{ 'Cumul déjà facturé' | trad }}</th>
              			<th colspan="3" class="thread_recap">{{ 'Cumul facture à signer' | trad }}</th>
              			<th colspan="3" class="thread_recap">{{ 'Cumul Total facturé' | trad }}</th>
              		</tr>
                    <tr class="secondeThead">
                        <th scope="col" width="5%">{{ 'CDE' | trad }}</th>
                        <th scope="col" width="5%">{{ 'Ligne' | trad }}</th>
                        <th scope="col">{{ 'Article' | trad }}</th>
                        <th scope="col" colspan="2" class="align-center">{{ 'Qté' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PU' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PT' | trad }}</th>
                        
                        <th scope="col" colspan="1" class="montant thread_recap">{{ 'Qté' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'Mnt' | trad }}</th>
                        
                        <th scope="col" colspan="1" class="montant thread_recap">{{ 'Qté' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PU' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PT' | trad }}</th>
                        
                        <th scope="col" colspan="1" class="montant thread_recap">{{ 'Qté' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PU' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PT' | trad }}</th>
                        
                        <th scope="col" colspan="1" class="montant thread_recap">{{ 'Qté' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PU' | trad }}</th>
                        <th scope="col" colspan="1" class="montant">{{ 'PT' | trad }}</th>
                    </tr>
              	</thead>
                <tbody>
                
                    {% for ligne in listeCde %}
                    
                    	<tr>
                    		<td class="">{% if ligne.NO_CDE %}{{ ligne.NO_CDE }}{% endif %}</td>
                    		<td class="">{% if ligne.NO_CDE %}{{ ligne.NO_PO }}{% endif %}</td>
                    		<td class="">{{ ligne.DES_SOMM }}</td>
                    		<td class="montant">{% if ligne.NO_CDE %}{{ ligne.QTE_COMM | tva }}{% endif %}</td>
                    		<td class="devise">{% if ligne.NO_CDE %}{{ ligne.UNITE }}{% endif %}</td>
                    		<td class="montant">{% if ligne.NO_CDE %}{{ ligne.PU | tva }}{% endif %}</td>
                    		<td class="montant">{% if ligne.NO_CDE %}{{ ligne.MONTANT_TOTAL_CDE | tva }}{% endif %}</td>
                    		
                    		<td class="montant table_recap">{{ ligne.QTE_RECEP | tva }}</td>
                    		<td class="montant table_recap">{{ ligne.MONTANT_TOTAL_RECEP | tva }}</td>
                    		
                    		<td class="montant">{{ ligne.QTE_DEJA_FAC | tva }}</td>
                    		<td class="montant">{{ ligne.PU_DEJA_FAC | tva }}</td>
                    		<td class="montant">{{ ligne.MONTANT_TOTAL_DEJA_FAC | tva  }}</td>

                    		<td class="montant table_recap">{{ ligne.QTE_FAC_A_SIG | tva }}</td>
                    		<td class="montant table_recap">{{ ligne.PU_FAC_A_SIG | tva }}</td>
                    		<td class="montant table_recap">{{ ligne.MONTANT_TOTAL_FAC_A_SIG | tva  }}</td>
                    		
                    		<td class="montant" {% if ligne.QTE_COMM<ligne.QTE_FACTU and ligne.NO_CDE %}style="color:var(--error);"{% endif %}>{{ ligne.QTE_FACTU | tva }}</td>
                    		<td class="montant">{{ ligne.PU_FACTU | tva  }}</td>
                    		<td class="montant" {% if ligne.MONTANT_TOTAL_CDE<ligne.MONTANT_TOTAL_FACTU and ligne.NO_CDE %}style="color:var(--error);"{% endif %}>{{ ligne.MONTANT_TOTAL_FACTU | tva  }}</td>
                    	</tr>
                    
                    {% endfor %}
                
                		<tr class="recherche tr_SSTOTAL">
                			<td colspan="6"></td>
                			<td class="montant">{{ totalCde  | tva}}</td>
                			<td colspan="10"></td>
                			<td class="montant">{{ total | tva }}</td>
                		</tr>
                
                </tbody>
            </table>

        </div>
    
    </div>

{% endblock %}