
{% extends 'layout.twig' %}

{% block body %}
<form method="post" name="filtre_facture" id="filtre_facture">
   <div class="contenu clearfix"  id="liste_entete_factures">
        <h1>
        	{{ 'Liste des factures par entêtes' | trad }}
        	<a href="{{ path('Facture.ImpressionFacture.impressionEntete') }}"><button type="button" class="button secondaire">{{ 'Impression des entêtes de factures' | trad }}</button></a>
        </h1>
        {{ ariane() }}
        <div class="filtreBtn">
            <button type="submit" class="principal button btn_filtre last button_right">{{ 'Filtrer' | trad }}</button>
            <button class="secondaire button ajout button_right" id="buttonCollapseFA"  data-toggle="collapse" href="#filtre_avances" >
                {{ 'Filtres avancés' | trad }}
            </button>
        </div>
        <div id="filtre_avances" class="collapse clearfix">
            {{ filtreAvance(post, filtreAvance, initFiltreAvance) }}  
        </div>
        <div class="resultat_filtre">
            {{ bullFiltre(post, 'filtre_facture') }}
        </div>
        <table class="table table-hover">
        	<thead class="thead-dark">
            	<tr>
                	<th scope="col" width="5%">{{ triTable('TYPE',  infoPagination.filter.tri_TYPE, 'Type' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col" width="8%">{{ triTable('NUM_FACT',  infoPagination.filter.tri_NUM_FACT, 'N° Enreg.' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col" width="100px">{{ triTable('FACT_FOU',  infoPagination.filter.tri_FACT_FOU, 'Réf. Frs' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col">{{ triTable('CODE_STE',  infoPagination.filter.tri_CODE_STE, 'Société' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col">{{ triTable('CODE_FOUR',  infoPagination.filter.tri_CODE_FOUR, 'Fournisseur' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col" width="8%">{{ triTable('DATE_ENR',  infoPagination.filter.tri_DATE_ENR, 'Enreg. le' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col" width="8%">{{ triTable('DTAE_ECH',  infoPagination.filter.tri_DTAE_ECH, 'Echéance le' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col">{{ triTable('TOTAL_HT',  infoPagination.filter.tri_TOTAL_HT, 'Total HT' | trad, '', '', 'filtre_facture') }}</th>
                    <th scope="col">{{ triTable('TOTAL_TTC',  infoPagination.filter.tri_TOTAL_TTC, 'Total TTC' | trad, '', '', 'filtre_facture') }}</th>
                </tr>
            </thead>
        	<tbody>
            	<tr class="recherche">
                	<td>{{ filterSelect('TYPE', infoPagination.filter.filter_TYPE, listeType, 'filtre_facture','','','','', 'Type' | trad) }}</td>
                    <td>{{ filterTable('NUM_FACT', infoPagination.filter.filter_NUM_FACT, '', '', '', 'filtre_facture','', 'N° Enreg.' | trad) }}</td>
                    <td>{{ filterTable('FACT_FOU', infoPagination.filter.filter_FACT_FOU, '', '', '', 'filtre_facture','', 'Réf. Frs' | trad) }}</td>
                    <td>{{ zoomFilter('egal_SOCIETE'~spliter()~'RAIS_SOC', infoPagination.filter['filter_egal_SOCIETE'~spliter()~'RAIS_SOC'], '', 'filtre_facture', path('Ajax.liste.societe'), 'Liste des sociétés' | trad, '','', 'Société' | trad) }}</td>
                    <td>{{ zoomFilter('CODE_FOUR'~spliter()~'RS', infoPagination.filter['filter_CODE_FOUR'~spliter()~'RS'], '', 'filtre_facture', path('Ajax.liste.fournisseur'), 'Liste des fournisseurs' | trad, '','', 'Fournisseur' | trad) }}</td>
                    <td>{{ filterTable('date_DATE_ENR', infoPagination.filter.filter_date_DATE_ENR, '', '', '','filtre_facture', 'datepicker', 'Enreg. le' | trad) }}</td>
                    <td>{{ filterTable('date_DTAE_ECH', infoPagination.filter.filter_date_DTAE_ECH, '', '', '','filtre_facture', 'datepicker', 'Echéance le' | trad) }}</td>
                    <td>{{ filterTable('montant_TOTAL_HT', infoPagination.filter.filter_montant_TOTAL_HT, '', '', '', 'filtre_facture','', 'Total HT' | trad) }}</td>
                    <td>{{ filterTable('montant_TOTAL_TTC', infoPagination.filter.filter_montant_TOTAL_TTC, '', '', '', 'filtre_facture','', 'Total TTC' | trad) }}</td>
                </tr>
                {% for facture in factures %}
                <tr id="facture{{ facture.NUM_FACT }}">
                    <td >{{ listeType[facture.TYPE] }}</td>
                    <td class="montant toggleSlide" onclick="toggleSlide('{{ path('Facture.ajax.ligneListeEntete') }}' , 'facture{{ facture.NUM_FACT }}detail', {id : {{ facture.NUM_FACT }} } );">{{ facture.NUM_FACT }}</td>
                    <td>{{ facture.FACT_FOU }}</td>
                    <td>{{ facture.CODE_STE|societeTrad | convert_encoding('UTF-8', 'ISO-8859-1') }}{% if facture.CODE_STE!='' %} ({{ facture.CODE_STE }}){% endif %}</td>
                    <td>{{ facture.RS | convert_encoding('UTF-8', 'ISO-8859-1') }}{% if facture.CODE_FOUR!='' %} ({{ facture.CODE_FOUR }}){% endif %}</td>
                    <td>{{ facture.DATE_ENR | dateTrad }}</td>
                    <td>{{ facture.DTAE_ECH | dateTrad }}</td>
                    <td class="montant">{{ facture.TOTAL_HT | prix }}</td>
                    <td class="montant">{{ facture.TOTAL_TTC | prix }}</td>
                </tr>
                <tr class="detail_ligne hide_detail" id="facture{{ facture.NUM_FACT }}detail" ></tr>
                {% endfor %}
            </tbody>
        </table>
        {{ paginations(path('Facture.ListesFactureController.listeEntete'),infoPagination.nombreDePage, infoPagination.page, infoPagination.post) }}
    </div>
</form>
{% endblock %}