Commit dbe670ae authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Avancées sur le détail de calcul de formule

parent f5d34744
Loading
Loading
Loading
Loading
+1 −1
Changes for code/formules/testArrondisseurFromTbl.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ $fs = $container->get(\Formule\Service\FormuleService::class);

$sTbl = $fs->getServiceTableauBord();
$params = [
    //'INTERVENANT_ID' => 899413,
    'INTERVENANT_ID' => 899413,
    'TYPE_VOLUME_HORAIRE_ID' => 1,
    'ETAT_VOLUME_HORAIRE_ID' => 1,
    'STATUT_ID' => 744,
+8 −2
Changes for code/test6.php: 8 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -13,5 +13,11 @@ $fs = $container->get(\Formule\Service\FormuleService::class);
//2023/2024 - DALMASSO Marion
$fi = $fs->getFormuleServiceIntervenant(783665, 1, 1);

$extractor = new FormuleDetailsExtractor();
$data      = $extractor->extract($fi);
if (null == $fi->getArrondisseurTrace()) {
    $fs->calculer($fi);
}
$trace = $fi->getArrondisseurTrace();

$vu = $trace->getValeursUtilisees();

var_dump($vu);
 No newline at end of file
+89 −1
Changes for code/test8.php: 89 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -5,4 +5,92 @@
 * @var $container  \Psr\Container\ContainerInterface
 */

echo 'coucou';
 No newline at end of file
use Formule\Model\Arrondisseur\Ligne;



$typesHetd = [
    'Total'                        => true,
    'HeuresService'                => true,
    'HeuresServiceEnseignement'    => true,
    'HeuresServiceFi'              => true,
    'HeuresServiceFa'              => true,
    'HeuresServiceFc'              => false,
    'HeuresServiceReferentiel'     => false,
    'HeuresCompl'                  => true,
    'HeuresComplEnseignement'      => true,
    'HeuresComplFi'                => true,
    'HeuresComplFa'                => false,
    'HeuresComplFc'                => false,
    'HeuresComplReferentiel'       => false,
    'HeuresPrimes'                 => true,
    'HeuresNonPayable'             => true,
    'HeuresNonPayableEnseignement' => true,
    'HeuresNonPayableFi'           => false,
    'HeuresNonPayableFa'           => false,
    'HeuresNonPayableFc'           => false,
    'HeuresNonPayableReferentiel'  => true,
];


$l = new Ligne();
$typesHetd = $l->getValeursUtilisees($typesHetd);

var_dump($typesHetd);

$res = finaliserTypesHetd($typesHetd);

var_dump($res);

function finaliserTypesHetd(array $typesHetd): array
{
    $tree = [];

    if (in_array(Ligne::TOTAL,$typesHetd)){
        $tree['Total'] = [];
    }

    $tradCats  = [
        Ligne::CAT_SERVICE     => 'Service',
        Ligne::CAT_COMPL       => 'Heures compl.',
        Ligne::CAT_NON_PAYABLE => 'Non payable',
    ];
    $tradTypes = [
        Ligne::TYPE_FI          => 'FI',
        Ligne::TYPE_FA          => 'FA',
        Ligne::TYPE_FC          => 'FC',
        Ligne::TYPE_REFERENTIEL => 'Référentiel',
    ];

    foreach (Ligne::CATEGORIES as $cat) {
        $tcat = $tradCats[$cat];
        if (in_array($cat,$typesHetd)){
            $tree[$tcat][] = 'Total';
        }
        if (in_array($cat.Ligne::TYPE_ENSEIGNEMENT, $typesHetd)){
            $tree[$tcat][] = 'Tot. Ens.';
        }
        foreach (Ligne::TYPES as $type) {
            if (in_array($cat . $type, $typesHetd)) {
                $ttype = $tradTypes[$type];
                if (!array_key_exists($tcat, $tree)) {
                    $tree[$tcat] = [];
                }
                $tree[$tcat][] = $ttype;
            }
        }
    }

    if (in_array(Ligne::CAT_TYPE_PRIME, $typesHetd)) {
        $tree['Primes'] = [];
    }

    // on repasse le non payable en dernier
    if (isset($tree[$tradCats[Ligne::CAT_NON_PAYABLE]])){
        $np = $tree[$tradCats[Ligne::CAT_NON_PAYABLE]];
        unset($tree[$tradCats[Ligne::CAT_NON_PAYABLE]]);
        $tree[$tradCats[Ligne::CAT_NON_PAYABLE]] = $np;
    }

    return $tree;
}
 No newline at end of file
+1 −2
Changes for front/Formule/Details.vue: 1 added line, 2 removed lines.
Original line number Diff line number Diff line
@@ -81,8 +81,7 @@
                    <th rowspan="2">Heures</th>
                    <th rowspan="2">&nbsp;</th>
                    <template v-for="(sousTypesHetd,typeHetd) in data.typesHetd" :key="typeHetd">

                        <th :rowspan="sousTypesHetd.length == 0 ? 2 : 1" :colspan="Math.min(sousTypesHetd.length,1)">{{ typeHetd }}</th>
                        <th :rowspan="sousTypesHetd.length == 0 ? 2 : 1" :colspan="Math.max(sousTypesHetd.length,1)">{{ typeHetd }}</th>
                    </template>
                </tr>
                <tr class="details">
+18 −9
Changes for front/Formule/DetailsHetd.vue: 18 added lines, 9 removed lines.
Original line number Diff line number Diff line
<template>
    <td>
        <div :class="arrondiClass" :title="legende">
    <td :class="arrondiClass" :title="legende">
        <u-heures :valeur="hetd.valeur"></u-heures>
        </div>
    </td>
</template>
<script>
@@ -20,24 +18,27 @@ export default {
            switch(this.hetd.arrondi){
                case -1: return 'arrondi-defaut';
                case 1: return 'arrondi-exces';
                default: return "";
            }
            if (this.hetd.original != this.hetd.valeur){
                return 'arrondi';
            }
            return "";
        },
        legende()
        {
            let titre = "";

            if (this.hetd.arrondi == 1){
                titre = "Arrondi à l'excès";
                titre = "L'arrondisseur de règle de calcul a procédé à un arrondi à l'excès";
            }else if (this.hetd.arrondi == -1){
                titre = "Arrondi par défaut";
                titre = "L'arrondisseur de règle de calcul a procédé à un arrondi par troncature";
            }

            if (this.hetd.original != this.hetd.valeur){
                if (titre != ""){
                    titre += "\n";
                }
                titre += "Valeur originale : " + Util.floatToString(this.hetd.original);
                titre += "Valeur originale : " + Util.floatToString(this.hetd.original, 15);
            }

            return titre;
@@ -48,12 +49,20 @@ export default {
</script>
<style scoped>

.arrondi {
    text-decoration: underline dotted;
}

.arrondi-defaut {
    color: #083d77;
    color: blue;
    background-color: #E6E6FF;
    text-decoration: underline dotted;
}

.arrondi-exces {
    color: #8c1c2e;
    color: red;
    background-color: #FFE6E6;
    text-decoration: underline dotted;
}

</style>
 No newline at end of file
Loading