src: |
  SELECT subview.budget_id,
      base.cti_group_concat_without_sep(subview.xmldef) AS xmldef
     FROM ( SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              1 AS level,
              (((((((((((((('<PARENT '::text || 'oid="'::text) || t_budgets_saisis.oid::text) || '" '::text) || 'parent_id="'::text) || t_budgets_saisis.parent_id::text) || '" '::text) || 'parent_code="'::text) || t_budgets_saisis.parent_code) || '" '::text) || 'parent_texte="'::text) || t_budgets_saisis.parent_texte) || '" '::text) || 'repartition_type="'::text) || t_budgets_saisis.repartition_type::text) || '" >'::text AS xmldef
             FROM activite.t_budgets_saisis
          UNION ALL
           SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              21 AS level,
              ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((('<ITEM '::text || 'item_type="ENT" '::text) || 'item_label="Entrées" '::text) || 'item_indicator="nb_entrees_directes" '::text) || 'reference_value_0="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_total, 0::numeric)::text) || '" '::text) || 'reference_value_1="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[1], 0::numeric)::text) || '" '::text) || 'reference_value_2="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[2], 0::numeric)::text) || '" '::text) || 'reference_value_3="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[3], 0::numeric)::text) || '" '::text) || 'reference_value_4="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[4], 0::numeric)::text) || '" '::text) || 'reference_value_5="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[5], 0::numeric)::text) || '" '::text) || 'reference_value_6="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[6], 0::numeric)::text) || '" '::text) || 'reference_value_7="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[7], 0::numeric)::text) || '" '::text) || 'reference_value_8="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[8], 0::numeric)::text) || '" '::text) || 'reference_value_9="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[9], 0::numeric)::text) || '" '::text) || 'reference_value_10="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[10], 0::numeric)::text) || '" '::text) || 'reference_value_11="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[11], 0::numeric)::text) || '" '::text) || 'reference_value_12="'::text) || COALESCE(t_budgets_saisis.reference_nb_entrees_directes_mois[12], 0::numeric)::text) || '" '::text) || 'budget_value_0="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_total, 0::numeric)::text) || '" '::text) || 'budget_value_1="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[1], 0::numeric)::text) || '" '::text) || 'budget_value_2="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[2], 0::numeric)::text) || '" '::text) || 'budget_value_3="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[3], 0::numeric)::text) || '" '::text) || 'budget_value_4="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[4], 0::numeric)::text) || '" '::text) || 'budget_value_5="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[5], 0::numeric)::text) || '" '::text) || 'budget_value_6="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[6], 0::numeric)::text) || '" '::text) || 'budget_value_7="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[7], 0::numeric)::text) || '" '::text) || 'budget_value_8="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[8], 0::numeric)::text) || '" '::text) || 'budget_value_9="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[9], 0::numeric)::text) || '" '::text) || 'budget_value_10="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[10], 0::numeric)::text) || '" '::text) || 'budget_value_11="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[11], 0::numeric)::text) || '" '::text) || 'budget_value_12="'::text) || COALESCE(t_budgets_saisis.budget_nb_entrees_directes_mois[12], 0::numeric)::text) || '" '::text) || ' />'::text
             FROM activite.t_budgets_saisis
            WHERE t_budgets_saisis.reference_nb_entrees_directes_total <> 0::numeric
          UNION ALL
           SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              22 AS level,
              ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((('<ITEM '::text || 'item_type="SOR" '::text) || 'item_label="Sorties" '::text) || 'item_indicator="nb_sorties_directes" '::text) || 'reference_value_0="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_total, 0::numeric)::text) || '" '::text) || 'reference_value_1="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[1], 0::numeric)::text) || '" '::text) || 'reference_value_2="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[2], 0::numeric)::text) || '" '::text) || 'reference_value_3="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[3], 0::numeric)::text) || '" '::text) || 'reference_value_4="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[4], 0::numeric)::text) || '" '::text) || 'reference_value_5="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[5], 0::numeric)::text) || '" '::text) || 'reference_value_6="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[6], 0::numeric)::text) || '" '::text) || 'reference_value_7="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[7], 0::numeric)::text) || '" '::text) || 'reference_value_8="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[8], 0::numeric)::text) || '" '::text) || 'reference_value_9="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[9], 0::numeric)::text) || '" '::text) || 'reference_value_10="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[10], 0::numeric)::text) || '" '::text) || 'reference_value_11="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[11], 0::numeric)::text) || '" '::text) || 'reference_value_12="'::text) || COALESCE(t_budgets_saisis.reference_nb_sorties_directes_mois[12], 0::numeric)::text) || '" '::text) || 'budget_value_0="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_total, 0::numeric)::text) || '" '::text) || 'budget_value_1="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[1], 0::numeric)::text) || '" '::text) || 'budget_value_2="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[2], 0::numeric)::text) || '" '::text) || 'budget_value_3="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[3], 0::numeric)::text) || '" '::text) || 'budget_value_4="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[4], 0::numeric)::text) || '" '::text) || 'budget_value_5="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[5], 0::numeric)::text) || '" '::text) || 'budget_value_6="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[6], 0::numeric)::text) || '" '::text) || 'budget_value_7="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[7], 0::numeric)::text) || '" '::text) || 'budget_value_8="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[8], 0::numeric)::text) || '" '::text) || 'budget_value_9="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[9], 0::numeric)::text) || '" '::text) || 'budget_value_10="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[10], 0::numeric)::text) || '" '::text) || 'budget_value_11="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[11], 0::numeric)::text) || '" '::text) || 'budget_value_12="'::text) || COALESCE(t_budgets_saisis.budget_nb_sorties_directes_mois[12], 0::numeric)::text) || '" '::text) || ' />'::text
             FROM activite.t_budgets_saisis
            WHERE t_budgets_saisis.reference_nb_sorties_directes_total <> 0::numeric
          UNION ALL
           SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              23 AS level,
              ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((('<ITEM '::text || 'item_type="AMB" '::text) || 'item_label="Ambulatoires" '::text) || 'item_indicator="nb_ambulatoires" '::text) || 'reference_value_0="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_total, 0::numeric)::text) || '" '::text) || 'reference_value_1="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[1], 0::numeric)::text) || '" '::text) || 'reference_value_2="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[2], 0::numeric)::text) || '" '::text) || 'reference_value_3="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[3], 0::numeric)::text) || '" '::text) || 'reference_value_4="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[4], 0::numeric)::text) || '" '::text) || 'reference_value_5="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[5], 0::numeric)::text) || '" '::text) || 'reference_value_6="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[6], 0::numeric)::text) || '" '::text) || 'reference_value_7="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[7], 0::numeric)::text) || '" '::text) || 'reference_value_8="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[8], 0::numeric)::text) || '" '::text) || 'reference_value_9="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[9], 0::numeric)::text) || '" '::text) || 'reference_value_10="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[10], 0::numeric)::text) || '" '::text) || 'reference_value_11="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[11], 0::numeric)::text) || '" '::text) || 'reference_value_12="'::text) || COALESCE(t_budgets_saisis.reference_nb_ambulatoires_mois[12], 0::numeric)::text) || '" '::text) || 'budget_value_0="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_total, 0::numeric)::text) || '" '::text) || 'budget_value_1="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[1], 0::numeric)::text) || '" '::text) || 'budget_value_2="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[2], 0::numeric)::text) || '" '::text) || 'budget_value_3="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[3], 0::numeric)::text) || '" '::text) || 'budget_value_4="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[4], 0::numeric)::text) || '" '::text) || 'budget_value_5="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[5], 0::numeric)::text) || '" '::text) || 'budget_value_6="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[6], 0::numeric)::text) || '" '::text) || 'budget_value_7="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[7], 0::numeric)::text) || '" '::text) || 'budget_value_8="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[8], 0::numeric)::text) || '" '::text) || 'budget_value_9="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[9], 0::numeric)::text) || '" '::text) || 'budget_value_10="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[10], 0::numeric)::text) || '" '::text) || 'budget_value_11="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[11], 0::numeric)::text) || '" '::text) || 'budget_value_12="'::text) || COALESCE(t_budgets_saisis.budget_nb_ambulatoires_mois[12], 0::numeric)::text) || '" '::text) || ' />'::text
             FROM activite.t_budgets_saisis
            WHERE t_budgets_saisis.reference_nb_ambulatoires_total <> 0::numeric
          UNION ALL
           SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              24 AS level,
              ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((('<ITEM '::text || 'item_type="EXT" '::text) || 'item_label="Externes" '::text) || 'item_indicator="nb_externes" '::text) || 'reference_value_0="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_total, 0::numeric)::text) || '" '::text) || 'reference_value_1="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[1], 0::numeric)::text) || '" '::text) || 'reference_value_2="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[2], 0::numeric)::text) || '" '::text) || 'reference_value_3="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[3], 0::numeric)::text) || '" '::text) || 'reference_value_4="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[4], 0::numeric)::text) || '" '::text) || 'reference_value_5="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[5], 0::numeric)::text) || '" '::text) || 'reference_value_6="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[6], 0::numeric)::text) || '" '::text) || 'reference_value_7="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[7], 0::numeric)::text) || '" '::text) || 'reference_value_8="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[8], 0::numeric)::text) || '" '::text) || 'reference_value_9="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[9], 0::numeric)::text) || '" '::text) || 'reference_value_10="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[10], 0::numeric)::text) || '" '::text) || 'reference_value_11="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[11], 0::numeric)::text) || '" '::text) || 'reference_value_12="'::text) || COALESCE(t_budgets_saisis.reference_nb_externes_mois[12], 0::numeric)::text) || '" '::text) || 'budget_value_0="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_total, 0::numeric)::text) || '" '::text) || 'budget_value_1="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[1], 0::numeric)::text) || '" '::text) || 'budget_value_2="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[2], 0::numeric)::text) || '" '::text) || 'budget_value_3="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[3], 0::numeric)::text) || '" '::text) || 'budget_value_4="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[4], 0::numeric)::text) || '" '::text) || 'budget_value_5="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[5], 0::numeric)::text) || '" '::text) || 'budget_value_6="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[6], 0::numeric)::text) || '" '::text) || 'budget_value_7="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[7], 0::numeric)::text) || '" '::text) || 'budget_value_8="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[8], 0::numeric)::text) || '" '::text) || 'budget_value_9="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[9], 0::numeric)::text) || '" '::text) || 'budget_value_10="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[10], 0::numeric)::text) || '" '::text) || 'budget_value_11="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[11], 0::numeric)::text) || '" '::text) || 'budget_value_12="'::text) || COALESCE(t_budgets_saisis.budget_nb_externes_mois[12], 0::numeric)::text) || '" '::text) || ' />'::text
             FROM activite.t_budgets_saisis
            WHERE t_budgets_saisis.reference_nb_externes_total <> 0::numeric
          UNION ALL
           SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              25 AS level,
              ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((('<ITEM '::text || 'item_type="JOU" '::text) || 'item_label="Journées" '::text) || 'item_indicator="nb_jours_js_non_inclus" '::text) || 'reference_value_0="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_total, 0::numeric)::text) || '" '::text) || 'reference_value_1="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[1], 0::numeric)::text) || '" '::text) || 'reference_value_2="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[2], 0::numeric)::text) || '" '::text) || 'reference_value_3="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[3], 0::numeric)::text) || '" '::text) || 'reference_value_4="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[4], 0::numeric)::text) || '" '::text) || 'reference_value_5="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[5], 0::numeric)::text) || '" '::text) || 'reference_value_6="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[6], 0::numeric)::text) || '" '::text) || 'reference_value_7="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[7], 0::numeric)::text) || '" '::text) || 'reference_value_8="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[8], 0::numeric)::text) || '" '::text) || 'reference_value_9="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[9], 0::numeric)::text) || '" '::text) || 'reference_value_10="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[10], 0::numeric)::text) || '" '::text) || 'reference_value_11="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[11], 0::numeric)::text) || '" '::text) || 'reference_value_12="'::text) || COALESCE(t_budgets_saisis.reference_nb_jours_js_non_inclus_mois[12], 0::numeric)::text) || '" '::text) || 'budget_value_0="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_total, 0::numeric)::text) || '" '::text) || 'budget_value_1="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[1], 0::numeric)::text) || '" '::text) || 'budget_value_2="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[2], 0::numeric)::text) || '" '::text) || 'budget_value_3="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[3], 0::numeric)::text) || '" '::text) || 'budget_value_4="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[4], 0::numeric)::text) || '" '::text) || 'budget_value_5="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[5], 0::numeric)::text) || '" '::text) || 'budget_value_6="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[6], 0::numeric)::text) || '" '::text) || 'budget_value_7="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[7], 0::numeric)::text) || '" '::text) || 'budget_value_8="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[8], 0::numeric)::text) || '" '::text) || 'budget_value_9="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[9], 0::numeric)::text) || '" '::text) || 'budget_value_10="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[10], 0::numeric)::text) || '" '::text) || 'budget_value_11="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[11], 0::numeric)::text) || '" '::text) || 'budget_value_12="'::text) || COALESCE(t_budgets_saisis.budget_nb_jours_js_non_inclus_mois[12], 0::numeric)::text) || '" '::text) || ' />'::text
             FROM activite.t_budgets_saisis
            WHERE t_budgets_saisis.reference_nb_jours_js_non_inclus_total <> 0::numeric
          UNION ALL
           SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              26 AS level,
              ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((('<ITEM '::text || 'item_type="SEA" '::text) || 'item_label="Séances" '::text) || 'item_indicator="nb_seances" '::text) || 'reference_value_0="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_total, 0::numeric)::text) || '" '::text) || 'reference_value_1="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[1], 0::numeric)::text) || '" '::text) || 'reference_value_2="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[2], 0::numeric)::text) || '" '::text) || 'reference_value_3="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[3], 0::numeric)::text) || '" '::text) || 'reference_value_4="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[4], 0::numeric)::text) || '" '::text) || 'reference_value_5="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[5], 0::numeric)::text) || '" '::text) || 'reference_value_6="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[6], 0::numeric)::text) || '" '::text) || 'reference_value_7="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[7], 0::numeric)::text) || '" '::text) || 'reference_value_8="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[8], 0::numeric)::text) || '" '::text) || 'reference_value_9="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[9], 0::numeric)::text) || '" '::text) || 'reference_value_10="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[10], 0::numeric)::text) || '" '::text) || 'reference_value_11="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[11], 0::numeric)::text) || '" '::text) || 'reference_value_12="'::text) || COALESCE(t_budgets_saisis.reference_nb_seances_mois[12], 0::numeric)::text) || '" '::text) || 'budget_value_0="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_total, 0::numeric)::text) || '" '::text) || 'budget_value_1="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[1], 0::numeric)::text) || '" '::text) || 'budget_value_2="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[2], 0::numeric)::text) || '" '::text) || 'budget_value_3="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[3], 0::numeric)::text) || '" '::text) || 'budget_value_4="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[4], 0::numeric)::text) || '" '::text) || 'budget_value_5="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[5], 0::numeric)::text) || '" '::text) || 'budget_value_6="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[6], 0::numeric)::text) || '" '::text) || 'budget_value_7="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[7], 0::numeric)::text) || '" '::text) || 'budget_value_8="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[8], 0::numeric)::text) || '" '::text) || 'budget_value_9="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[9], 0::numeric)::text) || '" '::text) || 'budget_value_10="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[10], 0::numeric)::text) || '" '::text) || 'budget_value_11="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[11], 0::numeric)::text) || '" '::text) || 'budget_value_12="'::text) || COALESCE(t_budgets_saisis.budget_nb_seances_mois[12], 0::numeric)::text) || '" '::text) || ' />'::text
             FROM activite.t_budgets_saisis
            WHERE t_budgets_saisis.reference_nb_seances_total <> 0::numeric
          UNION ALL
           SELECT t_budgets_saisis.budget_id,
              t_budgets_saisis.parent_code,
              99 AS level,
              '</PARENT>'::text AS text
             FROM activite.t_budgets_saisis
    ORDER BY 1, 2, 3) subview
    GROUP BY subview.budget_id;