|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
<VUE name="ACTI000098"
|
|
|
label="Tableau HSTV"
|
|
|
database="iCTI"
|
|
|
swf="*CTI_view1"
|
|
|
softCode="iCTI_activite"
|
|
|
globals="ACTI_globals.XML"
|
|
|
admProvider="csis">
|
|
|
|
|
|
<title><![CDATA[=
|
|
|
var title:String = 'Tableau HSTV';
|
|
|
|
|
|
title = title + ' (' + VIEW.PERIODE_H + ' - ' + VIEW.TOPERIODE_H + ')'
|
|
|
|
|
|
return title;
|
|
|
]]></title>
|
|
|
<VIEWPROPERTIES>
|
|
|
|
|
|
<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
|
|
|
|
|
|
<PROPERTY name="GROUPBY_OID_FIELD" >
|
|
|
<value><![CDATA[
|
|
|
[EVAL
|
|
|
if ('[GROUPBY]' == 'UF') {return "temp_acti000098.parent_id";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS01') {return "parent_section_id[1]";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS02') {return "parent_section_id[2]";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS03') {return "parent_section_id[3]";}
|
|
|
return 'parent_id';
|
|
|
EVAL]
|
|
|
]]></value>
|
|
|
</PROPERTY>
|
|
|
<PROPERTY name="GROUPBY_COD_FIELD" >
|
|
|
<value><![CDATA[
|
|
|
[EVAL
|
|
|
if ('[GROUPBY]' == 'UF') {return "parent_code";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS01') {return "parent_section_code[1]";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS02') {return "parent_section_code[2]";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS03') {return "parent_section_code[3]";}
|
|
|
return 'parent_code';
|
|
|
EVAL]
|
|
|
]]></value>
|
|
|
</PROPERTY>
|
|
|
<PROPERTY name="GROUPBY_TXT_FIELD" >
|
|
|
<value><![CDATA[
|
|
|
[EVAL
|
|
|
if ('[GROUPBY]' == 'UF') {return "parent_texte";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS01') {return "parent_section_texte[1]";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS02') {return "parent_section_texte[2]";}
|
|
|
if ('[GROUPBY]' == 'UFTCLS03') {return "parent_section_texte[3]";}
|
|
|
return 'parent_code';
|
|
|
EVAL]
|
|
|
]]></value>
|
|
|
</PROPERTY>
|
|
|
|
|
|
<PROPERTY name="GROUPBY2_OID_FIELD" >
|
|
|
<value><![CDATA[
|
|
|
[EVAL
|
|
|
if ('[GROUPBY_2]' == 'UF') {return "temp_acti000098.parent_id";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS01') {return "parent_section_id[1]";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS02') {return "parent_section_id[2]";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS03') {return "parent_section_id[3]";}
|
|
|
return '';
|
|
|
EVAL]
|
|
|
]]></value>
|
|
|
</PROPERTY>
|
|
|
<PROPERTY name="GROUPBY2_COD_FIELD" >
|
|
|
<value><![CDATA[
|
|
|
[EVAL
|
|
|
if ('[GROUPBY_2]' == 'UF') {return "parent_code";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS01') {return "parent_section_code[1]";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS02') {return "parent_section_code[2]";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS03') {return "parent_section_code[3]";}
|
|
|
return '';
|
|
|
EVAL]
|
|
|
]]></value>
|
|
|
</PROPERTY>
|
|
|
<PROPERTY name="GROUPBY2_TXT_FIELD" >
|
|
|
<value><![CDATA[
|
|
|
[EVAL
|
|
|
if ('[GROUPBY_2]' == 'UF') {return "parent_texte";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS01') {return "parent_section_texte[1]";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS02') {return "parent_section_texte[2]";}
|
|
|
if ('[GROUPBY_2]' == 'UFTCLS03') {return "parent_section_texte[3]";}
|
|
|
return '';
|
|
|
EVAL]
|
|
|
]]></value>
|
|
|
</PROPERTY>
|
|
|
|
|
|
|
|
|
</VIEWPROPERTIES>
|
|
|
|
|
|
<SELECTIONS label="Paramètres">
|
|
|
|
|
|
<GROUP label="Budget">
|
|
|
<FIELD name="BUDGET" label="" UI="combo" width="200" default="-1" >
|
|
|
<OPTION label="Choix obligatoire" data="-1"/>
|
|
|
<OPTION dataLink="BUDGET" dataField="cod" labelField="txt" />
|
|
|
</FIELD>
|
|
|
</GROUP>
|
|
|
|
|
|
<GROUP label="Période">
|
|
|
<FIELD name="TOMOIS" label="" UI="combo" width="200" default="12" >
|
|
|
<OPTION label="Année complète" data="12"/>
|
|
|
<OPTION label="janvier" data="01"/>
|
|
|
<OPTION label="février" data="02"/>
|
|
|
<OPTION label="mars" data="03"/>
|
|
|
<OPTION label="avril" data="04"/>
|
|
|
<OPTION label="mai" data="05"/>
|
|
|
<OPTION label="juin" data="06"/>
|
|
|
<OPTION label="juillet" data="07"/>
|
|
|
<OPTION label="aout" data="08"/>
|
|
|
<OPTION label="septembre" data="09"/>
|
|
|
<OPTION label="octobre" data="10"/>
|
|
|
<OPTION label="novembre" data="11"/>
|
|
|
<OPTION label="décembre" data="12"/>
|
|
|
</FIELD>
|
|
|
</GROUP>
|
|
|
|
|
|
<GROUP label="Regroupement">
|
|
|
<FIELD name="GROUPBY" label="" UI="combo" width="200" default="UF" tree="true">
|
|
|
<OPTION label="Unité fonctionnelle" data="UF" globalListProvider="UF_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="200" default="-1" tree="true">
|
|
|
<OPTION label="" data="-1" treeLevel="1"/>
|
|
|
<OPTION label="Unité fonctionnelle" data="UF" globalListProvider="UF_GROUPBY"/>
|
|
|
</FIELD>
|
|
|
</GROUP>
|
|
|
|
|
|
|
|
|
|
|
|
</SELECTIONS>
|
|
|
|
|
|
<QUERIES>
|
|
|
|
|
|
<QUERY>
|
|
|
<SQL optimizer="V_SEJOURS_X" optimizer2="V_MOUVEMENTS_SEJOUR_X">
|
|
|
<select><![CDATA[
|
|
|
|
|
|
DROP TABLE IF EXISTS temp_ACTI000098_0;
|
|
|
CREATE TEMP TABLE temp_ACTI000098_0 AS
|
|
|
SELECT
|
|
|
CASE WHEN t_budgets.dimension1 = 'UF' THEN t_unites_fonctionnelles.oid WHEN t_budgets.dimension1 = 'SER' THEN t_services_facturation.oid ELSE 0 END AS parent_id ,
|
|
|
CASE WHEN t_budgets.dimension1 = 'UF' THEN t_unites_fonctionnelles.code WHEN t_budgets.dimension1 = 'SER' THEN t_services_facturation.code ELSE '' END AS parent_code ,
|
|
|
CASE WHEN t_budgets.dimension1 = 'UF' THEN t_unites_fonctionnelles.texte WHEN t_budgets.dimension1 = 'SER' THEN t_services_facturation.texte ELSE '' END AS parent_texte,
|
|
|
CASE WHEN t_budgets.dimension1 = 'UF' THEN
|
|
|
t_unites_fonctionnelles.section_id
|
|
|
WHEN t_budgets.dimension1 = 'SER' THEN
|
|
|
t_services_facturation.section_id
|
|
|
ELSE NULL END
|
|
|
AS parent_section_id,
|
|
|
CASE WHEN t_budgets.dimension1 = 'UF' THEN
|
|
|
t_unites_fonctionnelles.section_code
|
|
|
WHEN t_budgets.dimension1 = 'SER' THEN
|
|
|
t_services_facturation.section_code
|
|
|
ELSE NULL END
|
|
|
AS parent_section_code,
|
|
|
CASE WHEN t_budgets.dimension1 = 'UF' THEN
|
|
|
t_unites_fonctionnelles.section_texte
|
|
|
WHEN t_budgets.dimension1 = 'SER' THEN
|
|
|
t_services_facturation.section_texte
|
|
|
ELSE NULL END
|
|
|
AS parent_section_texte,
|
|
|
|
|
|
COALESCE(CASE WHEN t_budgets.dimension1 = 'UF' THEN t_unites_fonctionnelles.finess_id WHEN t_budgets.dimension1 = 'SER' THEN t_services_facturation.finess_id ELSE NULL END,0) AS finess_id,
|
|
|
COALESCE(t_finess_c.code,'') AS finess_code,
|
|
|
COALESCE(t_finess_c.texte,'') AS finess_texte,
|
|
|
t_finess_c.section_id
|
|
|
t_finess_c.section_code
|
|
|
t_finess_c.section_texte
|
|
|
FROM activite.t_budgets
|
|
|
LEFT JOIN activite.t_unites_fonctionnelles ON t_budgets.oid = [BUDGET] AND t_budgets.dimension1 = 'UF'
|
|
|
LEFT JOIN activite.t_services_facturation ON t_budgets.oid = [BUDGET] AND t_budgets.dimension1 = 'SER'
|
|
|
LEFT JOIN activite.t_finess_c ON t_finess_c.oid = COALESCE(t_unites_fonctionnelles.finess_id, t_services_facturation.finess_id);
|
|
|
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS temp_ACTI000098;
|
|
|
CREATE TEMP TABLE temp_ACTI000098 AS
|
|
|
SELECT
|
|
|
CASE
|
|
|
WHEN dimension1 = 'UF' THEN lieu_unite_fonctionnelle_id
|
|
|
WHEN dimension1 = 'SER' THEN lieu_service_id
|
|
|
WHEN dimension1 = 'ETA' THEN lieu_etage_id
|
|
|
ELSE 0
|
|
|
END AS parent_id,
|
|
|
|
|
|
date_trunc('month', date) + interval '13 month' - interval '1 day' AS date,
|
|
|
|
|
|
0::numeric AS pre_nb_places,
|
|
|
NULL::date[] AS pre_nb_jours_places ,
|
|
|
SUM(nb_entrees_directes) AS pre_nb_entrees_directes,
|
|
|
SUM(nb_sorties_directes) AS pre_nb_sorties_directes,
|
|
|
SUM(nb_ambulatoires) AS pre_nb_ambulatoires,
|
|
|
SUM(nb_externes) AS pre_nb_externes,
|
|
|
SUM(nb_jours_js_non_inclus) AS pre_nb_jours_js_non_inclus,
|
|
|
SUM(nb_seances) AS pre_nb_seances,
|
|
|
0::numeric AS cur_nb_places,
|
|
|
NULL::date[] AS cur_nb_jours_places ,
|
|
|
0::numeric AS cur_nb_entrees_directes,
|
|
|
0::numeric AS cur_nb_sorties_directes,
|
|
|
0::numeric AS cur_nb_ambulatoires,
|
|
|
0::numeric AS cur_nb_externes,
|
|
|
0::numeric AS cur_nb_jours_js_non_inclus,
|
|
|
0::numeric AS cur_nb_seances,
|
|
|
0::numeric AS bud_nb_entrees_directes,
|
|
|
0::numeric AS bud_nb_sorties_directes,
|
|
|
0::numeric AS bud_nb_ambulatoires,
|
|
|
0::numeric AS bud_nb_externes,
|
|
|
0::numeric AS bud_nb_jours_js_non_inclus,
|
|
|
0::numeric AS bud_nb_seances
|
|
|
FROM activite.t_budgets
|
|
|
JOIN #V_MOUVEMENTS_SEJOUR_X# ON v_mouvements_sejour_2.date BETWEEN t_budgets.date_debut - interval '1 year' AND '[VIEW.TOPERIODE]'::date - interval '1 year'
|
|
|
JOIN #V_SEJOURS_X# ON v_mouvements_sejour_2.no_sejour = v_sejours_1.no_sejour
|
|
|
WHERE t_budgets.oid = [BUDGET] AND est_mouvement_previsionnel <> '1'
|
|
|
GROUP BY 1,2;
|
|
|
|
|
|
|
|
|
INSERT INTO temp_ACTI000098
|
|
|
SELECT
|
|
|
CASE
|
|
|
WHEN dimension1 = 'UF' THEN lieu_unite_fonctionnelle_id
|
|
|
WHEN dimension1 = 'SER' THEN lieu_service_id
|
|
|
WHEN dimension1 = 'ETA' THEN lieu_etage_id
|
|
|
ELSE 0
|
|
|
END AS parent_id,
|
|
|
date_trunc('month', date) + interval '1 month' - interval '1 day' AS date,
|
|
|
0::numeric AS pre_nb_places,
|
|
|
NULL::date[] AS pre_nb_jours_places ,
|
|
|
0::numeric AS pre_nb_entrees_directes,
|
|
|
0::numeric AS pre_nb_sorties_directes,
|
|
|
0::numeric AS pre_nb_ambulatoires,
|
|
|
0::numeric AS pre_nb_externes,
|
|
|
0::numeric AS pre_nb_jours_js_non_inclus,
|
|
|
0::numeric AS pre_nb_seances,
|
|
|
0::numeric AS cur_nb_places,
|
|
|
NULL::date[] AS cur_nb_jours_places ,
|
|
|
SUM(nb_entrees_directes) AS cur_nb_entrees_directes,
|
|
|
SUM(nb_sorties_directes) AS cur_nb_sorties_directes,
|
|
|
SUM(nb_ambulatoires) AS cur_nb_ambulatoires,
|
|
|
SUM(nb_externes) AS cur_nb_externes,
|
|
|
SUM(nb_jours_js_non_inclus) AS cur_nb_jours_js_non_inclus,
|
|
|
SUM(nb_seances) AS cur_nb_seances,
|
|
|
0::numeric AS bud_nb_entrees_directes,
|
|
|
0::numeric AS bud_nb_sorties_directes,
|
|
|
0::numeric AS bud_nb_ambulatoires,
|
|
|
0::numeric AS bud_nb_externes,
|
|
|
0::numeric AS bud_nb_jours_js_non_inclus,
|
|
|
0::numeric AS bud_nb_seances
|
|
|
FROM activite.t_budgets
|
|
|
JOIN #V_MOUVEMENTS_SEJOUR_X# ON v_mouvements_sejour_2.date BETWEEN date_debut AND '[VIEW.TOPERIODE]'
|
|
|
JOIN #V_SEJOURS_X# ON v_mouvements_sejour_2.no_sejour = v_sejours_1.no_sejour
|
|
|
WHERE t_budgets.oid = [BUDGET] AND est_mouvement_previsionnel <> '1'
|
|
|
GROUP BY 1,2;
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO temp_ACTI000098
|
|
|
SELECT
|
|
|
parent_id,
|
|
|
date,
|
|
|
0::numeric AS pre_nb_places,
|
|
|
NULL::date[] AS pre_nb_jours_places ,
|
|
|
0::numeric AS pre_nb_entrees_directes,
|
|
|
0::numeric AS pre_nb_sorties_directes,
|
|
|
0::numeric AS pre_nb_ambulatoires,
|
|
|
0::numeric AS pre_nb_externes,
|
|
|
0::numeric AS pre_nb_jours_js_non_inclus,
|
|
|
0::numeric AS pre_nb_seances,
|
|
|
0::numeric AS cur_nb_places,
|
|
|
NULL::date[] AS cur_nb_jours_places ,
|
|
|
0::numeric AS cur_nb_entrees_directes,
|
|
|
0::numeric AS cur_nb_sorties_directes,
|
|
|
0::numeric AS cur_nb_ambulatoires,
|
|
|
0::numeric AS cur_nb_externes,
|
|
|
0::numeric AS cur_nb_jours_js_non_inclus,
|
|
|
0::numeric AS cur_nb_seances,
|
|
|
SUM(nb_entrees_directes) AS bud_nb_entrees_directes,
|
|
|
SUM(nb_sorties_directes) AS bud_nb_sorties_directes,
|
|
|
SUM(nb_ambulatoires) AS bud_nb_ambulatoires,
|
|
|
SUM(nb_externes) AS bud_nb_externes,
|
|
|
SUM(nb_jours_js_non_inclus) AS bud_nb_jours_js_non_inclus,
|
|
|
SUM(nb_seances) AS bud_nb_seances
|
|
|
FROM activite.v_budgets_saisis_2
|
|
|
WHERE oid = [BUDGET] AND date <= '[VIEW.TOPERIODE]'
|
|
|
GROUP BY 1,2;
|
|
|
|
|
|
|
|
|
|
|
|
INSERT INTO temp_ACTI000098
|
|
|
SELECT
|
|
|
CASE
|
|
|
WHEN dimension1 = 'UF' THEN uf_id
|
|
|
WHEN dimension1 = 'SER' THEN service_id
|
|
|
WHEN dimension1 = 'ETA' THEN etage_id
|
|
|
ELSE 0
|
|
|
END AS parent_id,
|
|
|
date_trunc('month', date) + interval '13 month' - interval '1 day' AS date,
|
|
|
SUM(nb_lits_ouverts) AS pre_nb_places,
|
|
|
base.cti_group_array3(DISTINCT CASE WHEN nb_lits_ouverts <> 0 THEN date ELSE NULL END) AS pre_nb_jours_places,
|
|
|
0::numeric AS pre_nb_entrees_directes,
|
|
|
0::numeric AS pre_nb_sorties_directes,
|
|
|
0::numeric AS pre_nb_ambulatoires,
|
|
|
0::numeric AS pre_nb_externes,
|
|
|
0::numeric AS pre_nb_jours_js_non_inclus,
|
|
|
0::numeric AS pre_nb_seances,
|
|
|
0::numeric AS cur_nb_places,
|
|
|
NULL::date[] AS cur_nb_jours_places ,
|
|
|
0::numeric AS cur_nb_entrees_directes,
|
|
|
0::numeric AS cur_nb_sorties_directes,
|
|
|
0::numeric AS cur_nb_ambulatoires,
|
|
|
0::numeric AS cur_nb_externes,
|
|
|
0::numeric AS cur_nb_jours_js_non_inclus,
|
|
|
0::numeric AS cur_nb_seances,
|
|
|
0::numeric AS bud_nb_entrees_directes,
|
|
|
0::numeric AS bud_nb_sorties_directes,
|
|
|
0::numeric AS bud_nb_ambulatoires,
|
|
|
0::numeric AS bud_nb_externes,
|
|
|
0::numeric AS bud_nb_jours_js_non_inclus,
|
|
|
0::numeric AS bud_nb_seances
|
|
|
FROM activite.v_places_1
|
|
|
JOIN activite.t_budgets ON t_budgets.oid = [BUDGET] AND
|
|
|
v_places_1.date BETWEEN t_budgets.date_debut - interval '1 year' AND '[VIEW.TOPERIODE]'::date - interval '1 year' AND
|
|
|
parent_type = t_budgets.dimension1
|
|
|
GROUP BY 1,2;
|
|
|
|
|
|
|
|
|
INSERT INTO temp_ACTI000098
|
|
|
SELECT
|
|
|
CASE
|
|
|
WHEN dimension1 = 'UF' THEN uf_id
|
|
|
WHEN dimension1 = 'SER' THEN service_id
|
|
|
WHEN dimension1 = 'ETA' THEN etage_id
|
|
|
ELSE 0
|
|
|
END AS parent_id,
|
|
|
date_trunc('month', date) + interval '1 month' - interval '1 day' AS date,
|
|
|
0::numeric AS pre_nb_places,
|
|
|
NULL::date[] AS pre_nb_jours_places ,
|
|
|
0::numeric AS pre_nb_entrees_directes,
|
|
|
0::numeric AS pre_nb_sorties_directes,
|
|
|
0::numeric AS pre_nb_ambulatoires,
|
|
|
0::numeric AS pre_nb_externes,
|
|
|
0::numeric AS pre_nb_jours_js_non_inclus,
|
|
|
0::numeric AS pre_nb_seances,
|
|
|
SUM(nb_lits_ouverts) AS cur_nb_places,
|
|
|
base.cti_group_array3(DISTINCT CASE WHEN nb_lits_ouverts <> 0 THEN date ELSE NULL END) AS cur_nb_jours_places,
|
|
|
0::numeric AS cur_nb_entrees_directes,
|
|
|
0::numeric AS cur_nb_sorties_directes,
|
|
|
0::numeric AS cur_nb_ambulatoires,
|
|
|
0::numeric AS cur_nb_externes,
|
|
|
0::numeric AS cur_nb_jours_js_non_inclus,
|
|
|
0::numeric AS cur_nb_seances,
|
|
|
0::numeric AS bud_nb_entrees_directes,
|
|
|
0::numeric AS bud_nb_sorties_directes,
|
|
|
0::numeric AS bud_nb_ambulatoires,
|
|
|
0::numeric AS bud_nb_externes,
|
|
|
0::numeric AS bud_nb_jours_js_non_inclus,
|
|
|
0::numeric AS bud_nb_seances
|
|
|
FROM activite.v_places_1
|
|
|
JOIN activite.t_budgets ON t_budgets.oid = [BUDGET] AND
|
|
|
v_places_1.date BETWEEN date_debut AND '[VIEW.TOPERIODE]' AND
|
|
|
parent_type = t_budgets.dimension1
|
|
|
GROUP BY 1,2;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
]]></select>
|
|
|
</SQL>
|
|
|
<SQL>
|
|
|
<select><![CDATA[
|
|
|
|
|
|
CTISELECT_TREE
|
|
|
WORKTABLE{temp_ACTI000098_3}
|
|
|
GROUPBY1{[VIEW.GROUPBY_OID_FIELD],, [VIEW.GROUPBY_COD_FIELD],, [VIEW.GROUPBY_TXT_FIELD]}
|
|
|
GROUPBY1MODE{[GROUPBY_TAB]}
|
|
|
GROUPBY2{[VIEW.GROUPBY2_OID_FIELD],, [VIEW.GROUPBY2_COD_FIELD],, [VIEW.GROUPBY2_TXT_FIELD]}
|
|
|
INDICATORS{
|
|
|
SUM(cur_nb_places),
|
|
|
SUM(pre_nb_places),
|
|
|
SUM(0),
|
|
|
(SELECT count(DISTINCT cti_unnest) from base.cti_unnest(base.cti_group_array4(cur_nb_jours_places))),
|
|
|
(SELECT count(DISTINCT cti_unnest) from base.cti_unnest(base.cti_group_array4(pre_nb_jours_places))),
|
|
|
SUM(0),
|
|
|
SUM(cur_nb_entrees_directes + cur_nb_ambulatoires),
|
|
|
SUM(pre_nb_entrees_directes + pre_nb_ambulatoires),
|
|
|
SUM(bud_nb_entrees_directes + bud_nb_ambulatoires),
|
|
|
SUM(cur_nb_jours_js_non_inclus + cur_nb_ambulatoires),
|
|
|
SUM(pre_nb_jours_js_non_inclus + pre_nb_ambulatoires),
|
|
|
SUM(bud_nb_jours_js_non_inclus + bud_nb_ambulatoires),
|
|
|
SUM(cur_nb_externes),
|
|
|
SUM(pre_nb_externes),
|
|
|
SUM(bud_nb_externes),
|
|
|
}
|
|
|
|
|
|
FROM temp_ACTI000098
|
|
|
JOIN temp_ACTI000098_0 ON temp_ACTI000098.parent_id = temp_ACTI000098_0.parent_id;
|
|
|
|
|
|
|
|
|
UPDATE temp_ACTI000098_3 SET
|
|
|
level = 1,
|
|
|
code1 = chr(128),
|
|
|
code = 'TOTAL',
|
|
|
texte = 'TOTAL GENERAL'
|
|
|
WHERE oid = -9999999 AND oidt = -9999999;
|
|
|
|
|
|
UPDATE temp_ACTI000098_3 SET
|
|
|
code1 = chr(128),
|
|
|
code = 'S-TOTAL ' || code,
|
|
|
texte = 'SOUS TOTAL ' || texte
|
|
|
WHERE oid = -9999999 AND oidt <> -9999999;
|
|
|
|
|
|
|
|
|
DROP TABLE IF EXISTS temp_ACTI000098_4;
|
|
|
CREATE TEMP TABLE temp_ACTI000098_4 AS
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, 0 AS oid3, '0' AS code3, oid, code, texte, level,
|
|
|
0 AS cur_nb,
|
|
|
0 AS pre_nb,
|
|
|
0 AS bud_nb
|
|
|
FROM temp_ACTI000098_3
|
|
|
WHERE indicateurs[1] <> 0 OR indicateurs[2] <> 0 OR indicateurs[3] <> 0 OR
|
|
|
indicateurs[4] <> 0 OR indicateurs[5] <> 0 OR indicateurs[6] <> 0 OR
|
|
|
indicateurs[7] <> 0 OR indicateurs[8] <> 0 OR indicateurs[9] <> 0 OR
|
|
|
indicateurs[10] <> 0 OR indicateurs[11] <> 0 OR indicateurs[12] <> 0 OR
|
|
|
indicateurs[12] <> 0 OR indicateurs[13] <> 0 OR indicateurs[15] <> 0
|
|
|
|
|
|
UNION
|
|
|
|
|
|
|
|
|
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, 1 AS oid3, '1' AS code3, oid, '' AS code, 'Nombre de lits et places installés (moyenne mensuelle)' AS texte, 3 AS level,
|
|
|
base.cti_division(indicateurs[1], indicateurs[4]),
|
|
|
base.cti_division(indicateurs[2], indicateurs[5]),
|
|
|
base.cti_division(indicateurs[3], indicateurs[6])
|
|
|
FROM temp_ACTI000098_3
|
|
|
WHERE indicateurs[1] <> 0 OR indicateurs[2] <> 0 OR indicateurs[3] <> 0 OR
|
|
|
indicateurs[4] <> 0 OR indicateurs[5] <> 0 OR indicateurs[6] <> 0
|
|
|
|
|
|
UNION
|
|
|
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, 2 AS oid3, '2' AS code3, oid, '' AS code, 'Nombre de séjours (entrées)' AS texte, 3 AS level,
|
|
|
indicateurs[7],
|
|
|
indicateurs[8],
|
|
|
indicateurs[9]
|
|
|
FROM temp_ACTI000098_3
|
|
|
WHERE
|
|
|
indicateurs[7] <> 0 OR indicateurs[8] <> 0 OR indicateurs[9] <> 0
|
|
|
|
|
|
UNION
|
|
|
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, 3 AS oid3, '3' AS code3, oid, '' AS code, 'Nombre de journées' AS texte, 3 AS level,
|
|
|
indicateurs[10],
|
|
|
indicateurs[11],
|
|
|
indicateurs[12]
|
|
|
FROM temp_ACTI000098_3
|
|
|
WHERE
|
|
|
indicateurs[10] <> 0 OR indicateurs[11] <> 0 OR indicateurs[12] <> 0
|
|
|
|
|
|
UNION
|
|
|
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, 4 AS oid3, '4' AS code3, oid, '' AS code, 'Taux d''occupation' AS texte, 3 AS level,
|
|
|
base.cti_division(indicateurs[10] , indicateurs[1]) * 100,
|
|
|
base.cti_division(indicateurs[11] , indicateurs[2]) * 100,
|
|
|
0
|
|
|
FROM temp_ACTI000098_3
|
|
|
WHERE indicateurs[1] <> 0 OR indicateurs[2] <> 0 OR indicateurs[3] <> 0 OR
|
|
|
indicateurs[10] <> 0 OR indicateurs[11] <> 0 OR indicateurs[12] <> 0
|
|
|
|
|
|
UNION
|
|
|
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, 5 AS oid3, '5' AS code3, oid, '' AS code, 'DMS' AS texte, 3 AS level,
|
|
|
base.cti_division(indicateurs[10] , indicateurs[7]) ,
|
|
|
base.cti_division(indicateurs[11] , indicateurs[8]) ,
|
|
|
0
|
|
|
FROM temp_ACTI000098_3
|
|
|
WHERE
|
|
|
indicateurs[7] <> 0 OR indicateurs[8] <> 0 OR indicateurs[9] <> 0 OR
|
|
|
indicateurs[10] <> 0 OR indicateurs[11] <> 0 OR indicateurs[12] <> 0
|
|
|
|
|
|
UNION
|
|
|
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, 7 AS oid3, '7' AS code3, oid, '' AS code, 'Nombre de consultations externes' AS texte, 3 AS level,
|
|
|
indicateurs[13],
|
|
|
indicateurs[14],
|
|
|
indicateurs[15]
|
|
|
FROM temp_ACTI000098_3
|
|
|
WHERE
|
|
|
indicateurs[12] <> 0 OR indicateurs[13] <> 0 OR indicateurs[15] <> 0 ;
|
|
|
|
|
|
|
|
|
|
|
|
SELECT oidt, labelt, textet, oid1, code1, oid2, code2, oid3, code3, oid, code, texte, level,
|
|
|
CASE WHEN oid3 = 4 THEN '#,00%' WHEN oid3 = 5 THEN '#,00' ELSE '#' END,
|
|
|
cur_nb,
|
|
|
pre_nb,
|
|
|
cur_nb - pre_nb,
|
|
|
CASE WHEN pre_nb <> 0 AND cur_nb <> 0 THEN base.cti_division(cur_nb - pre_nb, pre_nb) * 100 ELSE 0 END ,
|
|
|
bud_nb,
|
|
|
cur_nb - bud_nb,
|
|
|
CASE WHEN bud_nb <> 0 AND cur_nb <> 0 THEN base.cti_division(cur_nb - bud_nb, bud_nb) * 100 ELSE 0 END
|
|
|
FROM temp_ACTI000098_4
|
|
|
ORDER BY labelt,oidt,code1,oid1,code2,oid2,code3,oid3;
|
|
|
|
|
|
|
|
|
|
|
|
]]></select>
|
|
|
<FIELDS>
|
|
|
<INSERT name="CTISELECT_TREE_FIELDS"/>
|
|
|
<FIELD name="FMT" />
|
|
|
<FIELD name="CUR" />
|
|
|
<FIELD name="PRE" />
|
|
|
<FIELD name="EVO_PRE" />
|
|
|
<FIELD name="EVP_PRE" />
|
|
|
<FIELD name="BUD" />
|
|
|
<FIELD name="EVO_BUD" />
|
|
|
<FIELD name="EVP_BUD" />
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
|
|
|
</QUERY>
|
|
|
|
|
|
|
|
|
<QUERY type="comboLink" name="BUDGET" >
|
|
|
<SQL select="SELECT oid, texte FROM activite.t_budgets" >
|
|
|
<FIELDS>
|
|
|
<FIELD name="cod" />
|
|
|
<FIELD name="txt" />
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
</QUERY>
|
|
|
|
|
|
<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
|
|
|
<SQL select="
|
|
|
SELECT 'TOPERIODE', date_trunc('year',date_fin) + interval '[TOMOIS] month' - interval '1 day'
|
|
|
FROM activite.t_budgets
|
|
|
WHERE oid = [BUDGET]
|
|
|
">
|
|
|
<FIELDS>
|
|
|
<FIELD name="name"/>
|
|
|
<FIELD name="value"/>
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
</QUERY>
|
|
|
|
|
|
|
|
|
<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
|
|
|
<SQL select="
|
|
|
SELECT 'PERIODE', date_debut
|
|
|
FROM activite.t_budgets
|
|
|
WHERE oid = [BUDGET]
|
|
|
">
|
|
|
<FIELDS>
|
|
|
<FIELD name="name"/>
|
|
|
<FIELD name="value"/>
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
</QUERY>
|
|
|
|
|
|
<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
|
|
|
<SQL select="
|
|
|
SELECT 'PERIODE_H', p_calendrier_mois.texte_court
|
|
|
FROM activite.t_budgets
|
|
|
JOIN base.p_calendrier_mois ON t_budgets.date_debut BETWEEN p_calendrier_mois.date_debut AND p_calendrier_mois.date_fin
|
|
|
WHERE oid = [BUDGET]
|
|
|
">
|
|
|
<FIELDS>
|
|
|
<FIELD name="name"/>
|
|
|
<FIELD name="value"/>
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
</QUERY>
|
|
|
|
|
|
<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
|
|
|
<SQL select="
|
|
|
SELECT 'TOPERIODE_H', p_calendrier_mois.texte_court
|
|
|
FROM activite.t_budgets
|
|
|
JOIN base.p_calendrier_mois ON date_trunc('year',t_budgets.date_fin) + interval '[TOMOIS] month' - interval '1 day'
|
|
|
BETWEEN p_calendrier_mois.date_debut AND p_calendrier_mois.date_fin
|
|
|
WHERE oid = [BUDGET]
|
|
|
">
|
|
|
<FIELDS>
|
|
|
<FIELD name="name"/>
|
|
|
<FIELD name="value"/>
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
</QUERY>
|
|
|
|
|
|
<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
|
|
|
<SQL select="
|
|
|
SELECT 'PERIODEP_H', p_calendrier_mois.texte_court
|
|
|
FROM activite.t_budgets
|
|
|
JOIN base.p_calendrier_mois ON t_budgets.date_debut - interval '1 year' BETWEEN p_calendrier_mois.date_debut AND p_calendrier_mois.date_fin
|
|
|
WHERE oid = [BUDGET]
|
|
|
">
|
|
|
<FIELDS>
|
|
|
<FIELD name="name"/>
|
|
|
<FIELD name="value"/>
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
</QUERY>
|
|
|
|
|
|
<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
|
|
|
<SQL select="
|
|
|
SELECT 'TOPERIODEP_H', p_calendrier_mois.texte_court
|
|
|
FROM activite.t_budgets
|
|
|
JOIN base.p_calendrier_mois ON date_trunc('year',t_budgets.date_fin) + interval '[TOMOIS] month' - interval '1 day' - interval '1 year'
|
|
|
BETWEEN p_calendrier_mois.date_debut AND p_calendrier_mois.date_fin
|
|
|
WHERE oid = [BUDGET]
|
|
|
">
|
|
|
<FIELDS>
|
|
|
<FIELD name="name"/>
|
|
|
<FIELD name="value"/>
|
|
|
</FIELDS>
|
|
|
</SQL>
|
|
|
</QUERY>
|
|
|
|
|
|
|
|
|
</QUERIES>
|
|
|
|
|
|
<CALCFIELDS>
|
|
|
</CALCFIELDS>
|
|
|
|
|
|
<PRESENTATION>
|
|
|
|
|
|
|
|
|
<ONGLET excelLabel="Suivi budget" label="Suivi budget" queryNumber="0" multiTab="true">
|
|
|
|
|
|
<DATAGRID title="" total="false" headerHeight="54" sortable="false" variableRowHeight="true">
|
|
|
|
|
|
<ROWSTYLE name="fontSize" value="11"/>
|
|
|
<FOOTERROWSTYLE name="fontSize" value="11"/>
|
|
|
|
|
|
<ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '1'"/>
|
|
|
<ROWSTYLE name="backgroundColor" value="0xFFD393" condition="ROW.LVL == '1'"/>
|
|
|
<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '1'"/>
|
|
|
<ROWSTYLE name="borderSides" value="top bottom" condition="ROW.LVL == '1'"/>
|
|
|
<ROWSTYLE name="borderStyle" value="solid" condition="ROW.LVL == '1'"/>
|
|
|
<ROWSTYLE name="borderThickness" value="2" condition="ROW.LVL == '1'"/>
|
|
|
|
|
|
<ROWSTYLE name="fontWeight" value="bold" condition="ROW.LVL == '2'"/>
|
|
|
|
|
|
<ROWSTYLE name="rowHeight" value="20" condition="ROW.LVL == '1'"/>
|
|
|
<ROWSTYLE name="backgroundColor" value="0xFFD393" condition="ROW.LVL == '1' "/>
|
|
|
|
|
|
|
|
|
|
|
|
<COLUMN dataField="LVL" width="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="FMT" width="50" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="TABD" width="60" type="Number" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="OID1" width="60" type="Char" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="COD1" width="60" type="Char" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="OID2" width="60" type="Char" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="COD2" width="60" type="Char" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="OID3" width="60" type="Char" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="COD3" width="60" type="Char" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
|
|
|
<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="COD" width="100" type="Char" visible="false" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
|
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' && VIEW.GROUPBY_TAB != 'TAB' "/>
|
|
|
<CELLSTYLE name="paddingLeft" value="30" condition="ROW.LVL == '3' && VIEW.GROUPBY_TAB != 'TAB' "/>
|
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' && VIEW.GROUPBY_TAB == 'TAB' "/>
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="TXT" type="Char" minWidth="150" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres">
|
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' && VIEW.GROUPBY_TAB != 'TAB' "/>
|
|
|
<CELLSTYLE name="paddingLeft" value="30" condition="ROW.LVL == '3' && VIEW.GROUPBY_TAB != 'TAB' "/>
|
|
|
<CELLSTYLE name="paddingLeft" value="15" condition="ROW.LVL == '2' && VIEW.GROUPBY_TAB == 'TAB' "/>
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="CUR" type="Number" width="100" outputFormat="= ROW.FMT" visible="true" headerTextCalc="true" headerText="'Réalisé\r' + VIEW.PERIODE_H + ' à\r ' + VIEW.TOPERIODE_H" textAlign="right" totalFunction="text" otherFunction="text" otherComplement="">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="PRE" type="Number" width="100" outputFormat="= ROW.FMT" visible="true" headerTextCalc="true" headerText="'Réalisé\r' + VIEW.PERIODEP_H + ' à\r ' + VIEW.TOPERIODEP_H" textAlign="right" totalFunction="text" otherFunction="text" otherComplement="">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="EVO_PRE" type="Number" width="100" outputFormat="= ROW.FMT" visible="true" headerText="Evolution" textAlign="right" totalFunction="text" otherFunction="text" otherComplement="">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="EVP_PRE" type="Number" width="100" outputFormat="#,00%" visible="true" headerText="% Evolution" textAlign="right" totalFunction="text" otherFunction="text" otherComplement="">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="BUD" type="Number" width="100" outputFormat="= ROW.FMT" visible="true" headerTextCalc="true" headerText="'Prévisions\r' + VIEW.PERIODE_H + ' à\r ' + VIEW.TOPERIODE_H" textAlign="right" totalFunction="text" otherFunction="text" otherComplement="">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="EVO_BUD" type="Number" width="100" outputFormat="= ROW.FMT" visible="true" headerText="Ecart / Prévisions" textAlign="right" totalFunction="text" otherFunction="text" otherComplement="">
|
|
|
</COLUMN>
|
|
|
<COLUMN dataField="EVP_BUD" type="Number" width="100" outputFormat="#,00%" visible="true" headerText="% Ecart / Prévisions" textAlign="right" totalFunction="text" otherFunction="text" otherComplement="">
|
|
|
</COLUMN>
|
|
|
</DATAGRID>
|
|
|
|
|
|
</ONGLET>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</PRESENTATION>
|
|
|
|
|
|
</VUE>
|
|
|
|
|
|
|