<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="ECO000015" 
	label="ECO. Analyse des facturation" 
	title="= 'Analyse facturation par ' +  SELECT.GROUPBY_LABEL + ' de ' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL " 
	database="iCTI" 
	swf="*CTI_view1" 
	globals="ECO_globals.XML" 
	componentsFile="ECO_components.XML"
	dboptimizer="ECO_dboptimizer.XML"
	softCode="iCTI_eco">
	
	<VIEWPROPERTIES componentName="PROPERTIES_FACTURES"/>
	<VIEWPROPERTIES componentName="PROPERTIES_GROUPBY"/>
	
	
	<SELECTIONS label="Paramètres de l'analyse" displayText="">
		<GROUP label="Période">
			<FIELD name="PERIODE" label="" UI="combo" tree="true" width="200" default="2010-01-01" globalListProvider="PERIODE_DEBUT">
			</FIELD>
			<FIELD name="TOPERIODE" label="au" UI="combo" tree="true" width="200" default="2010-01-31" globalListProvider="PERIODE_FIN">
			</FIELD>
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" label="" UI="combo" width="200" default="ART" tree="true">
				<OPTION label="Site" data="SIT" treeLevel="1"  globalListProvider="SITE_GROUPBY"/>
				<OPTION label="Article" data="ART" treeLevel="1"  globalListProvider="ARTICLE_GROUPBY"/>
				<OPTION label="Compte" data="CPA" treeLevel="1"  globalListProvider="COMPTE_ARTICLE_GROUPBY"/>
				<OPTION label="Fournisseur" data="FOU" treeLevel="1"  globalListProvider="FOURNISSEUR_GROUPBY"/>
				<OPTION label="Gestionnaire" data="GES" treeLevel="1"  globalListProvider="GESTIONNAIRE_GROUPBY"/>
				<OPTION label="Lieu" data="LIE" treeLevel="1"  globalListProvider="LIEU_GROUPBY"/>
				<OPTION label="Unité fonctionnelle" data="UFO" treeLevel="1"  globalListProvider="UNITE_FONCTIONNELLE_GROUPBY"/>
				<OPTION label="Facture" data="FAC" treeLevel="1"  />
				<OPTION label="Commande" data="CMD" treeLevel="1"  />
				<OPTION label="Source de données" data="PVD" treeLevel="1"  globalListProvider="PROVIDER_GROUPBY"/>
			</FIELD>
			<FIELD name="GROUPBY_TAB" width="100" label="Présentation" UI="combo" default="AUTO" visible="= SELECT.GROUPBY_2 != '-1' ">
				<OPTION label="Automatique" data="AUTO"/>
				<OPTION label="Arbre" data="TREE"/>
				<OPTION label="Onglet" data="TAB"/>
			</FIELD>
		</GROUP>
		<GROUP label="">
			<FIELD name="GROUPBY_2" label="" width="200" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de second niveau" data="-1"/>
				<OPTION label="Site" data="SIT" treeLevel="1"  globalListProvider="SITE_GROUPBY"/>
				<OPTION label="Article" data="ART" treeLevel="1"  globalListProvider="ARTICLE_GROUPBY"/>
				<OPTION label="Compte" data="CPA" treeLevel="1"  globalListProvider="COMPTE_ARTICLE_GROUPBY"/>
				<OPTION label="Fournisseur" data="FOU" treeLevel="1"  globalListProvider="FOURNISSEUR_GROUPBY"/>
				<OPTION label="Gestionnaire" data="GES" treeLevel="1"  globalListProvider="GESTIONNAIRE_GROUPBY"/>
				<OPTION label="Lieu" data="LIE" treeLevel="1"  globalListProvider="LIEU_GROUPBY"/>
				<OPTION label="Unité fonctionnelle" data="UFO" treeLevel="1"  globalListProvider="UNITE_FONCTIONNELLE_GROUPBY"/>
				<OPTION label="Commande" data="CMD" treeLevel="1"  />
				<OPTION label="Source de données" data="PVD" treeLevel="1"  globalListProvider="PROVIDER_GROUPBY"/>
			</FIELD>
		</GROUP>
		<GROUP label="">
			<FIELD name="GROUPBY_3" label="" width="200" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de troisième niveau" data="-1"/>
				<OPTION label="Site" data="SIT" treeLevel="1"  globalListProvider="SITE_GROUPBY"/>
				<OPTION label="Article" data="ART" treeLevel="1"  globalListProvider="ARTICLE_GROUPBY"/>
				<OPTION label="Compte" data="CPA" treeLevel="1"  globalListProvider="COMPTE_ARTICLE_GROUPBY"/>
				<OPTION label="Fournisseur" data="FOU" treeLevel="1"  globalListProvider="FOURNISSEUR_GROUPBY"/>
				<OPTION label="Gestionnaire" data="GES" treeLevel="1"  globalListProvider="GESTIONNAIRE_GROUPBY"/>
				<OPTION label="Lieu" data="LIE" treeLevel="1"  globalListProvider="LIEU_GROUPBY"/>
				<OPTION label="Unité fonctionnelle" data="UFO" treeLevel="1"  globalListProvider="UNITE_FONCTIONNELLE_GROUPBY"/>
				<OPTION label="Commande" data="CMD" treeLevel="1"  />
				<OPTION label="Source de données" data="PVD" treeLevel="1"  globalListProvider="PROVIDER_GROUPBY"/>
			</FIELD>
		</GROUP>

	</SELECTIONS>
	
	<SELECTIONS componentName="FILTRES_FACTURE_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_FOURNISSEUR_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_ARTICLE_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_PROVIDER_SELECTIONS"/>
		
	<QUERIES>
		<QUERY label=""> 
			<SQL>
				<select><![CDATA[		

					CTISELECT_TREE
						GROUPBY1{[VIEW.GROUPBY_OID_FIELD],, [VIEW.GROUPBY_COD_FIELD],, [VIEW.GROUPBY_TXT_FIELD]}
						GROUPBY1MODE{[GROUPBY_TAB]}
						GROUPBY2{[VIEW.GROUPBY_2_OID_FIELD],, [VIEW.GROUPBY_2_COD_FIELD],, [VIEW.GROUPBY_2_TXT_FIELD]}
						GROUPBY3{[VIEW.GROUPBY_3_OID_FIELD],, [VIEW.GROUPBY_3_COD_FIELD],, [VIEW.GROUPBY_3_TXT_FIELD]}
						OPTIONS{NOTZERO=1}
						INDICATORS{
							SUM(v_eco_view_1.montant_facture_ht),
							SUM(v_eco_view_1.montant_facture_tva),
							SUM(v_eco_view_1.montant_facture_ttc),
							SUM(v_eco_view_1.montant_facture_article_ht_prorata),
							SUM(v_eco_view_1.montant_facture_article_tva_prorata),
						}	
							
					FROM eco.v_lignes_facture_1 v_eco_view_1 
					WHERE v_eco_view_1.date_facture BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.ARTICLE_SELECT]
						[VIEW.FOURNISSEUR_SELECT]
						[VIEW.FACTURE_SELECT]
						[VIEW.PROVIDER_SELECT]
					
					

				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="MFACHT" />
					<FIELD name="MFACTVA" />
					<FIELD name="MFACTTC" />
					<FIELD name="MFACHTP" />
					<FIELD name="MFACTVAP" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINKx label="Liste des factures" shortLabel="Liste factures" view="ECO000011.XML" componentName="ECO_VIEWLINK" >
				<ARGS name="SPEC" >
					<value><![CDATA[
						LINKVARIABLES['GROUPBY'] = '-1'
						LINKVARIABLES['GROUPBY_2'] = 'CMD'
						return 'OK';
			
					]]></value>
				</ARGS>
			</VIEWLINKx>
			<VIEWLINKx label="Liste des lignes de facture" shortLabel="Liste lignes" view="ECO000011.XML" componentName="ECO_VIEWLINK" >
				<ARGS name="SPEC" >
					<value><![CDATA[
						LINKVARIABLES['GROUPBY'] = 'CMD'
						LINKVARIABLES['GROUPBY_2'] = 'CML'
						return 'OK';
			
					]]></value>
				</ARGS>
			</VIEWLINKx>
		</VIEWLINKS>		
		<ONGLET label="Onglet" multiTab="true" >
		
				
			<DATAGRID 	title="" 
						total="true" 
						headerHeight="40" 
						selectRowInRows="= ROW.OID == '-9999997'" 
						otherRowInRows="= ROW.OID == '-9999998'" 
						totalRowInRows="= ROW.OID == '-9999999'"
						variableRowHeight="true" 
						sortable="= SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB'"> 
				
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>
				
				<COLUMN dataField="OID"
					type="Number"
					visible="false" />
				<COLUMN dataField="COD" 
					type="Char" 
					width="100"
					outputFormat="#"
					headerText="Code" 
					textAlign="left" 
					totalComplement="*ROW">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" 
					type="Char" 
					minWidth="110"
					headerText="Texte" 
					textAlign="left" 
					totalComplement="*ROW"/>
					
				<COLUMN dataField="MFACTTC" 
					type="Number" 
					width="80"
					outputFormat="#E"
					visible="true"
					headerText="Total TTC" 
					textAlign="right"
					totalComplement="*ROW" />
				
				
				<COLUMN dataField="MFACHT" 
					type="Number" 
					width="80"
					outputFormat="#E"
					visible="true"
					headerText="Tarif HT" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="MFACTVA" 
					type="Number" 
					width="80"
					outputFormat="#E"
					visible="true"
					headerText="TVA" 
					textAlign="right"
					totalComplement="*ROW" />
				
				<COLUMN dataField="MFACHTP" 
					type="Number" 
					width="80"
					outputFormat="#E"
					visible="true"
					headerText="Tarif HT@LF@(prorata TVA)" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="MFACTVAP" 
					type="Number" 
					width="80"
					outputFormat="#E"
					visible="true"
					headerText="TVA@LF@(prorata TVA)" 
					textAlign="right"
					totalComplement="*ROW" />
				
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>

			
