<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="COMPTA000025" label="Justificatif échéancier fournisseur" title="= 'Justificatif échéancier fournisseur  (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'" database="iCTI" swf="*CTI_view1" globals="COMPTA_globals.XML" dboptimizer="COMPTA_dboptimizer.XML" componentsFile="COMPTA_components.XML" softCode="iCTI_compta" helpFile="iCTI_COMPTA_COMPTA000025.HTML">
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
		<PROPERTY name="TRT_SELECT">
			<value><![CDATA[[EVAL 
				
				if ('[TRT]' == 'P') {
					return "AND ecriture_exclue = '0'";
				}
				if ('[TRT]' == 'X') {
					return "AND ecriture_exclue = '1'";
				}
				return "";
				
			EVAL]]]></value>
		</PROPERTY>
		
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse"  displayText="= var display:String = '';
		
						if (SELECT.TRT == 'P') {
							display = display + ' Factures à payer';
						}
						if (SELECT.TRT == 'X') {
							display = display + ' Lignes exclues';
						}
						
						return display;
						">
		
		<GROUP>
			<FIELD name="PERIODE" label="Période échéance" UI="combo" tree="true" width="200" default="2015-01-01" globalListProvider="DATE_DEBUT">
			</FIELD>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2015-01-31" globalListProvider="DATE_FIN">
			</FIELD>
		</GROUP>
		<GROUP label="">
			<FIELD name="TRT" label="Traitement" width="200" UI="combo" default="-1">
				<OPTION label="Pas de sélection" data="-1" />
				<OPTION label="Factures à payer" data="P" />
				<OPTION label="Lignes exclues" data="X" />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="ECRITURES_FOURNISSEUR_SELECTIONS"/>
	<SELECTIONS componentName="ECRITURES_SELECTIONS_COMPLEMENTAIRES"/>
	<QUERIES>
		<QUERY>
			<SQL>
				<select><![CDATA[		
					SELECT 
						v_historique_ecritures_1.site_code, 
						v_historique_ecritures_1.cle_originale, 
						v_historique_ecritures_1.mois_comptable, 
						v_historique_ecritures_1.date_ecriture,
						v_historique_ecritures_1.date_echeance,
						v_historique_ecritures_1.compte_numero, 
						v_historique_ecritures_1.compte_extra_numero, 
						v_historique_ecritures_1.journal_code,
						v_historique_ecritures_1.journal_paiement_code,
						v_historique_ecritures_1.mode_paiement_code,
						v_historique_ecritures_1.texte, 
						v_historique_ecritures_1.dossier, 
						v_historique_ecritures_1.piece,
						v_historique_ecritures_1.montant_debit,
						v_historique_ecritures_1.montant_credit, 
						v_historique_ecritures_1.montant_solde_credit, 
						CASE WHEN ecriture_exclue = '0' THEN 'A payer' ELSE 'Exclue' END
						
					FROM compta.v_ecriture_fournisseur_1 v_historique_ecritures_1
					WHERE facture_soldee = '0' AND
						(date_echeance BETWEEN '[PERIODE]' AND '[TOPERIODE]' OR ecriture_exclue <> '0')
						[VIEW.ECRITURES_SELECT]
						[VIEW.ECRITURES_SELECT_COMP]
						[VIEW.TRT_SELECT]
					
					UNION ALL
					
					(SELECT 
 
						'', 
						'',
						-9999999, 
						null,
						null,
						'', 
						'', 
						'',
						'', 
						'',
						'TOTAL '::text || COUNT(*)::text || ' écritures'::text, 
						'', 
						'', 
						SUM(v_historique_ecritures_1.montant_debit),
						SUM(v_historique_ecritures_1.montant_credit), 
						SUM(v_historique_ecritures_1.montant_solde_credit), 
						''
						
						
					FROM compta.v_ecriture_fournisseur_1 v_historique_ecritures_1
					WHERE facture_soldee = '0' AND
						(date_echeance BETWEEN '[PERIODE]' AND '[TOPERIODE]' OR ecriture_exclue <> '0')
						[VIEW.ECRITURES_SELECT]
						[VIEW.ECRITURES_SELECT_COMP]
						[VIEW.TRT_SELECT]
					)


					ORDER BY 2
				]]></select>
				<FIELDS>
					<FIELD name="SIT"/>
					<FIELD name="CLE"/>
					<FIELD name="MOI"/>
					<FIELD name="DAT"/>
					<FIELD name="DATECH"/>
					<FIELD name="CPT"/>
					<FIELD name="CPX"/>
					<FIELD name="JRN"/>
					<FIELD name="JPA"/>
					<FIELD name="MPA"/>
					<FIELD name="TXT"/>
					<FIELD name="FAC"/>
					<FIELD name="PIE"/>
					<FIELD name="DEB"/>
					<FIELD name="CRE"/>
					<FIELD name="SOL"/>
					<FIELD name="TRT"/>
					
				</FIELDS>
			</SQL>
			
		</QUERY>
		
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
		</VIEWLINKS>
		<ONGLET excelLabel="Liste écritures" label="Liste écritures">
			<DATAGRID title="" total="true" headerHeight="36" variableRowHeight="true" totalRowInRows="= ROW.MOI == '-9999999'">
				<COLUMN dataField="MOI" type="Date" inputFormat="AAAAMM" outputFormat="MM/YYYY" width="70" visible="true" headerText="Mois comptable" textAlign="left"/>
				<COLUMN dataField="DAT" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD MMM YY" width="70" visible="true" headerText="Date écriture" textAlign="left"/>
				
				<COLUMN dataField="SIT" type="Char" width="40" visible="true" fixed="false" headerText="Site" textAlign="left" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="CLE" type="Char" width="90" visible="true" fixed="false" headerText="Clé" textAlign="left" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="CPX" type="Char" width="65" visible="true" headerText="Compte extra"/>
				<COLUMN dataField="FAC" type="Char" width="80" fixed="false" visible="true" headerText="Facture - Dossier" textAlign="left"/>
				<COLUMN dataField="PIE" type="Char" width="80" fixed="false" visible="true" headerText="Pièce" textAlign="left"/>
				<COLUMN dataField="JRN" type="Char" width="40" visible="true" headerText="Jrn"/>
				<COLUMN dataField="JPA" type="Char" width="40" visible="true" headerText="Jrn Pai"/>
				<COLUMN dataField="MPA" type="Char" width="40" visible="true" headerText="Mode Pai"/>
				<COLUMN dataField="DATECH" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD MMM YY" width="70" visible="true" headerText="Date échéance" textAlign="left"/>
				
				<COLUMN dataField="IND" type="Number" outputFormat="= VIEW.INDICATEUR_FORMAT" visibleCondition="SELECT.INDICATEUR != '-1'" width="100" headerText="'Indicateur : ' + VIEW.INDICATEUR_ENTETE" headerTextCalc="true" align="right" totalFunction="sum" />
				
				<COLUMN dataField="DEB" type="Number" outputFormat="#,00E" width="100" headerText="Débit" align="right" totalFunction="sum"/>
				<COLUMN dataField="CRE" type="Number" outputFormat="#,00 E" width="90" headerText="Crédit" align="right" totalFunction="sum"/>
				<COLUMN dataField="SOL" type="Number" outputFormat="#,00E" width="100" headerText="Solde" align="right" totalFunction="sum"/>
				
				<COLUMN dataField="TXT" type="Char" minWidth="70" fixed="false" visible="true" headerText="Texte" textAlign="left" totalFunction="text" totalComplement="*ROW"/>
				
				<COLUMN dataField="TRT" type="Char" width="70" fixed="false" visible="true" headerText="Traitement" textAlign="left" totalFunction="text" totalComplement="*ROW"/>
				
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
