<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="PMSI000364" label="PMSI. Prestations non valorisées" title="= 'Prestations par ' +  SELECT.GROUPBY_2_LABEL + ' (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" typeEts="23" helpDokuWIkiDir="pmsi:controles:ovalide" helpDokuWIkiFile="pmsi000364"  helpFile="iCTI_PMSI_PMSI000364.HTML">
	<VIEWPROPERTIES componentName="PROPERTIES_RSS" />
	<VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE" />
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value" />
		<PROPERTY name="SORTBY">
			<value><![CDATA[[EVAL 
			
				if ('[GROUPBY]' != '-1' && '[GROUPBY]' != '-1' && '[GROUPBY_TAB]' != 'TAB') {
					return 'ORDER BY 2,5,7';
				}
				else {
					return 'ORDER BY 12 DESC,5,7';
				}
			EVAL]]]></value>
		</PROPERTY>
		<PROPERTY name="PRESTATION_SELECT">
				<value><![CDATA[[EVAL 
						
					$subselect = '';
					
					// Prestation
					$mode = substr('[PRESTATION]',0,2);
					$oid = substr('[PRESTATION]',2);
					if ($mode == 'LS') {
						$section_id = PMSI_get_section_id('[PRESTATION]');
						$oid = PMSI_get_classe_oid('[PRESTATION]');
					}
					
					
					$subselect2 = '';
					if ($mode == 'LI') {$subselect2 = " prestation_id IN (SELECT to_id FROM pmsi.t_listes_contenu WHERE liste_id = $oid)";}
					if ($mode == 'SL') {$subselect2 = " prestation_id NOT IN (SELECT to_id FROM pmsi.t_listes_contenu WHERE liste_id = $oid)";}
					if ($mode == 'LS') {$subselect2 = " prestation_id IN (SELECT oid FROM pmsi.t_prestations WHERE $section_id = $oid)";}
					if ($mode == 'PR') {$subselect2 = " prestation_id = $oid ";}
					
					if ($subselect2 != '') {
						$subselect = "$subselect AND $subselect2 ";
					}
					
					return $subselect;
					
				EVAL]]]></value>
			</PROPERTY>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse" displayText=""> 
		<GROUP>
			<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="2016-01-01" printable="false" globalListProvider="DATE_DEBUT" />
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2016-12-31" printable="false" globalListProvider="DATE_FIN" />
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" width="220" label="" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de regroupement" data="-1" treeLevel="1" />
				<OPTION label="Prestations non valorisées" data="PRESTA_NON_VAL" 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 != '-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">
				<OPTION label="Pas de regroupement" data="-1" treeLevel="1" />
				<OPTION label="Regle de non valorisation" data="RULE_NON_VAL"  />
			</FIELD>
		</GROUP>
		<GROUP label="Prestation">
			<FIELD name="PRESTATION" label="" UI="combo" tree="true" width="400" default="-1" globalListProvider="PRESTATION" showIfNotDefault="true" />
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_RSS_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_rsf_detail_non_valorise_1.rss_id) as nb_rss,
                        count(*) as nombre
                    FROM #V_RSS_X#
					JOIN pmsi.v_rsf_detail_non_valorise_1 ON v_rsf_detail_non_valorise_1.rss_id = v_rss_1.rss_id, 
						[VIEW.SELECT_TABTREE_VIEW]
                        
                    WHERE 
                        mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) 
                        AND date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]'
                        [VIEW.FILTRE_RSS_SELECT]
                        [VIEW.SELECT_TABTREE_WHERE]
						[VIEW.PRESTATION_SELECT]
                        
                    GROUP BY 1,2,3,4,5,6,7,8,9,10,11
                    
                    [VIEW.SORTBY]
                ]]></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="NBRSS" />
					<FIELD name="NOMBRE" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Liste des RSS" shortLabel="Liste RSS" view="PMSI000365.XML" componentName="RSS_BASE_VIEWLINK">
				<ARG name="RULE_NON_VAL">
					<value><![CDATA[
				
					if (SELECT.GROUPBY_2 'RULE_NON_VAL' && ROW.COD == ROW.COD2) { return ROW.OID2;}
	
					]]></value>
				</ARG>
				<ARG name="PRESTATION">
					<value><![CDATA[
				
						if (SELECT.GROUPBY == 'PRESTA_NON_VAL' && ROW.OID1 >= 0) { return 'PR' + ROW.OID1;}
					
					]]></value>
				</ARG>
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Analyse prestations non valorisées" label="Analyse prestations non valorisées" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="Répartition en nombre d'occurences (10 premiers)" type="pieChart" maxItems="10" maxItemsSortOn="NOMBRE" maxItemsSortSeq="D" sortField="NOMBRE" sortSeq="D" condition="ROW.LVL == '1'">
				<CATEGORY field="CODTXT" type="Char" />
				<SERIE field="NOMBRE" />
			</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 == '-1' || 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" />
				<COLUMN dataField="COD" width="70" type="Char" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' &amp;&amp; SELECT.GROUPBY_TAB != 'TAB'" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" maxWidth="300" headerText="SELECT.GROUPBY_2_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="CODTXT" type="Char" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' ' + ROW.TXT" />
				</COLUMN>
				<COLUMN dataField="NBRSS" width="80" type="Number" outputFormat="#" headerText="Nb RSS" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="NOMBRE" width="90" type="Number" outputFormat="#" headerText="Nombre d'occurences" textAlign="right" totalFunction="sum" otherFunction="sum" />
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
