<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="ACTI000123" label="Activité. Occupation" title="= 'Occupation' +  ' ' + SELECT.REAPRE2 + ' par ' +  SELECT.GROUPBY_LABEL + ' (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'" database="iCTI" swf="*CTI_view1" softCode="iCTI_activite" globals="ACTI_globals.XML" componentsFile="ACTI_components.XML" 
        helpFile="iCTI_ACTI_ACTI000123.HTML"
        helpDokuWIkiDir="activite:occupation_sejours" 
        helpDokuWIkiFile="acti000123" 
>
	<VIEWPROPERTIES componentName="PROPERTIES_OCCUPATION" />
	<VIEWPROPERTIES>
		
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value" />
		<PROPERTY name="REAPRE_SELECT">
			<value><![CDATA[
						[EVAL 
							if ('[REAPRE]' == '1' && '[ENV.OPTADM_PREVUS]' == '1') {return "";}
							if ('[REAPRE]' == '2' && '[ENV.OPTADM_PREVUS]' == '1') {return " AND est_mouvement_previsionnel = '1'";}
							return " AND est_mouvement_previsionnel <> '1'";
						EVAL]
					]]></value>
		</PROPERTY>
		<PROPERTY name="ORDERBY">
			<value><![CDATA[[EVAL 
					
					$groupbys = array(
										'[GROUPBY]', 
										'[GROUPBY_2]', 
										'[GROUPBY_3]'
									);
					$exceptions = array('ANNEE', 'TRIM', 'MOIS', 'JOUR','JOURS', 'NUMEROTRIM', 'NUMEROMOIS', 'NUMEROJOUR','SEMAINEWE','SEMAINEANNE','SEMAINE','EDS');
					
					$result = array_intersect($groupbys, $exceptions);
					
					if (count($result) > 0) {
						return "DEFAULT";
					}
					else {
						return "indicateurs[24]";
					}
					
			EVAL]]]></value>
		</PROPERTY>
		<PROPERTY name="GROUPBY_DATE">
			<value>
				<![CDATA[
				[EVAL 	
					switch ('[GROUPBY]') {
						case 'ANNEE' :			$s = 'JOURS'; 		break;
						case 'TRIM' :			$s = 'JOURS';		break;
						case 'MOIS' :			$s = 'JOURS';		break;
						case 'NUMEROMOIS' :		$s = 'JOURS';		break;
						case 'NUMEROTRIM' :		$s = 'JOURS';		break;
						case 'SEMAINEWE' :		$s = 'JOURS';		break;
						case 'SEMAINEANNE' :	$s = 'JOURS';		break;
						case 'NUMEROJOUR' :		$s = 'JOURS';		break;
						case 'JOURS' :			$s = 'JOURS';		break;
						case 'JOUR' :			$s = 'JOURS';		break;
						
				
						default :				
								{$s = 'JOURS';			break;}
						
					}
					return $s;
				EVAL]
				]]>
			</value>
		</PROPERTY>
	
	</VIEWPROPERTIES>
	
	<SELECTIONS label="Paramètres de l'analyse">
		<GROUP>
			<FIELD name="ALIAS_PERIODE" label="" UI="combo" width="220" default="CUM_LAST_MONTH" tree="true" globalListProvider="ALIAS_PERIODE" />
            <FIELD name="PERIODE" label="Période" UI="combo" tree="true" width="220" default="2009-01-01" globalListProvider="DATE_DEBUT" />
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="220" default="2009-01-31" globalListProvider="DATE_FIN" />
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" label="" UI="combo" width="300" default="SER" tree="true">
				<OPTION label="OCCUPATION_GROUPBY" data="" globalListProvider="OCCUPATION_GROUPBY" />
			</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" label="" UI="combo" width="300" default="-1" tree="true">
				<OPTION label="" data="-1" treeLevel="1" />
				<OPTION label="OCCUPATION_GROUPBY" data="" globalListProvider="OCCUPATION_GROUPBY" />
			</FIELD>
			<FIELD name="GROUPBY_3" label="" UI="combo" width="300" default="-1" tree="true">
				<OPTION label="" data="-1" treeLevel="1" />
				<OPTION label="OCCUPATION_GROUPBY" data="" globalListProvider="OCCUPATION_GROUPBY" />
			</FIELD>
		</GROUP>
		
	</SELECTIONS>
	<SELECTIONS componentName="DAYS_SELECTIONS" />
	<SELECTIONS label="Modes de calcul" collapsible="true" displayText="= var display:String='';display=display+'Modes de calcul : #B#'+SELECT.QPLACES_LABEL+'. '+VIEW.OPTADM_DAYOUT+'. '+SELECT.QJMUT_LABEL+'#/B#';return display;">
		<GROUP label="Modes">
			<FIELD name="REAPRE" label="" width="145" UI="combo" default="0" visible="= ENV.OPTADM_PREVUS == '1'" showIfNotDefault="true">
				<OPTION data="0" label="Prévus exclus" data2="" />
				<OPTION data="1" label="Prévus inclus" data2="(Réalisation et Prévisions)" />
				<OPTION data="2" label="Uniquement prévus" data2="(Prévisions)" />
			</FIELD>
		</GROUP>
		<GROUP label="">
			<FIELD name="QJMUT" label="" width="350" UI="combo" default="f">
				<OPTION data="d" label="Si mutation, journée affectée à la premiere localisation" />
				<OPTION data="f" label="Si mutation, journée affectée à la dernière localisation" />
				<OPTION data="12" label="Si mutation, journée affectée à la localisation occupée à 12h" />
				<OPTION data="prorata" label="Si mutation, journée affectée au prorata du temps passé" />
			</FIELD>
		</GROUP>
		<GROUP label="">
			<FIELD name="QPLACES" label="" width="200" UI="combo" default="OUV">
				<OPTION data="OUV" label="Lits et box ouverts" />
				<OPTION data="THEO" label="Lits et box théoriques" />
			</FIELD>
			<FIELD name="QMOY" label="" width="200" UI="combo" default="0">
				<OPTION data="0" label="Ne pas afficher les moyennes" />
				<OPTION data="1" label="Afficher les moyenne quotidiennes" />
			</FIELD>
		</GROUP>
		
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_OCCUPATION_SOUSSELECTIONS" />
	<SELECTIONS componentName="FILTRES_MOUVEMENTS_SELECTIONS" />
	<SELECTIONS componentName="FILTRES_SEJOURS_SELECTIONS" />
	<SELECTIONS componentName="FILTRES_PATIENTS_SELECTIONS" />
	<SELECTIONS componentName="FILTRES_PASSAGES_SELECTIONS" />
	
	<QUERIES>
		<QUERY label="0">
			<SQL>
				<select><![CDATA[ 
					
					CTIPREPAR_TREE
						WORKTABLE{acti000123_places} 
						GROUPBY1{[VIEW.GROUPBY_PLACES_OID_FIELD],, [VIEW.GROUPBY_PLACES_COD_FIELD],, [VIEW.GROUPBY_PLACES_TXT_FIELD]} 
						GROUPBY1MODE{[GROUPBY_TAB]} 
						GROUPBY2{[VIEW.GROUPBY_2_PLACES_OID_FIELD],, [VIEW.GROUPBY_2_PLACES_COD_FIELD],, [VIEW.GROUPBY_2_PLACES_TXT_FIELD]} 
						GROUPBY3{[VIEW.GROUPBY_3_PLACES_OID_FIELD],, [VIEW.GROUPBY_3_PLACES_COD_FIELD],, [VIEW.GROUPBY_3_PLACES_TXT_FIELD]} 
					INDICATORS{ 
						SUM(CASE WHEN date = '[VIEW.TOPERIODE]' THEN v_places_1.nb_lits_theoriques ELSE 0 END),, 
						SUM(CASE WHEN v_places_1.est_ouvert = '1' THEN v_places_1.[VIEW.PLACES_FIELD] ELSE 0 END),, 
						COUNT(DISTINCT date),, 
						COUNT(DISTINCT CASE WHEN v_places_1.est_ouvert = '1' THEN date ELSE NULL END),, 
						COUNT(DISTINCT CASE WHEN v_places_1.est_ouvert = '1' AND heberge_hospitalises = '1' THEN date ELSE NULL END),, 
						COUNT(DISTINCT CASE WHEN v_places_1.est_ouvert = '1' AND heberge_externes = '1' THEN date ELSE NULL END),, 
						COUNT(DISTINCT CASE WHEN v_places_1.est_ouvert = '1' AND heberge_ambulatoires = '1' THEN date ELSE NULL END),, 
						COUNT(DISTINCT CASE WHEN v_places_1.est_ouvert = '1' AND heberge_urgences = '1' THEN date ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN v_places_1.est_ouvert = '1' AND heberge_bebes = '1' THEN date ELSE NULL END),, 
						COUNT(DISTINCT CASE WHEN v_places_1.est_ouvert = '1' AND heberge_seances = '1' THEN date ELSE NULL END),, 
						SUM(CASE WHEN v_places_1.est_ouvert = '1' THEN v_places_1.[VIEW.PLACES_CP_FIELD] ELSE 0 END)
					} 
					FROM activite.v_places_1 
					WHERE 
						[VIEW.PERIODE_ENHANCED] 
						[VIEW.ETAGE_PLACES_SELECT] [VIEW.JOURS_SELECT] 
					
				]]></select>
			</SQL>
			<SQL optimizer="V_SEJOURS_X" optimizer2="V_MOUVEMENTS_SEJOUR_X">
				<select><![CDATA[ 
                        
					CTISELECT_TREE 
						WORKTABLE{acti000123} 
						GROUPBY1{[VIEW.GROUPBY_OID_FIELD],, [VIEW.GROUPBY_COD_FIELD],, [VIEW.GROUPBY_TXT_FIELD]} 
						GROUPBY1MODE{[GROUPBY_TAB]} 
						GROUPBY2{[VIEW.GROUPBY_2_OID_FIELD],, [VIEW.GROUPBY_2_COD_FIELD],, [VIEW.GROUPBY_2_TXT_FIELD]} 
						GROUPBY3{[VIEW.GROUPBY_3_OID_FIELD],, [VIEW.GROUPBY_3_COD_FIELD],, [VIEW.GROUPBY_3_TXT_FIELD]} 
						SIGNIFDATA{[VIEW.ACTIVITE_SIGNIFICATIVE_DATA],, [ACTIVITE_SIGNIFICATIVE_MODE],, [ACTIVITE_SIGNIFICATIVE_NUMBER]} 
					INDICATORS{ 
						0,, 
						SUM(nb_entrees_directes) ,, 
						SUM(nb_entrees_mutation_service) ,, 
						SUM(nb_entrees_mutation_etage) ,, 
						SUM(nb_sorties_directes) ,, 
						SUM(nb_sorties_mutation_[VIEW.MUTATION_FIELD]) ,, 
						SUM([VIEW.JOURNEES_FIELD]) ,, 
						SUM([VIEW.CP_FIELD]) ,, 
						SUM(nb_externes) ,, 
						SUM(nb_ambulatoires) ,, 
						SUM(nb_seances) ,, 
						SUM(nb_urgences) ,, 
						SUM(nb_bebes) ,, 
						
						0 ,,
						0 ,, 
						SUM([VIEW.JOURNEES_FIELD]),, 
						SUM(nb_externes),, 
						SUM(nb_ambulatoires),, 
						SUM(nb_urgences),,
						SUM(nb_bebes),, 
						SUM([VIEW.JOURNEES_FIELD] + nb_ambulatoires + CASE WHEN type_sejour = '5' THEN nb_seances ELSE 0 END),, 
						SUM(nb_seances),, 
						
						SUM([VIEW.JOURNEES_FIELD] + nb_ambulatoires + nb_seances_dans_taux) ,,
						COUNT(DISTINCT v_sejours_1.no_sejour),, 
						COUNT(DISTINCT CASE WHEN v_sejours_1.date_entree < '[PERIODE]' THEN v_sejours_1.no_sejour ELSE null END),,
						COUNT(DISTINCT CASE WHEN v_sejours_1.date_entree BETWEEN '[PERIODE]' AND '[TOPERIODE]' THEN v_sejours_1.no_sejour ELSE null END),, 
						COUNT(DISTINCT CASE WHEN v_sejours_1.date_entree BETWEEN '[PERIODE]' AND '[TOPERIODE]' AND v_sejours_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]' THEN v_sejours_1.no_sejour ELSE null END),, 
						COUNT(DISTINCT CASE WHEN code_sorti = 0 THEN v_sejours_1.no_sejour ELSE null END),,
						COUNT(DISTINCT CASE WHEN v_sejours_1.date_sortie > '[TOPERIODE]' AND v_sejours_1.code_sorti = 1 THEN v_sejours_1.no_sejour ELSE null END),, 
						COUNT(DISTINCT CASE WHEN v_sejours_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]' AND v_sejours_1.code_sorti = 1 THEN v_sejours_1.no_sejour ELSE null END),, 
						
						COUNT(DISTINCT CASE WHEN v_mouvements_sejour_2.est_facture = '1' AND date_sortie <= '[TOPERIODE]' AND v_sejours_1.code_sorti = 1 THEN v_sejours_1.no_sejour ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN v_mouvements_sejour_2.est_facture = '0' AND date_sortie <= '[TOPERIODE]' AND v_sejours_1.code_sorti = 1 THEN v_sejours_1.no_sejour ELSE NULL END),,
						
                        SUM(CASE WHEN type_sejour = '1' THEN nb_jour_sejour_sorti ELSE 0 END ),,
						SUM(CASE WHEN  type_sejour = '1' AND v_mouvements_sejour_2.est_facture = '1' THEN nb_jour_sejour_sorti ELSE 0 END),,
						SUM(nb_jour_sejour_sorti),,
						SUM(CASE WHEN v_mouvements_sejour_2.est_facture = '1' THEN nb_jour_sejour_sorti ELSE null END),,
						
						SUM(CASE WHEN type_sejour = '1' AND nb_sorties_directes = 1 THEN duree ELSE 0 END),,
						SUM(CASE WHEN type_sejour = '1' AND nb_sorties_directes = 1 THEN duree WHEN type_sejour = '2' THEN nb_ambulatoires WHEN type_sejour = '5' THEN nb_seances ELSE 0 END),,
						SUM(CASE WHEN v_sejours_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]' AND nb_sorties_directes + nb_ambulatoires + nb_seances_dans_taux > 0 THEN 1 ELSE 0 END),,
						
						MIN(type_sejour::numeric),,
						sum(nb_seances_dans_taux),,
						SUM(nb_deces),,
						0,,
						0,,
						
						COUNT(DISTINCT CASE WHEN type_sejour IN ('1','2') THEN v_sejours_1.no_sejour ELSE NULL END),,
						SUM(equivalent_malade_complet),,
						
						SUM(nb_passage_externe) ,, 
						base.cti_division(
							SUM(CASE WHEN heure_fin < '[VIEW.TAUXSORAVANT]' THEN nb_sorties_directes ELSE 0 END ),
							SUM(nb_sorties_directes)
							) * 100,,
                        COUNT(DISTINCT v_sejours_1.no_patient),,
                        
                        base.cti_division(
                            SUM(gir_gmp_base*gir_gmp_coefficient),
                            SUM(gir_gmp_base)
                        ),,
						
						SUM(nb_seances_dialyse) ,, 
						SUM(nb_seances_chimio) ,, 
						SUM(nb_seances_autre) ,,

						SUM(CASE WHEN forme_activite_code LIKE '11%' THEN [VIEW.JOURNEES_FIELD] ELSE 0 END),,

						SUM(CASE WHEN type_hospi_pmsi_id LIKE '21%' THEN [VIEW.JOURNEES_FIELD] ELSE 0 END),,
						SUM(CASE WHEN type_hospi_pmsi_id LIKE '22%' THEN [VIEW.JOURNEES_FIELD] ELSE 0 END),,

						SUM(CASE WHEN type_hospi_pmsi_id LIKE '31%' THEN [VIEW.JOURNEES_FIELD] ELSE 0 END),,
						SUM(CASE WHEN type_hospi_pmsi_id LIKE '32%' THEN [VIEW.JOURNEES_FIELD] ELSE 0 END),,

						SUM(CASE WHEN forme_activite_code LIKE '4%' THEN [VIEW.JOURNEES_FIELD] ELSE 0 END),,

						
					}
					ORDERBY{[VIEW.ORDERBY],, DESC} 
					
				FROM #V_MOUVEMENTS_SEJOUR_X#
					JOIN #V_SEJOURS_X#  ON v_mouvements_sejour_2.no_sejour = v_sejours_1.no_sejour 
				WHERE 
						[VIEW.PERIODE_ENHANCED] 
						[VIEW.SEJOURS_SELECT] [VIEW.PATIENTS_SELECT] 
						[VIEW.MOUVEMENTS_SELECT] [VIEW.REAPRE_SELECT] [VIEW.JOURS_SELECT] [VIEW.PASSAGES_SELECT]
						AND v_sejours_1.type_sejour <> '9'
				
				AFTER{ 
					UPDATE acti000123 SET 
						indicateurs[1] = COALESCE(acti000123_places.indicateurs[1],0), 
						indicateurs[14] = COALESCE(acti000123_places.indicateurs[4],0), 
						indicateurs[15] = COALESCE(acti000123_places.indicateurs[3],0), 
						indicateurs[16] = base.cti_division(acti000123.indicateurs[16] , COALESCE(acti000123_places.indicateurs[5],0)) , 
						indicateurs[17] = base.cti_division(acti000123.indicateurs[17] , COALESCE(acti000123_places.indicateurs[6],0)) , 
						indicateurs[18] = base.cti_division(acti000123.indicateurs[18] , COALESCE(acti000123_places.indicateurs[7],0)) , 
						indicateurs[19] = base.cti_division(acti000123.indicateurs[19] , COALESCE(acti000123_places.indicateurs[8],0)) , 
						indicateurs[20] = base.cti_division(acti000123.indicateurs[20] , COALESCE(acti000123_places.indicateurs[9],0)) , 
						indicateurs[21] = base.cti_division(acti000123.indicateurs[21] , COALESCE(acti000123_places.indicateurs[2],0)) * 100,
						indicateurs[22] = base.cti_division(acti000123.indicateurs[22] , COALESCE(acti000123_places.indicateurs[10],0)),
						indicateurs[43] = COALESCE(acti000123_places.indicateurs[11],0), 
						indicateurs[44] = base.cti_division(acti000123.indicateurs[8] , COALESCE(acti000123_places.indicateurs[11],0)) * 100
					FROM acti000123 acti000123_bis
						LEFT JOIN acti000123_places ON	(acti000123_places.oidt = acti000123_bis.oidt OR acti000123_places.oidt = -111) AND 
										(acti000123_places.oid1 = acti000123_bis.oid1 OR acti000123_places.oid1 = -111) AND 
										(acti000123_places.oid2 = acti000123_bis.oid2 OR acti000123_places.oid2 = -111) AND 
										(acti000123_places.oid3 = acti000123_bis.oid3 OR acti000123_places.oid3 = -111) 
					WHERE acti000123_bis.oidt = acti000123.oidt AND 
						acti000123_bis.oid1 = acti000123.oid1 AND 
						acti000123_bis.oid2 = acti000123.oid2 AND 
						acti000123_bis.oid3 = acti000123.oid3
                        
				} 
				
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS" />
					<FIELD name="SORT" />
					<FIELD name="LIT" /><!-- 			1	nombre de lits -->
					<FIELD name="ENT" /><!-- 			2	entrées -->
					<FIELD name="ENTMS" /><!-- 			3	entrées par service -->
					<FIELD name="ENTME" /><!-- 			4	entrées par etage  -->
					<FIELD name="SOR" /><!-- 			5	sorties -->
					<FIELD name="SORM" /><!-- 			6	sorties par service/etage/uf -->
					<FIELD name="JRN" /><!-- 			7	journées sur la période -->
					<FIELD name="NCP" /><!-- 			8	chambres particulières -->
					<FIELD name="EXT" /><!-- 			9	externes -->
					<FIELD name="AMB" /><!-- 			10	ambulatoires -->
					<FIELD name="SEA" /><!-- 			11	séances -->
					<FIELD name="URG" /><!-- 			12	urgence -->
					<FIELD name="BB" /><!-- 			13	bébés -->
						
					<FIELD name="OUV" /><!--  			14	jours ouverts -->
					<FIELD name="PER" /><!--  			15	jours période -->
					<FIELD name="JRNM" /><!-- 			16	moyenne quotidienne journées -->
					<FIELD name="EXTM" /><!-- 			17	moyenne quotidienne externes -->
					<FIELD name="AMBM" /><!-- 			18	moyenne quotidienne nb_ambulatoires -->
					<FIELD name="URGM" /><!-- 			19	moyenne quotidienne nb_urgences  -->
					<FIELD name="BBM" /><!--  			20	moyenne quotidienne nb_bebes  -->
					<FIELD name="TAU" /><!--  			21	taux d'occupation  -->
					<FIELD name="SEAM" /><!--  			22	séances par jour  -->
						
					<FIELD name="JRNHON" /><!--  		23	journées hospitalisation  -->
					<FIELD name="SEJ" /><!--  			24	séjours  -->
					<FIELD name="ENTPRE" /><!--  		25	admissions < période  -->
					<FIELD name="ENTPER" /><!--  		26	admissions pendant période  -->
					<FIELD name="FULL" /><!--  			27	entiers période  -->
					<FIELD name="NONSOR" /><!--  		28	séjours non sortis  -->
					<FIELD name="SORPOST" /><!-- 		29	sorties > période  -->
					<FIELD name="SORPER" /><!-- 		30	sorties période  -->
						
					<FIELD name="SORFAC" /><!--  		31	sorties période facturées  -->
					<FIELD name="SORNONFAC" /><!--  	32	sorties période non facturées  -->
						
					<FIELD name="JRNSOR" /><!-- 		33	journées hospitalisés sorties  -->
					<FIELD name="JRNSORFAC" /><!--  	34	journées hospitalisés sorties facturées  -->
					<FIELD name="JRNSORHON" /><!-- 		35	journées hospitalisation sorties  -->
					<FIELD name="JRNSORHONFAC" /><!--  	36	journées hospitalisation sorties facturées  -->
						
					<FIELD name="DURHES" /><!--  		37	Durée hospitalisés  -->
					<FIELD name="DURHON" /><!--  		38	Durée hospitalisation  -->
					<FIELD name="SORHON" /><!--  		39	Sorties hospitalisation  -->
						
					<FIELD name="TYPSEJ" /><!--  		40	Type de séjour  -->
					<FIELD name="SEATAU" /><!--  		41	Nombre de séances dans taux  -->
					<FIELD name="DECES" /><!--  		42	Nombre de décès  -->
					<FIELD name="CPOUV" /><!--  		43	Nombre de Journées CP ouvertes  -->
					<FIELD name="CPTAU" /><!--  		44	Taux d'occupation en chambre particulière  -->
					
					<FIELD name="SEJHON" /><!--  		45	Séjours hospitalisation connus (Hospit/Ambu) pour calcul DMS  -->
					
					<FIELD name="EMC" /><!--  			46	Equivalent malade complet  -->
					
					<FIELD name="EXTP" /><!--  		47	Passage externes (CERNER ST JOSEPH ST LUC)  -->
					
					<FIELD name="TXSOR11" /><!-- 			48	sorties avant 11h -->
					<FIELD name="PAT" /><!-- 			49	Nombre de Patients -->
                    
                    <FIELD name="GMP" /><!-- 			50	GMP -->
					
					<FIELD name="SEADIA" /><!-- 		51	séances dialyse -->
					<FIELD name="SEACHM" /><!-- 		51	séances chimio -->
					<FIELD name="SEADIV" /><!-- 		51	séances autre -->

					<FIELD name="JRNMCOHOSPI" /><!-- 	52	Journées mco hospitalisés -->

					<FIELD name="JRNSSRHC" /><!-- 		53	journées SSR Hospitalisation complète -->
					<FIELD name="JRNSSRHP" /><!-- 		54	journées SSR Hospitalisation partiel -->

					<FIELD name="JRNPSYHC" /><!-- 		55	journées PSY Hospitalisation complète -->
					<FIELD name="JRNPSYHP" /><!-- 		56	journées PSY Hospitalisation partiel -->

					<FIELD name="JRNHAD" /><!-- 		57	journées HAD -->
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL>
				<select><![CDATA[ 
					
						SELECT 
							'TOPERIODE', 
							to_char(COALESCE(MAX(date),'[TOPERIODE]'::date), 'YYYY-MM-DD')
						FROM 
							activite.p_mouvements_sejour 
						WHERE 
							date BETWEEN '[PERIODE]' AND '[TOPERIODE]' [VIEW.REAPRE_SELECT]
					UNION 
						SELECT 
							'PERIODE_ENHANCED_2',
							CASE WHEN '[PERIODE]' = '[TOPERIODE]' THEN ' = ' || '''' || to_char(COALESCE(MIN(date),'[PERIODE]'::date), 'YYYY-MM-DD') || '''::date'
								ELSE ' BETWEEN ''' || to_char(COALESCE(MIN(date),'[PERIODE]'::date), 'YYYY-MM-DD') || '''::date AND ''' || to_char(COALESCE(MAX(date),'[TOPERIODE]'::date), 'YYYY-MM-DD') || '''::date'
							END
						FROM 
							activite.p_mouvements_sejour 
						WHERE 
							date BETWEEN '[PERIODE]' AND '[TOPERIODE]' [VIEW.REAPRE_SELECT]
					UNION ALL
						SELECT 'ANA_CROI_PERIODE', to_char(greatest(	date_trunc('year', '[TOPERIODE]'::date) - INTERVAL  '3 year', 
														(SELECT date_trunc('year', min(date_comptable)) FROM activite.p_chiffrier_comptable)
													)::date, 'YYYY-MM-DD')
					UNION ALL
						SELECT 'ANA_CROI_TOPERIODE', 	to_char(
									least(	date_trunc('year', '[TOPERIODE]'::date) - interval '1 day' + interval '1 year',
												'[TOPERIODE]'::date)
									, 'YYYY-MM-DD')
					UNION ALL
						SELECT 'COMP_PERIODE', to_char(
									greatest(	date_trunc('year', '[TOPERIODE]'::date),
												date_trunc('month', '[PERIODE]'::date))
									, 'YYYY-MM-DD')
					UNION ALL
						SELECT 'COMP_PERIODE_D', to_char(
									greatest(	date_trunc('year', '[TOPERIODE]'::date) - interval '1 year',
												date_trunc('month', '[PERIODE]'::date) - interval '1 year')
									, 'YYYY-MM-DD')
					UNION ALL
						SELECT 'COMP_TOPERIODE_D', 	to_char(
									least(	date_trunc('year', '[TOPERIODE]'::date) - interval '1 day',
												'[TOPERIODE]'::date - interval '1 year')
									, 'YYYY-MM-DD')
					UNION ALL
						SELECT	
							'PLACESREF_GROUPBY',
							CASE 	WHEN t_divers.valeur = 'SER' THEN 'service'::text
									WHEN t_divers.valeur = 'UF' THEN  'uf'::text
									ELSE 'etage'::text
							END
						FROM activite.t_divers WHERE code = 'PLACESREF'
					UNION ALL
						SELECT	
							'PLACESREF_TEXT',
							CASE 	WHEN t_divers.valeur = 'SER' THEN 'Service'::text
									WHEN t_divers.valeur = 'UF' THEN  'Unité Fonctionnelle'::text
									ELSE 'Etage'::text
							END
						FROM activite.t_divers WHERE code = 'PLACESREF'
                    UNION ALL
						SELECT	
							'PLACESREF',valeur
						FROM activite.t_divers WHERE code = 'PLACESREF'					
					UNION ALL
						SELECT	
							'TAUXSORAVANT',valeur
						FROM activite.t_divers WHERE code = 'TAUXSORAVANT'
                    UNION ALL 
                    	SELECT
							'SUIVICP',valeur
						FROM activite.t_divers WHERE code = 'SUIVICP'
					UNION ALL 
						SELECT 'ENV_WITHMCO', MAX(CASE WHEN schemaname = 'pmsi' AND tablename = 'p_rss' THEN 1 ELSE 0 END)::text
							FROM pg_tables 
						WHERE schemaname = 'pmsi' AND tablename = 'p_rss'
					UNION ALL 
					SELECT 'ENV_WITHSSR', MAX(CASE WHEN schemaname = 'pmsissr' AND tablename = 'p_ssr' THEN 1 ELSE 0 END)::text 
						FROM pg_tables 
						WHERE schemaname = 'pmsissr' AND tablename = 'p_ssr'
					UNION ALL 
					SELECT 'ENV_WITHPSY', MAX(CASE WHEN schemaname = 'pmsipsy' AND tablename = 'p_rps' THEN 1 ELSE 0 END)::text 
						FROM pg_tables 
						WHERE schemaname = 'pmsissr' AND tablename = 'p_rps'
					UNION ALL 
					SELECT 'ENV_WITHHAD', MAX(CASE WHEN schemaname = 'pmsihad' AND tablename = 'p_rpss' THEN 1 ELSE 0 END)::text
						FROM pg_tables 
						WHERE schemaname = 'pmsihad' AND tablename = 'p_rpss'
						
				]]></select>
				<FIELDS>
					<FIELD name="name" />
					<FIELD name="value" />
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL>
				<select><![CDATA[ 
					
                    -- cette partie de code semble dépréciée, je n'arrive pas à voir où elle peut être utilsée
                    -- elle est de toute façon obsolète depuis l'utilisation des classes en ARRAY
                    
					DROP TABLE IF EXISTS w_placesref; 
					CREATE TEMP TABLE w_placesref AS SELECT 'PLACESREF_GROUPBY_CLS'::text as name, ''::text as value; 
					
					UPDATE w_placesref SET value = w_1.value 
					FROM 
					(
						SELECT 
							'PLACESREF_GROUPBY_CLS' as name, 
							CASE 	WHEN t_listes_tables.code = 'SERVICE_F' THEN 'service_section' || t_classes.sequence::text 
								WHEN t_listes_tables.code = 'UF' THEN  'uf_section' || t_classes.sequence::text 
								ELSE 'etage_section' || t_classes.sequence::text 
							END as value 
						FROM 
							activite.t_classes 
							JOIN activite.t_listes_tables ON t_listes_tables.oid = t_classes.table_id 
						WHERE 
							t_listes_tables.code LIKE (SELECT '%' || valeur || '%' FROM activite.t_divers WHERE code = 'PLACESREF') 
							AND t_classes.sequence = 1 
					) w_1; 
					SELECT * FROM w_placesref; 
						
				]]></select>
				<FIELDS>
					<FIELD name="name" />
					<FIELD name="value" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Dernier mois/année" shortLabel="Dernier mois/année"   rowContext="false" buttonType="VIEWLINKPOPUP">
				<VIEWITEM label="Dernier mois" shortLabel="Dernier mois"  view="ACTI000056.XML" rowContext="false" enabled="true" buttonType="COMPARATIF" >
					<ARG name="ALIAS_PERIODE" value="return '-1';" />
					<ARG name="PERIODE" value="return SELECT.TOPERIODE.substr(0,8)+'01';"/>
					<ARG name="TOPERIODE" value=" return SELECT.TOPERIODE;"/>
					<ARG name="GROUPBY" value="return VIEW.GROUPBY_DATE;"/>
					<ARG name="GROUPBY_2" value="return SELECT.GROUPBY;" />
					<ARG name="GROUPBY_3" value="return SELECT.GROUPBY_2;" />
					<ARG name="LGROUPBY" value="return SELECT.GROUPBY;" />
					<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;" />
					<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;" />
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />
					<ARG name="DATA4" value="'NAM';"/>
					<ARG name="DATA5" value="'NJNAS';"/>	
					<ARG name="TYPE_COMPARAISON" value="'2'" />
					<ARG name="GROUPBY_TAB" value="return 'TAB';" />
				</VIEWITEM>	
				<VIEWITEM label="&#8721; dernier mois" data="2" shortLabel="&#8721; dernier  mois"  view="ACTI000182.XML" enabled="true" rowContext="false" buttonType="COMPARATIF" >
					<ARG name="ALIAS_PERIODE" value="return '-1';" />
					<ARG name="PERIODE" value="return SELECT.TOPERIODE.substr(0,8)+'01';"/>
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />
					<ARG name="GROUPBY" value="return VIEW.GROUPBY_DATE;"/>
					<ARG name="GROUPBY_2" value="return '-1';" />
					<ARG name="GROUPBY_3" value="return '-1';" />
					<ARG name="LGROUPBY" value="return SELECT.GROUPBY;" />
					<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;" />
					<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;" />
					<ARG name="TYPE_COMPARAISON" value="return '2';" />
				</VIEWITEM>
				<VIEWITEM  label="Dernière année" data="2" shortLabel="derniere  année"  view="ACTI000056.XML" enabled="true" rowContext="false" buttonType="COMPARATIF" >
					<ARG name="ALIAS_PERIODE" value="return '-1';" />
					<ARG name="PERIODE" value="return SELECT.TOPERIODE.substr(0,4)+'-01-01';"/>
					<ARG name="TOPERIODE" value=" return SELECT.TOPERIODE;"/>
					<ARG name="GROUPBY" value="return VIEW.GROUPBY_DATE;"/>
					<ARG name="GROUPBY_2" value="return SELECT.GROUPBY;" />
					<ARG name="GROUPBY_3" value="return SELECT.GROUPBY_2;" />
					<ARG name="LGROUPBY" value="return SELECT.GROUPBY;" />
					<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;" />
					<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;" />
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />
					<ARG name="DATA4" value="'NAM';"/>
					<ARG name="DATA5" value="'NJNAS';"/>	
					<ARG name="TYPE_COMPARAISON" value="'2'" />
					<ARG name="GROUPBY_TAB" value="return 'TAB';" />
				</VIEWITEM>	
				<VIEWITEM label="&#8721; dernière Année" shortLabel="&#8721; derniere année"  view="ACTI000182.XML" rowContext="false" enabled="true" buttonType="COMPARATIF">
					<ARG name="ALIAS_PERIODE" value="return '-1';" />
					<ARG name="PERIODE_D" value="return VIEW.COMP_PERIODE_D;" />
					<ARG name="TOPERIODE_D" value="return VIEW.COMP_TOPERIODE_D;" />
					<ARG name="PERIODE" value="return SELECT.TOPERIODE.substr(0,4)+'-01-01';" />
					<ARG name="TOPERIODE" value=" return SELECT.TOPERIODE;" />
					<ARG name="GROUPBY" value="return VIEW.GROUPBY_DATE;"/>
					<ARG name="GROUPBY_2" value="return '-1';"/>
					<ARG name="GROUPBY_3" value="return '-1';"/>
					<ARG name="LGROUPBY" value="return SELECT.GROUPBY;" />
					<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;" />
					<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;" />
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />
					<ARG name="TYPE_COMPARAISON" value="'2'" />
				</VIEWITEM>	
			</VIEWLINK>
			<VIEWLINK label="Comparatif" shortLabel="Comparatif"  view="ACTI000056.XML" rowContext="false" enabled="true" buttonType="COMPARATIF" >
					<ARG name="PERIODE" value="return VIEW.COMP_PERIODE;" />
					<ARG name="PERIODE_D" value="return VIEW.COMP_PERIODE_D;" />
					<ARG name="TOPERIODE_D" value="return VIEW.COMP_TOPERIODE_D;" />
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />
					<ARG name="DATA4" value="'NAM';"/>
					<ARG name="DATA5" value="'NJNAS';"/>	
					<ARG name="TYPE_COMPARAISON" value="'S'" />
			</VIEWLINK>			
			<VIEWLINK label="Comparatif mensuel" shortLabel="Comp. mensuel"  view="ACTI000169.XML" rowContext="false" enabled="true" buttonType="COMPARATIF" >
					<ARG name="PERIODE" value="return SELECT.TOPERIODE.substr(0,4)+'-01-01';" />
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />	
					<ARG name="TYPE_COMPARAISON" value="'2'" />
			</VIEWLINK>
			<VIEWLINK label="Evolution comparative" shortLabel="Evol. comparative"   rowContext="false" buttonType="VIEWLINK_EVO_COMP" >			
				<VIEWITEM label="Standard" shortLabel="Evolution comparative" view="ACTI000173.XML" rowContext="false" enabled="true" buttonType="VIEWLINK_EVO_COMP">
					<ARG name="GROUPBY" value="return SELECT.GROUPBY;" />
					<ARG name="GROUPBY_2" value="return 'NUMEROMOIS';" />
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />
					<ARG name="DATA4" value="'NAM';"/>
					<ARG name="DATA5" value="'NJNAS';"/>
					<ARG name="DATA6"   value="return '0';" />
					<ARG name="DATA7"   value="return '0';" />
					<ARG name="DATA8"   value="return '0';" />
					<ARG name="DATA9"   value="return '0';"/>
					<ARG name="DATA10" 	value="return '0';"/>
					<ARG name="DATA011" value="return '0';" />
					<ARG name="DATA012" value="return '0';" />
					<ARG name="DATA013" value="return '0';" />
					<ARG name="DATA014" value="return '0';"/>
					<ARG name="DATA015" value="return '0';"/>
					<ARG name="LGROUPBY" value="return SELECT.GROUPBY;"/>
					<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;"/>
					<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;"/>
					<ARG name="GROUPBY_TAB" value="return 'TAB';" />
					<ARG name="TYPE_COMPARAISON" value="'2'" />
				</VIEWITEM>	
				<VIEWITEM label="Détaillée" shortLabel="Evol. comparative" view="ACTI000173.XML" rowContext="false" enabled="true" buttonType="COMPARATIF">
					<ARG name="GROUPBY" value="return SELECT.GROUPBY;" />
					<ARG name="GROUPBY_2" value="return 'NUMEROMOIS';" />
					<ARG name="DATA1" value="'NSEJ'" />
					<ARG name="DATA2" value="'NSD'" />
					<ARG name="DATA3" value="'NJN'" />
					<ARG name="DATA4" value="'NAM';"/>
					<ARG name="DATA5" value="'NJNAS';"/>
					<ARG name="DATA6" value="'NSE'" />
					<ARG name="DATA7" value="'NEX'" />
					<ARG name="DATA8" value="'EMC'" />
					<ARG name="DATA9" value="'DMSHES';"/>
					<ARG name="DATA10" value="'DMSHON';"/>
					<ARG name="DATA011" value="return '0';" />
					<ARG name="DATA012" value="return '0';" />
					<ARG name="DATA013" value="return '0';" />
					<ARG name="DATA014" value="return '0';"/>
					<ARG name="DATA015" value="return '0';"/>
					<ARG name="LGROUPBY" value="return SELECT.GROUPBY;"/>
					<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;"/>
					<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;"/>
					<ARG name="GROUPBY_TAB" value="return 'TAB';" />
					<ARG name="TYPE_COMPARAISON" value="'2'" />
				</VIEWITEM>	
			</VIEWLINK>	
			<VIEWLINK label="Evolution" shortLabel="Evolution" view="ACTI000054.XML" rowContext="false" enabled="true" buttonType="EVOLUTION" componentName="PERIODICITE_VIEWLINK" component2Name="OCC_BASE_VIEWLINK" >
			</VIEWLINK>
			<VIEWLINK label="Répartition hebdomadaire" shortLabel="Répartition hebdo" view="ACTI000036.XML" rowContext="false" enabled="true" buttonType="EVOLUTION" componentName="OCC_BASE_VIEWLINK">
				<ARG name="DATA" value="'NSD'" />
			</VIEWLINK>
			<VIEWLINK label="Analyse croisée" shortLabel="Analyse croisée" view="ACTI000072.XML" enabled="true" rowContext="false" buttonType="ANALYSE_CROISEE" >
				<ARG name="ALIAS_PERIODE" value="return '-1';" />
				<ARG name="PERIODE" value="return VIEW.ANA_CROI_PERIODE;" />
				<ARG name="TOPERIODE" value="return VIEW.ANA_CROI_TOPERIODE;" />
				<ARG name="DATA" value="'NSD'" />
				<ARG name="COLUMNBY" value="'NUMEROMOIS'" />
				<ARG name="GROUPBY" value="'ANNEE'" />
				<ARG name="GROUPBY_2" value="if (SELECT.GROUPBY == 'ANNEE' || SELECT.GROUPBY == 'JOUR') {return 'SER';} else {return SELECT.GROUPBY;}" />
				<ARG name="GROUPBY_3" value="return SELECT.GROUPBY_2;" />		
				<ARG name="GROUPBY_TAB" value="'TAB'" />
				<ARG name="COLUMNBYCOUNT" value="'12'" />
				<ARG name="LGROUPBY" value="return SELECT.GROUPBY;"/>
				<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;"/>
				<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;"/>
			</VIEWLINK>
			<VIEWLINK label="Analyse" shortLabel="Analyse" view="ACTI000123.XML" enabled="true" rowContext="false" buttonType="ANALYSE" >
				<ARG name="ALIAS_PERIODE" value="return '-1'" />
				<ARG name="GROUPBY" value="return SELECT.GROUPBY;" />
				<ARG name="GROUPBY_2" value="reurn SELECT.GROUPBY_2" />
				<ARG name="GROUPBY_2" value="reurn SELECT.GROUPBY_3" />
				<ARG name="GROUPBY_TAB" value="return 'TAB';" />
				<ARG name="LGROUPBY" value="return SELECT.GROUPBY;"/>
				<ARG name="LGROUPBY_2" value="return SELECT.GROUPBY_2;"/>
				<ARG name="LGROUPBY_3" value="return SELECT.GROUPBY_3;"/>
			</VIEWLINK>	
			<VIEWLINK label="Liste des séjours" shortLabel="Séjours" view="ACTI000052.XML" componentName="OCC_BASE_VIEWLINK" component3Name="STANDARD_BASE_VIEWLINK">
				<ARG name="ALIAS_PERIODE" value="return '-1';" />
				<ARG name="DATA">
					<value><![CDATA[ 
						
						var s:String = '';
						switch (COLUMN.NAME) {
							case 'ENT' :			s = 'ENT'; 			break;
							case 'ENTMS' :			s = 'ENTMUTS';	    break;
							case 'ENTME' :			s = 'ENTMUTE';       break;
							case 'SOR' :			s = 'SOR';			break;
							case 'SORM' :			s = 'SORMUT';		break;
							case 'JRN' :			s = 'JRN';			break;
							case 'JRNM' :			s = 'JRN';			break;
							case 'NCP' :			s = 'CP';			break;
							case 'EXT' :			s = 'EXT';			break;
							case 'EXTM' :			s = 'EXT';			break;
							case 'AMB' :			s = 'AMB';			break;
							case 'AMBM' :			s = 'AMB';			break;
							case 'URG' :			s = 'URG';			break;
							case 'URGM' :			s = 'URG';			break;
							case 'BB' :				s = 'BB';			break;
							case 'BBM' :			s = 'BB';			break;
							case 'SEA' :			s = 'SEA';			break;
							case 'SEAM' :			s = 'SEA';			break;
							case 'JRNHON' :			s = 'JRNHON';		break;
							case 'SORFAC' :			s = 'SORFAC';		break;
							case 'JRNSOR' :			s = 'JRNSOR';		break;
							case 'JRNSORFAC' :		s = 'JRNSORFAC';	break;
							case 'JRNSORHON' :		s = 'JRNSORHON';	break;
							case 'JRNSORHONFAC' :	s = 'JRNSORHONFAC';	break;
							case 'SORNONFAC' :		s = 'SORNONFAC';	break;
							case 'DECES' :			s = 'DECES';		break;
							default :				s = '-1';			break;
						}
						return s;
						
					]]></value>
				</ARG>
				<ARG name="STATUT_SEJOUR">
					<value><![CDATA[ 
						
						var s:String = '';
						switch (COLUMN.NAME) {
							case 'FULL' :		s = '1';	break; 
							case 'SORPER' :		s = '2';	break; 
							case 'ENTPER' :		s = '3';	break; 
							case 'ENTPRE' :		s = '4';	break; 
							case 'SORPOST' :	s = '5';	break; 
                            case 'DECES' :	    s = '2';	break;
							default :			s = '-1';	break; 
						}
						return s;
						
					]]></value>
				</ARG>
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Synthèse" label="Synthèse" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="" type="group" subType="h" percentHeight="100" fromTotal="true" maxItems="10">
				<CHART title="Répartition des séjours" type="pieChart" serieIsCategory="true" fromTotal="true">
					<CATEGORY field="CODTXT" type="Char" />
					<SERIE field="SOR" displayName="Sorties Hospitalisés" />
					<SERIE field="AMB" displayName="Ambulatoires" />
					<SERIE field="SEA" displayName="Séances" />
					<SERIE field="EXT" displayName="Externes" />
					<SERIE field="BB" displayName="Bébés" />
					<SERIE field="URG" displayName="Urgences" />
				</CHART>
				<CHART title="Répartition des séances" type="pieChart" serieIsCategory="true" fromTotal="true" visibleCondition="TOTALROW.SEA &gt; 0">
						<CATEGORY field="CODTXT" type="Char" />
						<SERIE field="SEADIA" displayName="Séances Dialyse" />
						<SERIE field="SEACHM" displayName="Séances Chimio"/>
						<SERIE field="SEADIV" displayName="Autres séances"/>
				</CHART>
				<CHART title="Proportion des urgences / (Entrées + Ambulatoires + Séances + Externes)" type="pieChart" serieIsCategory="true" fromTotal="true" showDataTips="true" visibleCondition="TOTALROW.URG &gt; 0">
						<CATEGORY field="TXT" type="Char" />
						<SERIE field="PURG" displayName="% urgences" />
						<SERIE field="XURG" displayName="% hors urgences"/>
				</CHART>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" 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')">
				<INSERT name="DATAGRID_MULTITAB_STYLES" />
				<HEADERROWSTYLE name="textAlign" value="center"/>

				<COLUMN dataField="OID" type="Char" width="60" visible="false" headerText="Oid" />
				<COLUMN dataField="COD" type="Char" width="70" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES" />
				</COLUMN>
				<COLUMN dataField="CODTXT" type="Char" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' - ' + ROW.TXT.toString().substr(0,13) + (ROW.TXT.toString().length > 13 ? '.' : '')" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="SEJ" type="Number" width="65" outputFormat="#" headerText="Séjours" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séjours (tous types de séjours)"/>
				<COLUMN dataField="PSEJ" type="Number" width="75" headerText="% Séjours" outputFormat="#,0%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Pourcentage par rapport au total des séjours">
					<CALC formula="ROW.SEJ / TOTALROW.SEJ * 100" />
				</COLUMN>
				<COLUMN dataField="EMC" type="Number" width="65" outputFormat="#" headerText="EMC" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Equivalent Malade Complet"/>				
                <COLUMN dataField="ENT" fixed="false" type="Number" width="87" selectable="true" outputFormat="#" headerText="Entrées&#xD;Hospitalisés" textAlign="right" totalComplement="*ROW"
					description="Nombre d'entrées des séjours hospitalisés" />
				<COLUMN dataField="SOR" type="Number" width="87" selectable="true" outputFormat="#" headerText="Sorties&#xD;Hospitalisés" textAlign="right" totalComplement="*ROW"
					description="Nombre de sorties des séjours hospitalisés" />
				<COLUMN dataField="AMB" type="Number" width="95" selectable="true" outputFormat="#" headerText="Ambulatoires" textAlign="right" totalComplement="*ROW"
					description="Nombre d'ambulatoires" />
				<COLUMN dataField="AMBM" width="93" type="Number" selectable="true" outputFormat="#,0" visibleCondition="SELECT.QMOY == '1'" headerText="Ambulatoires&#xD;/ jour" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre d'ambulatoires par jour" />
				<COLUMN dataField="SEA" type="Number" width="70" selectable="true" outputFormat="#" headerText="Séances total" textAlign="right" totalComplement="*ROW"
					description="Nombre de séances total" />
				<COLUMN dataField="SEAM" width="65" type="Number" selectable="true" outputFormat="#,0" visibleCondition="SELECT.QMOY == '1'" headerText="Séances&#xD;/ jour" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séances par jour" />
				<COLUMN dataField="SEADIA" width="65" type="Number" selectable="true" outputFormat="#" headerText="Séances Dialyse" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Séances Dialyse" />
				<COLUMN dataField="SEACHM" width="65" type="Number" selectable="true" outputFormat="#" headerText="Séances Chimio" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Séances Chimio" />
				<COLUMN dataField="SEADIV" width="65" type="Number" selectable="true" outputFormat="#" headerText="Autres Séances" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Séances Autres" />
				<COLUMN dataField="EXT" type="Number" width="70" selectable="true" outputFormat="#" headerText="Externes" textAlign="right" totalComplement="*ROW"
					description="Nombre de consultations externes" />
				<COLUMN dataField="EXTM" width="65" type="Number" selectable="true" outputFormat="#,0" visibleCondition="SELECT.QMOY == '1'" headerText="Externes&#xD;/ jour" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de consultations externes par jour" />
				<COLUMN dataField="EXTP" type="Number" width="70" selectable="true" outputFormat="#" headerText="Passage Externes" textAlign="right" totalComplement="*ROW"
					description="Nombre de passages externes" />
				<COLUMN dataField="BB" type="Number" width="70" selectable="true" outputFormat="#" headerText="Bébés" textAlign="right" totalComplement="*ROW"
					description="Nombre de bébés" />
				<COLUMN dataField="URG" width="74" type="Number" selectable="true" outputFormat="#" headerText="Urgences" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre d'urgences (calculé par rapport à la date d'entrée)" />
				<COLUMN dataField="URGM" width="65" type="Number" selectable="true" outputFormat="#,0" visibleCondition="SELECT.QMOY == '1'" headerText="Urgences&#xD;/ jour" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="SEATAU" width="65" type="Number" outputFormat="#,0" visible="false" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="SEJO" type="Number" width="85" outputFormat="#" visible="false" textAlign="right" totalComplement="" calc="true">
					<CALC formula="ROW.ENT + ROW.SEATAU + ROW.AMB + ROW.EXT" />
				</COLUMN>
				<COLUMN dataField="PURG" type="Number" width="85" outputFormat="#,0%" headerText="% Urgences" textAlign="right" totalComplement="" calc="true"
					description="Nombre d'urgences / (Hospitalisés + Séances + Ambulatoires + Externes)">
					<CALC formula="ROW.URG / (ROW.ENT + ROW.SEATAU + ROW.AMB + ROW.EXT) * 100" />
				</COLUMN>
				<COLUMN dataField="XURG" type="Number" width="85" outputFormat="#,0%" visible="false" headerText="% Hors Urgences" textAlign="right" totalComplement="" calc="true"
					description="1 - (Nombre d'urgences / (Hospitalisés + Séances + Ambulatoires + Externes))">
					<CALC formula="(1 - (ROW.URG / (ROW.ENT + ROW.SEATAU + ROW.AMB + ROW.EXT))) * 100" />
				</COLUMN>
			</DATAGRID>
		</ONGLET>
		<ONGLET excelLabel="Occupation" label="Occupation" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<INPUTSELECTION condition="ROW.TYPSEJ != 3"/>			
			<CHART title="" type="group" subType="h" percentHeight="100" maxItems="10"
				visibleCondition="SELECT.GROUPBY == 'ANNEE' || SELECT.GROUPBY == 'TRIM' || SELECT.GROUPBY == 'MOIS' || SELECT.GROUPBY == 'NUMEROTRIM' || SELECT.GROUPBY == 'NUMEROMOIS' || SELECT.GROUPBY == 'NUMEROJOUR' || SELECT.GROUPBY == 'JOUR'">
				<CHART title="Séjours" type="pieChart" serieIsCategory="true" fromTotal="true">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="SOR" displayName="Sorties Hospitalisés" />
					<SERIE field="AMB" displayName="Ambulatoires" />
					<SERIE field="SEA" displayName="Séances" />
				</CHART>
				<CHART title="Evolution" type="lineChart" condition="ROW.LVL == '1'">
					<CATEGORY field="TXT" type="Char"/>
					<SERIE field="SOR" displayName="Sorties hospitalisés"/>
					<SERIE field="AMB" displayName="Ambulatoires"/>
					<SERIE field="JRN" displayName="Journées hospitalisés" />
				</CHART>				
			</CHART>
			<CHART title="" type="group" subType="h" percentHeight="100" maxItems="10"
				visibleCondition="SELECT.GROUPBY != 'ANNEE' &amp;&amp; SELECT.GROUPBY != 'TRIM' &amp;&amp; SELECT.GROUPBY != 'MOIS' &amp;&amp; SELECT.GROUPBY != 'NUMEROTRIM' &amp;&amp; SELECT.GROUPBY != 'NUMEROMOIS' &amp;&amp; SELECT.GROUPBY != 'NUMEROJOUR' &amp;&amp; SELECT.GROUPBY != 'JOUR'">
				<CHART title="Sorties" type="pieChart" showDataTips="true" maxItems="10" maxItemsSortOn="SOR" maxItemsSortSeq="D" sortField="SOR" sortSeq="D" condition="ROW.LVL == '1'">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="SOR" displayName="Sorties Hospitalisés" />
				</CHART>
				<CHART title="Séjours" type="columnChart" serieIsCategory="true" fromTotal="true">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="SOR" displayName="Sorties Hospitalisés" />
					<SERIE field="AMB" displayName="Ambulatoires" />
					<SERIE field="SEA" displayName="Séances" />
				</CHART>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" 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')">
				<INSERT name="DATAGRID_MULTITAB_STYLES" />
				<HEADERROWSTYLE name="textAlign" value="center"/>
		
				<COLUMN dataField="TYPSEJ" width="60" type="Char" visible="false" headerText="TYPSEJ" />
				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid" />
				<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" minWidth="200" type="Char" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="SEJ" type="Number" width="65" outputFormat="#" headerText="Séjours" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séjours (tous types de séjours)"/>
				<COLUMN dataField="PSEJ" type="Number" width="75" headerText="% Séjours" outputFormat="#,0%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Pourcentage par rapport au total des séjours">
					<CALC formula="ROW.SEJ / TOTALROW.SEJ * 100" />
				</COLUMN>
				<COLUMN dataField="EMC" type="Number" width="65" outputFormat="#" headerText="EMC" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Equivalent Malade Complet"/>
                <COLUMN dataField="LIT" width="70" type="Number" outputFormat="#" visible="true" headerText="Places&#xD;théoriques" textAlign="right" totalFunction="text" otherFunction="text" otherComplement=""
					description="Nombre de lits disponibles"/>
				<COLUMN dataField="TAU" width="85" type="Number"  visible="true" outputFormat="#,0%" headerText="if(VIEW.PLACESREF == SELECT.GROUPBY || VIEW.PLACESREF == SELECT.GROUPBY.substr(0,3) ){return 'Taux Occupation effectif'}else{return 'Poids Occupation';}" headerTextCalc="true"  textAlign="right" totalFunction="text" otherFunction="text"
					description="(Nombre de journées hospitalisés + nombre d'ambulatoires + nombre de séances) / (Nombre de lits ouverts)">
					<CELLSTYLE name="fontWeight" value="bold" />
					<CELLSTYLE name="fontSize" value="11" />
				</COLUMN>
				<COLUMN dataField="PER" width="61" type="Number" outputFormat="#j" visibleCondition="SELECT.GROUPBY != 'MOI'" headerText="Jours période" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de jours dans la période d'analyse" />
				<COLUMN dataField="OUV" width="61" type="Number" outputFormat="#j" headerText="Jours ouverts" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de jours ouverts dans la période d'analyse" />
				<COLUMN dataField="ENT" fixed="false" width="86" type="Number" selectable="true" outputFormat="#" headerText="Entrées&#xD;hospitalisés" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre d'entrées directes" />
				<COLUMN dataField="ENTMS" width="76" type="Number" selectable="true" outputFormat="#" headerTextCalc="true" headerText="'Entrées (mutation ' + VIEW.MUTATION_FIELD_TEXT + ')'" visibleCondition="SELECT.GROUPBY.substr(0,3) == 'SER'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre d'entrées par mutation" />				
				<COLUMN dataField="ENTME" width="76" type="Number" selectable="true" outputFormat="#" headerTextCalc="true" headerText="'Entrées (mutation ' + VIEW.MUTATION_FIELD_TEXT + ')'" visibleCondition="SELECT.GROUPBY.substr(0,3) == 'ETA'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre d'entrées par mutation" />
				<COLUMN dataField="EXTAMB" width="65" type="Number" visible="false" calc="true">
					<CALC formula="ROW.EXT + ROW.AMB" />
				</COLUMN>
				<COLUMN dataField="SOR" width="86" type="Number" selectable="true" outputFormat="#" headerText="Sorties&#xD;hospitalisés" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de sorties directes" />
				<COLUMN dataField="TXSOR11" width="66" type="Number" selectable="true" outputFormat="#%" headerText="'Taux sorties avant ' + VIEW.TAUXSORAVANT.substr(0,2) + 'h'" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="" />
				<COLUMN dataField="SORM" width="76" type="Number" selectable="true" visible="true" outputFormat="#" headerTextCalc="true" headerText="'Sorties (mutation ' + VIEW.MUTATION_FIELD_TEXT + ')'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de sorties par mutation" />
				<COLUMN dataField="AMB" width="93" type="Number" selectable="true" outputFormat="#" headerText="Ambulatoires" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre d'ambulatoires" />
				<COLUMN dataField="AMBM" width="93" type="Number" selectable="true" outputFormat="#,0" visibleCondition="SELECT.QMOY == '1'" headerText="Ambulatoires&#xD;/ jour" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="SEA" width="65" type="Number" visible="false" selectable="true" outputFormat="#" headerText="Séances" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séances" />
				<COLUMN dataField="SEADIA" width="65" type="Number" selectable="true" outputFormat="#" headerText="Séances Dialyse" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Séances Dialyse" />
				<COLUMN dataField="SEACHM" width="65" type="Number" selectable="true" outputFormat="#" headerText="Séances Chimio" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Séances Chimio" />
				<COLUMN dataField="SEADIV" width="65" type="Number" selectable="true" outputFormat="#" headerText="Autres Séances" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Séances Autres" />
				<COLUMN dataField="SEAM" width="65" type="Number" selectable="true" outputFormat="#,0" visibleCondition="SELECT.QMOY == '1'" headerText="Séances&#xD;/ jour" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="JRN" width="85" type="Number" selectable="true" visible="true" outputFormat="#j" headerText="Journées hospitalisés" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées des hospitalisés" />
				<COLUMN dataField="JRNM" width="65" type="Number" selectable="true" outputFormat="#,0" visibleCondition="SELECT.QMOY == '1'" headerText="Moyenne jours" textAlign="right" totalFunction="sum" otherFunction="sum" />
				<COLUMN dataField="JRNHON" width="112" type="Number" selectable="true" visible="true" outputFormat="#j" headerText="Journées d'hospitalisation" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées hospitalisés + nombre d'ambulatoires + nombre de séances (hors séances effectuées durant une hospitalisation)" />
				<COLUMN dataField="CPOUV" width="70" type="Number" selectable="true" outputFormat="#" visible="true" headerText="Places&#xD;C.P.&#xD;ouvertes" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de places effectives en chambres particulières sur la période d'analyse" visibleCondition="VIEW.SUIVICP == '1'"/>
				<COLUMN dataField="NCP" width="88" type="Number" selectable="true" outputFormat="#j" visible="true" headerText="Journées&#xD;chambres&#xD;particulières" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées en chambre particulière" visibleCondition="VIEW.SUIVICP == '1'"/>
				<COLUMN dataField="CPTAU" width="88" type="Number" selectable="true" outputFormat="#,0%" visible="true" headerText="Taux&#xD;d'occupation&#xD;C.P." textAlign="right" totalFunction="text" otherFunction="text"
					description="Toux d'occupation des chambres particulières = Nombre de journées en Chambre particulière divisé par le nombre de chambres particulières ouvertes sur la période" visibleCondition="VIEW.SUIVICP == '1'"/>
				<COLUMN dataField="DECES" width="55" type="Number" selectable="true" outputFormat="#" visible="true" headerText="Décès" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de décès (les décès sont comptabilisés sur les services, étages ou UF de sortie)" />
			</DATAGRID>
		</ONGLET>
		<ONGLET excelLabel="Séjours" label="Séjours" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="" type="group" subType="h" percentHeight="100" fromTotal="true" maxItems="10">
				<CHART title="Nb journées" type="pieChart" serieIsCategory="true" fromTotal="true" showDataTips="true">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="JRN" displayName="Journées hospitalisés" />
					<SERIE field="JRNHON" displayName="Journées hospitalisation"/>
				</CHART>
				<CHART title="Séjours" type="columnChart" serieIsCategory="true" fromTotal="true">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="ENTPRE" displayName="Admissions avant période" />
					<SERIE field="ENTPER" displayName="Admissions sur période" />
					<SERIE field="SORPER" displayName="Sorties sur période" />
					<SERIE field="SORPOST" displayName="Sorties après période" />
				</CHART>
			</CHART>
			<CHART title="Admissions %" type="columnChart" subType="100%" maxItems="12" maxItemsSortOn="ENTPER" maxItemsSortSeq="D" sortField="ENTPER" sortSeq="D" >
				<CATEGORY field="CODTXT" type="Char"/>
				<SERIE field="ENTPER" displayName="Admissions sur période"/>
				<SERIE field="ENTPRE" displayName="Admissions avant période"/>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" 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')">
				<INSERT name="DATAGRID_MULTITAB_STYLES" />
				<HEADERROWSTYLE name="textAlign" value="center"/>
				
				<COLUMN dataField="OID" type="Char" width="60" visible="false" headerText="Oid" />
				<COLUMN dataField="COD" type="Char" width="70" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="CODTXT" type="Char" width="70" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' - ' + ROW.TXT.toString().substr(0,13) + (ROW.TXT.toString().length > 13 ? '.' : '')" />
				</COLUMN>
				<COLUMN dataField="SEJ" type="Number" width="65" outputFormat="#" headerText="Séjours" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séjours (tous types de séjours)"/>
				<COLUMN dataField="PSEJ" type="Number" width="75" headerText="% Séjours" outputFormat="#,0%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Pourcentage par rapport au total des séjours">
					<CALC formula="ROW.SEJ / TOTALROW.SEJ * 100" />
				</COLUMN>
                <COLUMN dataField="PAT" type="Number" width="65" outputFormat="#" headerText="Patients" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de Patients"/>
				<COLUMN dataField="EMC" type="Number" width="65" outputFormat="#" headerText="EMC" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Equivalent Malade Complet"/>
				<COLUMN dataField="GMP" fixed="false" type="Number" width="60" outputFormat="#" headerText="GMP&#xD;période" textAlign="right" totalFunction="sum" totalComplement="*ROW" otherFunction="sum" 
					description="GIR Moyen Pondéré">
				</COLUMN>
                <COLUMN dataField="ENTPRE" fixed="false" type="Number" width="83" outputFormat="#" headerText="Admissions&#xD;avant période" selectable="true" textAlign="right" totalComplement="*ROW"
					description="Séjours administratifs dont la date d'entrée est strictement inférieure à la date de début de la période d'analyse (tous types de séjours)" />
				<COLUMN dataField="ENTPER" type="Number" width="83" outputFormat="#" headerText="Admissions&#xD;période" selectable="true" textAlign="right" totalComplement="*ROW"
					description="Séjours administratifs dont la date d'entrée est dans la période d'analyse (tous types de séjours)" />
				<COLUMN dataField="P_ADM" type="Number" width="85" outputFormat="#,0%" headerText="% Admissions&#xD;période" textAlign="right" totalComplement="" calc="true"
					description="Pourcentage de séjours dont la date d'entrée est dans la période d'analyse (tous types de séjours)">
					<CALC formula="ROW.ENTPER / ROW.SEJ * 100" />
				</COLUMN>
				<COLUMN dataField="SORPER" type="Number" width="70" outputFormat="#" headerText="Sorties&#xD;période" textAlign="right" selectable="true" totalComplement="*ROW"
					description="Nombre de séjours administratifs dont la date de sortie est inférieure ou égale à la date de fin de la période d'analyse (tous types de séjours)" />
				<COLUMN dataField="SORPOST" type="Number" width="75" outputFormat="#" headerText="Sorties&#xD;&gt; période" selectable="true" textAlign="right" totalComplement="*ROW"
					description="Nombre de séjours administratifs dont la date de sortie est strictement supérieure à la date de fin de la période d'analyse (tous types de séjours, les présents ne sont pas comptés)" />
				<COLUMN dataField="NONSOR" type="Number" width="75" outputFormat="#" headerText="Séjours&#xD;non sortis" selectable="true" textAlign="right" totalComplement="*ROW" 
					description="Nombre de séjours administratifs encore présents dans l'établissement (tous types de séjours)" />
				<COLUMN dataField="FULL" type="Number" width="70" outputFormat="#" headerText="Entiers&#xD;période" selectable="true" textAlign="right" totalComplement="*ROW"
					description="Nombre de séjours administratifs dont les dates d'entrée et de sortie sont dans la période d'analyse (tous types de séjours)" />
				<COLUMN dataField="JRN" type="Number" width="90" outputFormat="#j" headerText="Journées&#xD;hospitalisés&#xD;période" selectable="true" textAlign="right" totalComplement="*ROW"
					description="Nombre de journées des hospitalisés" />
				<COLUMN dataField="JRNHON" type="Number" width="105" outputFormat="#j" headerText="Journées&#xD;hospitalisation&#xD;période" selectable="true" textAlign="right" totalComplement="*ROW"
					description="Nombre de journées des hospitalisés + nombre d'ambulatoires + nombre de séances" />
				<COLUMN dataField="P_JRNHON" type="Number" width="105" outputFormat="#,0%" headerText="% Journées&#xD;hospitalisation&#xD;/ Total" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Poids des journées du critère de regroupement par rapport au nombre total des journées d'hospitalisation">
					<CALC formula="ROW.JRNHON / TOTALROW.JRNHON * 100" />
				</COLUMN>
				<COLUMN dataField="DMS_HES_PER" type="Number" width="90" outputFormat="#,00j" headerText="DMS&#xD;hospitalisés&#xD;sortis période" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Rapport entre le nombre de journées de présence des séjours hospitalisés sortis (Indicateur journées hospitalisés dans l'onglet Facturation) et le nombre de séjours hospitalisés sortis(Indicateur sorties hospitalisés dans l'onglet occupation)">
					<CALC formula="ROW.JRNSOR / ROW.SOR" />
				</COLUMN>
				<COLUMN dataField="DMS_HON_PER" type="Number" width="105" outputFormat="#,00j" headerText="DMS&#xD;hospitalisation&#xD;période" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Rapport entre le nombre de journées de présence des séjours d'hospitalisation sortis et le nombre de séjours d'hospitalisation sortis (hospitalisation = hospitalisés + séances + ambulatoires)">
					<CALC formula="ROW.JRNSORHON / ROW.SORHON" />
				</COLUMN>
				<COLUMN dataField="DMS_HOA_PER" type="Number" width="105" outputFormat="#,00j" headerText="DMS&#xD;hosp + ambu&#xD;période" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="DMS des séjours hospitalisés et des ambulatoires : Rapport entre le nombre d'ambulatoires et le nombre de journées hospitalisées d'une part et le nombre d'ambulatoires et le nombre de séjours hospitalisés d'autre part">
					<CALC formula="(ROW.JRN + ROW.AMB) / (ROW.SEJHON)" />
				</COLUMN>
                
			</DATAGRID>
		</ONGLET>
		<ONGLET excelLabel="Facturation" label="Facturation" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="" type="group" subType="h" percentHeight="100" maxItems="10">
				<CHART title="Sorties" type="pieChart" showDataTips="true" maxItems="10" maxItemsSortOn="SOR" maxItemsSortSeq="D" sortField="SOR" sortSeq="D" condition="ROW.LVL == '1'">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="SEJ" displayName="Séjours" />
				</CHART>
				<CHART title="Rapport entre le nombre de sorties facturées et le nombre de sorties" type="columnChart" subType="stacked" maxItems="8" maxItemsSortOn="JRN" maxItemsSortSeq="D" sortField="JRN" sortSeq="D" condition="ROW.LVL == '1'">
					<CATEGORY field="CODTXT" type="Char" />
					<SERIE field="P_SORFAC" displayName="% Sorties période facturées" />
					<SERIE field="P_SORNONFAC" displayName="Sorties période non facturés" />
				</CHART>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" 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')">
				<INSERT name="DATAGRID_MULTITAB_STYLES" />
				<HEADERROWSTYLE name="textAlign" value="center"/>

				<COLUMN dataField="OID" type="Char" width="60" visible="false" headerText="Oid" />
				<COLUMN dataField="COD" type="Char" width="70" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES" />
				</COLUMN>
				<COLUMN dataField="CODTXT" type="Char" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' - ' + ROW.TXT.toString().substr(0,13) + (ROW.TXT.toString().length > 13 ? '.' : '')" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="SEJ" type="Number" width="65" outputFormat="#" headerText="Séjours" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séjours (tous types de séjours)"/>
				<COLUMN dataField="PSEJ" type="Number" width="75" headerText="% Séjours" outputFormat="#,0%" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Pourcentage par rapport au total des séjours">
					<CALC formula="ROW.SEJ / TOTALROW.SEJ * 100" />
				</COLUMN>
				<COLUMN dataField="EMC" type="Number" width="65" outputFormat="#" headerText="EMC" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Equivalent Malade Complet"/>
				<COLUMN dataField="TAU" width="85" type="Number"  visible="true" outputFormat="#,0%" headerText="if(VIEW.PLACESREF == SELECT.GROUPBY){return 'Taux Occupation effectif'}else{return 'Poids Occupation';}" headerTextCalc="true"  textAlign="right" totalFunction="text" otherFunction="text"
					description="(Nombre de journées hospitalisés + nombre d'ambulatoires + nombre de séances) / (Nombre de lits ouverts)">
					<CELLSTYLE name="fontWeight" value="bold" />
					<CELLSTYLE name="fontSize" value="11" />
				</COLUMN>
				<COLUMN dataField="SORPER" fixed="false" type="Number" width="70" selectable="true" outputFormat="#" headerText="Sorties&#xD;période" textAlign="right" totalComplement="*ROW"
					description="Nombre de séjours administratifs sortis sur la période (tous types de séjours)" />
				<COLUMN dataField="SOR" width="86" type="Number" selectable="true" outputFormat="#" headerText="Sorties&#xD;hospitalisés" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de sorties directes" />
				<COLUMN dataField="SORTS" width="86" type="Number" selectable="true" outputFormat="#" headerText="Sorties&#xD;hospi+Ambu+Séa" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Nombre de sorties directes + séances + ambulatoires">
					<CALC formula="ROW.SOR + ROW.AMB  + ROW.SEA" />
				</COLUMN>
				<COLUMN dataField="SORFAC" type="Number" width="72" selectable="true" outputFormat="#" headerText="Sorties&#xD;période&#xD;facturées" textAlign="right" totalComplement="*ROW"
					description="Nombre de séjours administratifs sortis sur la période et actuellement facturés (tous types de séjours)" />
				<COLUMN dataField="P_SORFAC" type="Number" width="75" outputFormat="#,0%" headerText="% Sorties&#xD;période&#xD;facturées" textAlign="right" totalComplement="" calc="true"
					description="Proportion de séjours administratifs facturés sur les séjours sortis">
					<CALC formula="ROW.SORFAC / ROW.SORPER * 100" />
				</COLUMN>
				<COLUMN dataField="SORNONFAC" type="Number" width="95" selectable="true" outputFormat="#" headerText="Sorties&#xD;période&#xD;non facturées" textAlign="right" totalComplement="*ROW"
					description="Nombre de séjours sortis sur la période et toujours pas facturés (hospitalisés + ambulatoires + séances + externes)" />
				<COLUMN dataField="P_SORNONFAC" type="Number" width="75" visible="false" outputFormat="#,0%" textAlign="right" totalComplement="" calc="true">
					<CALC formula="ROW.SORNONFAC / ROW.SORPER * 100" />
				</COLUMN>
				<COLUMN dataField="JRNSOR" type="Number" width="87" selectable="true" outputFormat="#j" headerText="Journées&#xD;hospitalisés" textAlign="right" totalComplement="*ROW"
					description="Nombre de journées des séjours hospitalisés sortis sur la période" />
				<COLUMN dataField="JRNSORFAC" type="Number" width="87" selectable="true" outputFormat="#j" headerText="Journées&#xD;hospitalisés&#xD;facturées" textAlign="right" totalComplement="*ROW"
					description="Nombre de journées des séjours hospitalisés sortis sur la période d'analyse et actuellement facturés" />
				<COLUMN dataField="JRNSORHON" type="Number" width="105" selectable="true" outputFormat="#j" headerText="Journées&#xD;hospitalisation" textAlign="right" totalComplement="*ROW"
					description="Nombre de journées d'hospitalisation (hospitalisés + ambulatoires + séances) des séjours sortis sur la période" />
				<COLUMN dataField="JRNSORHONFAC" type="Number" width="105" selectable="true" outputFormat="#j" headerText="Journées&#xD;hospitalisation&#xD;facturées" textAlign="right" totalComplement="*ROW"
					description="Nombre de journées d'hospitalisation (hospitalisés + ambulatoires + séances) des séjours sortis sur la période et actuellement facturés" />
				<COLUMN dataField="DMS_HES_PER" type="Number" width="90" outputFormat="#,00j" headerText="DMS&#xD;hospitalisés&#xD;sortis période" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Rapport entre le nombre de journées de présence des séjours hospitalisés sortis (Indicateur journées hospitalisés dans l'onglet Facturation) et le nombre de séjours hospitalisés sortis(Indicateur sorties hospitalisés dans l'onglet occupation)">
					<CALC formula="ROW.JRNSOR / ROW.SOR" />
				</COLUMN>
				<COLUMN dataField="DMS_HON_PER" type="Number" width="105" outputFormat="#,00j" headerText="DMS&#xD;hospitalisation&#xD;période" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="Rapport entre le nombre de journées de présence des séjours d'hospitalisation sortis et le nombre de séjours d'hospitalisation sortis (hospitalisation = hospitalisés + séances + ambulatoires)">
					<CALC formula="ROW.JRNSORHON / ROW.SORHON" />
				</COLUMN>
				<COLUMN dataField="DMS_HOA_PER" type="Number" width="105" outputFormat="#,00j" headerText="DMS&#xD;hosp + ambu&#xD;période" textAlign="right" totalFunction="calc" totalComplement="" otherFunction="calc" calc="true"
					description="DMS des séjours hospitalisés et des ambulatoires : Rapport entre le nombre d'ambulatoires et le nombre de journées hospitalisées d'une part et le nombre d'ambulatoires et le nombre de séjours hospitalisés d'autre part">
					<CALC formula="(ROW.JRN + ROW.AMB) / (ROW.SEJHON)" />
				</COLUMN>			
			</DATAGRID>
		</ONGLET>
		<ONGLET excelLabel="PMSI" label="PMSI" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			<CHART title="" type="group" subType="h" percentHeight="100" maxItems="10">
				<CHART title="Journées" type="pieChart" showDataTips="true" maxItems="10" maxItemsSortOn="JRNMCOHOSPI" maxItemsSortSeq="D" sortField="JRNMCOHOSPI" sortSeq="D" condition="ROW.LVL == '1'">
					<CATEGORY field="TXT" type="Char" />
					<SERIE field="JRNMCOHOSPI" displayName="Journées hospitalisés" />
				</CHART>
				<CHART title="Journées hosipitalisation" type="columnChart" subType="stacked" maxItems="8" maxItemsSortOn="JRNMCOHOSPI" maxItemsSortSeq="D" sortField="JRNMCOHOSPI" sortSeq="D" condition="ROW.LVL == '1'">
					<CATEGORY field="CODTXT" type="Char" />
					<SERIE field="JRNMCOHOSPI" displayName="Journées hospitalisés MCO" />
					<SERIE field="AMB" displayName="Ambulatoires" />
					<SERIE field="SEA" displayName="Sèances" />
				</CHART>
			</CHART>
			<DATAGRID title="" total="true" showOthers="true" headerHeight="60" 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')">
				<INSERT name="DATAGRID_MULTITAB_STYLES" />
				<HEADERROWSTYLE name="textAlign" value="center"/>

				<COLUMN dataField="OID" type="Char" width="60" visible="false" headerText="Oid" />
				<COLUMN dataField="COD" type="Char" width="70" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES" />
				</COLUMN>
				<COLUMN dataField="CODTXT" type="Char" visible="false" totalFunction="text" otherFunction="text" calc="true">
					<CALC formula="ROW.COD + ' - ' + ROW.TXT.toString().substr(0,13) + (ROW.TXT.toString().length > 13 ? '.' : '')" />
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="200" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres" />
				<COLUMN dataField="JRNMCOHOSPI" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;MCO&lt;/font&gt;' +'\n'+'Journées' +'\n'+'hospitalisés';" headerTextCalc="true"  visibleCondition="VIEW.ENV_WITHMCO == '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées hospitalisés MCO">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>					
				<COLUMN dataField="AMB" type="Number" width="85" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;MCO&lt;/font&gt;' +'\n'+'Ambulatoires';" headerTextCalc="true" visibleCondition="VIEW.ENV_WITHMCO == '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre séjours Ambulatoires">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>					
				<COLUMN dataField="SEA" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;MCO&lt;/font&gt;' +'\n'+'Séances';" headerTextCalc="true"  visibleCondition="VIEW.ENV_WITHMCO == '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de séjours Séances">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>					
				
				<COLUMN dataField="EXT" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;Externes&lt;/font&gt;';" headerTextCalc="true" visibleCondition="VIEW.ENV_WITHMCO == '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées Externes">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				
				<COLUMN dataField="JRNSSRHC" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;SSR&lt;/font&gt;' +'\n'+'journées' +'\n'+'H.C.';" headerTextCalc="true" visibleCondition="VIEW.ENV_WITHSSR == '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées hospitalisation complète SSR">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="JRNSSRHP" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;SSR&lt;/font&gt;' +'\n'+'journées' +'\n'+'H.P.';" headerTextCalc="true" visibleCondition="VIEW.ENV_WITHSSR == '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées hospitalisation partiel ou HDJ SSR">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				
				<COLUMN dataField="JRNPSYHP" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;PSY&lt;/font&gt;' +'\n'+'journées' +'\n'+'H.C.';" headerTextCalc="true" visibleCondition="VIEW.ENV_WITHPSY== '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées hospitalisation complète PSY">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				<COLUMN dataField="JRNPSYHP" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;PSY&lt;/font&gt;' +'\n'+'journées' +'\n'+'H.P.';" headerTextCalc="true" visibleCondition="VIEW.ENV_WITHPSY== '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées hospitalisation partiel PSY">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
				
				<COLUMN dataField="JRNHAD" type="Number" width="80" outputFormat="#" headerText="return '&lt;font color=\'#DB1702\'&gt;HAD&lt;/font&gt;' +'\n'+'journées';" headerTextCalc="true" visibleCondition="VIEW.ENV_WITHHAD== '1'" textAlign="right" totalFunction="sum" otherFunction="sum"
					description="Nombre de journées hospitalisation HAD">
						<HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
						<FOOTERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>