<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="ECO000064" label="ECO. Effets Prix - Volume" 
	 title="= 'Effets Prix - Volume par ' +  SELECT.GROUPBY_LABEL + ' (' + SELECT.DATE_BASE_LABEL + ' : ' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ' vs ' + VIEW.PERIODE_D_LABEL + ' à ' + VIEW.TOPERIODE_D_LABEL + ')' + ' sur le Montant commandé et le ' + SELECT.DATA01_LABEL " 
	 database="iCTI" 
	 swf="*CTI_view1" 
	 softCode="iCTI_eco" 
	 typeEts="" 
	 globals="ECO_globals.XML" 
	 dboptimizer="ECO_dboptimizer.XML"
	 componentsFile="ECO_components.XML" 
	 helpDokuWIkiDir="eco:commandes:effet-prix-volume"  
	 helpDokuWIkiFile="eco000064"  
	 helpFile="iCTI_ECO_ECO000064.HTML">

	<VIEWPROPERTIES componentName="PROPERTIES_COMMANDES"/>
	<VIEWPROPERTIES componentName="PROPERTIES_GROUPBY"/>
	<VIEWPROPERTIES>
        <PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
		<PROPERTY name="DATAFUNC">
			<value><![CDATA[[EVAL 
				// <?php
				
				function ECO000064_calcSQL($data) {
					
					$ctiDivision = "base.cti_division(%s, %s)";
					$countDistinct = "count(DISTINCT CASE WHEN [DATE_BASE2] BETWEEN @date_debut@ AND @date_fin@ THEN %s ELSE null END)";
					$sum = "sum(CASE WHEN [DATE_BASE2] BETWEEN @date_debut@ AND @date_fin@ THEN %s ELSE null END)";
					$periodeDebut = '\'[PERIODE]\'::date';
					$periodeFin = '\'[TOPERIODE]\'::date';
					$periodePrecDebut = '\'[VIEW.PERIODE_D]\'::date';
					$periodePrecFin = '\'[VIEW.TOPERIODE_D]\'::date';
					
					$tmp = sprintf($sum, 'quantite_livraison_approvisionnement');
					
					$toReplace = array(
						'@date_debut@',
						'@date_fin@'
					);
					
					$curPeriod = array(
						$periodeDebut,
						$periodeFin
					);
					
					$prevPeriod = array(
						$periodePrecDebut,
						$periodePrecFin
					);
					
					return str_replace($toReplace, $curPeriod, $tmp) . ', ' . str_replace($toReplace, $prevPeriod, $tmp);
				}
                
                function ECO000064_CA_calcSQL($data,$data2) {
					
					
					$ctiDivision = "base.cti_division(%s, %s)";
					$sum = "sum( CASE WHEN [DATE_BASE2] BETWEEN @date_debut@ AND @date_fin@ THEN %s ELSE 0 END )";
					$sum2 = "sum( CASE WHEN [DATE_BASE2] BETWEEN @date_debut@ AND @date_fin@ THEN %s ELSE NULL END )";
					$periodeDebut = '\'[PERIODE]\'::date';
					$periodeFin = '\'[TOPERIODE]\'::date';
					$periodePrecDebut = '\'[VIEW.PERIODE_D]\'::date';
					$periodePrecFin = '\'[VIEW.TOPERIODE_D]\'::date';
					
					$tmp = sprintf($sum, 'montant_liquidation_ht');
					
					$toReplace = array(
						'@date_debut@',
						'@date_fin@'
					);
					
					$curPeriod = array(
						$periodeDebut,
						$periodeFin
					);
					
					$prevPeriod = array(
						$periodePrecDebut,
						$periodePrecFin
					);
					
					return str_replace($toReplace, $curPeriod, $tmp) . ', ' . str_replace($toReplace, $prevPeriod, $tmp);
				}
				
				// ?>
			EVAL]]]></value>
		</PROPERTY>
		<PROPERTY name="DATASQL">
			<value><![CDATA[[EVAL 
				// <?php
				
				return 
					ECO000064_calcSQL('[DATA01]') . ', 0, 0, ' . PHP_EOL . 
					ECO000064_CA_calcSQL('[DATA01]','[DATA02]'). ', 0 '; 
				// ?>
			EVAL]]]></value>
		</PROPERTY>
		<PROPERTY name="FILTERSQL">
			<value><![CDATA[[EVAL 
				// <?php
				
				return str_replace(', ',' > 0 AND ',ECO000064_calcSQL('[DATA01]')) . '> 0'; 
				// ?>
			EVAL]]]></value>
		</PROPERTY>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse">
		<GROUP label="Période">
            <FIELD name="DATE_BASE" label="" width="130" UI="combo" default="2" default2="date_commande">
				<OPTION label="Date commande" data="2" data2="date_commande"/>
				<OPTION label="Date engagement" data="3" data2="date_engagement"/>
			</FIELD>
			<FIELD name="ALIAS_PERIODE" label="" UI="combo" width="180" default="CUM_LAST_MONTH" tree="true" globalListProvider="ALIAS_PERIODE" />
			<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="Période précédente">
			<FIELD name="TYPE_COMPARAISON" label="" UI="combo" default="2" width="150">
				<OPTION label="Année précédente" data="2" />
				<OPTION label="Saisie période" data="S" />
			</FIELD>
            <FIELD name="PERIODE_D" label="Période précédente" UI="combo" tree="true" width="150" default="2015-01-01" printable="false" globalListProvider="DATE_DEBUT" visible="= SELECT.TYPE_COMPARAISON == 'S'"/>
			<FIELD name="TOPERIODE_D" label="à" UI="combo" tree="true" width="150" default="2015-12-30" printable="false" globalListProvider="DATE_FIN" visible="= SELECT.TYPE_COMPARAISON == 'S'"/>
		</GROUP>
        
		<GROUP label="Regroupements">
			<FIELD name="GROUPBY" width="220" label="" UI="combo" 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="Commande" data="CMD" treeLevel="1"  />
				<OPTION label="Année-Mois Commande" globalListProvider="DATE_GROUPBY" 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" width="220" label="" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de second niveau" data="-1" treeLevel="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="Année-Mois Commande" globalListProvider="DATE_GROUPBY" treeLevel="1"  />
				<OPTION label="Source de données" data="PVD" treeLevel="1"  globalListProvider="PROVIDER_GROUPBY"/>
			</FIELD>
            <FIELD name="GROUPBY_3" label="" UI="combo" default="-1" width="220" 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="Année-Mois Commande" globalListProvider="DATE_GROUPBY" treeLevel="1"  />
				<OPTION label="Source de données" data="PVD" treeLevel="1"  globalListProvider="PROVIDER_GROUPBY"/>
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_COMMANDE_SIGNIFICATIF"/>
	<SELECTIONS componentName="FILTRES_COMMANDE_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_FOURNISSEUR_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_ARTICLE_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_PROVIDER_SELECTIONS"/>
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_LIGNES_COMMANDES_X" optimizer2="V_ALL_X">
				<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]}
						SIGNIFDATA{[VIEW.ECO_SIGNIFICATIVE_DATA],, [ECO_SIGNIFICATIVE_MODE],, [ECO_SIGNIFICATIVE_NUMBER]}
						OPTIONS{NOTZERO=1}
						ORDERBY{[VIEW.DATA01],, DESC}
						INDICATORS{
							[VIEW.DATASQL]
						}
					FROM #V_LIGNES_COMMANDES_X##V_ALL_X#
					WHERE ([DATE_BASE2] BETWEEN '[PERIODE]' AND '[TOPERIODE]' OR
						[DATE_BASE2] BETWEEN '[VIEW.PERIODE_D]' AND '[VIEW.TOPERIODE_D]')
						[VIEW.ARTICLE_SELECT]
						[VIEW.FOURNISSEUR_SELECT]
						[VIEW.COMMANDE_SELECT]
						[VIEW.PROVIDER_SELECT]
					HAVING 
						[VIEW.FILTERSQL]
					AFTER{
						UPDATE w_table SET 
							indicateurs[3] = indicateurs[1] - indicateurs[2],
							indicateurs[4] = CASE 
												WHEN indicateurs[1] > 0 AND indicateurs[2] > 0 THEN base.cti_division(indicateurs[1] - indicateurs[2], indicateurs[2]) * 100
											 ELSE 0 END,
							indicateurs[7] = indicateurs[5] - indicateurs[6],
							indicateurs[8] = CASE 
												WHEN indicateurs[5] > 0 AND indicateurs[6] > 0 THEN base.cti_division(indicateurs[5] - indicateurs[6], indicateurs[6]) * 100
											 ELSE 0 END
					}
					
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS" />
					<FIELD name="SORT" />
					
					<!-- Première donnée -->
					<FIELD name="F1" />
					<FIELD name="D1" />
					<FIELD name="D1_ECA" />
					<FIELD name="D1_PCT" />
					
					<!-- Deuxième donnée -->
					<FIELD name="F2" />
					<FIELD name="D2" />
					<FIELD name="D2_ECA" />
					<FIELD name="D2_PCT" />
					
				</FIELDS>
			</SQL>
		</QUERY>
        <QUERY type="propertiesLink" name="VIEWPROPERTIES" forRows="false">
			<SQL>
				<select><![CDATA[	
					SELECT 'PERIODE_D' , CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[PERIODE]'::date - interval '1 year') ELSE '[PERIODE_D]' END::text
					UNION
					SELECT 'TOPERIODE_D' , CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[TOPERIODE]'::date - interval '1 year') ELSE '[TOPERIODE_D]' END::text
					UNION
					SELECT 'LENGTH', ((DATE_PART('year', '[TOPERIODE]'::date)
						- DATE_PART('year', CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[PERIODE]'::date - interval '1 year') ELSE '[PERIODE_D]' END::date)) * 12 +
						DATE_PART('month', '[TOPERIODE]'::date)
						- DATE_PART('month', CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[PERIODE]'::date - interval '1 year') ELSE '[PERIODE_D]' END::date))::text
					UNION
					SELECT 'PERIODE_D_LABEL', CASE WHEN  CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[PERIODE]'::date - interval '1 year') ELSE '[PERIODE_D]' END = p_calendrier_mois.date_debut THEN p_calendrier_mois.texte ELSE p_calendrier.texte_court END
					FROM base.p_calendrier
						JOIN base.p_calendrier_mois ON p_calendrier.mois = p_calendrier_mois.mois
					WHERE date = CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[PERIODE]'::date - interval '1 year') ELSE '[PERIODE_D]' END
					UNION
					SELECT 'TOPERIODE_D_LABEL', CASE WHEN  CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[TOPERIODE]'::date - interval '1 year') ELSE '[TOPERIODE_D]' END = p_calendrier_mois.date_fin THEN p_calendrier_mois.texte ELSE p_calendrier.texte_court END
					FROM base.p_calendrier
						JOIN base.p_calendrier_mois ON p_calendrier.mois = p_calendrier_mois.mois
					WHERE date = CASE WHEN '[TYPE_COMPARAISON]' = '2' THEN date('[TOPERIODE]'::date - interval '1 year') ELSE '[TOPERIODE_D]' END
				]]></select>
				<FIELDS>
					<FIELD name="name" />
					<FIELD name="value" />
				</FIELDS>
			</SQL>
        </QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL>
				<select><![CDATA[
						SELECT 'X_PERIODE', greatest(to_date(to_char('[PERIODE]'::date - INTERVAL  '3 year', 'YYYY-MM-DD'), 'YYYY-MM-DD'), (SELECT min(date_commande) FROM eco.p_commandes ))::text;
				]]></select>
				<FIELDS>
					<FIELD name="name"/>
					<FIELD name="value"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Evolution temporelle" shortLabel="Evolution" view="ECO000007.XML" componentName="ECO_VIEWLINK">
				<ARGS name="SPEC" >
					<value><![CDATA[
						LINKVARIABLES['ALIAS_PERIODE'] = '-1';
						LINKVARIABLES['DATA01'] = 'CTI_PUMOYCOM';
						LINKVARIABLES['PERIODICITE'] = 'MONTH';

						if (String(COLUMN.NAME).substr(0,1) == 'D') {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = VIEW.TOPERIODE_D;
						}
						else {
							if (String(COLUMN.NAME).substr(0,1) == 'F') {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = VIEW.TOPERIODE_D;
							}
							else {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = SELECT.TOPERIODE;
								if(int(VIEW.LENGTH) < 14) {
									LINKVARIABLES['PERIODICITE'] = 'MONTH';
								}
								else {
									LINKVARIABLES['PERIODICITE'] = 'QUARTER';
								}
							}
						}
						
						return 'OK';
					]]>
					</value>
				</ARGS>
			</VIEWLINK>
			<VIEWLINK label="Liste des commandes" shortLabel="Liste commandes" view="ECO000011.XML" componentName="ECO_VIEWLINK" >
				<ARGS name="SPEC" >
					<value><![CDATA[
						LINKVARIABLES['GROUPBY'] = '-1';
						LINKVARIABLES['GROUPBY_2'] = 'CMD';
						
						if (String(COLUMN.NAME).substr(0,1) == 'D') {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = VIEW.TOPERIODE_D;
						}
						else {
							if (String(COLUMN.NAME).substr(0,1) == 'F') {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = VIEW.TOPERIODE_D;
							}
							else {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = SELECT.TOPERIODE;
							}
						}
						LINKVARIABLES['GROUPBY'] = 'CMD'
						LINKVARIABLES['GROUPBY_2'] = '-1'
						return 'OK';
					]]></value>
				</ARGS>
			</VIEWLINK>
			<VIEWLINK label="Liste des lignes de commande" shortLabel="Liste lignes" view="ECO000011.XML" componentName="ECO_VIEWLINK">
				<ARGS name="SPEC" >
					<value><![CDATA[
						if (COLUMN.NAME == '') {
							LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D
							LINKVARIABLES['TOPERIODE'] = SELECT.TOPERIODE
						}
						else {
							if (String(COLUMN.NAME).substr(0,1) == 'F') {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = VIEW.TOPERIODE_D;
							}
							else {
								LINKVARIABLES['PERIODE'] = VIEW.PERIODE_D;
								LINKVARIABLES['TOPERIODE'] = SELECT.TOPERIODE;
							}
						}
						LINKVARIABLES['GROUPBY'] = 'CMD'
						LINKVARIABLES['GROUPBY_2'] = 'CML'
						return 'OK';
			
					]]></value>
				</ARGS>
			</VIEWLINK>
			<VIEWLINK label="Détail article" shortLabel="Détail article" view="ECO000069.XML" componentName="ECO_VIEWLINK" component2Name="DATE_EVOL_VIEWLINK">
				<ARGS name="SPEC" >
					<value><![CDATA[
						LINKVARIABLES['GROUPBY'] = 'AMCMD'
						LINKVARIABLES['GROUPBY_2'] = 'AMMVT'
						LINKVARIABLES['GROUPBY_3'] = 'AMSTO'
						LINKVARIABLES['TAB'] = 'AUTO'
						return 'OK';
					]]></value>
				</ARGS>
			</VIEWLINK>
		</VIEWLINKS>
        <ONGLET excelLabel="Effet Simplifié" label="Effet Simplifié" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="" type="group" subType="" percentHeight="100" >
				<CHART title="Montant Total (10 premiers)" type="pieChart" subType="" maxItems="10" maxItemsSortOn="" maxItemsSortSeq="" sortField="F2" sortSeq="D">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="F2" displayName="Montant Total" />
				</CHART>
                <CHART title="Articles pour les 10 premiers" type="columnChart" maxItems="10" maxItemsSortOn="F1" maxItemsSortSeq="D" sortField="COD" sortSeq="A" condition="ROW.LVL == '1'">
                    <CATEGORY field="CODTXT" type="Char" />
                    <SERIE field="EPXS" displayName="Effet Prix " displayNameCalc="false" />
                    <SERIE field="EVLS" displayName="Effet Volume" displayNameCalc="false" />
                </CHART>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="70" variableRowHeight="true" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'" sortable="= SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB'">
				<INSERT name="DATAGRID_MULTITAB_STYLES" />
				<COLUMN dataField="LVL" width="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" />
				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid" />
				<COLUMN dataField="COD" width="70" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="TOTAL">
					<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="CODTXT" type="Char" minWidth="200" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' ' + ROW.TXT.toString().substr(0,10)" />
				</COLUMN>
				
				<COLUMN dataField="D1" type="Number" width="80" outputFormat="= SELECT.DATA012" selectable="true" headerText="'(Q1)'+ '\n' +SELECT.DATA01_LABEL +'\n'+ '&lt;font color=\'#DB1702\'&gt;N-1&lt;/font&gt;'" headerTextCalc="true" description="= SELECT.DATA015 " textAlign="center">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="F1" type="Number" width="80" outputFormat="= SELECT.DATA012" selectable="true" headerText="'(Q2)' +'\n' +SELECT.DATA01_LABEL +'\n'+ '&lt;font color=\'#DB1702\'&gt;N&lt;/font&gt;'"  headerTextCalc="true" description="= SELECT.DATA015 " textAlign="center">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="D1_ECA" type="Number" width="80" outputFormat="= SELECT.DATA012" headerText="@LF@ Ecart" textAlign="center">
					<CELLSTYLE name="cellIndicator" value="triangle_down, 10, left middle, 0xD63E00" condition="(SELECT.DATA014 == 'P' &amp;&amp; ROW.F1 &lt; ROW.D1) || (SELECT.DATA014 == 'N' &amp;&amp; ROW.F1 &gt; ROW.D1)" />
					<CELLSTYLE name="cellIndicator" value="triangle_up, 10, left middle, 0x75a0eb" condition="(SELECT.DATA014 == 'P' &amp;&amp; ROW.F1 &gt; ROW.D1) || (SELECT.DATA014 == 'N' &amp;&amp; ROW.F1 &lt; ROW.D1)" />
					<CELLSTYLE name="cellIndicator" value="rectangle, 10, left middle, 0xFFA500" condition="ROW.F1 != null &amp;&amp; ROW.D1 != null &amp;&amp; ROW.F1 == ROW.D1" />
                        <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
                </COLUMN>
				<COLUMN dataField="D1_PCT" type="Number" width="45" outputFormat="= if (ROW.D1 !=0) {return '0%'} else {return '#'}" headerText="@LF@ %" textAlign="center">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				
				<COLUMN dataField="D2" type="Number" width="85" outputFormat="#E" selectable="true" headerText="+ '\n' + 'Montant total'+ '\n' +  '&lt;font color=\'#DB1702\'&gt;N-1&lt;/font&gt;'  + '\n' " headerTextCalc="true" description="= SELECT.DATA025 " textAlign="center">	
						<HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="F2" type="Number" width="85" outputFormat="#E" selectable="true" headerText="+ '\n' + 'Montant total'+ '\n' +  '&lt;font color=\'#DB1702\'&gt;N&lt;/font&gt;'  + '\n' " headerTextCalc="true" description="= SELECT.DATA025" textAlign="center">	
						<HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="D2_ECA" type="Number" width="95" outputFormat="#E" headerText="(X1) @LF@ Ecart" textAlign="center">
					<CELLSTYLE name="cellIndicator" value="triangle_down, 10, left middle, 0xD63E00" condition="(SELECT.DATA024 == 'P' &amp;&amp; ROW.F2 &lt; ROW.D2) || (SELECT.DATA024 == 'N' &amp;&amp; ROW.F2 &gt; ROW.D2)" />
					<CELLSTYLE name="cellIndicator" value="triangle_up, 10, left middle, 0x75a0eb" condition="(SELECT.DATA024 == 'P' &amp;&amp; ROW.F2 &gt; ROW.D2) || (SELECT.DATA024 == 'N' &amp;&amp; ROW.F2 &lt; ROW.D2)" />
					<CELLSTYLE name="cellIndicator" value="rectangle, 10, left middle, 0xFFA500" condition="ROW.F2 != null &amp;&amp; ROW.D2 != null &amp;&amp; ROW.F2 == ROW.D2" />
                        <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="D2_PCT" type="Number" width="45" outputFormat="= if (ROW.D2 !=0) {return '0%'} else {return '#'}" headerText="@LF@ %" textAlign="center">	
						<HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
                <COLUMN dataField="CA_MOY_OLD" type="Number" width="80" outputFormat="#E" headerText="'(P1)' + '\n' + 'Montant moyen '+'\n'+ '&lt;font color=\'#DB1702\'&gt;N-1&lt;/font&gt;'" headerTextCalc="true"  description="Montant / nb" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.D2 / ROW.D1)" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="CA_MOY_NOW" type="Number" width="80" outputFormat="#E" headerText="'(P2)' + '\n' + 'Montant moyen ' +'\n'+ '&lt;font color=\'#DB1702\'&gt;N&lt;/font&gt;'" headerTextCalc="true"  description="Montant / nb" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.F2 / ROW.F1)" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
                    <FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="EPXS" type="Number" width="95" outputFormat="#E" headerText="@LF@ Effet Prix" description="EP=(P2-P1)*Q2" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.CA_MOY_NOW - ROW.CA_MOY_OLD)* ROW.F1" />
                    <CELLSTYLE name="cellIndicator" value="circle, 5, left middle, 0xD63E00" condition="(ROW.EPXS &lt; '0')" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="EVLS" type="Number" width="95" outputFormat="#E" headerText="@LF@ Effet Volume" description="EV=(Q2-Q1)*P1" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.F1 - ROW.D1)* ROW.CA_MOY_OLD" />
                    <CELLSTYLE name="cellIndicator" value="circle, 5, left middle, 0xD63E00" condition="(ROW.EVLS &lt; '0')" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="ETOT" type="Number" width="90" outputFormat="#E" headerText="@LF@ Somme des Effets" description="X1 = EP + EV " totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.EPXS + ROW.EVLS)" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
		<ONGLET excelLabel="Effet Croisé" label="Effet Croisé" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="" type="group" subType="" percentHeight="100" >
				<CHART title="Montant Total (10 premiers)" type="pieChart" subType="" maxItems="10" maxItemsSortOn="" maxItemsSortSeq="" sortField="F2" sortSeq="D">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="F2" displayName="Montant Total" />
				</CHART>
                <CHART title="Articles pour les 10 premiers" type="columnChart" maxItems="10" maxItemsSortOn="F1" maxItemsSortSeq="D" sortField="COD" sortSeq="A" condition="ROW.LVL == '1'">
                    <CATEGORY field="CODTXT" type="Char" />
                    <SERIE field="EPX" displayName="Effet Prix " displayNameCalc="false" />
                    <SERIE field="EVL" displayName="Effet Volume" displayNameCalc="false" />
                    <SERIE field="ECR" displayName="Effet Croisé" displayNameCalc="false" />
                </CHART>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="70" variableRowHeight="true" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'" sortable="= SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB'">
				<INSERT name="DATAGRID_MULTITAB_STYLES" />
				<COLUMN dataField="LVL" width="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" />
				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid" />
				<COLUMN dataField="COD" width="70" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="TOTAL">
					<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="CODTXT" type="Char" minWidth="200" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' ' + ROW.TXT.toString().substr(0,10)" />
				</COLUMN>
				
				<COLUMN dataField="D1" type="Number" width="80" outputFormat="= SELECT.DATA012" selectable="true" headerText="'(Q1)'+ '\n' +SELECT.DATA01_LABEL +'\n'+ '&lt;font color=\'#DB1702\'&gt;N-1&lt;/font&gt;'" headerTextCalc="true" description="= SELECT.DATA015 " textAlign="center">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="F1" type="Number" width="80" outputFormat="= SELECT.DATA012" selectable="true" headerText="'(Q2)' +'\n' +SELECT.DATA01_LABEL +'\n'+ '&lt;font color=\'#DB1702\'&gt;N&lt;/font&gt;'"  headerTextCalc="true" description="= SELECT.DATA015 " textAlign="center">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="D1_ECA" type="Number" width="80" outputFormat="= SELECT.DATA012" headerText="@LF@ Ecart" textAlign="center">
					<CELLSTYLE name="cellIndicator" value="triangle_down, 10, left middle, 0xD63E00" condition="(SELECT.DATA014 == 'P' &amp;&amp; ROW.F1 &lt; ROW.D1) || (SELECT.DATA014 == 'N' &amp;&amp; ROW.F1 &gt; ROW.D1)" />
					<CELLSTYLE name="cellIndicator" value="triangle_up, 10, left middle, 0x75a0eb" condition="(SELECT.DATA014 == 'P' &amp;&amp; ROW.F1 &gt; ROW.D1) || (SELECT.DATA014 == 'N' &amp;&amp; ROW.F1 &lt; ROW.D1)" />
					<CELLSTYLE name="cellIndicator" value="rectangle, 10, left middle, 0xFFA500" condition="ROW.F1 != null &amp;&amp; ROW.D1 != null &amp;&amp; ROW.F1 == ROW.D1" />
                        <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
                </COLUMN>
				<COLUMN dataField="D1_PCT" type="Number" width="45" outputFormat="= if (ROW.D1 !=0) {return '0%'} else {return '#'}" headerText="@LF@ %" textAlign="center">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				
				<COLUMN dataField="D2" type="Number" width="85" outputFormat="#E" selectable="true" headerText="+ '\n' + 'Montant total'+ '\n' +  '&lt;font color=\'#DB1702\'&gt;N-1&lt;/font&gt;'  + '\n' " headerTextCalc="true" description="= SELECT.DATA025 " textAlign="center">	
						<HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="F2" type="Number" width="85" outputFormat="#E" selectable="true" headerText="+ '\n' + 'Montant total'+ '\n' +  '&lt;font color=\'#DB1702\'&gt;N&lt;/font&gt;'  + '\n' " headerTextCalc="true" description="= SELECT.DATA025" textAlign="center">	
						<HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="D2_ECA" type="Number" width="95" outputFormat="#E" headerText="(X1) @LF@ Ecart" textAlign="center">
					<CELLSTYLE name="cellIndicator" value="triangle_down, 10, left middle, 0xD63E00" condition="(SELECT.DATA024 == 'P' &amp;&amp; ROW.F2 &lt; ROW.D2) || (SELECT.DATA024 == 'N' &amp;&amp; ROW.F2 &gt; ROW.D2)" />
					<CELLSTYLE name="cellIndicator" value="triangle_up, 10, left middle, 0x75a0eb" condition="(SELECT.DATA024 == 'P' &amp;&amp; ROW.F2 &gt; ROW.D2) || (SELECT.DATA024 == 'N' &amp;&amp; ROW.F2 &lt; ROW.D2)" />
					<CELLSTYLE name="cellIndicator" value="rectangle, 10, left middle, 0xFFA500" condition="ROW.F2 != null &amp;&amp; ROW.D2 != null &amp;&amp; ROW.F2 == ROW.D2" />
                        <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="D2_PCT" type="Number" width="45" outputFormat="= if (ROW.D2 !=0) {return '0%'} else {return '#'}" headerText="@LF@ %" textAlign="center">	
						<HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
                <COLUMN dataField="CA_MOY_OLD" type="Number" width="80" outputFormat="#E" headerText="'(P1)' + '\n' + 'Montant moyen '+'\n'+ '&lt;font color=\'#DB1702\'&gt;N-1&lt;/font&gt;'" headerTextCalc="true"  description="Montant / nb" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.D2 / ROW.D1)" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="CA_MOY_NOW" type="Number" width="80" outputFormat="#E" headerText="'(P2)' + '\n' + 'Montant moyen ' +'\n'+ '&lt;font color=\'#DB1702\'&gt;N&lt;/font&gt;'" headerTextCalc="true"  description="Montant / nb" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.F2 / ROW.F1)" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
                    <FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="EPX" type="Number" width="95" outputFormat="#E" headerText="@LF@ Effet Prix" description="EP=(P2-P1)*Q1" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.CA_MOY_NOW - ROW.CA_MOY_OLD)* ROW.D1" />
                    <CELLSTYLE name="cellIndicator" value="circle, 5, left middle, 0xD63E00" condition="(ROW.EPX &lt; '0')" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="EVL" type="Number" width="95" outputFormat="#E" headerText="@LF@ Effet Volume" description="EV=(Q2-Q1)*P1" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.F1 - ROW.D1)* ROW.CA_MOY_OLD" />
                    <CELLSTYLE name="cellIndicator" value="circle, 5, left middle, 0xD63E00" condition="(ROW.EVL &lt; '0')" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="ECR" type="Number" width="95" outputFormat="#E" headerText="@LF@ Effet Croisé" description="EC=(Q2-Q1)*(P2-P1)" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="((ROW.F1 - ROW.D1)*(ROW.CA_MOY_NOW - ROW.CA_MOY_OLD) )" />
                    <CELLSTYLE name="cellIndicator" value="circle, 5, left middle, 0xD63E00" condition="(ROW.ECR &lt; '0')" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
				<COLUMN dataField="ETOT" type="Number" width="90" outputFormat="#E" headerText="@LF@ Somme des Effets" description="X1 = EP + EV + EC" totalFunction="calc" otherFunction="calc" calc="true" textAlign="center">
					<CALC formula="(ROW.EPX + ROW.EVL + ROW.ECR)" />
                    <HEADERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
					<FOOTERCELLSTYLE name="backgroundColor" value="0xDCDCDC"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
