<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="ACTI000099" label="Activité. Analyse chambres particulières" title="= 'Chambres particulières 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" 
        helpDokuWIkiDir="activite:qualite:etudes:chambres_particulieres" 
        helpDokuWIkiFile="acti000099" 
        helpFile="iCTI_ACTI_ACTI000099.HTML"
>
	<VIEWPROPERTIES componentName="PROPERTIES_OCCUPATION"/>
	<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="Période" UI="combo" tree="true" width="200" default="2009-01-01" globalListProvider="DATE_DEBUT" >
			</FIELD>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2009-01-31" globalListProvider="DATE_FIN" >
			</FIELD>
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" label="" UI="combo" width="200" default="SER" tree="true">
				<OPTION label="OCCUPATION_GROUPBY" data="" globalListProvider="OCCUPATION_GROUPBY"/>
				<OPTION label="Mois" data="MOIS"/>
			</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="200" default="-1" tree="true">
				<OPTION label="" data="-1" treeLevel="1"/>
				<OPTION label="OCCUPATION_GROUPBY" data="" globalListProvider="OCCUPATION_GROUPBY"/>
				<OPTION label="Mois" data="MOIS"/>
			</FIELD>
			<FIELD name="GROUPBY_3" label="" UI="combo" width="200" default="-1" tree="true">
				<OPTION label="" data="-1" treeLevel="1"/>
				<OPTION label="OCCUPATION_GROUPBY" data="" globalListProvider="OCCUPATION_GROUPBY"/>
				<OPTION label="Mois" data="MOIS"/>
			</FIELD>
		</GROUP>
		
	</SELECTIONS>
	<SELECTIONS label="Modes de calcul" displayText="= var display:String = '';
						display = display + 'Modes de calcul : #B#' + VIEW.OPTADM_DAYOUT + '. ' + SELECT.QJMUT_LABEL  + '#/B#';
						return display;
						">
		<GROUP label="Modes">
			<FIELD name="QJMUT" label="" 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>
		
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_OCCUPATION_SOUSSELECTIONS"/>
	<SELECTIONS componentName="FILTRES_MOUVEMENTS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_SEJOURS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_PASSAGES_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
			
			<SQL optimizer="V_SEJOURS_X" optimizer2="V_MOUVEMENTS_SEJOUR_X">
				<select><![CDATA[
					DROP TABLE IF EXISTS acti000099_sejcp;
					CREATE TEMP TABLE acti000099_sejcp AS
					SELECT v_sejours_1.no_sejour
					FROM #V_SEJOURS_X#
						JOIN #V_MOUVEMENTS_SEJOUR_X# ON v_mouvements_sejour_2.no_sejour = v_sejours_1.no_sejour
					WHERE '[_ONGLET_O1_VISIBLE]'='true' AND
							date BETWEEN '[PERIODE]' AND '[VIEW.TOPERIODE]' AND
							v_sejours_1.type_sejour IN ('1','2') AND
							[VIEW.CP_FIELD] <> 0 AND est_mouvement_previsionnel <> '1'
							[VIEW.SEJOURS_SELECT] [VIEW.PASSAGES_SELECT]
							
					GROUP BY 1;
					
					ALTER TABLE acti000099_sejcp ADD CONSTRAINT acti000099_sejcp_pkey PRIMARY KEY(no_sejour);
					
				
				]]></select>
				
			</SQL>
			
			<SQL optimizer="V_SEJOURS_X" optimizer2="V_FACTURES_LIGNES_C_X">
				<select><![CDATA[
					
					
					DROP SEQUENCE IF EXISTS ACTI000099_faccp_rub_seq;
					CREATE TEMP SEQUENCE ACTI000099_faccp_rub_seq;
					
					DROP TABLE IF EXISTS acti000099_faccp_rub;
					CREATE TEMP TABLE acti000099_faccp_rub AS
					SELECT rubrique_facturation_id, rubrique_facturation_code, nextval('ACTI000099_faccp_rub_seq'::regclass) AS columnby_sequence, nb_cp_facturees
					FROM (	
						SELECT rubrique_facturation_id, rubrique_facturation_code,    						
							COUNT(DISTINCT CASE WHEN nb_rubrique > 0 THEN v_factures_lignes_c_4.no_sejour||to_char(date_debut,'YYYYMMDD') ELSE NULL END) - COUNT(DISTINCT CASE WHEN nb_rubrique < 0 THEN v_factures_lignes_c_4.no_sejour||to_char(date_debut,'YYYYMMDD') ELSE NULL END) AS nb_cp_facturees				
						FROM #V_FACTURES_LIGNES_C_X#
							JOIN #V_SEJOURS_X# ON v_sejours_1.no_sejour = v_factures_lignes_c_4.no_sejour
						WHERE '[_ONGLET_O1_VISIBLE]'='true' AND
							v_factures_lignes_c_4.date_fin BETWEEN '[PERIODE]' AND '[VIEW.TOPERIODE]' AND
							rubrique_facturation_id IN (SELECT to_id FROM activite.v_listes_3 WHERE liste_code = 'CTI_SHO_R')
							[VIEW.SEJOURS_SELECT] [VIEW.PASSAGES_SELECT]
						GROUP BY 1,2
						ORDER BY 3 DESC
					) subview;
					
					CTISELECT_PROPERTY DISTINCT 'COLI' || columnby_sequence::text, CASE WHEN columnby_sequence <= 10 THEN rubrique_facturation_id::text ELSE '-1' END FROM acti000099_faccp_rub				
					UNION 					
					CTISELECT_PROPERTY DISTINCT 'COLH' || columnby_sequence::text, rubrique_facturation_code FROM acti000099_faccp_rub;
					
					DROP TABLE IF EXISTS acti000099_faccp;
					CREATE TEMP TABLE acti000099_faccp AS
					SELECT v_sejours_1.no_sejour, 
						v_factures_lignes_c_4.date_fin,
						CASE WHEN SUM(nb_rubrique) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees,
						CASE WHEN MAX(v_factures_lignes_c_4.date_fin) = MAX(date_sortie) AND SUM(nb_rubrique) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_js,
						SUM(montant_facture + montant_encours) AS montant_cp_facturees,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 1 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_1,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 2 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_2,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 3 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_3,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 4 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_4,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 5 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_5,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 6 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_6,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 7 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_7,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 8 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_8,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 9 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_9,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 10 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_10,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 11 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_11,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 12 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_12,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 13 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_13,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 14 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_14,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 15 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_15,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 16 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_16,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 17 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_17,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 18 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_18,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 19 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_19,
						CASE WHEN SUM(CASE WHEN acti000099_faccp_rub.columnby_sequence = 20 THEN nb_rubrique ELSE 0 END) > 0 THEN 1 ELSE 0 END AS nb_cp_facturees_20
					FROM #V_FACTURES_LIGNES_C_X#
						JOIN #V_SEJOURS_X# ON v_sejours_1.no_sejour = v_factures_lignes_c_4.no_sejour
						JOIN acti000099_faccp_rub ON v_factures_lignes_c_4.rubrique_facturation_id = acti000099_faccp_rub.rubrique_facturation_id
					WHERE '[_ONGLET_O1_VISIBLE]'='true' AND
							v_factures_lignes_c_4.date_fin BETWEEN '[PERIODE]' AND '[VIEW.TOPERIODE]'
							[VIEW.SEJOURS_SELECT] [VIEW.PASSAGES_SELECT] 
					GROUP BY 1,2;
					
					ALTER TABLE acti000099_faccp ADD CONSTRAINT acti000099_faccp_pkey PRIMARY KEY(no_sejour, date_fin);
				
				]]></select>
				
			</SQL>
			
			<SQL optimizer="V_SEJOURS_X" optimizer2="V_MOUVEMENTS_SEJOUR_X">
				<select><![CDATA[	
														
					CTISELECT_TREE
						WORKTABLE{acti000099}
						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{
						COUNT(DISTINCT v_sejours_1.no_sejour) ,,
						SUM([VIEW.JOURNEES_FIELD] + nb_ambulatoires),,
						
						COUNT(DISTINCT CASE WHEN [VIEW.CP_FIELD] <> 0 THEN v_sejours_1.no_sejour ELSE NULL END) ,,
						SUM(CASE WHEN v_sejours_1.code_cp_demandee = '1' THEN [VIEW.CP_FIELD] ELSE NULL END),,
						SUM(CASE WHEN v_sejours_1.code_cp_demandee <> '1' THEN [VIEW.CP_FIELD] ELSE NULL END),,
						

						COUNT(DISTINCT CASE WHEN acti000099_sejcp.no_sejour IS NOT NULL AND [VIEW.JOURNEES_FIELD] + nb_ambulatoires <> 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULl END)
						- SUM([VIEW.CP_FIELD]),,
						
						COUNT(DISTINCT CASE WHEN acti000099_sejcp.no_sejour IS NULL AND v_sejours_1.code_cp_demandee = '1' AND v_sejours_1.code_sorti = '1' AND [VIEW.JOURNEES_FIELD] + nb_ambulatoires <> 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN acti000099_sejcp.no_sejour IS NULL AND v_sejours_1.code_cp_demandee = '1' AND v_sejours_1.code_sorti <> '1' AND [VIEW.JOURNEES_FIELD] + nb_ambulatoires <> 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						
						COUNT(DISTINCT CASE WHEN acti000099_sejcp.no_sejour IS NULL AND v_sejours_1.code_cp_demandee <> '1' AND [VIEW.JOURNEES_FIELD] + nb_ambulatoires <> 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						
						COUNT(DISTINCT CASE WHEN nb_cp_facturees > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_js > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						
						SUM(CASE WHEN v_sejours_1.code_cp_demandee = '1' THEN [VIEW.CP_FIELD] ELSE NULL END) - COUNT(DISTINCT CASE WHEN nb_cp_facturees > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						base.cti_division(
							COUNT(DISTINCT CASE WHEN nb_cp_facturees > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),
							SUM(CASE WHEN v_sejours_1.code_cp_demandee = '1' THEN [VIEW.CP_FIELD] ELSE NULL END)
							) * 100,,
						
						
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_1 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_2 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_3 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_4 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_5 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_6 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_7 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_8 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_9 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_10 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_11 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_12 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_13 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_14 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_15 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_16 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_17 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_18 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_19 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN nb_cp_facturees_20 > 0 THEN v_sejours_1.no_sejour::text || to_char(date, 'YYYYMMDD') ELSE NULL END),,
					}
					
					FROM #V_SEJOURS_X#
						JOIN #V_MOUVEMENTS_SEJOUR_X# ON v_mouvements_sejour_2.no_sejour = v_sejours_1.no_sejour
						LEFT JOIN acti000099_sejcp ON acti000099_sejcp.no_sejour = v_sejours_1.no_sejour
						LEFT JOIN acti000099_faccp ON acti000099_faccp.no_sejour = v_mouvements_sejour_2.no_sejour AND
												acti000099_faccp.date_fin = v_mouvements_sejour_2.date
					WHERE '[_ONGLET_O1_VISIBLE]'='true' AND
							date BETWEEN '[PERIODE]' AND '[VIEW.TOPERIODE]' AND
							(v_sejours_1.type_sejour IN ('1','2') AND [VIEW.JOURNEES_FIELD] + nb_ambulatoires <> 0 OR
							nb_cp_facturees IS NOT NULL AND nb_cp_facturees <> 0 AND [VIEW.JOURNEES_FIELD] + nb_ambulatoires = 0 )
							[VIEW.SEJOURS_SELECT] [VIEW.PASSAGES_SELECT]
							[VIEW.MOUVEMENTS_SELECT] AND est_mouvement_previsionnel <> '1'
						
				
						
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="NBSEJ"/>
					<FIELD name="NBJRN"/>
					<FIELD name="NBSEJCP"/>
					<FIELD name="NBJRNCPAD"/>
					<FIELD name="NBJRNCPSD"/>
					<FIELD name="NBJRNCPP"/>
					<FIELD name="NBJRNCPDSS"/>
					<FIELD name="NBJRNCPDSP"/>
					<FIELD name="NBJRNNPDS"/>
					<FIELD name="NBJRNCPF"/>
					<FIELD name="NBJRNCPFJS"/>
					<FIELD name="ECJRNCPF"/>
					<FIELD name="PRJRNCPF"/>
					<FIELD name="NBJRNCPF1"/>
					<FIELD name="NBJRNCPF2"/>
					<FIELD name="NBJRNCPF3"/>
					<FIELD name="NBJRNCPF4"/>
					<FIELD name="NBJRNCPF5"/>
					<FIELD name="NBJRNCPF6"/>
					<FIELD name="NBJRNCPF7"/>
					<FIELD name="NBJRNCPF8"/>
					<FIELD name="NBJRNCPF9"/>
					<FIELD name="NBJRNCPF10"/>
					<FIELD name="NBJRNCPF11"/>
					<FIELD name="NBJRNCPF12"/>
					<FIELD name="NBJRNCPF13"/>
					<FIELD name="NBJRNCPF14"/>
					<FIELD name="NBJRNCPF15"/>
					<FIELD name="NBJRNCPF16"/>
					<FIELD name="NBJRNCPF17"/>
					<FIELD name="NBJRNCPF18"/>
					<FIELD name="NBJRNCPF19"/>
					<FIELD name="NBJRNCPF20"/>
				</FIELDS>
			</SQL>
		</QUERY>
		
		<QUERY label="">
			
			<SQL optimizer="V_SEJOURS_X" optimizer2="V_FACTURES_LIGNES_C_X">
				<select><![CDATA[
					
					
					DROP TABLE IF EXISTS w_faccp;
					CREATE TEMP TABLE w_faccp AS
					SELECT p_sejours.no_sejour,
						p_factures.no_facture,
						-9::bigint AS tiers_payant_id,
						' PAT'::text AS tiers_payant_code,
						' PATIENTS'::text AS tiers_payant_texte,
						v_factures_lignes_c_4.date_fin,
						montant_facture_0 AS montant_facture,
						CASE WHEN v_factures_lignes_c_4.date_fin = date_sortie THEN '1' ELSE '0' END AS is_js,
						'0'::text AS is_multi
					FROM activite.v_factures_lignes_c_4
					JOIN activite.p_sejours ON p_sejours.no_sejour = v_factures_lignes_c_4.no_sejour
					JOIN activite.p_factures ON v_factures_lignes_c_4.no_facture = p_factures.no_facture
					WHERE '[_ONGLET_O2_VISIBLE]'='true' AND
						p_factures.date_fin between '[PERIODE]' AND '[VIEW.TOPERIODE]' AND
						rubrique_facturation_id = ANY (SELECT to_id FROM activite.v_listes_3 WHERE liste_code = 'CTI_SHO_R') AND
						p_sejours.type_sejour = '1' AND
						montant_facture_0 <> 0;

					INSERT INTO w_faccp
					SELECT p_sejours.no_sejour,
						p_factures.no_facture,
						t_tiers_payant.oid AS tiers_payant_id,
						t_tiers_payant.code AS tiers_payant_code,
						t_tiers_payant.texte AS tiers_payant_texte,
						v_factures_lignes_c_4.date_fin,
						montant_facture_2 AS montant_facture,
						CASE WHEN v_factures_lignes_c_4.date_fin = date_sortie THEN '1' ELSE '0' END AS is_js,
						'0'::text AS is_multi
					FROM activite.v_factures_lignes_c_4
					JOIN activite.p_sejours ON p_sejours.no_sejour = v_factures_lignes_c_4.no_sejour
					JOIN activite.p_factures ON v_factures_lignes_c_4.no_facture = p_factures.no_facture
					JOIN activite.t_tiers_payant ON p_factures.tiers_payant_2_id = t_tiers_payant.oid
					WHERE '[_ONGLET_O2_VISIBLE]'='true' AND
						p_factures.date_fin between '[PERIODE]' AND '[VIEW.TOPERIODE]' AND
						rubrique_facturation_id = ANY (SELECT to_id FROM activite.v_listes_3 WHERE liste_code = 'CTI_SHO_R') AND
						p_sejours.type_sejour = '1' AND
						montant_facture_2 <> 0 AND
						p_factures.tiers_payant_2_id <> 0;


					INSERT INTO w_faccp
					SELECT p_sejours.no_sejour,
						p_factures.no_facture,
						t_tiers_payant.oid AS tiers_payant_id,
						t_tiers_payant.code AS tiers_payant_code,
						t_tiers_payant.texte AS tiers_payant_texte,
						v_factures_lignes_c_4.date_fin,
						montant_facture_22 AS montant_facture,
						CASE WHEN v_factures_lignes_c_4.date_fin = date_sortie THEN '1' ELSE '0' END AS is_js,
						'0'::text AS is_multi
					FROM activite.v_factures_lignes_c_4
					JOIN activite.p_sejours ON p_sejours.no_sejour = v_factures_lignes_c_4.no_sejour
					JOIN activite.p_factures ON v_factures_lignes_c_4.no_facture = p_factures.no_facture
					JOIN activite.t_tiers_payant ON p_factures.tiers_payant_22_id = t_tiers_payant.oid
					WHERE '[_ONGLET_O2_VISIBLE]'='true' AND
						p_factures.date_fin between '[PERIODE]' AND '[VIEW.TOPERIODE]' AND
						rubrique_facturation_id = ANY (SELECT to_id FROM activite.v_listes_3 WHERE liste_code = 'CTI_SHO_R') AND
						p_sejours.type_sejour = '1' AND
						montant_facture_22 <> 0 AND
						p_factures.tiers_payant_22_id <> 0;



					INSERT INTO w_faccp
					SELECT p_sejours.no_sejour,
						p_factures.no_facture,
						t_tiers_payant.oid AS tiers_payant_id,
						t_tiers_payant.code AS tiers_payant_code,
						t_tiers_payant.texte AS tiers_payant_texte,
						v_factures_lignes_c_4.date_fin,
						montant_facture_1 AS montant_facture,
						CASE WHEN v_factures_lignes_c_4.date_fin = date_sortie THEN '1' ELSE '0' END AS is_js,
						'0'::text AS is_multi
					FROM activite.v_factures_lignes_c_4
					JOIN activite.p_sejours ON p_sejours.no_sejour = v_factures_lignes_c_4.no_sejour
					JOIN activite.p_factures ON v_factures_lignes_c_4.no_facture = p_factures.no_facture
					JOIN activite.t_tiers_payant ON p_factures.tiers_payant_1_id = t_tiers_payant.oid
					WHERE '[_ONGLET_O2_VISIBLE]'='true' AND
						p_factures.date_fin between '[PERIODE]' AND '[VIEW.TOPERIODE]' AND
						rubrique_facturation_id = ANY (SELECT to_id FROM activite.v_listes_3 WHERE liste_code = 'CTI_SHO_R') AND
						p_sejours.type_sejour = '1' AND
						montant_facture_1 <> 0 AND
						p_factures.tiers_payant_1_id <> 0
					;

					
					DELETE FROM w_faccp
					USING 
						(
						SELECT no_sejour, date_fin, tiers_payant_id
						FROM w_faccp
						GROUP BY 1,2,3
						HAVING SUM(montant_facture) <= 0
						) subview
					WHERE w_faccp.no_sejour = subview.no_sejour AND
						w_faccp.date_fin = subview.date_fin AND
						w_faccp.tiers_payant_id = subview.tiers_payant_id
					;
					
					UPDATE w_faccp
					SET is_multi = '1'
					FROM 
						(
						SELECT no_sejour, date_fin
						FROM w_faccp
						GROUP BY 1,2
						HAVING count(DISTINCT tiers_payant_id) > 1
						) subview
					WHERE w_faccp.no_sejour = subview.no_sejour AND
						w_faccp.date_fin = subview.date_fin
					;
					
														
					CTISELECT_TREE
						WORKTABLE{acti000099_2}
						GROUPBY1{tiers_payant_id,, tiers_payant_code,, tiers_payant_texte}
						
					INDICATORS{
						COUNT(DISTINCT no_sejour) ,,
						COUNT(DISTINCT no_sejour||date_fin) ,,
						SUM(montant_facture),,
						COUNT(DISTINCT CASE WHEN is_js = '1' THEN no_sejour||date_fin ELSE NULL END) ,,
						SUM(CASE WHEN is_js = '1' THEN montant_facture ELSE 0 END) ,,
						COUNT(DISTINCT CASE WHEN is_multi = '1' THEN no_sejour||date_fin ELSE NULL END) ,,
						base.cti_division(
							COUNT(DISTINCT CASE WHEN is_js = '1' THEN no_sejour||date_fin ELSE NULL END),
							COUNT(DISTINCT no_sejour)
						)*100,,
						base.cti_division(
							SUM(montant_facture),
							COUNT(DISTINCT no_sejour||date_fin)
						),,
					}
					
					FROM w_faccp
						
				
						
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="NBSEJ"/>
					<FIELD name="NBCP"/>
					<FIELD name="MTCP"/>
					<FIELD name="NBCPS"/>
					<FIELD name="MTCPS"/>
					<FIELD name="NBMUL"/>
					<FIELD name="TXCPS"/>
					<FIELD name="PUCP"/>
				</FIELDS>
			</SQL>
		</QUERY>
		
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL select="
				SELECT 'TOPERIODE', COALESCE(MAX(date),'[TOPERIODE]') FROM activite.p_mouvements_sejour WHERE date BETWEEN '[PERIODE]' AND '[TOPERIODE]' AND est_mouvement_previsionnel &lt;&gt; '1' 
				">
				<FIELDS>
					<FIELD name="name"/>
					<FIELD name="value"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Justificatif des séjours" shortLabel="Liste séjours" view="ACTI000100.XML" componentName="OCC_BASE_VIEWLINK" component3Name="STANDARD_BASE_VIEWLINK">
				<ARG name="DATA" value="if (COLUMN.NAME == 'ECJRNCPF') {return 'ECARTFF'}
										if (COLUMN.NAME == 'NBJRNCPSD') {return 'CPSANSDMD'}
										if (COLUMN.NAME == 'NBJRNCPP') {return 'CPETNONCP'}
										if (COLUMN.NAME == 'NBJRNCPDSS') {return 'DMDSANSCPS'}
										if (COLUMN.NAME == 'NBJRNCPDSP') {return 'DMDSANSCPP'}
										
										return '-1'"/>
			</VIEWLINK>

		</VIEWLINKS>
		<ONGLET excelLabel="Chambres particulières" label="Chambres particulières" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			
			<DATAGRID title="" total="true" showOthers="true" headerHeight="80" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'">
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>

				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD" width="70" type="Char" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="150" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres">
				</COLUMN>
				
				<COLUMN dataField="NBSEJ" width="60" type="Number" selectable="true" visible="true" outputFormat="#" fixed="false" headerText="Total@LF@Nb séjours" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de séjours ambulatoires, hospitalisés ou ayant eu une rubrique de facturation de chambre particulière facturée">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRN" width="80" type="Number" selectable="true" visible="true" outputFormat="#" fixed="false" headerText="Total@LF@Nb journées@LF@@LF@X=A+B+C+D+E+F" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de journées des séjours ambulatoires, hospitalisés ou ayant eu une rubrique de facturation de chambre particulière facturée">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				
				<COLUMN dataField="NBJRNCPAD" width="90"  type="Number" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP occupées@LF@avec demande@LF@(Facturables)@LF@A"  textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Journées passées dans un lit identifié comme chambre particulière. Le patient a fait une demande de chambre particulière">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPSD" width="90" selectable="true" type="Number" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP occupées@LF@sans demande@LF@@LF@B"  textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Journées passées dans un lit identifié comme chambre particulière. Le patient n'a pas fait de demande de chambre particulière">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPP" width="100" selectable="true" type="Number" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP non occupées@LF@avec une CP dans le séjour@LF@C" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Parmi les séjours pour lesquels un patient a passé au moins une journée en chambre particulière (demandée ou pas), nombre de journées passées en dehors d'une chambre particulière">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPDSS" width="100" type="Number" selectable="true" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP non occupées@LF@avec demande@LF@(Sortis)@LF@D" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de journées des séjours &lt;b&gt;sortis&lt;/b&gt; pour lesquels le patient avait fait une demande de chambre particulière et où il n'a jamais occupé de chambre particulière">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPDSP" width="100" type="Number" selectable="true" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP non occupées@LF@avec demande@LF@(présents)@LF@E" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de journées des séjours &lt;b&gt;présents&lt;/b&gt; pour lesquels le patient avait fait une demande de chambre particulière et où il n'a jamais occupé de chambre particulière">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNNPDS" width="90" type="Number" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP non occupées@LF@sans demande@LF@F" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de journées des séjours pour lesquels le patient n'a pas fait de demande de chambre particulière et où il n'en a jamais occupé une">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF" width="90" type="Number" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP facturées@LF@@LF@@LF@G" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de rubriques de facturation de chambres particulières facturées. Ces rubriques sont identifiables dans la liste &lt;b&gt;CTI : chambre particulière&lt;/b&gt; (&lt;i&gt;CTI_SHO_R&lt;/i&gt;) consultable via le menu Activité -> Paramètres -> Classification -> Listes -> Rubriques de facturation -> Listes CTI.">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPFJS" width="90" type="Number" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@CP facturées@LF@Dont JS@LF@@LF@H" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de rubriques de facturation de chambres particulières facturées le jour de sortie. Ces rubriques sont identifiables dans la liste &lt;b&gt;CTI : chambre particulière&lt;/b&gt; (&lt;i&gt;CTI_SHO_R&lt;/i&gt;) consultable via le menu Activité -> Paramètres -> Classification -> Listes -> Rubriques de facturation -> Listes CTI.">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="ECJRNCPF" width="90" selectable="true" type="Number" outputFormat="#" fixed="false" visible="true" headerText="Journées@LF@Ecart@LF@facturables/@LF@facturées@LF@A-G" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Différence entre les colonnes &lt;b&gt;A&lt;/b&gt; (&lt;i&gt;Journées CP occupées avec demande (Facturables)&lt;/i&gt;) et &lt;b&gt;G&lt;/b&gt; (&lt;i&gt;Journées CP facturées&lt;/i&gt;)">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="PRJRNCPF" width="90" selectable="true" type="Number" outputFormat="#,0%" fixed="false" visible="true" headerText="Journées@LF@%@LF@facturées/@LF@facturables@LF@%G/A" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Rapport, en pourcentage, entre les colonnes &lt;b&gt;G&lt;/b&gt; (&lt;i&gt;Journées CP facturées&lt;/i&gt;) et &lt;b&gt;A&lt;/b&gt; (&lt;i&gt;Journées CP occupées avec demande (Facturables)&lt;/i&gt;)">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF1" width="90" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH1 != null" headerText="'Journées\rCP facturées\rdont: ' + VIEW.COLH1" columnData="= VIEW.COLI1" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH1 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF2" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH2 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH2" columnData="= VIEW.COLI2" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH2 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF3" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH3 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH3" columnData="= VIEW.COLI3" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH3 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF4" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH4 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH4" columnData="= VIEW.COLI4" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH4 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF5" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH5 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH5" columnData="= VIEW.COLI5" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH5 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF6" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH6 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH6" columnData="= VIEW.COLI6" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH6 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF7" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH7 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH7" columnData="= VIEW.COLI7" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH7 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF8" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH8 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH8" columnData="= VIEW.COLI8" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH8 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF9" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH9 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH9" columnData="= VIEW.COLI9" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH9 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF10" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH10 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH10" columnData="= VIEW.COLI10" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH10 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF11" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH11 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH11" columnData="= VIEW.COLI11" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH11 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF12" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH12 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH12" columnData="= VIEW.COLI12" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH12 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF13" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH13 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH13" columnData="= VIEW.COLI13" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH13 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF14" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH14 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH14" columnData="= VIEW.COLI14" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH14 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF15" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH15 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH15" columnData="= VIEW.COLI15" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH15 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF16" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH16 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH16" columnData="= VIEW.COLI16" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH16 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF17" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH17 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH17" columnData="= VIEW.COLI17" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH17 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF18" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH18 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH18" columnData="= VIEW.COLI18" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH18 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF19" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH19 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH19" columnData="= VIEW.COLI19" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH19 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBJRNCPF20" width="80" type="Number" outputFormat="#" fixed="false" visibleCondition="VIEW.COLH20 != null" headerText="'Journées\rCP facturées\rdont:\r' + VIEW.COLH20" columnData="= VIEW.COLI20" headerTextCalc="true" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="= 'Nombre de rubriques &lt;b&gt;' + VIEW.COLH20 + '&lt;/b&gt; factureés'">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
		
		
		<ONGLET excelLabel="CP Hospitalisés par TP" label="CP Hospitalisés par TP" multiTab="false" queryNumber="1">
			
			<DATAGRID title="" total="true" showOthers="true" headerHeight="40" selectRowInRows="= ROW.OID == '-9999997'" otherRowInRows="= ROW.OID == '-9999998'" totalRowInRows="= ROW.OID == '-9999999'">
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>

				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD" width="70" type="Char" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="150" headerText="Tiers payant" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres">
				</COLUMN>
				
				<COLUMN dataField="NBSEJ" width="100" type="Number" selectable="true" visible="true" outputFormat="#" fixed="false" 
					headerText="Nb séjours sortis" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBCP" width="100" type="Number" selectable="true" visible="true" outputFormat="#" fixed="false" 
					headerText="Nb CP" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBMUL" width="100" type="Number" selectable="true" visible="true" outputFormat="#" fixed="false" 
					headerText="Nb CP avec autre tiers" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="PUCP" width="100" type="Number" selectable="true" visible="true" outputFormat="#E" fixed="false" 
					headerText="P.U. moyen CP" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="MTCP" width="100" type="Number" selectable="true" visible="true" outputFormat="#E" fixed="false" 
					headerText="Mt CP" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="NBCPS" width="100" type="Number" selectable="true" visible="true" outputFormat="#" fixed="false" 
					headerText="Nb CP JS" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="MTCPS" width="100" type="Number" selectable="true" visible="true" outputFormat="#E" fixed="false" 
					headerText="Mt CP JS" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
				<COLUMN dataField="TXCPS" width="100" type="Number" selectable="true" visible="true" outputFormat="#%" fixed="false" 
					headerText="Taux CP JS" textAlign="right" totalFunction="sum" otherFunction="sum">
					<HEADERCELLSTYLE name="textAlign" value="center"/>
				</COLUMN>
			</DATAGRID>
		</ONGLET>
		
	</PRESENTATION>
</VUE>
