<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="PMSI000016" label="PMSI. LPP" title="= 'LPP par ' +  SELECT.GROUPBY_LABEL + ' (' + SELECT.QUELLEDATE_LABEL + ' : ' +  SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ') - ' + SELECT.VERSION_GROUPAGE_LABEL" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" helpDokuWIkiDir="pmsi:sejour_analyse_detaillee:lpp" helpDokuWIkiFile="pmsi000016"  helpFile="iCTI_PMSI_PMSI000016.HTML">
	<VIEWPROPERTIES componentName="PROPERTIES_LPP" />
	<VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE" />
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value" />
		<PROPERTY name="SORTBY">
			<value><![CDATA[[EVAL 
			
				if ('[GROUPBY_2]' != '-1' && '[GROUPBY]' != '-1' && '[GROUPBY_TAB]' != 'TAB') {
					return 'ORDER BY 2,5,7';
				}
				else {
					return 'ORDER BY 15 DESC,5,7';
				}
			EVAL]]]></value>
		</PROPERTY>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse">
		<GROUP label="Période">
			<FIELD name="QUELLEDATE" label="" UI="combo" default="1" default2="date_fin" printable="false">
				<OPTION label="Date sortie" data="1" data2="date_sortie" />
				<OPTION label="Date lpp" data="2" data2="date_lpp" />
			</FIELD>
			<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="Regroupements">
			<FIELD name="GROUPBY" width="200" label="" UI="combo" default="LPP" tree="true">
				<OPTION label="Options" data="" globalListProvider="LPP_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="200" label="" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de second niveau" data="-1" />
				<OPTION label="Options" data="" globalListProvider="LPP_GROUPBY_OPTIONS" />
			</FIELD>
		</GROUP>		
        <GROUP label="">
			<FIELD name="GROUPBY_3" width="200" label="" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de troisième niveau" data="-1" />
				<OPTION label="Options" data="" globalListProvider="LPP_GROUPBY_OPTIONS" />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_LPP_SELECTIONS" />
	<SELECTIONS componentName="FILTRES_LPP_SOUSSELECTIONS" />
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X" cacheEnabled="true">
				<select><![CDATA[ 
					
					CTISELECT_TREE
						GROUPBY1{[VIEW.SELECT_TABTREE_OID_FIELD],, [VIEW.SELECT_TABTREE_COD_FIELD],, [VIEW.SELECT_TABTREE_TXT_FIELD]}
						GROUPBY1MODE{[GROUPBY_TAB]}
						GROUPBY2{[VIEW.SELECT_TABTREE_2_OID_FIELD],, [VIEW.SELECT_TABTREE_2_COD_FIELD],, [VIEW.SELECT_TABTREE_2_TXT_FIELD]}
						GROUPBY3{[VIEW.SELECT_TABTREE_3_OID_FIELD],, [VIEW.SELECT_TABTREE_3_COD_FIELD],, [VIEW.SELECT_TABTREE_3_TXT_FIELD]}
						SIGNIFDATA{[VIEW.SELECT_TABTREE_ACTIVITE_SIGNIFICATIVE_DATA],, [ACTIVITE_SIGNIFICATIVE_MODE],, [ACTIVITE_SIGNIFICATIVE_NUMBER]}
						INDICATORS{
						
                                count(DISTINCT v_rss_1.patient_id),
                                count(DISTINCT v_rss_lpp_1.rss_id),
                                sum(nombre),
                                sum(montant_facture),
                                sum(montant_tr),
                                sum(montant_t2a_accorde),
                                sum(montant_t2a_accorde) - sum(montant_facture)
                        }
                        ORDERBY{indicateurs[15],, DESC}
					FROM #V_RSS_X#
						JOIN pmsi.v_rss_lpp_1 ON v_rss_1.rss_id = v_rss_lpp_1.rss_id 
					WHERE 
						[VIEW.QUELLEDATE] BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						AND from_eco = 0
						[VIEW.LPP_SELECT]
						[VIEW.FILTRE_RSS_SELECT]
						
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="SORT" />
					<FIELD name="NPAT" />
					<FIELD name="NRSS" />
					<FIELD name="NB" />
					<FIELD name="MF" />
					<FIELD name="MTR" />
					<FIELD name="MT2A" />
					<FIELD name="MTE" />
				</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="PMSI000019.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;" />
			</VIEWLINK>
			<VIEWLINK label="Evolution" shortLabel="Evolution" view="PMSI000018.XML" enabled="true" rowContext="false" componentName="PERIODICITE_VIEWLINK" buttonType="EVOLUTION">
				<ARG name="DATA" value="'3'" />
			</VIEWLINK>
			<VIEWLINK label="Analyse croisée" shortLabel="Analyse croisée" view="PMSI000215.XML" enabled="true" rowContext="false" buttonType="ANALYSE_CROISEE">
				<ARG name="ALIAS_PERIODE" value="'-1'" />
                <ARG name="PERIODE" value="return VIEW.X_PERIODE;" />
				<ARG name="DATA" value="'3'" />
				<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 LPP par RSS" shortLabel="Liste LPP" view="PMSI000017.XML" componentName="RSS_BASE_VIEWLINK" component2Name="LPP_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 LPP" label="Analyse LPP" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
            <CHART title="" type="group" subType="h" percentHeight="100" fromTotal="false">			
                <CHART title="Nombre de LPP" type="pieChart" subType="" maxItems="10" maxItemsSortOn="NB" maxItemsSortSeq="D" sortField="NB" sortSeq="D" condition="ROW.LVL == '1'">
                    <CATEGORY field="CODTXT" type="Char" />
                    <SERIE field="NB" displayName="Nombre de LPP" />
                </CHART>
                <CHART title="Montant facturé LPP" type="columnChart" maxItems="10" maxItemsSortOn="MF" maxItemsSortSeq="D" sortField="MF" sortSeq="D" condition="ROW.LVL == '1'">
                    <CATEGORY field="CODTXT" type="Char"/>
                    <SERIE field="MF" displayName="Montant facturé"/>
                </CHART>
			</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_2 == '-1' || SELECT.GROUPBY_3 == '-1' || SELECT.GROUPBY_TAB == 'TAB'">
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>
				<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">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="150" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres">
				</COLUMN>
                <COLUMN dataField="CODTXT" type="Char" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' ' + ROW.TXT.toString().substr(0,20)" />
				</COLUMN>
				<COLUMN dataField="NPAT" width="80" type="Number" outputFormat="#" headerText="Patients" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de patients différents" />
				<COLUMN dataField="NRSS" width="80" type="Number" outputFormat="#" headerText="Séjours" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séjours différents" />
				<COLUMN dataField="NB" width="80" type="Number" visibleCondition="SELECT.GROUPBY == 'LPP' || SELECT.LPP != '-1'" outputFormat="#" headerText="LPP" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de LPP" />
				<COLUMN dataField="MF" width="95" type="Number" outputFormat="#E" headerText="Montant facturé" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Somme des montants facturés" />
				<COLUMN dataField="MFP" type="Number" headerText="% / Total" width="45" outputFormat="0%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Poids du montant facturé du critère de regroupement dans le montant facturé total">
					<CALC formula="ROW.MF / TOTALROW.MF * 100" />
				</COLUMN>
				<COLUMN dataField="PUM" width="80" type="Number" outputFormat="#,00E" visibleCondition="SELECT.GROUPBY == 'LPP' || SELECT.LPP != '-1'" headerText="P.U. Moyen" textAlign="right" totalFunction="calc" otherFunction="" calc="true"
					description="Rapport entre les colonnes &lt;b&gt;Montant facturé&lt;/b&gt; et &lt;b&gt;LPP&lt;/b&gt;">
					<CALC formula="ROW.MF / ROW.NB" />
				</COLUMN>
				<COLUMN dataField="MTR" width="95" type="Number" outputFormat="#E" headerText="Montant tarif LPP" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Somme des dépenses au tarif de la LPP pour le DMI. Nombre x tarif de la LPP" visibleCondition="ENV.TYPEETS == '2' || ENV.TYPEETS == '3'" />
				<COLUMN dataField="MT2A" width="95" type="Number" outputFormat="#E" headerText="Montant T2A accordé" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Somme des dépenses T2A accordées" visibleCondition="ENV.TYPEETS == '2' || ENV.TYPEETS == '3'" />
				<COLUMN dataField="MTE" width="80" type="Number" visibleCondition="ENV.TYPEETS == '2' || ENV.TYPEETS == '3'" outputFormat="#E" headerText="Ecart T2A-Facturé" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Différence entre les colonnes &lt;b&gt;Montant T2A accordé&lt;/b&gt; et &lt;b&gt;Montant facturé&lt;/b&gt;" />
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
