Commit 347a62d6 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Bon calcul des heures non payables

parent 31716ed4
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -14,8 +14,7 @@ SELECT
  CASE WHEN COALESCE(str.id,0) = COALESCE(to_number(p.valeur),0) THEN 1 ELSE 0 END structure_is_univ,
  CASE WHEN s.element_pedagogique_id IS NULL THEN 1 ELSE 0 END         structure_is_exterieur,
  COALESCE(tf.service_statutaire,1)                                    service_statutaire,
  -- TOTO ajouter les heures non payables
  0                                                                    non_payable,
  CASE WHEN vh.motif_non_paiement_id IS NULL THEN 0 ELSE 1 END         non_payable,

  CASE WHEN ep.id IS NOT NULL THEN ep.taux_fi ELSE 1 END               taux_fi,
  CASE WHEN ep.id IS NOT NULL THEN ep.taux_fa ELSE 0 END               taux_fa,
@@ -75,7 +74,6 @@ WHERE
  vh.histo_destruction IS NULL
  AND s.histo_destruction IS NULL
  AND vh.heures <> 0
  AND vh.motif_non_paiement_id IS NULL
  /*@INTERVENANT_ID=i.id*/
  /*@STATUT_ID=si.id*/
  /*@TYPE_INTERVENANT_ID=si.type_intervenant_id*/
@@ -100,10 +98,9 @@ SELECT
  CASE WHEN COALESCE(sr.structure_id,0) = COALESCE(to_number(p.valeur),0) THEN 1 ELSE 0 END structure_is_univ,
  0                                                                    structure_is_exterieur,
  COALESCE(fr.service_statutaire,1)                                    service_statutaire,
  -- TOTO ajouter les heures non payables
  0                                                                    non_payable,
  CASE WHEN sr.motif_non_paiement_id IS NULL THEN 0 ELSE 1 END         non_payable,

  0                                                                    taux_fi,
  1                                                                    taux_fi,
  0                                                                    taux_fa,
  0                                                                    taux_fc,
  1                                                                    taux_service_du,
@@ -132,7 +129,6 @@ WHERE
  vhr.histo_destruction IS NULL
  AND sr.histo_destruction IS NULL
  AND vhr.heures <> 0
  AND sr.motif_non_paiement_id IS NULL
  /*@INTERVENANT_ID=i.id*/
  /*@STATUT_ID=si.id*/
  /*@TYPE_INTERVENANT_ID=si.type_intervenant_id*/
+1 −0
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@
                    <details-hetds :hetds="sdata.hetd"/>
                </tr>
            </template>
            <tr><th class="service" colspan="999">&nbsp;</th></tr>
            <tr>
                <th class="total" :colspan="totalColSpan()">Total intervenant</th>
                <th>&nbsp;</th>
+36 −8
Original line number Diff line number Diff line
@@ -162,14 +162,10 @@ class AbstractFormuleCalcul
        ];

        foreach ($this->volumesHoraires as $l => $volumeHoraire) {
            foreach (self::RESCOLS as $resCol) {
                $cellColPos = $this->formule->{'get' . $resCol . 'Col'}();
                if ($cellColPos) {
                    $val = $this->c($cellColPos, $l);
            if ($volumeHoraire->isNonPayable()){
                $this->calculNonPayable($l, $volumeHoraire);
            }else {
                    $val = 0.0;
                }
                $volumeHoraire->{'set' . $resCol}($val);
                $this->calculPayable($l, $volumeHoraire);
            }
        }

@@ -194,4 +190,36 @@ class AbstractFormuleCalcul
            $this->intervenant->setDebugTrace($this->cache);
        }
    }



    protected function calculNonPayable(int $l, FormuleVolumeHoraire $volumeHoraire): void
    {
        if ($volumeHoraire->getVolumeHoraire()){
            $hetd = $volumeHoraire->getHeures() * $volumeHoraire->getPonderationServiceCompl() * $volumeHoraire->getTauxServiceCompl();

            $volumeHoraire->setHeuresNonPayableFi($hetd * $volumeHoraire->getTauxFi());
            $volumeHoraire->setHeuresNonPayableFa($hetd * $volumeHoraire->getTauxFa());
            $volumeHoraire->setHeuresNonPayableFc($hetd * $volumeHoraire->getTauxFc());
        }else{
            $hetd = $volumeHoraire->getHeures() * $volumeHoraire->getPonderationServiceCompl();

            $volumeHoraire->setHeuresNonPayableReferentiel($hetd);
        }
    }



    protected function calculPayable(int $l, FormuleVolumeHoraire $volumeHoraire): void
    {
        foreach (self::RESCOLS as $resCol) {
            $cellColPos = $this->formule->{'get' . $resCol . 'Col'}();
            if ($cellColPos) {
                $val = $this->c($cellColPos, $l);
            } else {
                $val = 0.0;
            }
            $volumeHoraire->{'set' . $resCol}($val);
        }
    }
}
 No newline at end of file