<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="PMSI000048" label="PMSI. Rapport personnalisé" title="PMSI. Rapport personnalisé" database="iCTI" swf="*CTI_view1" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" softCode="iCTI_pmsi" helpDokuWIkiDir="pmsi:rapport_de_synthese" helpDokuWIkiFile="pmsi000048"  helpFile="iCTI_PMSI_PMSI000048.HTML">
	<title><![CDATA[=	
		
		var group_by_label = '';
		if (SELECT.GROUPBY != '-1') {
			group_by_label = ' par ' + SELECT.GROUPBY_LABEL;
		}
		if (SELECT.GROUPBY_2 != '-1') {
			group_by_label = group_by_label + ' et ' + SELECT.GROUPBY_2_LABEL;
		}

		return SELECT.RAPPORT_LABEL + group_by_label +
		' ('  +  SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'
		
	]]></title>
	<VIEWPROPERTIES componentName="PROPERTIES_RSS"/>
	<VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE"/>
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse">
		<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>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2014-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="TREE" visible="false">
				<OPTION label="Automatique" data="AUTO"/>
				<OPTIONx label="Arbre" data="TREE"/>
				<OPTIONx 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>
			<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="Rapport">
			<FIELD name="RAPPORT" label="" UI="combo" default="-1" globalListProvider="RAPPORT">
			</FIELD>
		</GROUP>
		<GROUP label="Pourcentage">
			<FIELD name="POURCENTAGE" label="" UI="combo" default="-1">
				<OPTION label="Pas de pourcentage" data="-1" />
				<OPTION label="% sur le premier indicateur" data="1" />
				<OPTION label="% sur le deuxième indicateur" data="2" />
				<OPTION label="% sur les deux premiers indicateurs" data="12" />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_RSS_SELECTIONS"/>
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_RSS]
						}	
					FROM #V_RSS_X#
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P,, ADD}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_RUM]
						}	
					FROM #V_RSS_X# JOIN pmsi.v_rss_rum_1 ON v_rss_1.rss_id = v_rss_rum_1.rss_id
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P,, ADD}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_PRESTA]
						}	
					FROM #V_RSS_X# JOIN pmsi.v_rsf_detail_1 ON v_rss_1.rss_id = v_rsf_detail_1.rss_id
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P,, ADD}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_PRESTAH]
						}	
					FROM #V_RSS_X# JOIN pmsi.v_rsf_detail_6 ON v_rss_1.rss_id = v_rsf_detail_6.rss_id
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P,, ADD}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_LPP]
						}	
					FROM #V_RSS_X# JOIN pmsi.v_rss_lpp_1 ON v_rss_1.rss_id = v_rss_lpp_1.rss_id
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			<SQL optimizer="V_RSS_X" optimizer2="V_RSS_ACTES_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P,, ADD}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_ACTE]
						}	
					FROM #V_RSS_X#
						JOIN #V_RSS_ACTES_X# ON v_rss_1.rss_id = v_rss_actes_1.rss_id
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P,, ADD}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_DIAG]
						}	
					FROM #V_RSS_X# JOIN pmsi.v_rss_diagnostics_1 ON v_rss_1.rss_id = v_rss_diagnostics_1.rss_id
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			
			<SQL optimizer="V_RSS_X">
				<select><![CDATA[		

					CTIPREPAR_TREE
						WORKTABLE{PMSI000048_P,, ADD}
						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]}
						INDICATORS{
							[VIEW.INDICATEURS_EXPERT]
						}	
					FROM #V_RSS_X# 
						JOIN pmsi.v_expert_rss_controle_1 ON v_rss_1.rss_id = v_expert_rss_controle_1.rss_id AND v_expert_rss_controle_1.etat = ''
					WHERE mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.FILTRE_RSS_SELECT]


				]]></select>
			</SQL>
			

            <SQL optimizer="V_RSS_X">
                <select><![CDATA[

                    CTIPREPAR_TREE
                        WORKTABLE{PMSI000048_P,, ADD}
                        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]}
                        INDICATORS{ 
                            [VIEW.INDICATEURS_SRC] 
                        }
                    FROM #V_RSS_X# 
                    JOIN pmsi.v_rss_src_1 ON v_rss_1.rss_id = v_rss_src_1.oid
                    WHERE 1=1
                        AND v_rss_1.mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) 
                        AND v_rss_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
                        [VIEW.FILTRE_RSS_SELECT]

                ]]></select>
            </SQL>

			<SQL>
				<select><![CDATA[		

					SELECT oidt, labelt, textet, 
						oid1, code1, 
						oid2, code2, 
						oid3, code3, 
						oid, code, texte, level, 
						[VIEW.RUBRIQUES_RAPPORT]
					FROM PMSI000048_P
					GROUP BY 1,2,3,4,5,6,7,8,9,10,11,12,13
					ORDER BY labelt,oidt,code1,oid1,code2,oid2

				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="IN01"/>
					<FIELD name="IN02"/>
					<FIELD name="IN03"/>
					<FIELD name="IN04"/>
					<FIELD name="IN05"/>
					<FIELD name="IN06"/>
					<FIELD name="IN07"/>
					<FIELD name="IN08"/>
					<FIELD name="IN09"/>
					<FIELD name="IN10"/>
					<FIELD name="IN11"/>
					<FIELD name="IN12"/>
					<FIELD name="IN13"/>
					<FIELD name="IN14"/>
					<FIELD name="IN15"/>
					<FIELD name="IN16"/>
					<FIELD name="IN17"/>
					<FIELD name="IN18"/>
					<FIELD name="IN19"/>
					<FIELD name="IN20"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL>
				<select><![CDATA[	
				
					SELECT * FROM pmsi.cti_prepare_rapport([RAPPORT]) AS (name text, value text)

				]]></select>
				<FIELDS>
					<FIELD name="name"/>
					<FIELD name="value"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
		</VIEWLINKS>
		<ONGLET label="Onglet" multiTab="true">
			<DATAGRID title="" total="true" headerHeight="56" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'" variableRowHeight="true" sortable="= SELECT.GROUPBY_3 == '-1' &amp;&amp; (SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB')">
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>
				<COLUMN dataField="OID" type="Number" visible="false"/>
				<COLUMN dataField="COD" type="Char" width="60" outputFormat="#" headerText="Code" textAlign="left" totalComplement="*ROW">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="110" headerText="Texte" textAlign="left" totalComplement="*ROW"/>
				<COLUMN dataField="IN01" width="= Number(VIEW.IW1)" type="Number" outputFormat="= VIEW.IO1" fixed="false" visibleCondition="VIEW.IC1 != null" headerText="VIEW.IH1" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="P_IN01" type="Number" headerText=" '% ' + VIEW.IH1" headerTextCalc="true" width="= Number(VIEW.IW1)" outputFormat="#,0%" fixed="false" textAlign="right" visibleCondition="SELECT.POURCENTAGE == '1' || SELECT.POURCENTAGE == '12'" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.IN01 / TOTALROW.IN01 * 100" />
				</COLUMN>
				<COLUMN dataField="IN02" width="= Number(VIEW.IW2)" type="Number" outputFormat="= VIEW.IO2" fixed="false" visibleCondition="VIEW.IC2 != null" headerText="VIEW.IH2" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="P_IN02" type="Number" headerText=" '% ' + VIEW.IH2" headerTextCalc="true" width="= Number(VIEW.IW2)" outputFormat="#,0%" fixed="false" textAlign="right" visibleCondition="SELECT.POURCENTAGE == '2' || SELECT.POURCENTAGE == '12'" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true">
					<CALC formula="ROW.IN02 / TOTALROW.IN02 * 100" />
				</COLUMN>
				<COLUMN dataField="IN03" width="= Number(VIEW.IW3)" type="Number" outputFormat="= VIEW.IO3" fixed="false" visibleCondition="VIEW.IC3 != null" headerText="VIEW.IH3" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN04" width="= Number(VIEW.IW4)" type="Number" outputFormat="= VIEW.IO4" fixed="false" visibleCondition="VIEW.IC4 != null" headerText="VIEW.IH4" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN05" width="= Number(VIEW.IW5)" type="Number" outputFormat="= VIEW.IO5" fixed="false" visibleCondition="VIEW.IC5 != null" headerText="VIEW.IH5" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN06" width="= Number(VIEW.IW6)" type="Number" outputFormat="= VIEW.IO6" fixed="false" visibleCondition="VIEW.IC6 != null" headerText="VIEW.IH6" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN07" width="= Number(VIEW.IW7)" type="Number" outputFormat="= VIEW.IO7" fixed="false" visibleCondition="VIEW.IC7 != null" headerText="VIEW.IH7" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN08" width="= Number(VIEW.IW8)" type="Number" outputFormat="= VIEW.IO8" fixed="false" visibleCondition="VIEW.IC8 != null" headerText="VIEW.IH8" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN09" width="= Number(VIEW.IW9)" type="Number" outputFormat="= VIEW.IO9" fixed="false" visibleCondition="VIEW.IC9 != null" headerText="VIEW.IH9" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN10" width="= Number(VIEW.IW10)" type="Number" outputFormat="= VIEW.IO10" fixed="false" visibleCondition="VIEW.IC10 != null" headerText="VIEW.IH10" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN11" width="= Number(VIEW.IW11)" type="Number" outputFormat="= VIEW.IO11" fixed="false" visibleCondition="VIEW.IC11 != null" headerText="VIEW.IH11" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN12" width="= Number(VIEW.IW12)" type="Number" outputFormat="= VIEW.IO12" fixed="false" visibleCondition="VIEW.IC12 != null" headerText="VIEW.IH12" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN13" width="= Number(VIEW.IW13)" type="Number" outputFormat="= VIEW.IO13" fixed="false" visibleCondition="VIEW.IC13 != null" headerText="VIEW.IH13" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN14" width="= Number(VIEW.IW14)" type="Number" outputFormat="= VIEW.IO14" fixed="false" visibleCondition="VIEW.IC14 != null" headerText="VIEW.IH14" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN15" width="= Number(VIEW.IW15)" type="Number" outputFormat="= VIEW.IO15" fixed="false" visibleCondition="VIEW.IC15 != null" headerText="VIEW.IH15" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN16" width="= Number(VIEW.IW16)" type="Number" outputFormat="= VIEW.IO16" fixed="false" visibleCondition="VIEW.IC16 != null" headerText="VIEW.IH16" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN17" width="= Number(VIEW.IW17)" type="Number" outputFormat="= VIEW.IO17" fixed="false" visibleCondition="VIEW.IC17 != null" headerText="VIEW.IH17" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN18" width="= Number(VIEW.IW18)" type="Number" outputFormat="= VIEW.IO18" fixed="false" visibleCondition="VIEW.IC18 != null" headerText="VIEW.IH18" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN19" width="= Number(VIEW.IW19)" type="Number" outputFormat="= VIEW.IO19" fixed="false" visibleCondition="VIEW.IC19 != null" headerText="VIEW.IH19" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
				<COLUMN dataField="IN20" width="= Number(VIEW.IW20)" type="Number" outputFormat="= VIEW.IO20" fixed="false" visibleCondition="VIEW.IC20 != null" headerText="VIEW.IH20" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction=""/>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
