
{% block body %}

<td colspan="9"  id="ligneAffichage{{ id }}">
    <div class="informations_facture">
        
    	{# {% if entete.REFUSEE|boolSql == 1  %}<p class="titre_detail"><span>{{ 'Refusée ' | trad }}</span></p>
        {% elseif entete.ATT_SIG|boolSql == 1  %}<p class="titre_detail"><span>{{ 'En attente de signature' | trad }}</span></p>
        {% elseif entete.BON_A_PAY|boolSql == 1  %}<p class="titre_detail"><span>{{ 'Signée ' | trad }}</span></p>
        {% endif %} #}
        	
        <div class="colonne4">
            <div class="informations">
            	<p>
                	<span class="champs_label">{{ 'Emise le' | trad ~ colon() }}</span>
                	<span class="resultat">{{ entete.DATE_FAFO | dateTrad }}</span>
                </p>
                <p>
                	<span class="champs_label">{{ 'Période' | trad ~ colon() }}</span>
                	<span class="resultat">{{ entete.DATE_PER | dateTrad }}</span>
                </p>
            </div>
        </div>
        <div class="colonne4">
            <div class="informations">
                <p>
                	<span class="champs_label">{{ 'Ordo.' | trad ~ colon() }}</span>
                	<span class="resultat">{{ entete.ORDO }}</span>
                </p>
                <p>
                	<span class="champs_label">{{ 'Commande' | trad ~ colon() }}</span>
                	<span class="resultat">{{ entete.NUM_CDE }}</span>
                </p>
            </div>
        </div>
        <div class="colonne4">
            <div class="informations">
            	<p>
            		<span class="champs_label">{{ 'Dernier règlement' | trad ~ colon() }}</span>
                	<span class="resultat">{{ entete.DTE_DERNREG | dateTrad }}</span>
            	</p>
            	<p>
                	<span class="champs_label">{{ 'Montant total réglé' | trad ~ colon() }}</span>
                	<span class="resultat">{{ entete.MT_TOTREG | prix }} {{ entete.DEVISE }}</span>
                </p>
            </div>
        </div>
        <div class="colonne4">
            <div class="informations">
            	<p>
            		<span class="champs_label">{{ 'Entête :' | trad }}</span>
                	<span class="resultat">
                        {% if entete.ENT_COMPT|boolSql == true %}{{ 'En compta' | trad }}
                        {% elseif entete.ENT_VALID|boolSql == true %}{{ 'Validée' | trad }}
                        {% endif %}
                    </span>
            	</p>
                <p>
                	<span class="champs_label">{{ 'Affectation' | trad ~ colon() }}</span>
                	<span class="resultat">
                	    {% if entete.AFF_COMPT|boolSql == true %}{{ 'En compta' | trad }}
                        {% elseif entete.AFF_VALID|boolSql == true %}{{ 'Validée' | trad }}
                        {% endif %}
                   </span>
                </p>
                <p>
                	<span class="champs_label">{{ 'BAP' | trad ~ colon() }}</span>
                	<span class="resultat">
                	    {% if entete.BON_A_PAY|boolSql == true %}
                	        {{ entete.DATE_BAP | dateTrad }}
                	    {% endif %}
                        {% if entete.BAP_COMPT|boolSql == true %}, {{ 'En compta' | trad }}
                        {% endif %}
                   </span>
                </p>
            </div>
        </div>
    </div>
    <table class="table table-hover">
    	<thead>
    		<tr>
				{% if easyDemat == 0 %}
    			<th scope="col">{{ 'Cde' | trad }}</th>
    			<th scope="col">{{ 'BR' | trad }}</th>
				{% endif %}
    			<th scope="col">{{ 'Désignation' | trad }}</th>
    			<th scope="col">{{ 'Désignation Compl.' | trad }}</th>
				{% if easyDemat == 0 %}
    			<th scope="col">{{ 'Expédition' | trad }}</th>
    			<th scope="col">{{ 'TP' | trad }}</th>
				{% endif %}
    			<th scope="col">{{ 'Sous-famille' | trad }}</th>
    			<th scope="col">{{ 'TVA' | trad }}</th>
    			<th scope="col">{{ 'Type de TVA' | trad }}</th>
    			<th scope="col">{{ 'Quantité' | trad }}</th>
    			<th scope="col">{{ 'PU remisé' | trad }}</th>
    			<th scope="col">{{ 'Montant' | trad }}</th>
    			<th scope="col">{{ 'Section d\'imputation' | trad }}</th>
    			<th scope="col">{{ 'Code Complémentaire' | trad }}</th>
    			<th scope="col">{{ 'Sous-Compte d\'analyse' | trad }}</th>
            </tr>
        </thead>
        <tbody>
    		{% for ligne in lignes %}
    			<tr>
					{% if easyDemat == 0 %}
    				<td>{{ ligne.NUM_CDE~' '~ligne.NUM_LICDE }}</td>
    				<td>{{ ligne.NUM_BR~' '~ligne.NUM_LIBR  }}</td>
					{% endif %}					
    				<td>{{ ligne.DESIGNAT  | convert_encoding('UTF-8', 'ISO-8859-1') }}</td>
    				<td>{{ ligne.CONTMEMO  | convert_encoding('UTF-8', 'ISO-8859-1') }} </td>
					{% if easyDemat == 0 %}
    				<td>{{ ligne.NUM_EXP }} </td>
    				<td>{{ ligne.NUM_TERME }} </td>
					{% endif %}					
    				<td>{{ ligne.CODE_SFAM }} </td>
    				<td class="montant">{{ ligne.TAUX_TVA }} </td>
    				<td>{{ ligne.TYPE_TVA }} </td>
    				<td class="montant">{{ ligne.QUANTITE|number_format(3, '.', ' ') }} </td>
    				<td class="montant">{{ ligne.PU_REMISE | prixUnitaire }} {{ entete.DEVISE }} </td>
    				<td class="montant">{{ ligne.MONTANT | prix }} {{ entete.DEVISE }}</td>
    				<td class="">{{ ligne.CODE_SI }}</td>
    				<td class="">{{ ligne.CODE_CDC }}</td>
    				<td class="">{{ ligne.CODE_SCA }}</td>
                </tr>
             {% endfor %}
        </tbody>
    </table>
    {% if nombreEnregistrement > 1 and affichage == 'notAll' %}
    <div class="lignes_supplementaires" onclick="plusDeLignes('{{ path('Facture.ajax.ligneListeEntete') }}','{{ id }}')">
    	<span class="voir_plus">{{ 'Tout afficher' | trad }} ({{ nombreEnregistrement~' '~('lignes' | trad) }})</span>
    </div>
    {% endif %}
</td>


<script>
function plusDeLignes(path, id)
{
	$.ajax({
	  	dataType : 'html',
  		url: path,
  		data: {'id' : id, 'affichage' : 'all'},
  		type: "POST",
  		success: function(htmlData){
  			var result = $('<div />').append(htmlData).find('#ligneAffichage'+id).html();
            $('#ligneAffichage'+id).html(result);
  		}
  	});
}

ResizableColumns();
</script>
{% endblock %}
