Loading module/Formule/src/Model/Arrondisseur/Afficheur.php +9 −1 Original line number Diff line number Diff line Loading @@ -108,9 +108,17 @@ class Afficheur if ($valeur->hasError()) { $color = '#FFC4C4'; } else { if ($valeur->getValueFinale(true) != $valeur->getValueFinale(false)) { $color = '#fff06c'; }else{ $color = '#C4FFC5'; } } if ($valeur->getValueFinale(true) != $valeur->getValueFinale(false)) { $title[] = 'Valeur finale non forcée : ' . $valeur->getValueFinale(false); } if (!empty($errors)) { $title[] = 'Erreurs :'; Loading module/Formule/src/Model/Arrondisseur/Arrondisseur.php +60 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ class Arrondisseur unset($this->calculs[$ci]); } $this->remonteeTotaux($data); // On passe le résultat de l'arrondisseur pour débug éventuel $fi->setArrondisseurTrace($data); Loading Loading @@ -246,6 +248,64 @@ class Arrondisseur protected function remonteeTotaux(Ligne $ligne): void { $vns = [ Ligne::CAT_TYPE_PRIME, Ligne::TOTAL, ]; foreach (Ligne::CATEGORIES as $categorie) { $vns[] = $categorie; $vns[] = $categorie . Ligne::TYPE_FI; $vns[] = $categorie . Ligne::TYPE_FA; $vns[] = $categorie . Ligne::TYPE_FC; $vns[] = $categorie . Ligne::TYPE_REFERENTIEL; } foreach ($vns as $vn) { $iVal = $ligne->getValeur($vn); $iVal->setForced(0); foreach ($ligne->getSubs() as $service) { $this->remonteeTotauxHoritontaux($service); $sVal = $service->getValeur($vn); $sVal->setForced(0); foreach ($service->getSubs() as $vh) { $vhValue = $vh->getValeur($vn)->getValueFinale(); $iVal->addForced($vhValue); $sVal->addForced($vhValue); $this->remonteeTotauxHoritontaux($vh); } } } $this->remonteeTotauxHoritontaux($ligne); } protected function remonteeTotauxHoritontaux(Ligne $ligne): void { $total = $ligne->getValeur(Ligne::CAT_TYPE_PRIME)->getValueFinale(); foreach (Ligne::CATEGORIES as $categorie) { // ens = fi + fa + fc $ens = $ligne->getValeur($categorie . Ligne::TYPE_FI)->getValueFinale(); $ens += $ligne->getValeur($categorie . Ligne::TYPE_FA)->getValueFinale(); $ens += $ligne->getValeur($categorie . Ligne::TYPE_FC)->getValueFinale(); $ens = round($ens, 2); $ligne->getValeur($categorie . Ligne::TYPE_ENSEIGNEMENT)->setForced($ens); //total categorie = ens + referentiel $cat = $ligne->getValeur($categorie . Ligne::TYPE_ENSEIGNEMENT)->getValueFinale(); $cat += $ligne->getValeur($categorie . Ligne::TYPE_REFERENTIEL)->getValueFinale(); $ligne->getValeur($categorie)->setForced($cat); $total += $cat; } $ligne->getValeur(Ligne::TOTAL)->setForced($total); } /** * @param array|Valeur[] $valeurs * @return void Loading module/Formule/src/Model/Arrondisseur/Testeur.php +1 −7 Original line number Diff line number Diff line Loading @@ -19,13 +19,7 @@ class Testeur $data = $fi->getArrondisseurTrace(); // première passe $this->controleColonnes($data); // on recalcule les totaux $this->recalculTotaux($data); // comptage d'erreurs en seconde passe // comptage d'erreurs $errors = $this->controleColonnes($data); $serviceDuCalcule = $data->getValeur(Ligne::CAT_SERVICE)->getValueFinale(); Loading module/Formule/src/Model/Arrondisseur/Valeur.php +35 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ class Valeur protected float $value = 0.0; protected int $diff = 0; protected int $arrondi = 0; protected ?float $forced = null; protected array $errors = []; Loading Loading @@ -54,10 +55,14 @@ class Valeur public function getValueFinale(): float public function getValueFinale(bool $useForced = true): float { if ($useForced && $this->forced !== null) { return $this->forced; }else { return round($this->value + $this->arrondi / 100, 2); } } Loading Loading @@ -113,6 +118,34 @@ class Valeur public function getForced(): ?float { return $this->forced; } public function setForced(?float $forced): Valeur { $this->forced = $forced; return $this; } public function addForced(float $value, $round=true): Valeur { if ($round) { $this->forced = round($this->forced + $value, 2); }else{ $this->forced += $value; } return $this; } public function getArrondi(): int { return $this->arrondi; Loading Loading
module/Formule/src/Model/Arrondisseur/Afficheur.php +9 −1 Original line number Diff line number Diff line Loading @@ -108,9 +108,17 @@ class Afficheur if ($valeur->hasError()) { $color = '#FFC4C4'; } else { if ($valeur->getValueFinale(true) != $valeur->getValueFinale(false)) { $color = '#fff06c'; }else{ $color = '#C4FFC5'; } } if ($valeur->getValueFinale(true) != $valeur->getValueFinale(false)) { $title[] = 'Valeur finale non forcée : ' . $valeur->getValueFinale(false); } if (!empty($errors)) { $title[] = 'Erreurs :'; Loading
module/Formule/src/Model/Arrondisseur/Arrondisseur.php +60 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,8 @@ class Arrondisseur unset($this->calculs[$ci]); } $this->remonteeTotaux($data); // On passe le résultat de l'arrondisseur pour débug éventuel $fi->setArrondisseurTrace($data); Loading Loading @@ -246,6 +248,64 @@ class Arrondisseur protected function remonteeTotaux(Ligne $ligne): void { $vns = [ Ligne::CAT_TYPE_PRIME, Ligne::TOTAL, ]; foreach (Ligne::CATEGORIES as $categorie) { $vns[] = $categorie; $vns[] = $categorie . Ligne::TYPE_FI; $vns[] = $categorie . Ligne::TYPE_FA; $vns[] = $categorie . Ligne::TYPE_FC; $vns[] = $categorie . Ligne::TYPE_REFERENTIEL; } foreach ($vns as $vn) { $iVal = $ligne->getValeur($vn); $iVal->setForced(0); foreach ($ligne->getSubs() as $service) { $this->remonteeTotauxHoritontaux($service); $sVal = $service->getValeur($vn); $sVal->setForced(0); foreach ($service->getSubs() as $vh) { $vhValue = $vh->getValeur($vn)->getValueFinale(); $iVal->addForced($vhValue); $sVal->addForced($vhValue); $this->remonteeTotauxHoritontaux($vh); } } } $this->remonteeTotauxHoritontaux($ligne); } protected function remonteeTotauxHoritontaux(Ligne $ligne): void { $total = $ligne->getValeur(Ligne::CAT_TYPE_PRIME)->getValueFinale(); foreach (Ligne::CATEGORIES as $categorie) { // ens = fi + fa + fc $ens = $ligne->getValeur($categorie . Ligne::TYPE_FI)->getValueFinale(); $ens += $ligne->getValeur($categorie . Ligne::TYPE_FA)->getValueFinale(); $ens += $ligne->getValeur($categorie . Ligne::TYPE_FC)->getValueFinale(); $ens = round($ens, 2); $ligne->getValeur($categorie . Ligne::TYPE_ENSEIGNEMENT)->setForced($ens); //total categorie = ens + referentiel $cat = $ligne->getValeur($categorie . Ligne::TYPE_ENSEIGNEMENT)->getValueFinale(); $cat += $ligne->getValeur($categorie . Ligne::TYPE_REFERENTIEL)->getValueFinale(); $ligne->getValeur($categorie)->setForced($cat); $total += $cat; } $ligne->getValeur(Ligne::TOTAL)->setForced($total); } /** * @param array|Valeur[] $valeurs * @return void Loading
module/Formule/src/Model/Arrondisseur/Testeur.php +1 −7 Original line number Diff line number Diff line Loading @@ -19,13 +19,7 @@ class Testeur $data = $fi->getArrondisseurTrace(); // première passe $this->controleColonnes($data); // on recalcule les totaux $this->recalculTotaux($data); // comptage d'erreurs en seconde passe // comptage d'erreurs $errors = $this->controleColonnes($data); $serviceDuCalcule = $data->getValeur(Ligne::CAT_SERVICE)->getValueFinale(); Loading
module/Formule/src/Model/Arrondisseur/Valeur.php +35 −2 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ class Valeur protected float $value = 0.0; protected int $diff = 0; protected int $arrondi = 0; protected ?float $forced = null; protected array $errors = []; Loading Loading @@ -54,10 +55,14 @@ class Valeur public function getValueFinale(): float public function getValueFinale(bool $useForced = true): float { if ($useForced && $this->forced !== null) { return $this->forced; }else { return round($this->value + $this->arrondi / 100, 2); } } Loading Loading @@ -113,6 +118,34 @@ class Valeur public function getForced(): ?float { return $this->forced; } public function setForced(?float $forced): Valeur { $this->forced = $forced; return $this; } public function addForced(float $value, $round=true): Valeur { if ($round) { $this->forced = round($this->forced + $value, 2); }else{ $this->forced += $value; } return $this; } public function getArrondi(): int { return $this->arrondi; Loading