Commit 99a21370 authored by joriot221's avatar joriot221
Browse files

Prise en compte de la refonte et du changement de numéro des indicateurs

parent f99daa49
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_110 AS
SELECT
d.intervenant_id,
i.structure_id
i.structure_id,
TO_CHAR(MAX( ido.HISTO_MODIFICATION),'YYYY-MM-DD HH24:MI:SS') AS "Date modif"
FROM
tbl_dossier d
JOIN intervenant i ON i.id = d.intervenant_id
JOIN INTERVENANT_DOSSIER ido ON ido.ID = d.DOSSIER_ID
WHERE
d.dossier_id IS NOT NULL
/*Complétude des différents bloc dossier*/
......@@ -18,4 +20,5 @@ WHERE
AND d.completude_autres = 1
AND d.completude_statut = 1
AND d.validation_id IS NULL
AND d.actif = 1
\ No newline at end of file
AND d.actif = 1
GROUP BY (d.intervenant_id, i.STRUCTURE_ID)
\ No newline at end of file
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_120 AS
SELECT DISTINCT
i.id intervenant_id,
i.structure_id
i.structure_id,
TO_CHAR(MAX( d.HISTO_MODIFICATION),'YYYY-MM-DD HH24:MI:SS') AS "Date modif"
FROM
indic_modif_dossier d
JOIN intervenant i ON i.id = d.intervenant_id
WHERE
d.histo_destruction IS NULL
\ No newline at end of file
d.histo_destruction IS NULL
GROUP BY (i.id, i.STRUCTURE_ID)
\ No newline at end of file
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_920 AS
SELECT DISTINCT
w.intervenant_id,
w.structure_id
w.structure_id,
Max(v.HISTO_CREATION) AS dateModif
FROM
tbl_workflow w
JOIN VALIDATION v ON v.INTERVENANT_ID = w.INTERVENANT_ID
JOIN type_volume_horaire tvh ON tvh.code = 'REALISE'
LEFT JOIN VALIDATION_VOL_HORAIRE vvh ON vvh.VALIDATION_ID = v.ID
LEFT JOIN VALIDATION_VOL_HORAIRE_REF vvhr ON vvhr.VALIDATION_ID = v.ID
LEFT JOIN VOLUME_HORAIRE vh ON vh.ID = vvh.VOLUME_HORAIRE_ID
LEFT JOIN VOLUME_HORAIRE_REF vhr ON vhr.ID = vvhr.VOLUME_HORAIRE_REF_ID
WHERE
w.etape_code = 'DEMANDE_MEP'
AND w.type_intervenant_code = 'P'
AND w.atteignable = 1
AND w.objectif > w.realisation
\ No newline at end of file
AND w.objectif > w.realisation
AND (vhr.TYPE_VOLUME_HORAIRE_ID = tvh.id OR vh.TYPE_VOLUME_HORAIRE_ID = tvh.id)
GROUP BY
w.intervenant_id, w.structure_id
\ No newline at end of file
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_930 AS
SELECT DISTINCT
SELECT
w.intervenant_id,
w.structure_id
w.structure_id,
MAX(histo_modification) DATEMODIF
FROM
tbl_workflow w
mise_en_paiement mep
LEFT JOIN formule_resultat_service frs ON frs.id = mep.formule_res_service_id
LEFT JOIN formule_resultat_service_ref frsr ON frsr.id = mep.formule_res_service_ref_id
JOIN formule_resultat fr ON fr.id = COALESCE(frs.formule_resultat_id,frsr.formule_resultat_id)
JOIN tbl_workflow w ON w.intervenant_id = fr.intervenant_id
WHERE
w.etape_code = 'SAISIE_MEP'
mep.histo_destruction IS NULL
AND mep.periode_paiement_id IS NULL
AND w.etape_code = 'SAISIE_MEP'
AND w.type_intervenant_code = 'E'
AND w.atteignable = 1
AND w.objectif > w.realisation
\ No newline at end of file
AND w.objectif > w.realisation
GROUP BY
fr.intervenant_id,
w.annee_id,
w.intervenant_id,
w.structure_id
\ No newline at end of file
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_940 AS
SELECT DISTINCT
SELECT
w.intervenant_id,
w.structure_id
w.structure_id,
MAX(histo_modification) DATEMODIF
FROM
tbl_workflow w
mise_en_paiement mep
LEFT JOIN formule_resultat_service frs ON frs.id = mep.formule_res_service_id
LEFT JOIN formule_resultat_service_ref frsr ON frsr.id = mep.formule_res_service_ref_id
JOIN formule_resultat fr ON fr.id = COALESCE(frs.formule_resultat_id,frsr.formule_resultat_id)
JOIN tbl_workflow w ON w.intervenant_id = fr.intervenant_id
WHERE
w.etape_code = 'SAISIE_MEP'
mep.histo_destruction IS NULL
AND mep.periode_paiement_id IS NULL
AND w.etape_code = 'SAISIE_MEP'
AND w.type_intervenant_code = 'P'
AND w.atteignable = 1
AND w.objectif > w.realisation
\ No newline at end of file
AND w.objectif > w.realisation
GROUP BY
fr.intervenant_id,
w.annee_id,
w.intervenant_id,
w.structure_id
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment