{% extends 'layout.twig' %}

{% block body %}

    <div class="contenu clearfix"  id="commandes">
    
        <h1>
        	{{ 'Commandes' | trad }}
        	
        	{# {{ Button('Export', false,'', "exportCSV('"~path('Commande.Liste.exportListeLigneHistorisees')~"', 'filtre_commande');") }} #}
			{{ ButtonExport(path('Commande.Liste.exportListeLigneHistorisees'), 'filtre_commande' , path('Ajax.Erreur.popupInformation') , path('Ajax.Outil.appelAsync'), 'Export' ) }}
    	</h1>
    	
    	{{ ariane() }}
    	
    	<div class="tab-content padding-Vert15">
    		<form method="post" name="filtre_commande" id="filtre_commande">
                                               
                <table class="table table-hover">
                  	<thead class="thead-dark">
                        <tr>
                            <th scope="col" width='4%'>{{ triTable('NO_CDE',  infoPagination.filter.tri_NO_CDE, 'Numéro' | trad, '', '', 'filtre_commande') }}</th>
                            <th scope="col" width='4%'>{{ triTable('POSTE',  infoPagination.filter.tri_NO_PO, 'Ligne' | trad , '', '', 'filtre_commande') }}</th>
                            <th scope="col" width='20%'>{{ triTable('CODE_ART',  infoPagination.filter.CODE_ART, 'Article' | trad, '', '', 'filtre_commande') }}</th>
                            <th scope="col">{{ triTable('DESIGNAT',  infoPagination.filter.DES_SOMM, 'Désignation' | trad, '', '', 'filtre_commande') }}</th>
                            <th scope="col" width='10%' colspan="2">{{ triTable('QTE_COM',  infoPagination.filter.tri_QTE_COMM, 'Qté comm.' | trad, '', '', 'filtre_commande') }}</th>
                            <th scope="col" width='10%'>{{ triTable('DTELIVCON',  infoPagination.filter.tri_DTELIVCON, 'Délais' | trad, '', '', 'filtre_commande') }}</th>
                        </tr>
                  	</thead>
                    <tbody>
                        <tr class="recherche">
                        	<td>{{ filterTable('NO_CDE', infoPagination.filter.filter_NO_CDE, '', '', '', 'filtre_commande', '', '') }}</td>
                        	<td>{{ filterTable('POSTE', infoPagination.filter.filter_NO_PO, '', '', '', 'filtre_commande', '', '') }}</td>
                        	<td>{{ filterTable('CODE_ART', infoPagination.filter['filter_CODE_ART'], '', 'filtre_commande', '', '') }}</td>
                        	<td>{{ filterTable('DESIGNAT', infoPagination.filter['filter_DES_SOMM'], '', 'filtre_commande', '', '') }}</td>
                        	<td colspan="2">{{ filterTable('QTE_COM', infoPagination.filter.filter_QTE_COMM, '', '', '','filtre_commande') }}</td>
                        	<td>{{ filterTable('DTELIVCON', infoPagination.filter.filter_date_DTELIVCON, '', '', '', 'filtre_commande', 'date','Créé le' | trad) }}</td>
                        </tr>
                    </tbody>
                    {% for commande in listeCde %}
                    	<tr id="commande{{ loop.index }}">
                    		<td>{{ commande.NO_CDE  }}</td>
                    		<td class="loupe">{{ commande.POSTE}}</td>
                    		<td>{{ commande.CODE_ART }}</td>
                    		<td>{{ commande.DESIGNAT }}</td>
                    		<td class="montant">{{ commande.QTE_COM }}</td>
                    		<td>{{ commande.UNITE }}</td>
                    		<td>{{ commande.DLIV_CONT | dateTrad }}</td>
                    	</tr>
                    	<tr id="commande{{ loop.index }}detail" class="detail_ligne hide_detail">
							<td colspan="7">
    							<h5>{{ 'Lignes de la commande' | trad }}</h5>
    								<div class="single">
                    					<p>
                    						<span class="champs_label">{{ 'Remise' | trad }}</span>
    										<span class="resultat">{{ commande.REMISE }}%</span>
                    					</p>
    								</div>
    								<div class="colonne3">
    									<div class="informations">
                        					<p>
                        						<span class="champs_label">{{ 'Prix unitaire' | trad }}</span>
    											<span class="resultat">{{ commande.PX_UNIT | tva}} {{ commande.DEVISE }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Remise' | trad }}</span>
    											<span class="resultat">{{ commande.REMISE }}%</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'TVA' | trad }}</span>
    											<span class="resultat">{{ commande.TVA | tva}}%</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Total HT remisé' | trad }}</span>
    											<span class="resultat">{{ remise(commande.PX_UNIT*commande.QTE_COM, commande.REMISE) | tva}}  {{ commande.DEVISE }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'TTC remisé' | trad }}</span>
    											<span class="resultat">{{ remise(commande.PX_UNIT*commande.QTE_COM, commande.REMISE) * ((commande.TVA/100)+1) | tva}} {{ commande.DEVISE }}</span>
                        					</p>
                    					</div>
    								</div>
    								<div class="colonne3">
										<div class="informations">
                        					<p>
                        						<span class="champs_label">{{ 'DA' | trad }}</span>
    											<span class="resultat">{{ commande.NUM_DA }} / {{ commande.NO_POS_DA }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Demandeur' | trad }}</span>
    											<span class="resultat">
													{% if commande.DEMANDEUR %}
														{{ commande.DEMANDEUR_NOM }} ({{ commande.DEMANDEUR }})
													{% endif %}
												</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'SITE' | trad }}</span>
    											<span class="resultat">{{ commande.SITE_STK }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Saisie de réception ?' | trad }}</span>
    											<span class="resultat">{{ commande.RECEP_AUTO | boolTrad }}</span>
                        					</p>
                    					</div>
    								</div>
    								<div class="colonne3 last">
										<div class="informations">
                        					<p>
                        						<span class="champs_label">{{ 'Sous-famille' | trad }}</span>
    											<span class="resultat">{{ convertLibelleGlobal('SousFamille', '' , commande.SFAMILLE)}} {% if commande.SFAMILLE %}({{ commande.SFAMILLE }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Section d\'imputation' | trad }}</span>
    											<span class="resultat">{{ convertLibelleGlobal('Sectimpu', '' , commande.SI)}} {% if commande.SI %}({{ commande.SI }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Code compl.' | trad }}</span>
                        						<span class="resultat">{{ convertLibelleGlobal('Codecomp', '' , commande.CDC)}} {% if commande.CDC %}({{ commande.CDC }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'ScptAna' | trad }}</span>
    											<span class="resultat">{{ convertLibelleGlobal('Sscptana', '' , commande.SCA)}} {% if commande.SCA %}({{ commande.SCA }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Accord-cadre' | trad }}</span>
    											<span class="resultat">{{ convertLibelleGlobal('Acccadre', '' , commande.ACCORCA)}} {% if commande.ACCORCA %}({{ commande.ACCORCA }}){% endif %}</span>
                        					</p>
                    					</div>
    								</div>
                        		<h5>{{ 'Détail Entête' | trad }}</h5>
                        			<div class="colonne3">
                        				<div class="informations">
                        					<p>
                        						<span class="champs_label">{{ 'Fournisseur' | trad }}</span>
    											<span class="resultat">{{ convertLibelleGlobal('Fourniss', '' , commande.CODE_FOU)}} {% if commande.CODE_FOU %}({{ commande.CODE_FOU }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Acheteur' | trad }}</span>
    											<span class="resultat">{{ commande.Acheteur_NOM }} {% if commande.ACH %}({{ commande.ACH }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Societe' | trad }}</span>
    											<span class="resultat">
													{% if commande.CODE_STE %}
														{{ commande.Societe_RAIS_SOC }} ({{ commande.CODE_STE }})
													{% endif %}
												</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Section d\'imputation' | trad }}</span>
    											<span class="resultat">{{ convertLibelleGlobal('Sectimpu', '' , commande.SECTIMP)}} {% if commande.SECTIMP %}({{ commande.SECTIMP }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Code compl.' | trad }}</span>
                        						<span class="resultat">{{ convertLibelleGlobal('Codecomp', '' , commande.CODECOMP)}} {% if commande.CODE_COMP %}({{ commande.CODE_COMP }}){% endif %}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'ScptAna' | trad }}</span>
    											<span class="resultat">{{ convertLibelleGlobal('Sscptana', '' , commande.SSCPTEANA)}} {% if commande.SSCPTEANA %}({{ commande.SSCPTEANA }}){% endif %}</span>
                        					</p>
                        				</div>
                        			</div>
                        			<div class="colonne3">
                        				<div class="informations">
                        					<p>
                        						<span class="champs_label">{{ 'Type' | trad }}</span>
    											<span class="resultat">{{ commande.TYP_DOC  }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Date création' | trad }}</span>
    											<span class="resultat">{{ commande.DTE_CREAT | dateTrad  }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Date de validation' | trad }}</span>
    											<span class="resultat">{{ commande.DATE_VAL | dateTrad  }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Date période' | trad }}</span>
    											<span class="resultat">{{ commande.DTE_PER | dateTrad  }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Date A/R' | trad }}</span>
    											<span class="resultat">{{ commande.DTE_AR | dateTrad  }}</span>
                        					</p>
                        				</div>
                        			</div>
                        			<div class="colonne3 last">
                        				<div class="informations">
                        					<p>
                        						<span class="champs_label">{{ 'Emetteur' | trad }}</span>
    											<span class="resultat">
													{% if commande.CTR_EMETT  %}
														{{ commande.CentreEmet_RAIS_SOC }} ({{ commande.CTR_EMETT  }})
													{% endif %}
												</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Livraison' | trad }}</span>
    											<span class="resultat">
													{% if commande.CTR_LIV  %}
														{{ commande.CentreLivr_RAIS_SOC }} ({{ commande.CTR_LIV  }})
													{% endif %}
												</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Total HT' | trad }}</span>
    											<span class="resultat">{{ commande.TOTAL_HT | tva}} {{ commande.DEVISE }}</span>
                        					</p>
                        					<p>
                        						<span class="champs_label">{{ 'Total TTC' | trad }}</span>
    											<span class="resultat">{{ commande.TOTAL_TTC | tva}} {{ commande.DEVISE }}</span>
                        					</p>
                        				</div>
                        			</div>
                    		</td>
                    	</tr>
                    {% endfor %}
                </table>
    			{{ paginations(path('Commande.Liste.listeLigne'),infoPagination.nombreDePage, infoPagination.page, infoPagination.post, '') }}
    		
    		</form>
        </div>
    </div>

{% endblock %}