Commit 854763e5 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Merge branch 'master' into module-unicaen-siham

parents 480ae590 fa00cd71
Loading
Loading
Loading
Loading
+5 −10
Original line number Diff line number Diff line
@@ -265,20 +265,15 @@ CREATE OR REPLACE PACKAGE BODY FORMULE_POITIERS AS



    -- AE=SI(OU(ESTERREUR(I20);ESTERREUR(J20));1;SI(AD20=3;J20;I20)*K20)
    -- AE=SI(OU(ESTERREUR(I20);ESTERREUR(J20));1;I20*K20)
    WHEN c = 'AE' AND v >= 1 THEN
      --SI(AD20=3;J20;I20)*K20
      IF cell('AD',l) = 3 THEN
        RETURN vh.TAUX_SERVICE_COMPL * vh.PONDERATION_SERVICE_DU;
      ELSE
      RETURN vh.TAUX_SERVICE_DU * vh.PONDERATION_SERVICE_DU;
      END IF;



    -- AF=SI(OU(ESTERREUR(I20);ESTERREUR(J20));1;J20*K20)
    -- AF=SI(OU(ESTERREUR(I20);ESTERREUR(J20));1;J20*L20)
    WHEN c = 'AF' AND v >= 1 THEN
      RETURN vh.taux_service_compl * vh.ponderation_service_du;
      RETURN vh.taux_service_compl * vh.ponderation_service_compl;



+3 −3
Original line number Diff line number Diff line
@@ -1096,8 +1096,8 @@ CREATE OR REPLACE PACKAGE BODY FORMULE_UNICAEN AS

  PROCEDURE CALCUL_RESULTAT IS
  BEGIN
    -- si l'année est antérieure à 2020/2021 alors on utilise la V2!!
    IF ose_formule.intervenant.annee_id < 2020 THEN
    -- si l'année est antérieure à 2021/2022 alors on utilise la V2!!
    IF ose_formule.intervenant.annee_id < 2021 THEN
      FORMULE_UNICAEN_2016.CALCUL_RESULTAT;
      RETURN;
    END IF;
+19 −0
Original line number Diff line number Diff line
@@ -144,3 +144,22 @@ Créez la vue [SRC_LIEN](SRC_LIEN.sql).
Créez la vue [SRC_SCENARIO_LIEN](SRC_SCENARIO_LIEN.sql).

[Activez-là, puis tentez une synchronisation](../activer-synchroniser.md).

## Récupération des paramétrages par scénarios pour les noeuds

Créez la vue [SRC_SCENARIO_NOEUD](SRC_SCENARIO_NOEUD.sql).

Cette vue ne peuple que les noeuds correspondant aux étapes.
Il sont injectés sans aucun paramètre.
L'objectif est de pouvoir s'appuyer dessus pour injecter plus tard les effectifs.

[Activez-là, puis tentez une synchronisation](../activer-synchroniser.md).

## Récupération des paramétrages des effectifs par scénarios pour les noeuds d'étapes

Créez la vue [SRC_SCENARIO_NOEUD_EFFECTIF](SRC_SCENARIO_NOEUD_EFFECTIF.sql).

Les effectifs ne sont pas mis à jour si un quelqu'un les a modifié manuellement dans OSE.
La synchronisation ne modifie jamais des données saisies à la main.

[Activez-là, puis tentez une synchronisation](../activer-synchroniser.md).
 No newline at end of file
+16 −0
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW SRC_SCENARIO_NOEUD AS
SELECT
  s.id                         scenario_id,
  n.id                         noeud_id,
  src.id                       source_id,
  n.source_code || '_' || s.id source_code
FROM
            noeud            n
       JOIN scenario         s ON s.histo_destruction IS NULL
       JOIN source         src ON src.code = 'Apogee'
  LEFT JOIN scenario_noeud sno ON sno.scenario_id = s.id AND sno.noeud_id = n.id
  LEFT JOIN source         sns ON sns.id = sno.source_id
WHERE
  n.etape_id IS NOT NULL
  AND n.histo_destruction IS NULL
  AND COALESCE(sns.importable,1) = 1
 No newline at end of file
+33 −0
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW SRC_SCENARIO_NOEUD_EFFECTIF AS
WITH a AS (
            SELECT z_etape_id, annee_id, 'fi' z_type_heures_id, effectif_fi effectif FROM OSE_ETAPE_EFFECTIFS@apoprod etp WHERE effectif_fi > 0
  UNION ALL SELECT z_etape_id, annee_id, 'fa' z_type_heures_id, effectif_fa effectif FROM OSE_ETAPE_EFFECTIFS@apoprod etp WHERE effectif_fa > 0
  UNION ALL SELECT z_etape_id, annee_id, 'fc' z_type_heures_id, effectif_fc effectif FROM OSE_ETAPE_EFFECTIFS@apoprod etp WHERE effectif_fc > 0
), snem as (
  SELECT
    scenario_noeud_id
  FROM
    scenario_noeud_effectif sne
    JOIN source src ON src.id = sne.source_id
  WHERE
    src.importable = 0
    AND sne.histo_destruction IS NULL
)
SELECT
  sn.id scenario_noeud_id,
  th.id type_heures_id,
  a.effectif,
  e.id etape_id,
  src.id source_id,
  e.annee_id || '_' || e.source_code || '_' || th.code || '_' || s.id source_code
FROM
  a
  JOIN source src ON src.code = 'Apogee'
  JOIN scenario        s ON s.histo_destruction IS NULL
  JOIN type_heures th ON th.code = a.z_type_heures_id
  JOIN etape e ON e.source_code = a.z_etape_id AND e.annee_id = a.annee_id AND e.histo_destruction IS NULL
  JOIN noeud n ON n.etape_id = e.id
  LEFT JOIN scenario_noeud sn ON sn.noeud_id = n.id AND sn.scenario_id = s.id
  LEFT JOIN snem ON snem.scenario_noeud_id = sn.id
WHERE
  snem.scenario_noeud_id IS NULL
 No newline at end of file
Loading