<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000150" label="PMSI. Décomposition prestations honoraires" title="= 'Prestations Honoraires par ' +  SELECT.GROUPBY_LABEL + ' (' +  SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" globals="PMSI_globals.XML" typeEts="23" componentsFile="PMSI_components.XML">
	<VIEWPROPERTIES componentName="PROPERTIES_PRESTATIONS" />
	<VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE" />
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
					if (SELECT.PRESTATION != '-1') {display = display + '#B#Analyse prestation#/B# : #B#' + SELECT.PRESTATION_LABEL + '#/B#'}
					return display;
					">
		<GROUP label="Période">
			<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="Prestation">
			<FIELD name="PRESTATION" label="" UI="combo" tree="true" width="400" default="-1" globalListProvider="PRESTATION" showIfNotDefault="true" />
		</GROUP>
		<GROUP label="Regroupements">
			<FIELD name="GROUPBY" width="220" label="" UI="combo" default="PRESTA" tree="true">
				<OPTION label="Options" data="" globalListProvider="PRESTATIONS_GROUPBY_OPTIONS" />
			</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" />
				<OPTION label="Options" data="" globalListProvider="PRESTATIONS_GROUPBY_OPTIONS" />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_PRESTATION_SOUSSELECTIONS" />
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X" cacheEnabled="true">
				<select><![CDATA[ 
					
					SELECT [VIEW.SELECT_TABTREE_COLUMNS],
						
						count(DISTINCT v_rss_1.patient_id),
						count(DISTINCT  v_rss_1.rss_id),
						sum(nombre_coefficient),
						sum(v_rsf_detail_1.base_remboursement),
						sum(v_rsf_detail_1.base_remboursement_sauf_transition),
						sum(v_rsf_detail_1.sejour_remboursable)

					FROM [VIEW.V_RSS_VIEW_OPTIMIZE], pmsi.v_rsf_detail_6 v_rsf_detail_1, [VIEW.SELECT_TABTREE_VIEW]
					WHERE 
						v_rss_1.rss_id = v_rsf_detail_1.rss_id 
						AND mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) 
						AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
									
						[VIEW.PRESTATION_SELECT]
						[VIEW.FILTRE_RSS_SELECT]
						
						[VIEW.SELECT_TABTREE_WHERE]
						
					GROUP BY 1,2,3,4,5,6,7,8,9,10,11
					ORDER BY 2,5,7
						
				]]></select>
				<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="NB_PAT" />
					<FIELD name="NB_RSA" />
					<FIELD name="NB" />
					<FIELD name="MF" />
					<FIELD name="MFHT" />
					<FIELD name="MR" />
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL>
				<select><![CDATA[
						SELECT 'X_PERIODE_D', greatest(to_date(to_char('[PERIODE]'::date - INTERVAL  '1 year', 'YYYY-MM-DD'), 'YYYY-MM-DD'), (SELECT min(date_debut) FROM pmsi.p_imports))::text
					UNION ALL
						SELECT 'X_TOPERIODE_D', greatest(to_date(to_char('[TOPERIODE]'::date - INTERVAL  '1 year', 'YYYY-MM-DD'), 'YYYY-MM-DD'), (SELECT min(date_debut) FROM pmsi.p_imports))::text
					UNION ALL
						SELECT 'X_PERIODE', greatest(to_date(to_char('[PERIODE]'::date - INTERVAL  '3 year', 'YYYY-MM-DD'), 'YYYY-MM-DD'), (SELECT min(date_debut) FROM pmsi.p_imports))::text
				]]></select>
				<FIELDS>
					<FIELD name="name"/>
					<FIELD name="value"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Comparatif" shortLabel="Comparatif" view="PMSI000152.XML" enabled="true" rowContext="false" buttonType="COMPARATIF">
				<ARG name="PERIODE_D" value="return VIEW.X_PERIODE_D;" />
				<ARG name="TOPERIODE_D" value="return VIEW.X_TOPERIODE_D;" />
				<ARG name="DATA" value="'BR'" />
			</VIEWLINK>
			<VIEWLINK label="Evolution" shortLabel="Evolution" view="PMSI000151.XML" enabled="true" rowContext="false" componentName="PERIODICITE_VIEWLINK" buttonType="EVOLUTION">
				<ARG name="DATA" value="'1'" />
			</VIEWLINK>
			<VIEWLINK label="Analyse croisée" shortLabel="Analyse croisée" view="PMSI000222.XML" enabled="true" rowContext="false" buttonType="ANALYSE_CROISEE">
				<ARG name="PERIODE" value="return VIEW.X_PERIODE;" />
				<ARG name="DATA" value="'1'" />
				<ARG name="COLUMNBY" value="'MSOR'" />
				<ARG name="GROUPBY" value="'ASOR'" />
				<ARG name="GROUPBY_2" value="if (SELECT.GROUPBY == 'ASOR') {return 'GHM';} else {return SELECT.GROUPBY;}" />
				<ARG name="GROUPBY_TAB" value="'TAB'" />
				<ARG name="COLUMNBYCOUNT" value="'12'" />
			</VIEWLINK>
			<VIEWLINK label="Justificatif Prestations par RSS" shortLabel="Liste Prestations" view="PMSI000153.XML" componentName="RSS_BASE_VIEWLINK" component2Name="PRESTATION_VIEWLINK" component3Name="" />
			<VIEWLINK label="Liste des RSS" shortLabel="Liste RSS" view="PMSI000005.XML" componentName="RSS_BASE_VIEWLINK" component2Name="RSS_OTHERS_VIEWLINK" component3Name="" />
		</VIEWLINKS>
		<ONGLET excelLabel="Analyse prestations" label="Analyse prestations" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="Montant" type="pieChart" subType="" maxItems="10" maxItemsSortOn="MF" maxItemsSortSeq="D" sortField="CODTXT" sortSeq="A" condition="ROW.LVL == '1'">
				<CATEGORY field="CODTXT" type="Char" />
				<SERIE field="MF" displayName="Montant" />
			</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_3 == '-1' &amp;&amp; (SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB')">
				<ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="backgroundColor" value="0xFFD393" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="borderSides" value="top bottom" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="borderStyle" value="solid" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-1' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				<ROWSTYLE name="borderThickness" value="2" condition="ROW.LVL == '1' &amp;&amp; SELECT.GROUPBY_2 != '-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">
					<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				</COLUMN>
				<COLUMN dataField="COD" width="60" visibleCondition="SELECT.GROUPBY != '11'" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" />
				<COLUMN dataField="TXT" type="Char" visibleCondition="SELECT.GROUPBY != '11'" minWidth="200" maxWidth="300" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="TXT2" type="Date" visibleCondition="SELECT.GROUPBY == '11'" minWidth="200" maxWidth="300" inputFormat="AAAAMM" outputFormat="MMMM YY" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" calc="true">
					<CALC formula="ROW.COD" />
				</COLUMN>
				<COLUMN dataField="CODTXT" type="Char" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="if (SELECT.GROUPBY == '11') {return ROW.TXT2}
									return ROW.COD + ' ' + ROW.TXT.toString().substr(0,20)" />
				</COLUMN>
				<COLUMN dataField="NB_PAT" width="60" type="Number" outputFormat="#" currency="" currencyAlign="right" headerText="Nb Patients" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="NB_RSA" width="60" type="Number" outputFormat="#" currency="" currencyAlign="right" headerText="Nb Séjours" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="NB" width="80" type="Number" visibleCondition="SELECT.GROUPBY == 'PRESTA' || SELECT.PRESTATION != '-1'" outputFormat="#" headerText="Nb" textAlign="right" totalFunction="sum" otherFunction="" />
				<COLUMN dataField="MF" width="100" type="Number" outputFormat="#E" headerText="Montant facturé (BR)" textAlign="right" totalFunction="sum" otherFunction="" />
				<COLUMN dataField="MFP" type="Number" headerText="% / Total" width="45" outputFormat="0%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.MF / TOTALROW.MF * 100" />
				</COLUMN>
				<COLUMN dataField="PUM" width="80" type="Number" outputFormat="#,00E" visibleCondition="SELECT.GROUPBY == 'PRESTA' || SELECT.PRESTATION != '-1'" headerText="P.U Moyen" textAlign="right" totalFunction="calc" otherFunction="" calc="true">
					<CALC formula="ROW.MF / ROW.NB" />
				</COLUMN>
				<COLUMN dataField="MFHT" width="100" visibleCondition="ENV.TYPEETS == '2' || ENV.TYPEETS == '3'" type="Number" outputFormat="#E" headerText="Montant facturé (BR) Hors transition" textAlign="right" totalFunction="sum" otherFunction="" />
				<COLUMN dataField="MR" width="100" visibleCondition="ENV.TYPEETS == '2' || ENV.TYPEETS == '3'" type="Number" outputFormat="#E" headerText="Montant remboursé" textAlign="right" totalFunction="sum" otherFunction="" />
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
