<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000051" label="PMSI. Simulation tarif public" title="= 'Simulation tarif public par ' +  SELECT.GROUPBY_LABEL + ' (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" typeEts="1" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" helpDokuWIkiDir="pmsi" helpDokuWIkiFile="pmsi000051"  helpFile="iCTI_PMSI_PMSI000051.HTML">
	<VIEWPROPERTIES componentName="PROPERTIES_RSS"/>
	<VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE"/>
	<SELECTIONS label="Paramètres de l'analyse" displayText="">
		<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="" UI="combo" tree="true" width="200" default="2023-01-01" printable="false" globalListProvider="DATE_DEBUT">
			</FIELD>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2024-12-31" printable="false" globalListProvider="DATE_FIN">
			</FIELD>
		</GROUP>
		<GROUP label="Regroupements">
			<FIELD name="GROUPBY" width="220" label="" UI="combo" default="4" tree="true">
				<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_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="Options" data="" globalListProvider="RSS_GROUPBY_OPTIONS"/>
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_RSS_SOUSSELECTIONS"/>
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS"/>
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X" select="
				SELECT 
					[VIEW.SELECT_TABTREE_COLUMNS],
					
					SUM(nb_rsa),
					SUM(view1.montant_ghs_prive), 
					SUM(view1.montant_pii_prive), 
					SUM(view1.montant_pme_prive), 
					SUM(view1.montant_sup_prive), 
					SUM(honoraires_factures),
					SUM(view2.montant_ghs_public),
					SUM(view3.montant_sup_public)
					
					
				FROM #V_RSS_X#
					LEFT JOIN (SELECT rss_id, 
						SUM(CASE WHEN prestation_code = 'GHS' OR prestation_code = 'EXH' THEN base_remboursement ELSE 0 END) AS montant_ghs_prive, 
						SUM(CASE WHEN prestation_code = 'PII'  THEN base_remboursement ELSE 0 END) AS montant_pii_prive, 
						SUM(CASE WHEN prestation_code = 'PME'  THEN base_remboursement ELSE 0 END) AS montant_pme_prive, 
						SUM(CASE WHEN prestation_code IN ('NN1', 'NN2', 'NN3', 'REA', 'REP', 'SRA', 'SRC', 'SSC', 'STF', 'REP') THEN base_remboursement ELSE 0 END) AS montant_sup_prive
						FROM pmsi.v_rsf_detail_1 GROUP BY rss_id) AS view1  ON (v_rss_1.rss_id = view1.rss_id)       
					LEFT JOIN (SELECT rss_id, 
						SUM(montant_ghs_public + montant_exh_public) AS montant_ghs_public 
						FROM pmsi.v_rsf_detail_2 GROUP BY rss_id) AS view2  ON (v_rss_1.rss_id = view2.rss_id) 
					LEFT JOIN (SELECT rss_id, 
						SUM(CASE WHEN prestation_code IN ('NN1', 'NN2', 'NN3', 'REA', 'REP', 'SRA', 'SRC', 'SSC', 'STF', 'REP') THEN montant_public ELSE 0 END) AS montant_sup_public
						FROM pmsi.v_rsf_detail_3 GROUP BY rss_id) AS view3  ON (v_rss_1.rss_id = view3.rss_id), 
					[VIEW.SELECT_TABTREE_VIEW]       
						
				WHERE date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'

					[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

					">
				<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_RSA"/>
					<FIELD name="PR_GHS"/>
					<FIELD name="PR_PII"/>
					<FIELD name="PR_PME"/>
					<FIELD name="PR_SUP"/>
					<FIELD name="PR_HON"/>
					<FIELD name="PU_GHS"/>
					<FIELD name="PU_SUP"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Liste des RSS" shortLabel="Liste RSS" view="PMSI000052.XML" componentName="RSS_BASE_VIEWLINK">
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="CA Séjour" label="C.A. Séjour" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<DATAGRID title="" total="true" showOthers="true" headerHeight="54" 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="fontSize" value="11"/>
				<FOOTERROWSTYLE name="fontSize" value="11"/>
				<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>
				<COLUMN dataField="OID1" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD1" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="OID2" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD2" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD" width="70" type="Char" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="TOTAL">
					<CELLSTYLE name="fontSize" value="11"/>
					<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'"/>
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="Texte" textAlign="left" totalFunction="text" otherFunction="text" otherComplement="Autres">
					<CELLSTYLE name="fontSize" value="11"/>
				</COLUMN>
				<COLUMN dataField="NB_RSA" width="60" type="Number" outputFormat="#" headerText="RSA" textAlign="right" totalFunction="sum" otherFunction="sum" largeSeparator="true">
				</COLUMN>
				<COLUMN dataField="PR_GHS" width="80" type="Number" outputFormat="#E" fixed="false" headerText="(A) Privé   CA GHS" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="PR_SUP" width="80" type="Number" outputFormat="#E" fixed="false" headerText="(B) Privé   CA SUP" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="PR_HON" width="80" type="Number" outputFormat="#E" fixed="false" headerText="(C) Privé   CA HON" textAlign="right" totalFunction="sum" otherFunction="sum" largeSeparator="true">
				</COLUMN>
				<COLUMN dataField="PU_GHS" width="80" type="Number" outputFormat="#E" fixed="false" headerText="(X)   Public CA GHS" textAlign="right" totalFunction="sum" otherFunction="sum">
				</COLUMN>
				<COLUMN dataField="PU_SUP" width="80" type="Number" outputFormat="#E" fixed="false" headerText="(Y)   Public CA SUP" textAlign="right" totalFunction="sum" otherFunction="sum" largeSeparator="true">
				</COLUMN>
				<COLUMN dataField="PR_TOT" type="Number" headerText="(D) Privé   CA Total (A+B+C)" width="80" outputFormat="#E" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.PR_GHS + ROW.PR_SUP + ROW.PR_HON"/>
				</COLUMN>
				<COLUMN dataField="PU_TOT" type="Number" headerText="(Z) Public   CA Total (X+Y)" width="80" outputFormat="#E" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.PU_GHS + ROW.PU_SUP"/>
				</COLUMN>
				<COLUMN dataField="DIFF" type="Number" headerText="(E) Ecart   (Z-D)" width="80" outputFormat="#E" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.PU_TOT - ROW.PR_TOT"/>
				</COLUMN>
				<COLUMN dataField="PDIFF" type="Number" headerText="% Ecart TOT (E/D)" width="80" outputFormat="#%" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true" largeSeparator="true">
					<CALC formula="ROW.DIFF / ROW.PR_TOT * 100"/>
				</COLUMN>
				<COLUMN dataField="PR_AB" type="Number" headerText="(F) Privé   CA ETS (A+B)" width="80" outputFormat="#E" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.PR_GHS + ROW.PR_SUP"/>
				</COLUMN>
				<COLUMN dataField="PDIFFETS" type="Number" headerText="% Ecart ETS (E/F)" width="80" outputFormat="#%" fixed="false" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.DIFF / ROW.PR_AB * 100"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
