<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000042" label="PMSI. Comparaison CMA" title="= 'Comparaison ' +   SELECT.DATA_LABEL + ' (' + SELECT.PERIODE_F_LABEL + ' à ' + SELECT.TOPERIODE_F_LABEL + ' vs ' + SELECT.PERIODE_D_LABEL + ' à ' + SELECT.TOPERIODE_D_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" helpDokuWIkiDir="pmsi:sejours_analyse_globale:severites:severites_v10" helpDokuWIkiFile="pmsi000039">
	<SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
					if (SELECT.OCCURENCE != '') {display = display + '#B#Analyse CMA#/B# : Occurences significative = #B#' + SELECT.OCCURENCE + '#/B#'}
					return display;
					">
		<GROUP label="Période">
			<FIELD name="PERIODE_F" label="Période" UI="combo" tree="true" width="150" default="2014-07-01" printable="false" globalListProvider="DATE_DEBUT"/>
			<FIELD name="TOPERIODE_F" label="à" UI="combo" tree="true" width="150" default="2014-12-31" printable="false" globalListProvider="DATE_FIN"/>
		</GROUP>
		<GROUP label="Période précédente">
			<FIELD name="PERIODE_D" label="" UI="combo" tree="true" width="150" default="2014-01-01" printable="false" globalListProvider="DATE_DEBUT"/>
			<FIELD name="TOPERIODE_D" label="à" UI="combo" tree="true" width="150" default="2014-06-30" printable="false" globalListProvider="DATE_FIN"/>
		</GROUP>
		<GROUP label="Données">
			<FIELD name="DATA" label="" UI="combo" default="1" printable="false">
				<OPTION label="CMA" data="1"/>
				<OPTION label="CMA Sévère" data="2"/>
			</FIELD>
			<FIELD name="OCCURENCE" label="Occurences significatives" UI="number" width="50" default="50" showIfNotDefault="true"/>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS"/>
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X" cacheEnabled="true" enabled="[DATA!=1::false]" select="SELECT oid, code, texte, taux_cma_national * 100,
					sum(CASE WHEN date &gt;= '[PERIODE_F]' AND date &lt;='[TOPERIODE_F]' THEN viewt.nb_rsa ELSE 0 END),
					sum(CASE WHEN date &gt;= '[PERIODE_F]' AND date &lt;='[TOPERIODE_F]' THEN vieww.nb_rsa ELSE 0 END),
					
					sum(CASE WHEN date &gt;= '[PERIODE_D]' AND date &lt;='[TOPERIODE_D]' THEN viewt.nb_rsa ELSE 0 END),
					sum(CASE WHEN date &gt;= '[PERIODE_D]' AND date &lt;='[TOPERIODE_D]' THEN vieww.nb_rsa ELSE 0 END)
					
				FROM pmsi.v_ghm_4
					
						LEFT JOIN (
							SELECT date_sortie, ghm_code, sum(nb_rsa) as nb_rsa FROM #V_RSS_X# WHERE (date_sortie &gt;= '[PERIODE_D]' AND date_sortie &lt;='[TOPERIODE_D]' OR date_sortie &gt;= '[PERIODE_F]' AND date_sortie &lt;='[TOPERIODE_F]') [VIEW.FILTRE_RSS_SELECT] GROUP BY date_sortie, ghm_code
								) AS vieww  ON (v_ghm_4.code = vieww.ghm_code AND v_ghm_4.date = vieww.date_sortie) 
					
						LEFT JOIN (
							SELECT date_sortie, ghm_prefixe, sum(nb_rsa) as nb_rsa FROM #V_RSS_X# WHERE (date_sortie &gt;= '[PERIODE_D]' AND date_sortie &lt;='[TOPERIODE_D]' OR date_sortie &gt;= '[PERIODE_F]' AND date_sortie &lt;='[TOPERIODE_F]') [VIEW.FILTRE_RSS_SELECT] GROUP BY date_sortie, ghm_prefixe
								) AS viewt  ON (substr(v_ghm_4.code,1,5) = viewt.ghm_prefixe AND v_ghm_4.date = viewt.date_sortie) 

				WHERE substr(code, 6, 1) = 'W'
					AND (date &gt;= '[PERIODE_D]' AND date &lt;='[TOPERIODE_D]' OR	date &gt;= '[PERIODE_F]'	AND date &lt;='[TOPERIODE_F]')

				GROUP BY oid, code, texte, taux_cma_national * 100
					HAVING sum(viewt.nb_rsa)&gt; 0
					ORDER BY oid">
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="COD"/>
					<FIELD name="TXT"/>
					<FIELD name="TN"/>
					<FIELD name="FNT"/>
					<FIELD name="FNC"/>
					<FIELD name="DNT"/>
					<FIELD name="DNC"/>
				</FIELDS>
			</SQL>
			<SQL optimizer="V_RSS_X" enabled="[DATA==1::false]" select="SELECT oid, code, texte, taux_cma_national * 100,
					sum(CASE WHEN date &gt;= '[PERIODE_F]' AND date &lt;='[TOPERIODE_F]' THEN viewt.nb_rsa ELSE 0 END),
					sum(CASE WHEN date &gt;= '[PERIODE_F]' AND date &lt;='[TOPERIODE_F]' THEN vieww.nb_rsa ELSE 0 END),
					
					sum(CASE WHEN date &gt;= '[PERIODE_D]' AND date &lt;='[TOPERIODE_D]' THEN viewt.nb_rsa ELSE 0 END),
					sum(CASE WHEN date &gt;= '[PERIODE_D]' AND date &lt;='[TOPERIODE_D]' THEN vieww.nb_rsa ELSE 0 END)
					
				FROM pmsi.v_ghm_4
					
						LEFT JOIN (
							SELECT date_sortie, ghm_code, sum(nb_rsa) as nb_rsa FROM #V_RSS_X# WHERE (date_sortie &gt;= '[PERIODE_D]' AND date_sortie &lt;='[TOPERIODE_D]' OR date_sortie &gt;= '[PERIODE_F]' AND date_sortie &lt;='[TOPERIODE_F]') [VIEW.FILTRE_RSS_SELECT] GROUP BY date_sortie, ghm_code
								) AS vieww  ON (v_ghm_4.code = vieww.ghm_code AND v_ghm_4.date = vieww.date_sortie) 
					
						LEFT JOIN (
							SELECT date_sortie, cmd_code, sum(nb_rsa) as nb_rsa FROM #V_RSS_X# WHERE (date_sortie &gt;= '[PERIODE_D]' AND date_sortie &lt;='[TOPERIODE_D]' OR date_sortie &gt;= '[PERIODE_F]' AND date_sortie &lt;='[TOPERIODE_F]') [VIEW.FILTRE_RSS_SELECT] GROUP BY date_sortie, cmd_code
								) AS viewt  ON (substr(v_ghm_4.code,1,2) = viewt.cmd_code AND v_ghm_4.date = viewt.date_sortie) 

				WHERE substr(code, 6, 1) = 'S'
					AND (date &gt;= '[PERIODE_D]' AND date &lt;='[TOPERIODE_D]' OR	date &gt;= '[PERIODE_F]'	AND date &lt;='[TOPERIODE_F]')

				GROUP BY oid, code, texte, taux_cma_national * 100
					HAVING sum(viewt.nb_rsa)&gt; 0
					ORDER BY oid">
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="COD"/>
					<FIELD name="TXT"/>
					<FIELD name="TN"/>
					<FIELD name="FNT"/>
					<FIELD name="FNC"/>
					<FIELD name="DNT"/>
					<FIELD name="DNC"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Justificatif par RSS" shortLabel="Justificatif RSS" view="PMSI000040.XML" componentName="DATE_COMP_VIEWLINK" component2Name="" component3Name="">
				<ARG name="GHM" value="if (ROW == null) {
											if (SELECT.DATA == '1') {return 'CA'} 
											if (SELECT.DATA == '2') {return 'CS'} 
											return 'CA'
										}
										if (SELECT.DATA == '1' &amp; COLUMN.NAME == 'COL2D') {return 'GH' + ROW.OID} 
										if (SELECT.DATA == '1' &amp; COLUMN.NAME == 'COL2F') {return 'GH' + ROW.OID} 
										if (SELECT.DATA == '1') {return 'CW' + ROW.OID} 
										if (SELECT.DATA == '2') {return 'GH' + ROW.OID} 
										return SELECT.GHM"/>
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Comparaison" label="Comparaison">
			<FILTERSELECTION condition="Number(SELECT.OCCURENCE) == 0 || Number(ROW.FNT) &gt;= Number(SELECT.OCCURENCE)"/>
			<CHART title="% pour les 10 premiers" type="columnChart" maxItems="10" maxItemsSortOn="FNT" maxItemsSortSeq="D" sortField="COD" sortSeq="A">
				<CATEGORY field="COD" type="Char"/>
				<SERIE field="COL3D" displayName="'% Etab. ' + SELECT.PERIODE_D_LABEL + '-' + SELECT.TOPERIODE_D_LABEL" displayNameCalc="true"/>
				<SERIE field="COL3F" displayName="'% Etab. ' + SELECT.PERIODE_F_LABEL + '-' + SELECT.TOPERIODE_F_LABEL" displayNameCalc="true"/>
				<SERIE field="TN" displayName="% National"/>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" key="FNT" keySeq="D" headerHeight="54" printRatio="0.8">
				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid"/>
				<COLUMN dataField="COD" width="60" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="TOTAL"/>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="GHM" headerTextCalc="true" textAlign="left" totalFunction="text" otherFunction="text" otherComplement="Autres"/>
				<COLUMN dataField="TN" width="60" type="Number" outputFormat="#,0%" headerText="% National" textAlign="right" totalFunction="text" otherFunction="text"/>
				<COLUMN dataField="FNT" outputFormat="#" visible="false" type="Number" totalFunction="sum" otherFunction="sum"/>
				<COLUMN dataField="DNT" outputFormat="#" visible="false" type="Number" totalFunction="sum" otherFunction="sum"/>
				<COLUMN dataField="FNC" outputFormat="#" visible="false" type="Number" totalFunction="sum" otherFunction="sum"/>
				<COLUMN dataField="DNC" outputFormat="#" visible="false" type="Number" totalFunction="sum" otherFunction="sum"/>
				<COLUMN dataField="COL1D" width="80" type="Number" outputFormat="#" fixed="false" selectable="true" headerText="'Total ' + SELECT.PERIODE_D_LABEL + '-' + SELECT.TOPERIODE_D_LABEL" headerTextCalc="true" textAlign="right" totalFunction="calc" otherFunction="calc" calc="true">
					<CALC formula="ROW.DNT"/>
				</COLUMN>
				<COLUMN dataField="COL1F" width="80" type="Number" outputFormat="#" fixed="false" selectable="true" headerText="'Total ' + SELECT.PERIODE_F_LABEL + '-' + SELECT.TOPERIODE_F_LABEL" headerTextCalc="true" textAlign="right" totalFunction="calc" otherFunction="calc" calc="true">
					<CALC formula="ROW.FNT"/>
				</COLUMN>
				<COLUMN dataField="COL1E" type="Number" headerText="Ecart" width="70" outputFormat="#" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.COL1F - ROW.COL1D"/>
				</COLUMN>
				<COLUMN dataField="COL1P" type="Number" headerText="% évol." width="45" outputFormat="= if (ROW.COL1D !=0 || ROW.COL1F != 0) {return '0%'} else {return '#'}" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.COL1E / ROW.COL1D * 100"/>
				</COLUMN>
				<COLUMN dataField="COL2D" width="80" visible="true" type="Number" outputFormat="#" fixed="false" selectable="true" headerText="'CMA ' + SELECT.PERIODE_D_LABEL + '-' + SELECT.TOPERIODE_D_LABEL" headerTextCalc="true" textAlign="right" totalFunction="calc" otherFunction="calc" calc="true">
					<CALC formula="ROW.DNC"/>
				</COLUMN>
				<COLUMN dataField="COL2F" width="80" visible="true" type="Number" outputFormat="#" fixed="false" selectable="true" headerText="'CMA ' + SELECT.PERIODE_F_LABEL + '-' + SELECT.TOPERIODE_F_LABEL" headerTextCalc="true" textAlign="right" totalFunction="calc" otherFunction="calc" calc="true">
					<CALC formula="ROW.FNC"/>
				</COLUMN>
				<COLUMN dataField="COL2E" type="Number" visible="true" headerText="Ecart" width="70" outputFormat="#" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.COL2F - ROW.COL2D"/>
				</COLUMN>
				<COLUMN dataField="COL2P" type="Number" visible="true" headerText="% évol." width="45" fixed="false" outputFormat="= if (ROW.COL2D !=0 || ROW.COL2F != 0) {return '0%'} else {return '#'}" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.COL2E / ROW.COL2D * 100"/>
				</COLUMN>
				<COLUMN dataField="COL3D" width="80" visibleCondition="SELECT.DATA3 != '0'" type="Number" outputFormat="#,0%" fixed="false" selectable="true" headerText="'% Etab. ' + SELECT.PERIODE_D_LABEL + '-' + SELECT.TOPERIODE_D_LABEL" headerTextCalc="true" textAlign="right" totalFunction="calc" otherFunction="calc" calc="true">
					<CALC formula="ROW.DNC / ROW.DNT * 100"/>
				</COLUMN>
				<COLUMN dataField="COL3F" width="80" visible="true" type="Number" outputFormat="#,0%" fixed="false" headerText="'% Etab. ' + SELECT.PERIODE_F_LABEL + '-' + SELECT.TOPERIODE_F_LABEL" headerTextCalc="true" textAlign="right" totalFunction="calc" otherFunction="calc" calc="true">
					<CALC formula="ROW.FNC / ROW.FNT * 100"/>
				</COLUMN>
				<COLUMN dataField="COL3E" type="Number" visible="true" headerText="Ecart" width="70" outputFormat="#,0%" fixed="false" selectable="true" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.COL3F - ROW.COL3D"/>
				</COLUMN>
				<COLUMN dataField="COL3P" type="Number" visible="true" headerText="% évol." width="45" outputFormat="= if (ROW.COL3D !=0 || ROW.COL3F != 0) {return '0%'} else {return '#'}" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.COL3E / ROW.COL3D * 100"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
