<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="ACTI000058" label="Activité. Liste des séjours" title="= 'Liste des séjours (' + 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:etat_des_dossiers_superviseur_activite" 
    helpDokuWIkiFile="acti000057" 
>
	<VIEWPROPERTIES componentName="PROPERTIES_ETATDOSSIERS"/>
	<VIEWPROPERTIES>
			
		<PROPERTY name="FACTURE_SELECT" >
						<value><![CDATA[
							[EVAL 
								$select = "";
								
								if ('[QGROUPE]' == '1') {$select = $select . "AND v_factures_reference_1.nb_non_groupe > 0 ";}
								if ('[QGROUPE]' == '2') {$select = $select . "AND v_factures_reference_1.nb_groupe > 0 ";}
								if ('[QGROUPE]' == '3') {$select = $select . "AND v_factures_reference_1.nb_non_groupe = 0 ";}
								if ('[QFACTURE]' == '1') {$select = $select . "AND v_factures_reference_1.nb_non_calcules > 0";}
                                if ('[QFACTURE]' == '1HBG') {$select = $select . "AND v_factures_reference_1.nb_non_calcules_horsbg > 0";}
								if ('[QFACTURE]' == '1BG') {$select = $select . "AND v_factures_reference_1.nb_non_calcules_bg > 0";}
								if ('[QFACTURE]' == '2') {$select = $select . "AND v_factures_reference_1.nb_non_calcules = 0";}
								if ('[QEXPEDIE]' == '1') {$select = $select . "AND v_factures_reference_1.nb_non_expedie[VIEW.CLIHON] > 0";}
								if ('[QEXPEDIE]' == '2') {$select = $select . "AND v_factures_reference_1.nb_non_expedie[VIEW.CLIHON] = 0 ";}
								if ('[QSOLDE]' == '1') {$select = $select . "AND v_factures_reference_1.nb_non_solde[VIEW.CLIHON] > 0";}
								if ('[QSOLDE]' == '2') {$select = $select . "AND v_factures_reference_1.nb_non_solde[VIEW.CLIHON] = 0 ";}
								if ('[QCLOTURE]' == '1') {$select = $select . "AND v_factures_reference_1.nb_non_cloture[VIEW.CLIHON] > 0";}
								if ('[QCLOTURE]' == '2') {$select = $select . "AND v_factures_reference_1.nb_non_cloture[VIEW.CLIHON] = 0 AND v_factures_reference_1.nb_non_calcules = 0";}
								
								
								return $select;
							EVAL]
						]]></value>
		</PROPERTY>			
		
		<PROPERTY name="TIERS_COLUMN">
				<value>
					<![CDATA[
						[EVAL 
							if ('[QDETAIL_TIERS]' == '1') {return "tiers_payant_code || ' ' || tiers_payant_texte";}
							return "''";

						EVAL]
					]]>
				</value>
			</PROPERTY>

	</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 de sortie" UI="combo" tree="true" width="150" default="2009-01-01" globalListProvider="DATE_DEBUT" >
			</FIELD>
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="150" default="2009-01-31" globalListProvider="DATE_FIN" >
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS label="Filtre factures" displayText="= var display:String = '';

					
					
					if (SELECT.QGROUPE  != '-1' || SELECT.QFACTURE  != '-1' || SELECT.QEXPEDIE  != '-1' || SELECT.QSOLDE  != '-1' || SELECT.QCLOTURE  != '-1') {
						display = display + '  Etat dossiers : #B#';
						if (SELECT.QGROUPE  == '1') {
							display = display + '  Non Groupés';
						}
						if (SELECT.QGROUPE  == '2') {
							display = display + '  Groupés (PMSI)';
						}
						if (SELECT.QGROUPE  == '3') {
							display = display + '  Groupés (PMSI) ou hors PMSI';
						}
						if (SELECT.QFACTURE  == '1') {
							display = display + '  Non Calculés';
						}
                        if (SELECT.QFACTURE  == '1BG') {
							display = display + '  Non Calculés (BG-T2A)';
						}
						if (SELECT.QFACTURE  == '1HBG') {
							display = display + '  Non Calculés (Hors BG-T2A)';
						}
						if (SELECT.QFACTURE  == '2') {
							display = display + '  Calculés';
						}
						if (SELECT.QEXPEDIE  == '1') {
							display = display + '  Non Expédiés';
						}
						if (SELECT.QEXPEDIE  == '2') {
							display = display + '  Expédiés';
						}
						if (SELECT.QSOLDE  == '1') {
							display = display + '  Non Soldés';
						}
						if (SELECT.QSOLDE  == '2') {
							display = display + '  Soldés';
						}
						if (SELECT.QCLOTURE  == '1') {
							display = display + '  Non Cloturés';
						}
						if (SELECT.QCLOTURE  == '2') {
							display = display + '  Cloturés';
						}
						display = display + '#/B#';
					}
					
					if (display != '') {
						display = '#B#Filtres état#/B# = ' + display;
					}
					return display;
					">
		<GROUP label="Quelle date ?">
			<FIELD name="QUELLEDATE" label="" labelWidth="80" UI="combo" default="1" default2="date_fin">
				<OPTION label="Date sortie" data="1" data2="v_factures_reference_1.date_fin_facture"/>
				<OPTION label="Date facture" data="2" data2="v_factures_reference_1.date_facture"/>
				<OPTION label="Date d'expédition" data="3" data2="v_factures_reference_1.date_expedition"/>
				<OPTION label="Date groupage" data="5" data2="v_factures_reference_1.date_groupage"/>
			</FIELD>
		</GROUP>
		<GROUP label="Groupés ?">
			<FIELD name="QGROUPE" label="" labelWidth="80" UI="combo" width="200" default="-1" hidable="= SELECT.QFACTURE == '*'">
				<OPTION label="Pas de sélection" data="-1"/>
				<OPTION label="Non groupés" data="1"/>
				<OPTION label="Groupés (PMSI)" data="2"/>
				<OPTION label="Groupés (PMSI) ou hors PMSI" data="3"/>
			</FIELD>
		</GROUP>
		<GROUP label="Facturés ?">
			<FIELD name="QFACTURE" label="" labelWidth="80" UI="combo" tree="true" width="200" default="-1" hidable="= SELECT.QFACTURE == '*'">
				<OPTION label="Pas de sélection" data="-1" treeLevel="1"/>
				<OPTION label="Non calculés" data="1" treeLevel="1"/>
                <OPTION label="Non calculés (BG-T2A)" data="1BG" treeLevel="2"/>
				<OPTION label="Non calculés (Hors BG-T2A)" data="1HBG" treeLevel="2"/>
				<OPTION label="Calculés" data="2" treeLevel="1"/>
			</FIELD>
		</GROUP>
		<GROUP label="Expédiés ?">
			<FIELD name="QEXPEDIE" label="" labelWidth="80" UI="combo" width="200" default="-1" hidable="= SELECT.QEXPEDIE == '*'">
				<OPTION label="Pas de sélection" treeLevel="1" data="-1"/>
				<OPTION label="Non expédiés" treeLevel="1" data="1"/>
				<OPTION label="Expédiés" treeLevel="2" data="2"/>
			</FIELD>
		</GROUP>
		<GROUP label="Soldés ?">
			<FIELD name="QSOLDE" label="" labelWidth="80" UI="combo" width="200" default="-1" hidable="= SELECT.QSOLDE == '*'">
				<OPTION label="Pas de sélection" treeLevel="1" data="-1"/>
				<OPTION label="Non soldés" treeLevel="1" data="1"/>
				<OPTION label="Soldés" treeLevel="2" data="2"/>
			</FIELD>
		</GROUP>
		<GROUP label="Cloturés ?">
			<FIELD name="QCLOTURE" label="" labelWidth="80" UI="combo" width="200" default="-1" hidable="= SELECT.QSOLDE == '*'">
				<OPTION label="Pas de sélection" treeLevel="1" data="-1"/>
				<OPTION label="Non cloturés" treeLevel="1" data="1"/>
				<OPTION label="Cloturés" treeLevel="2" data="2"/>
			</FIELD>
		</GROUP>
		<GROUP label="Détail par tiers ?">
			<FIELD name="QDETAIL_TIERS" label="" labelWidth="80" UI="combo" width="200" default="-1" hidable="= SELECT.QSOLDE == '*'">
				<OPTION label="Pas de détail par tiers payant" treeLevel="1" data="-1"/>
				<OPTION label="Détail par tiers payant" treeLevel="1" data="1"/>
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_ETATDOSSIERS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_SEJOURS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_PATIENTS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_PASSAGES_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
			<SQL optimizer="V_SEJOURS_X">
				<select><![CDATA[		
					(SELECT 
						v_sejours_1.no_sejour, 
						nom || ' ' || prenom,
                        v_sejours_1.no_patient,
						medecin_sejour_code,
						medecin_sejour_nom_prenom,
						medecin_traitant_code,
						medecin_traitant_nom_prenom,
						v_sejours_1.date_entree,
						
						CASE WHEN v_sejours_1.code_sorti = '1' THEN v_sejours_1.date_sortie ELSE NULL END,
						CASE WHEN v_sejours_1.code_sorti = '0' THEN v_sejours_1.date_sortie ELSE NULL END,
						lieu_sortie_service_code,
						
						CASE WHEN v_sejours_1.date_groupage <> '2099-12-31' THEN to_char(v_sejours_1.date_groupage,'YYYY-MM-DD') ELSE '' END::text, 
						CASE WHEN no_facture_reference NOT LIKE 'E%' THEN no_facture_reference ELSE '' END,
						date_fin_facture,
						
						CASE WHEN  v_sejours_1.code_sorti <> 1 THEN 'PRESENT'
							 WHEN v_factures_reference_1.nb_non_groupe = 1 AND v_factures_reference_1.nb_non_calcules = 1 THEN 'SORTI'
							 WHEN v_factures_reference_1.nb_non_groupe = 0 AND v_factures_reference_1.nb_non_calcules = 1 AND v_factures_reference_1.TYPE_T2A = '1' THEN 'GROUPE'
							 WHEN v_factures_reference_1.nb_non_groupe = 0 AND v_factures_reference_1.nb_non_calcules = 1 THEN 'SORTI'
							 WHEN v_factures_reference_1.nb_non_expedie[VIEW.CLIHON] = 1 AND v_factures_reference_1.nb_non_calcules = 0 THEN 'CALCULE'
							 WHEN v_factures_reference_1.nb_non_expedie[VIEW.CLIHON] = 0 AND v_factures_reference_1.nb_non_solde[VIEW.CLIHON] = 1 THEN 'EXPEDIE'
							 WHEN v_factures_reference_1.nb_non_cloture[VIEW.CLIHON] = 1 AND v_factures_reference_1.nb_non_solde[VIEW.CLIHON] = 0 THEN 'SOLDE'
							 WHEN v_factures_reference_1.nb_non_cloture[VIEW.CLIHON] = 0 THEN 'CLOTURE'
							ELSE '???' END ||
							CASE WHEN t_services_facturation.avec_facturation_intermediaire = '1' AND v_factures_reference_1.date_fin_facture < v_sejours_1.date_sortie THEN '(INTERM)' ELSE '' END,
                        COALESCE(t_motif_non_facturation.texte || CASE WHEN motif_non_facturation_comment <> '' THEN ' - ' || motif_non_facturation_comment ELSE '' END,''),
						 v_sejours_1.etat_sejour_code || ' ' ||  v_sejours_1.etat_sejour_texte,
						nb_rejets,
						v_factures_reference_1.nb_factures,
						
						CASE WHEN tiers_payant_texte = 'Non saisi'  THEN 'Régime général' ELSE tiers_payant_code || ' ' || tiers_payant_texte END,
						CASE WHEN v_factures_reference_1.date_facture <> '2099-12-31' THEN to_char(v_factures_reference_1.date_facture,'YYYY-MM-DD') ELSE '' END::text, 
						CASE WHEN v_factures_reference_1.date_expedition <> '2099-12-31' AND v_factures_reference_1.date_expedition <> '0001-01-01' THEN to_char(v_factures_reference_1.date_expedition,'YYYY-MM-DD') ELSE '' END::text, 
						
						CASE WHEN v_factures_reference_1.date_solde[VIEW.CLIHON] <> '2099-12-31' AND v_factures_reference_1.date_facture <> '2099-12-31' AND v_factures_reference_1.montant_solde[VIEW.CLIHON] = 0 THEN to_char(v_factures_reference_1.date_solde[VIEW.CLIHON],'YYYY-MM-DD') ELSE '' END::text, 
						v_factures_reference_1.montant_facture[VIEW.CLIHON],
						CASE WHEN v_factures_reference_1.nb_non_calcules = 1  THEN v_factures_reference_1.montant_encours[VIEW.CLIHON]   ELSE NULL END,
						
						v_factures_reference_1.montant_encours[VIEW.CLIHON],
						v_factures_reference_1.montant_non_expedie[VIEW.CLIHON],
						v_factures_reference_1.montant_solde[VIEW.CLIHON],
						
						v_factures_reference_1.delai_groupage ,
						v_factures_reference_1.nb_non_groupe ,
						CASE WHEN v_factures_reference_1.nb_non_groupe = 1  THEN ((SELECT valeur_date FROM activite.t_divers where code = 'NOW')::date - v_factures_reference_1.date_sortie)  ELSE NULL END,
						
						v_factures_reference_1.delai_facture,
						v_factures_reference_1.nb_non_calcules,
						CASE WHEN v_factures_reference_1.nb_non_calcules = 1  THEN ((SELECT valeur_date FROM activite.t_divers where code = 'NOW')::date - v_factures_reference_1.date_sortie)  ELSE NULL END,
						
						v_factures_reference_1.nb_non_expedie[VIEW.CLIHON],
						v_factures_reference_1.montant_comptabilise[VIEW.CLIHON] - v_factures_reference_1.montant_non_expedie[VIEW.CLIHON],
						CASE WHEN  v_factures_reference_1.nb_non_expedie[VIEW.CLIHON] <> 1  THEN v_factures_reference_1.nb_factures ELSE NULL END,
						
						v_factures_reference_1.nb_non_solde[VIEW.CLIHON],
						CASE WHEN  v_factures_reference_1.nb_non_solde[VIEW.CLIHON] <> 1  THEN v_factures_reference_1.montant_facture[VIEW.CLIHON] ELSE NULL END,
						CASE WHEN  v_factures_reference_1.nb_non_solde[VIEW.CLIHON] <> 1  THEN v_factures_reference_1.nb_factures ELSE NULL END

					FROM activite.[VIEW.LEVELD_VIEW] v_factures_reference_1
						JOIN #V_SEJOURS_X# ON (v_factures_reference_1.no_sejour = v_sejours_1.no_sejour)
						JOIN activite.p_patients ON v_sejours_1.no_patient = p_patients.no_patient
                        LEFT JOIN activite.t_motif_non_facturation ON t_motif_non_facturation.oid = motif_non_facturation_id AND motif_non_facturation_id <> 0
						LEFT JOIN (SELECT oid, avec_facturation_intermediaire FROM activite.t_services_facturation) t_services_facturation ON lieu_sortie_service_id = t_services_facturation.oid
					WHERE 
						[VIEW.QUELLEDATE_FIELD] BETWEEN '[PERIODE]' AND '[TOPERIODE]' 
						[VIEW.SEJOURS_SELECT]
						[VIEW.ETATDOSSIERS_SELECT] 
						[VIEW.FACTURE_SELECT]
						[VIEW.PATIENTS_SELECT]
						[VIEW.PASSAGES_SELECT] AND
						(
							'[QGROUPE]' <> '1' OR
							'[QGROUPE]' = '1' AND (t_services_facturation.avec_facturation_intermediaire <> '1' OR v_factures_reference_1.date_fin_facture >= v_sejours_1.date_sortie)
						)
					)
					ORDER BY 1,9,10,11
				
				]]></select>
				<FIELDS>
					<FIELD name="SEJ"/>
					<FIELD name="NOM" ifHideNames="Non autorisé"/>
					<FIELD name="NPAT"/>

					<FIELD name="COMED"/>
					<FIELD name="MED"/>
					<FIELD name="COMEDT"/>
					<FIELD name="MEDT"/>
					<FIELD name="DENT"/>
					
					<FIELD name="DSOR"/>
					<FIELD name="DSORP"/>
					<FIELD name="CSER"/>
					
					<FIELD name="DGRP"/>
					<FIELD name="NOFAC"/>
					<FIELD name="DFIN"/>
					
					<FIELD name="ETAT"/>
                    <FIELD name="MOTIF"/>
					<FIELD name="ETAT1"/>
					<FIELD name="NBREJ"/>
					<FIELD name="NBFAC"/>
					
					<FIELD name="TP"/>
					<FIELD name="DFAC"/>
					<FIELD name="DEXP"/>
					
					<FIELD name="DSOL"/>
					<FIELD name="MFAC"/>
					<FIELD name="MCPT"/>
					
					<FIELD name="MENC"/>
					<FIELD name="MNEXP"/>
					<FIELD name="MNSOL"/>
					
					<FIELD name="DLGRP"/>
					<FIELD name="NGRP"/>
					<FIELD name="RGRP"/>
					
					<FIELD name="DLFAC"/>
					<FIELD name="NNFAC"/>
					<FIELD name="RFAC"/>
					
					<FIELD name="NFEXP"/>
					<FIELD name="MEXP"/>
					<FIELD name="NBFACEXP"/>
					
					<FIELD name="NFSOL"/>
					<FIELD name="MSOL"/>
					<FIELD name="NBFACSOL"/>
				</FIELDS>
			</SQL>
			<SQL optimizer="V_SEJOURS_X">
				<select><![CDATA[		
					(SELECT 
						'-9999999',
                        '',
						COUNT(DISTINCT v_sejours_1.no_sejour)::text || ' séjours, ' || COUNT(DISTINCT no_facture_reference)::text || ' factures référence',
                        COUNT(DISTINCT CASE WHEN v_sejours_1.code_sorti = '1' AND v_sejours_1.date_sortie BETWEEN '[PERIODE]' AND '[TOPERIODE]' THEN v_sejours_1.no_sejour ELSE NULL END)::text || ' sortis',
                        null,
						
						null,
						'',
						trunc(AVG(v_factures_reference_1.delai_groupage),1),
						trunc(AVG(v_factures_reference_1.delai_groupage),1)|| 'j',
						
						AVG(CASE WHEN v_factures_reference_1.nb_non_groupe = 1  THEN ((SELECT valeur_date FROM activite.t_divers where code = 'NOW')::date - v_factures_reference_1.date_sortie)  ELSE NULL END),
						AVG(v_factures_reference_1.delai_facture),
						SUM(v_factures_reference_1.nb_non_calcules),
						AVG(CASE WHEN v_factures_reference_1.nb_non_calcules = 1  THEN ((SELECT valeur_date FROM activite.t_divers where code = 'NOW')::date - v_factures_reference_1.date_sortie)  ELSE NULL END),
						
						SUM(CASE WHEN  v_factures_reference_1.nb_non_expedie[VIEW.CLIHON] <> 1  THEN v_factures_reference_1.nb_factures ELSE NULL END),
						SUM(v_factures_reference_1.montant_comptabilise[VIEW.CLIHON] - v_factures_reference_1.montant_non_expedie[VIEW.CLIHON]),
						SUM(v_factures_reference_1.nb_non_expedie[VIEW.CLIHON]),
						SUM(v_factures_reference_1.montant_non_expedie[VIEW.CLIHON]),
						
						SUM(CASE WHEN  v_factures_reference_1.nb_non_solde[VIEW.CLIHON] <> 1  THEN v_factures_reference_1.nb_factures ELSE NULL END	),
						SUM(CASE WHEN  v_factures_reference_1.nb_non_solde[VIEW.CLIHON] <> 1  THEN v_factures_reference_1.montant_facture[VIEW.CLIHON] ELSE 0 END ),
						SUM(v_factures_reference_1.nb_non_solde[VIEW.CLIHON]),
						SUM(CASE WHEN v_factures_reference_1.nb_non_solde[VIEW.CLIHON] <> 0 then v_factures_reference_1.montant_solde_0[VIEW.CLIHON] +  v_factures_reference_1.montant_solde_1[VIEW.CLIHON] + v_factures_reference_1.montant_solde_2[VIEW.CLIHON] ELSE 0 END),
						
						'',
						null,
						'',
						SUM(v_factures_reference_1.nb_rejets),
						
						SUM(v_factures_reference_1.nb_factures),
						'', 
						null, 
						null,  
						
						null,
						SUM(v_factures_reference_1.montant_facture[VIEW.CLIHON]),
						SUM(CASE WHEN v_factures_reference_1.nb_non_calcules = 1  THEN v_factures_reference_1.montant_encours[VIEW.CLIHON]   ELSE NULL END),
						SUM(v_factures_reference_1.montant_encours[VIEW.CLIHON])
					FROM activite.[VIEW.LEVELD_VIEW] v_factures_reference_1
						JOIN #V_SEJOURS_X# ON (v_factures_reference_1.no_sejour = v_sejours_1.no_sejour)
					WHERE 
						[VIEW.QUELLEDATE_FIELD] BETWEEN '[PERIODE]' AND '[TOPERIODE]' 
						[VIEW.SEJOURS_SELECT]
						[VIEW.ETATDOSSIERS_SELECT] 
						[VIEW.FACTURE_SELECT]
						[VIEW.PATIENTS_SELECT]
						[VIEW.PASSAGES_SELECT]
					)
					ORDER BY 1,9,10,11
				
				]]></select>
				<FIELDS>
					<FIELD name="SEJ"/>
					<FIELD name="NPAT"/>
					<FIELD name="NOM" />
					<FIELD name="MED"/>
					<FIELD name="DENT"/>
					
					<FIELD name="DSOR"/>
					<FIELD name="CSER"/>
					<FIELD name="DLGRP"/>
					<FIELD name="NGRP"/>
					
					<FIELD name="RGRP"/>
					<FIELD name="DLFAC"/>
					<FIELD name="NNFAC"/>
					<FIELD name="RFAC"/>
					
					<FIELD name="NBFACEXP"/>
					<FIELD name="MEXP"/>
					<FIELD name="NFEXP"/>
					<FIELD name="MNEXP"/>
					
					<FIELD name="NBFACSOL"/>
					<FIELD name="MSOL"/>
					<FIELD name="NFSOL"/>
					<FIELD name="MNSOL"/>
					
					<FIELD name="NOFAC"/>
					<FIELD name="DFIN"/>
					<FIELD name="ETAT"/>
					<FIELD name="NBREJ"/>
					
					<FIELD name="NBFAC"/>
					<FIELD name="TP"/>
					<FIELD name="DFAC"/>
					<FIELD name="DEXP"/>
					
					<FIELD name="DSOL"/>
					<FIELD name="MFAC"/>
					<FIELD name="MENC"/>
					<FIELD name="MCPT"/>
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forRows="false">
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Détail séjour" shortLabel="Détail séjour" view="ACTI000020.XML">
				<ARG name="SEJOUR" value="ROW.SEJ"/>
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Liste des séjour" label="Liste des séjour">
			<DATAGRID title="" total="true" headerHeight="36" totalRowInRows="= ROW.SEJ == '-9999999'">
				<COLUMN dataField="SEJ" frozen="left" width="100" type="Char" headerText="No Séjour" textAlign="left" otherFunction="text" totalFunction="text" totalComplement="Total">
				</COLUMN>
				<COLUMN dataField="NOM" frozen="left" type="Char" minWidth="80" visible="true" headerText="Nom" textAlign="left" totalFunction="text">
				</COLUMN>				
                <COLUMN dataField="NPAT" type="Char" minWidth="80" visible="true" headerText="N° Patient" textAlign="right" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="COMEDT" type="Char" minWidth="80" visible="true" headerText="Médecin traitant (code)" textAlign="left" totalFunction="text">
				</COLUMN>				
                <COLUMN dataField="MEDT" type="Char" minWidth="80" visible="true" headerText="Médecin traitant" textAlign="left" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="COMED" type="Char" minWidth="80" visible="true" headerText="Médecin séjour (code)" textAlign="left" totalFunction="text">
				</COLUMN>				
				<COLUMN dataField="MED" type="Char" minWidth="80" visible="true" headerText="Médecin séjour" textAlign="left" totalFunction="text">
				</COLUMN>				
				<COLUMN dataField="CSER" type="Char" minWidth="50" visible="true" headerText="Service" textAlign="left" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="DENT" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" fixed="false" headerText="Date entrée" textAlign="right" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DSOR" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" fixed="false" headerText="Date sortie" textAlign="right" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DSORP" width="65" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" fixed="false" headerText="Date sortie prév" textAlign="left" totalFunction="text" description="Date sortie prévisionnel">
				</COLUMN>
				<COLUMN dataField="ETAT1" type="Char" minWidth="90" visible="true" headerText="Etat" textAlign="left" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="DGRP" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" fixed="false" headerText="Date group." textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="DLGRP" width="60" type="Char" inputFormat="#,0" outputFormat="#,0" fixed="false" headerText="Délai Group." textAlign="right" totalFunction="sum" description="Délai de groupage " >
				</COLUMN>
				<COLUMN dataField="NGRP" width="60" type="Char" inputFormat="#" outputFormat="#" fixed="false" headerText="Nb reste à group." textAlign="right" totalFunction="sum" description="Nombre reste à grouper" >
				</COLUMN>

				<COLUMN dataField="RGRP" width="60" type="Number" inputFormat="#" outputFormat="#,0j" fixed="false" headerText="Retard group." textAlign="right" totalFunction="sum" description="Retard de groupage: Nombre de séjours non groupés/Nombre de séjours groupés par jour: Calcul par service " >
				</COLUMN>
				<COLUMN dataField="NOFAC" type="Char" width="110" visibleCondition="SELECT.QGROUPE != '1'" headerText="Facture" textAlign="left" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DFIN" width="60" type="Date" visibleCondition="SELECT.QGROUPE != '1' " inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" fixed="false" headerText="Fin facture" textAlign="right" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="ETAT" type="Char" minWidth="50" visible="true" headerText="Niveau de fact" textAlign="left" totalFunction="text" totalComplement="">
				</COLUMN>
                <COLUMN dataField="MOTIF" type="Char" minWidth="50" visible="true" headerText="Motif" textAlign="left" totalFunction="text" totalComplement="">
				</COLUMN>
				<COLUMN dataField="NBREJ" type="Number" width="60" outputFormat="#" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" headerText="Nb Rejets"  totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="NBFAC" type="Number" width="60" outputFormat="#" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'"  headerTextCalc="true" headerText=" if(SELECT.QDETAIL_TIERS == '1') {return 'Nb Fact par tiers';} else { return 'Nb Factures';}"  totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="TP" type="Char" minWidth="80" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" 
					headerTextCalc="true" 
					headerText="if (SELECT.QDETAIL_TIERS != '1') {return 'Tiers payant'} else {return 'AMO'}" 
					textAlign="left" totalFunction="text">
				</COLUMN>
				<COLUMN dataField="DFAC" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Date fact." textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="DLFAC" width="60" type="Number" inputFormat="#" outputFormat="#,0j" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Délai fact." textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="NNFAC" width="60" type="Char" inputFormat="#" outputFormat="#" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Nb reste a fact." textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="RFAC" width="60" type="Number" inputFormat="#" outputFormat="#,0j" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Retard fact." textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="MFAC" width="90" type="Number" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" outputFormat="#E" fixed="false" headerText="Montant facturé" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="MCPT" width="90" type="Number" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '2'" outputFormat="#E" fixed="false" headerText="Montant valorisé (NF)" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="DEXP" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Date exp." textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="NBFACEXP" width="60" type="Char" inputFormat="#" outputFormat="#" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerTextCalc="true" headerText=" if(SELECT.QDETAIL_TIERS == '1') {return 'Tiers expédiées';} else { return 'Nb Fact expé.';}" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="MEXP" width="90" type="Number" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '2'" outputFormat="#E" fixed="false" headerText="Montant expédié" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="NFEXP" width="60" type="Char" inputFormat="#" outputFormat="#" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Nb reste a exp." description="(Nombre de séjours ou de factures dans le cas de la facturation intermédiaire) non expédiés" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="MNEXP" width="90" type="Number" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" outputFormat="#E" fixed="false" headerText="Mt reste à expédier" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="DSOL" width="60" type="Date" inputFormat="AAAA-MM-JJ" outputFormat="DD/MM/YY" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Date solde" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="NBFACSOL" width="60" type="Char" inputFormat="#" outputFormat="#" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerTextCalc="true" headerText=" if(SELECT.QDETAIL_TIERS == '1') {return 'Tiers soldés';} else { return 'Nb Fact soldées.';}" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="MSOL" width="90" type="Number" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '2'" outputFormat="#E" fixed="false" headerText="Montant soldé" textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="NFSOL" width="60" type="Char" inputFormat="#" outputFormat="#" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" fixed="false" headerText="Nb reste a sol." textAlign="right" totalFunction="sum">
				</COLUMN>
				<COLUMN dataField="MNSOL" width="90" type="Number" visibleCondition="SELECT.QGROUPE != '1' &amp;&amp; SELECT.QFACTURE != '1'" outputFormat="#E" fixed="false" headerText="Reste à solder" textAlign="right" totalFunction="sum">
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
