You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

195 lines
9.1 KiB

dep:
- v_listes_1
src: |
SELECT v_listes_1.liste_id_combo AS oid,
''::text AS code,
v_listes_1.texte,
v_listes_1.liste_alias_combo AS alias,
v_listes_1.lvl AS level,
('00'::text || v_listes_1.sort) || chr(1) AS tri,
CASE
WHEN v_listes_1.is_cti = '1'::text OR v_listes_1.code ~~ 'CTI_%'::text THEN '1'::character(1)
ELSE '0'::character(1)
END AS is_cti
FROM activite.v_listes_1
WHERE v_listes_1.table_code = 'GHMGME'::text AND v_listes_1.lvl <> '0'::text
UNION ALL
SELECT ('LC'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes.oid::text AS oid,
''::text AS code,
t_classes.texte,
''::text AS alias,
'1'::text AS level,
'05'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text)) AS tri,
CASE
WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
ELSE '0'::character(1)
END AS is_cti
FROM activite.t_classes,
activite.t_listes_tables
WHERE t_classes.table_id = t_listes_tables.oid AND t_listes_tables.code = 'GHMGME'::text
UNION ALL
SELECT ('LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes_sections.oid::text AS oid,
''::text AS code,
t_classes_sections.texte,
('#LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || t_classes_sections.code AS alias,
'2'::text AS level,
'05'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || t_classes_sections.code) AS tri,
CASE
WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
ELSE '0'::character(1)
END AS is_cti
FROM activite.t_classes,
activite.t_classes_sections,
activite.t_listes_tables
WHERE t_classes.table_id = t_listes_tables.oid AND t_classes_sections.classe_id = t_classes.oid AND t_listes_tables.code = 'GHMGME'::text
UNION ALL
SELECT ('LS'::text || lpad(t_classes.sequence::text, 2, '0'::text)) || '0'::text AS oid,
''::text AS code,
'Section non attribuée'::character varying AS texte,
''::text AS alias,
'2'::text AS level,
'05'::text || btrim(rpad(lpad(t_classes.sequence::text, 2, '0'::text), 10, ' '::text) || chr(255)) AS tri,
CASE
WHEN t_classes.is_cti = '1'::bpchar OR t_classes.code ~~ 'CTI_%'::text THEN '1'::character(1)
ELSE '0'::character(1)
END AS is_cti
FROM activite.t_classes,
activite.t_listes_tables
WHERE t_classes.table_id = t_listes_tables.oid AND t_listes_tables.code = 'GHMGME'::text
UNION ALL
SELECT '-8'::text AS oid,
''::text AS code,
'MCO-GHM'::text AS texte,
''::text AS alias,
'1'::text AS level,
'60'::text AS tri,
''::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE t_ghmgme_c.ghmgme_id <> 0 AND (t_ghmgme_c.ghmgme_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'ghmgme'::text))
GROUP BY '-8'::text, ''::text, 'MCO-GHM'::text, '1'::text, '60'::text
UNION ALL
SELECT 'CM'::text || t_ghmgme_c.cmd_id::text AS oid,
t_ghmgme_c.cmd_code AS code,
(t_ghmgme_c.cmd_code || ' '::text) || t_ghmgme_c.cmd_texte AS texte,
''::text AS alias,
'2'::text AS level,
'61'::text || t_ghmgme_c.cmd_code AS tri,
'0'::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE (t_ghmgme_c.ghm_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'ghmgme'::text))
GROUP BY 'CM'::text || t_ghmgme_c.cmd_id::text, t_ghmgme_c.cmd_code, t_ghmgme_c.cmd_texte, ''::text, '2'::text, '61'::text, '0'::character(1)
UNION ALL
SELECT 'G5'::text || t_ghmgme_c.ghm5_id::text AS oid,
t_ghmgme_c.ghm5_code AS code,
(t_ghmgme_c.ghm5_code || ' '::text) || t_ghmgme_c.ghm5_texte AS texte,
''::text AS alias,
'3'::text AS level,
('61'::text || t_ghmgme_c.cmd_code) || t_ghmgme_c.ghm5_code AS tri,
'0'::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE (t_ghmgme_c.ghm_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'ghmgme'::text))
GROUP BY 'G5'::text || t_ghmgme_c.ghm5_id::text, t_ghmgme_c.ghm5_code, t_ghmgme_c.ghm5_texte, ''::text, '3'::text, ('61'::text || t_ghmgme_c.cmd_code) || t_ghmgme_c.ghm5_code, '0'::character(1)
UNION ALL
SELECT 'GM'::text || t_ghmgme_c.ghmgme_id::text AS oid,
t_ghmgme_c.ghmgme_code AS code,
(t_ghmgme_c.ghmgme_code || ' '::text) || t_ghmgme_c.ghmgme_texte AS texte,
''::text AS alias,
'4'::text AS level,
((('61'::text || t_ghmgme_c.cmd_code) || t_ghmgme_c.ghm5_code) || t_ghmgme_c.ghmgme_code) ||
CASE
WHEN t_ghmgme_c.ghmgme_id = 0 THEN '00000'::text
ELSE t_ghmgme_c.ghmgme_code
END AS tri,
'0'::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE t_ghmgme_c.ghmgme_id <> 0 AND (t_ghmgme_c.type_pmsi = ANY (ARRAY['1'::text, '12'::text, '*'::text])) AND (t_ghmgme_c.ghmgme_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'ghmgme'::text))
GROUP BY 'GM'::text || t_ghmgme_c.ghmgme_id::text, t_ghmgme_c.ghmgme_code, (t_ghmgme_c.ghmgme_code || ' '::text) || t_ghmgme_c.ghmgme_texte, ''::text, '4'::text, ((('61'::text || t_ghmgme_c.cmd_code) || t_ghmgme_c.ghm5_code) || t_ghmgme_c.ghmgme_code) ||
CASE
WHEN t_ghmgme_c.ghmgme_id = 0 THEN '00000'::text
ELSE t_ghmgme_c.ghmgme_code
END, '0'::character(1)
UNION ALL
SELECT '-8'::text AS oid,
''::text AS code,
'SSR-GME'::text AS texte,
''::text AS alias,
'1'::text AS level,
'70'::text AS tri,
'0'::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE t_ghmgme_c.ghmgme_id <> 0 AND (t_ghmgme_c.ghmgme_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'ghmgme'::text))
GROUP BY '-8'::text, ''::text, 'MCO-GME'::text, '1'::text, '8'::text
UNION ALL
SELECT 'CM'::text || t_ghmgme_c.cm_id::text AS oid,
t_ghmgme_c.cm_code AS code,
(t_ghmgme_c.cm_code || ' '::text) || t_ghmgme_c.cm_texte AS texte,
''::text AS alias,
'2'::text AS level,
'71'::text ||
CASE
WHEN t_ghmgme_c.cm_id = 0 THEN '00'::text
ELSE t_ghmgme_c.cm_code
END AS tri,
'0'::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE t_ghmgme_c.gme_id <> 0 AND (t_ghmgme_c.gme_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'ghmgme'::text))
GROUP BY 'CM'::text || t_ghmgme_c.cm_id::text, t_ghmgme_c.cm_code, (t_ghmgme_c.cm_code || ' '::text) || t_ghmgme_c.cm_texte, ''::text, '1'::text, '71'::text ||
CASE
WHEN t_ghmgme_c.cm_id = 0 THEN '00'::text
ELSE t_ghmgme_c.cm_code
END
UNION ALL
SELECT 'G5'::text || t_ghmgme_c.rgme_id::text AS oid,
t_ghmgme_c.rgme_code AS code,
(t_ghmgme_c.rgme_code || ' '::text) || t_ghmgme_c.rgme_texte AS texte,
''::text AS alias,
'3'::text AS level,
'71'::text ||
CASE
WHEN t_ghmgme_c.rgme_id = 0 THEN '0000'::text
ELSE (t_ghmgme_c.cm_code || chr(1)) || t_ghmgme_c.rgme_code
END AS tri,
'0'::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE t_ghmgme_c.gme_id <> 0 AND (t_ghmgme_c.gme_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'gme'::text))
GROUP BY 'G5'::text || t_ghmgme_c.rgme_id::text, t_ghmgme_c.rgme_code, (t_ghmgme_c.rgme_code || ' '::text) || t_ghmgme_c.rgme_texte, ''::text, '3'::text, '71'::text ||
CASE
WHEN t_ghmgme_c.rgme_id = 0 THEN '0000'::text
ELSE (t_ghmgme_c.cm_code || chr(1)) || t_ghmgme_c.rgme_code
END, '0'::character(1)
UNION ALL
SELECT 'GM'::text || t_ghmgme_c.ghmgme_id::text AS oid,
t_ghmgme_c.ghmgme_code AS code,
(t_ghmgme_c.ghmgme_code || ' '::text) || t_ghmgme_c.ghmgme_texte AS texte,
''::text AS alias,
'4'::text AS level,
'71'::text ||
CASE
WHEN t_ghmgme_c.ghmgme_id = 0 THEN '0000'::text
ELSE (((t_ghmgme_c.cm_code || chr(1)) || t_ghmgme_c.rgme_code) || chr(1)) || t_ghmgme_c.ghmgme_code
END AS tri,
'0'::character(1) AS is_cti
FROM activite.t_ghmgme_c
WHERE t_ghmgme_c.ghmgme_id <> 0 AND (t_ghmgme_c.type_pmsi = ANY (ARRAY['2'::text, '12'::text, '*'::text])) AND (t_ghmgme_c.ghmgme_id IN ( SELECT p_oids.oid
FROM activite.p_oids
WHERE p_oids.code_table = 'ghmgme'::text))
GROUP BY 'GM'::text || t_ghmgme_c.ghmgme_id::text, t_ghmgme_c.ghmgme_code, (t_ghmgme_c.ghmgme_code || ' '::text) || t_ghmgme_c.ghmgme_texte, ''::text, '4'::text, '71'::text ||
CASE
WHEN t_ghmgme_c.ghmgme_id = 0 THEN '0000'::text
ELSE (((t_ghmgme_c.cm_code || chr(1)) || t_ghmgme_c.rgme_code) || chr(1)) || t_ghmgme_c.ghmgme_code
END, '0'::character(1)
ORDER BY 6;