Commit 277f8df5 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Indicateur mission avec etudiants n'ayant pas encore déclaré sur l'honneur les IFC

parent 334476ca
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_391 AS
SELECT
    tp.intervenant_id,
    tp.structure_id
i.id                intervenant_id,
i.structure_id      structure_id
FROM
    tbl_mission_prime tp
WHERE
  tp.declaration > tp.validation+tp.refus
mission m
JOIN contrat c ON c.mission_id = m.id AND c.histo_destruction IS NULL
JOIN intervenant i ON i.id = m.intervenant_id
WHERE c.date_retour_signe IS NOT NULL
GROUP BY
  tp.intervenant_id,
  tp.annee_id,
  tp.structure_id
 No newline at end of file
i.id,
i.structure_id
HAVING SUM(m.prime_id) IS NULL
 No newline at end of file
+8 −9
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_392 AS
SELECT
i.id                intervenant_id,
i.structure_id      structure_id
    tp.intervenant_id,
    tp.structure_id
FROM
mission m
JOIN contrat c ON c.mission_id = m.id AND c.histo_destruction IS NULL
JOIN intervenant i ON i.id = m.intervenant_id
WHERE c.date_retour_signe IS NOT NULL
    tbl_mission_prime tp
WHERE
        tp.prime > tp.declaration
GROUP BY
i.id,
i.structure_id
HAVING SUM(m.prime_id) IS NULL
 No newline at end of file
    tp.intervenant_id,
    tp.annee_id,
    tp.structure_id
 No newline at end of file
+12 −0
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_INDICATEUR_393 AS
SELECT
    tp.intervenant_id,
    tp.structure_id
FROM
    tbl_mission_prime tp
WHERE
  tp.declaration > tp.validation+tp.refus
GROUP BY
  tp.intervenant_id,
  tp.annee_id,
  tp.structure_id
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ SELECT
FROM
  intervenant i
  JOIN tbl_workflow w ON w.intervenant_id = i.id
  JOIN statut si ON si.id = i.intervenant_id
  JOIN statut si ON si.id = i.statut_id
  JOIN (
    SELECT DISTINCT
      c.intervenant_id,
+15 −14
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ i.annee_id annee_id,
    i.id 			    intervenant_id,
    i.structure_id      structure_id,
    '1' 				actif,
CASE WHEN count(mp.id) = 0 THEN 1 ELSE count(mp.id) END		    prime,
    CASE WHEN count(mp.id) = 0 THEN 0 ELSE count(mp.id) END		    prime,
    SUM(CASE WHEN mp.declaration_id IS NOT NULL THEN 1 ELSE 0 END)   declaration,
    SUM(CASE WHEN mp.validation_id IS NOT NULL THEN 1 ELSE 0 END)   validation,
    SUM(CASE WHEN mp.date_refus IS NOT NULL THEN 1 ELSE 0 END)   refus
@@ -19,3 +19,4 @@ GROUP BY
    i.id,
    i.annee_id,
    i.structure_id
HAVING CASE WHEN count(mp.id) = 0 THEN 0 ELSE count(mp.id) END > 0
 No newline at end of file
Loading