Skip to content
Snippets Groups Projects
Commit 7cb49342 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Refactoring de l'indicateur 330 : Donne maintenant uniquement les intervenants...

Refactoring de l'indicateur 330 : Donne maintenant uniquement les intervenants en attente d'un avenant
parent 46153b70
No related branches found
No related tags found
1 merge request!55Ll bug report services
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_330 AS
WITH has_contrat AS (
SELECT DISTINCT
intervenant_id
i.id intervenant_id,
i.annee_id annee_id,
c.structure_id structure_id
FROM
tbl_contrat
intervenant i
JOIN contrat c ON c.intervenant_id = i.iD
WHERE
edite > 0
c.type_contrat_id = 1 --a déjà un contrat de type 'CONTRAT'
AND c.histo_destruction IS NULL
AND i.histo_destruction IS NULL
)
SELECT
rownum id,
......@@ -13,10 +18,13 @@ SELECT
w.intervenant_id,
w.structure_id
FROM
tbl_workflow w
JOIN has_contrat hc ON hc.intervenant_id = w.intervenant_id
intervenant i
JOIN tbl_workflow w ON w.intervenant_id = i.id
JOIN has_contrat hc ON hc.intervenant_id = i.id
LEFT JOIN contrat c ON c.intervenant_id = i.id AND c.structure_id = w.structure_id AND c.histo_destruction IS NULL
WHERE
w.atteignable = 1
AND w.etape_code = 'CONTRAT'
AND w.objectif > 0
AND w.realisation < w.objectif
AND c.id IS NULL
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment