Commit 7d142aed authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Amélioration arrondisseur

aide au débogage
parent fbdcfa36
Loading
Loading
Loading
Loading
Loading
+3 −3
Changes for code/formules/testArrondisseurFromService.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -12,11 +12,11 @@ $fs = $container->get(\Formule\Service\FormuleService::class);
$ts = $container->get(\Formule\Service\TestService::class);


$intervenantId = 777000;
$intervenantId = 201;
//$intervenantId = 2032;
$typeVolumeHoraireId = 1;
$etatVolumeHoraireId = 1;
$arrondir = \Formule\Entity\FormuleIntervenant::ARRONDISSEUR_FULL;
$etatVolumeHoraireId = 2;
$arrondir = \Formule\Entity\FormuleIntervenant::ARRONDISSEUR_MINIMAL;

$fi = $fs->getFormuleServiceIntervenant($intervenantId, $typeVolumeHoraireId, $etatVolumeHoraireId);
$fi->setArrondisseur($arrondir);
+10 −3
Changes for module/Formule/src/Model/Arrondisseur/Afficheur.php: 10 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ class Afficheur
        $main = $ligne;
        echo '<table class="table table-bordered table-xs">';
        echo '<tr>';
        echo '<th style="min-width:5em"></th><th>Total</th>';
        echo '<th style="min-width:5em"></th><th>Vol. horaire</th><th>Total</th>';
        foreach (Ligne::CATEGORIES as $categorie) {
            if ($main->getValeur($categorie)->getValue() == 0) continue;
            echo '<th>' . $categorie . '</th>';
@@ -48,10 +48,9 @@ class Afficheur
            foreach ($sl->getSubs() as $vk => $vl) {
                $this->affLigne($vl, $ligne, '&raquo; vol. h.', false);
            }
            echo '<tr><td colspan="13">&nbsp;</td></tr>';
            echo '<tr><td colspan="14">&nbsp;</td></tr>';
        }


        echo '</table>';
    }

@@ -66,6 +65,14 @@ class Afficheur
        }

        echo '<th>' . $name . '</th>';
        echo "<td>";
        if ($ligne->getVolumeHoraire()){
            $vh = $ligne->getVolumeHoraire();
            echo $vh->getHeures();
            echo " sd*=".($vh->getTauxServiceDu() * $vh->getPonderationServiceDu());
            echo " hc*=".($vh->getTauxServiceCompl() * $vh->getPonderationServiceCompl());
        }
        echo "</td>";
        $this->affValeur($ligne->getValeur(Ligne::TOTAL));
        foreach (Ligne::CATEGORIES as $categorie) {
            if ($main->getValeur($categorie)->getValue() == 0) continue;
+4 −4
Changes for module/Formule/src/Model/Arrondisseur/Arrondisseur.php: 4 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@
namespace Formule\Model\Arrondisseur;

use Enseignement\Entity\Db\Service;
use Formule\Entity\Db\FormuleTestIntervenant;
use Formule\Entity\FormuleIntervenant;
use Formule\Entity\FormuleServiceIntervenant;
use Formule\Entity\FormuleVolumeHoraire;
@@ -30,9 +29,10 @@ class Arrondisseur

        $this->calculs = [];

        if ($fi::ARRONDISSEUR_NO == $fi->getArrondisseur()) {
            return; // Aucun arrondissage à effectuer
        }
        // Optimisation dangeureuse : on doit entrer dans l'arrondisseur même s'il n'est pas utilisé afin de pouvoir déboguer
        //if ($fi::ARRONDISSEUR_NO == $fi->getArrondisseur()) {
        //    return; // Aucun arrondissage à effectuer
        //}

        $data = $this->makeData($fi);

+15 −0
Changes for module/Formule/src/Model/Arrondisseur/Testeur.php: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -40,6 +40,21 @@ class Testeur

    protected function controleColonnes(Ligne $ligne): void
    {
        if ($ligne->getVolumeHoraire()){
            $vh = $ligne->getVolumeHoraire();
            $pService = $vh->getTauxServiceDu() * $vh->getPonderationServiceDu();
            $pCompl = $vh->getTauxServiceCompl() * $vh->getPonderationServiceCompl();

            if ($ligne->getValeur(Ligne::CAT_SERVICE)->getValue() != 0 && $ligne->getValeur(Ligne::CAT_COMPL)->getValue() == 0){
                $ligne->getValeur(Ligne::TOTAL)->setControle($vh->getHeures() * $pService);
            }
            if ($ligne->getValeur(Ligne::CAT_SERVICE)->getValue() == 0 && $ligne->getValeur(Ligne::CAT_COMPL)->getValue() != 0){
                $ligne->getValeur(Ligne::TOTAL)->setControle($vh->getHeures() * $pCompl);
            }
            if (abs($pService-$pCompl) < 0.001){ // taux service = taux compl
                $ligne->getValeur(Ligne::TOTAL)->setControle($vh->getHeures() * $pCompl);
            }
        }
        foreach( $ligne->getValeurs() as $valeur ){
            $value = $valeur->getValueFinale();