<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="PMSI000380" label="PMSI. Impact codage CMA" title="= 'Impact codage CMA par ' + SELECT.GROUPBY_LABEL + ' (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'" database="iCTI" swf="*CTI_view1" softCode="iCTI_pmsi" globals="PMSI_globals.XML" componentsFile="PMSI_components.XML" helpDokuWIkiDir="pmsi:qualite:etudes" helpDokuWIkiFile="pmsi000380"  helpFile="iCTI_PMSI_PMSI000380.HTML">
    <VIEWPROPERTIES componentName="PROPERTIES_RSS" />
    <VIEWPROPERTIES componentName="PROPERTIES_SELECT_TABTREE" />
    <SELECTIONS label="Paramètres de l'analyse" displayText="= var display:String = '';
					display += 'Traitement coefficient : #B#' + SELECT.OPTION_COEF_LABEL + '#/B#';
					
					return display;
					">
        <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="" UI="combo" tree="true" width="200" default="2016-01-01" globalListProvider="DATE_DEBUT" />
            <FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2016-12-31" globalListProvider="DATE_FIN" />
        </GROUP>
        <GROUP label="Regroupements">
            <FIELD name="GROUPBY" width="220" label="" UI="combo" default="4" tree="true">
                <OPTION label="Options" data="" globalListProvider="RSS_GROUPBY_OPTIONS" />
            </FIELD>
            <FIELD name="GROUPBY_TAB" width="100" label="Présentation" UI="combo" default="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" width="220" label="" UI="combo" default="-1" tree="true">
                <OPTION label="Pas de second niveau" data="-1" treeLevel="1" />
                <OPTION label="Options" data="" globalListProvider="RSS_GROUPBY_OPTIONS" />
            </FIELD>
            <FIELD name="ACTIVITE_SIGNIFICATIVE_BASE" label="" UI="text" visible="false" default="-1" />
        </GROUP>        
        <GROUP label="">
            <FIELD name="GROUPBY_3" width="220" label="" UI="combo" default="-1" tree="true">
                <OPTION label="Pas de troisième niveau" data="-1" treeLevel="1" />
                <OPTION label="Options" data="" globalListProvider="RSS_GROUPBY_OPTIONS" />
            </FIELD>
            <FIELD name="ACTIVITE_SIGNIFICATIVE_BASE" label="" UI="text" visible="false" default="-1" />
        </GROUP>
		<GROUP label="">
            <FIELD name="OPTION_COEF" width="220" label="Coefficient" UI="combo" default="-1" tree="true">
                <OPTION label="Inclure le coefficient mco" data="-1" treeLevel="1" />
                <OPTION label="Ne pas inclure le coefficient mco" data="HC" treeLevel="1" />
            </FIELD>
        </GROUP>
    </SELECTIONS>
    <SELECTIONS componentName="FILTRES_RSS_SELECTIONS" />
    <QUERIES>
        <QUERY label="">
        
            <SQL optimizer="V_RSS_X" cacheEnabled="false">
                <select><![CDATA[ 
                
                
                -- La table p_etude_impact_cma est alimentée par la fonction pmsi.cti_etude_impact_cma()
				
				CTISELECT_TREE
					GROUPBY1{[VIEW.SELECT_TABTREE_OID_FIELD],, [VIEW.SELECT_TABTREE_COD_FIELD],, [VIEW.SELECT_TABTREE_TXT_FIELD]}
					GROUPBY1MODE{[GROUPBY_TAB]}
					GROUPBY2{[VIEW.SELECT_TABTREE_2_OID_FIELD],, [VIEW.SELECT_TABTREE_2_COD_FIELD],, [VIEW.SELECT_TABTREE_2_TXT_FIELD]}
					GROUPBY3{[VIEW.SELECT_TABTREE_3_OID_FIELD],, [VIEW.SELECT_TABTREE_3_COD_FIELD],, [VIEW.SELECT_TABTREE_3_TXT_FIELD]}
					SIGNIFDATA{[VIEW.SELECT_TABTREE_ACTIVITE_SIGNIFICATIVE_DATA],, [ACTIVITE_SIGNIFICATIVE_MODE],, [ACTIVITE_SIGNIFICATIVE_NUMBER]}
					INDICATORS{
				
						count(DISTINCT v_rss_1.no_rss),
						SUM(round(p_etude_impact_cma.ca_ghs_theorique * CASE WHEN '[OPTION_COEF]' = '-1' THEN coefficient_mco ELSE 1 END,2)),
						SUM(round(p_etude_impact_cma.ca_exh * CASE WHEN '[OPTION_COEF]' = '-1' THEN coefficient_mco ELSE 1 END,2)),
						SUM(round(p_etude_impact_cma.ca_perte_exb * CASE WHEN '[OPTION_COEF]' = '-1' THEN coefficient_mco ELSE 1 END,2)),
						SUM(round(p_etude_impact_cma.ca_ghs_dossier * CASE WHEN '[OPTION_COEF]' = '-1' THEN coefficient_mco ELSE 1 END,2)),
						SUM(round(p_etude_impact_cma.tarif_ghs_calc * CASE WHEN '[OPTION_COEF]' = '-1' THEN coefficient_mco ELSE 1 END,2)),
						SUM(round(p_etude_impact_cma.impact_cma * CASE WHEN '[OPTION_COEF]' = '-1' THEN coefficient_mco ELSE 1 END,2)),
					}
					ORDERBY{indicateurs[1],, DESC}
                FROM 
                    #V_RSS_X#
                    JOIN pmsi.p_etude_impact_cma ON v_rss_1.rss_id = p_etude_impact_cma.rss_id
                WHERE 1=1
                    AND mois_sortie IN ([VIEW.PERIODE_MOIS_LIST]) 
                    AND v_rss_1.date_sortie BETWEEN '[PERIODE]'::date AND '[TOPERIODE]'::date
                    [VIEW.FILTRE_RSS_SELECT]
                    
            ]]></select>
            <FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="SORT" />
                    <FIELD name="NB_RSS" />
                    <FIELD name="CA_GHST" />
                    <FIELD name="CA_EXH" />
                    <FIELD name="CA_EXBP" />
                    <FIELD name="CA_GHS" />
                    <FIELD name="CA_GHS_CALC" />
					<FIELD name="ECART_GHS" />
                </FIELDS>
            </SQL>
        </QUERY>
    </QUERIES>
    <PRESENTATION>
        <VIEWLINKS>
            <VIEWLINK label="Justificatif par RSS" shortLabel="Liste RSS" view="PMSI000381.XML" componentName="RSS_BASE_VIEWLINK" />
        </VIEWLINKS>
        <ONGLET excelLabel="Impact codage CMA" label="Impact codage CMA" multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
            <DATAGRID title="" total="true" showOthers="false" headerHeight="54" variableRowHeight="true" totalRowInRows="= ROW.OID == '-9999999'"
                sortable="= SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_3 == '-1' || SELECT.GROUPBY_TAB == 'TAB'">
				<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="NB_RSS" width="60" type="Number" outputFormat="#" headerText="Nb RSS" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Nombre de RSS comptabilisés dans le niveau de regroupement" />
                <COLUMN dataField="CA_GHST" width="105" type="Number" outputFormat="#,00E" headerText="CA GHS&#xD;théorique" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Chiffre d'affaires brut du GHS dossier" />
                <COLUMN dataField="CA_EXH" width="105" type="Number" outputFormat="#,00E" headerText="CA EXH" textAlign="right" totalFunction="sum" otherFunction="sum" 
                    description="Chiffre d'affaires EXH lié au GHS dossier" />
                <COLUMN dataField="CA_EXBP" width="105" type="Number" outputFormat="#,00E" headerText="Perte EXB" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="Chiffre d'affaires des pertes EXB (forfaits ou tarifs journaliers)" />
                <COLUMN dataField="CA_GHS" width="105" type="Number" outputFormat="#,00E" headerText="CA GHS&#xD;dossier" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="CA GHS théorique + CA EXH - CA pertes EXB" />
                <COLUMN dataField="CA_GHS_CALC" width="105" type="Number" outputFormat="#,00E" headerText="CA GHS&#xD;calculé sans impact CMA" textAlign="right" totalFunction="sum" otherFunction="sum"
                    description="CA GHS théorique + CA EXH - CA perte EXB en considérant non pas le GHS du dossier mais le GHS attribué par la méthodogie" />
                <COLUMN dataField="ECART_GHS" type="Number" headerText="Ecart =&#xD;Impact CMA" width="105" outputFormat="#,00E" textAlign="right" totalFunction="sum" totalComplement=""
					description="Ecart entre le GHS calculé et le GHS du dossier">
				</COLUMN>
                </DATAGRID>
        </ONGLET>
    </PRESENTATION>
</VUE>
