<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="PMSI000257" label="PMSI. Analyse des codes retour groupage" title="= 'Codes retour groupage par ' +  SELECT.GROUPBY_LABEL + ' (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" helpDokuWIkiDir="" helpDokuWIkiFile="pmsi000257"  helpFile="">
	<VIEWPROPERTIES componentName="PROPERTIES_RSS" />
	<VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE" />
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value" />
		<PROPERTY name="SORTBY">
			<value><![CDATA[[EVAL 
			
				if ('[GROUPBY]' != '-1' && '[GROUPBY]' != '-1' && '[GROUPBY_TAB]' != 'TAB') {
					return 'ORDER BY 2,5,7';
				}
				else {
					return 'ORDER BY 13 DESC,5,7';
				}
			EVAL]]]></value>
		</PROPERTY>
		<PROPERTY name="ROWS">
			<value><![CDATA[[EVAL 
				
				if ('[ERREURS]' == 'BLOQ' ) {
					return " AND v_rss_leg_1.bloquante = 'O' " ;
				}
				else if ('[ERREURS]' == 'NON_BLOQ' ) {
					return " AND v_rss_leg_1.bloquante = 'N' " ;
				}
				else {
					return "";
				}
				
			EVAL]]]></value>
		</PROPERTY>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
					
					if (SELECT.ERREURS  != 'ALL') {
						display = display + '#B#' + SELECT.ERREURS_LABEL + '#/B# ';
					}
					
					if (display != '') {
					}
					return display;
					
					"> 
		<GROUP>
			<FIELD name="ALIAS_PERIODE" label="" UI="combo" width="220" default="CUM_LAST_MONTH" tree="true" globalListProvider="ALIAS_PERIODE" />
			<FIELD name="PERIODE" label="de" UI="combo" tree="true" width="200" default="2014-01-01" printable="false" globalListProvider="DATE_DEBUT" />
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-12-31" printable="false" globalListProvider="DATE_FIN" />
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" width="220" label="" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de regroupement" data="-1" treeLevel="1" />
				<OPTION label="Options" data="" globalListProvider="RSS_GROUPBY_OPTIONS" />
			</FIELD>
			<FIELD name="GROUPBY_TAB" width="100" label="Présentation" UI="combo" default="AUTO" visible="= SELECT.GROUPBY != '-1' ">
				<OPTION label="Automatique" data="AUTO" />
				<OPTION label="Arbre" data="TREE" />
				<OPTION label="Onglet" data="TAB" />
			</FIELD>
		</GROUP>
		<GROUP label="Erreurs">
			<FIELD name="ERREURS" width="200" label="" UI="combo" default="ALL">
				<OPTION label="Toutes les erreurs" data="ALL" />
				<OPTION label="Uniquement erreurs bloquantes" data="BLOQ" showIfNotDefault="true" />
				<OPTION label="Uniquement erreurs non bloquantes" data="NON_BLOQ" showIfNotDefault="true" />
			</FIELD>
		</GROUP>
		<GROUP label="">
			<FIELD name="GROUPBY_2" width="220" label="" UI="combo" default="ERR_GROUP" visible="false">
				<OPTION label="Erreur de groupage" data="ERR_GROUP"  />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_RSS_SOUSSELECTIONS" />
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X" cacheEnabled="true" select="
				SELECT [VIEW.SELECT_TABTREE_COLUMNS],
					CASE WHEN v_rss_leg_1.bloquante = 'O' THEN 'Oui' ELSE 'Non' END as bloq,
					count(distinct v_rss_leg_1.rss_id) as rssleg,
					sum(nombre_erreur_groupeur) as nombre
				FROM #V_RSS_X#, [VIEW.SELECT_TABTREE_VIEW]
				WHERE 
					mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) 
					AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
					AND v_rss_leg_1.rss_id IS DISTINCT FROM NULL
					[VIEW.FILTRE_RSS_SELECT]
					[VIEW.SELECT_TABTREE_WHERE]
					[VIEW.ROWS]
					
				GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12
				[VIEW.SORTBY]
					">
				<FIELDS>
					<FIELD name="TABD" />
					<FIELD name="TABDL" />
					<FIELD name="TABDLL" />
					<FIELD name="OID1" />
					<FIELD name="COD1" />
					<FIELD name="OID2" />
					<FIELD name="COD2" />
					<FIELD name="OID" />
					<FIELD name="COD" />
					<FIELD name="TXT" />
					<FIELD name="LVL" />
					<FIELD name="BLOQ" />
					<FIELD name="RSSLEG" />
					<FIELD name="NOMBRE" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Liste des RSS" shortLabel="Liste RSS" view="PMSI000258.XML" componentName="RSS_BASE_VIEWLINK">
				<ARG name="ERR_GROUP">
					<value><![CDATA[
				
						if (SELECT.GROUPBY == '-1') {return ROW.OID1;}
						else if (SELECT.GROUPBY != '-1' && ROW.COD == ROW.COD2) { return ROW.OID2;}
						else {return '-1';}
						
					]]></value>
				</ARG>
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Analyse codes erreur" label="Analyse codes erreur" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="Répartition en nombre d'erreurs (10 premiers)" type="pieChart" maxItems="10" maxItemsSortOn="NOMBRE" maxItemsSortSeq="D" sortField="NOMBRE" sortSeq="D" condition="ROW.LVL == '1'">
				<CATEGORY field="CODTXT" type="Char" />
				<SERIE field="NOMBRE" />
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" variableRowHeight="true" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'"
				sortable="= SELECT.GROUPBY == '-1' || SELECT.GROUPBY_TAB == 'TAB'">
				<ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="backgroundColor" value="0xFFD393" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="borderSides" value="top bottom" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="borderStyle" value="solid" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="borderThickness" value="2" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<COLUMN dataField="LVL" width="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" />
				<COLUMN dataField="OID1" width="60" type="Char" visible="false" headerText="Oid" />
				<COLUMN dataField="COD1" width="60" type="Char" visible="false" headerText="Oid" />
				<COLUMN dataField="OID2" width="60" type="Char" visible="false" headerText="Oid" />
				<COLUMN dataField="COD2" width="60" type="Char" visible="false" headerText="Oid" />
				<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">
					<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" maxWidth="300" headerText="SELECT.GROUPBY_2_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="BLOQ" type="Char" width="80" headerText="Erreur bloquante" textAlign="left" />
				<COLUMN dataField="CODTXT" type="Char" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' ' + ROW.TXT" />
				</COLUMN>
				<COLUMN dataField="RSSLEG" width="80" type="Number" outputFormat="#" headerText="Nb RSA" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="NOMBRE" width="90" type="Number" outputFormat="#" headerText="Nombre erreurs" textAlign="right" totalFunction="sum" otherFunction="sum" />
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
