Commit 83ba4805 authored by Florian Joriot's avatar Florian Joriot
Browse files

Plafond 15 filtre les heures qui ne sont ni en service ni en HC

parent f9bf597e
Loading
Loading
Loading
Loading
Loading
+11 −13
Changes for data/plafonds-sql/15.sql: 11 added lines, 13 removed lines.
Original line number Diff line number Diff line
SELECT
  i.annee_id                 annee_id,
  vhr.type_volume_horaire_id type_volume_horaire_id,
  i.id                       intervenant_id,
  s.id                       structure_id,
  SUM(vhr.heures)            heures
  i.annee_id,
  fr.type_volume_horaire_id         type_volume_horaire_id,
  sr.structure_id                   structure_id,
  sum(frvr.total)                        heures
FROM
  service_referentiel       sr
  JOIN intervenant           i ON i.id = sr.intervenant_id
  JOIN structure             s ON s.id = sr.structure_id
  JOIN volume_horaire_ref  vhr ON vhr.service_referentiel_id = sr.id AND vhr.histo_destruction IS NULL
WHERE
  sr.histo_destruction IS NULL
GROUP BY
  i.annee_id, vhr.type_volume_horaire_id, i.id, s.id
 No newline at end of file
  formule_resultat_volume_horaire frvr
    JOIN formule_resultat_intervenant fr ON fr.id = frvr.formule_resultat_intervenant_id
    JOIN volume_horaire_ref          vhr ON vhr.id =  frvr.volume_horaire_ref_id AND vhr.histo_destruction IS NULL
    JOIN service_referentiel          sr ON sr.id = vhr.service_referentiel_id AND sr.intervenant_id = fr.intervenant_id AND sr.histo_destruction IS NULL
    JOIN intervenant                   i ON i.id = fr.intervenant_id
    JOIN etat_volume_horaire         evh ON evh.code = 'saisi' AND evh.id = fr.etat_volume_horaire_id
GROUP BY i.annee_id, fr.type_volume_horaire_id, sr.structure_id