From 14fbcdcae120d327f90bae9b3c614efc09d2a8bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Laurent=20L=C3=A9cluse?= <laurent.lecluse@unicaen.fr>
Date: Fri, 21 Feb 2025 15:11:44 +0100
Subject: [PATCH] =?UTF-8?q?Forcage=20du=20calcul=20du=20taux=20FI=20non=20?=
 =?UTF-8?q?=C3=A9ditable=20pour=20garantir=20somme=20=C3=A0=20100%?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 front/Formule/Test/Test.vue                      | 5 ++---
 module/Formule/src/Controller/TestController.php | 1 -
 module/Formule/src/Service/TestService.php       | 2 ++
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/front/Formule/Test/Test.vue b/front/Formule/Test/Test.vue
index f8dc6e1c44..6d3c0cff97 100644
--- a/front/Formule/Test/Test.vue
+++ b/front/Formule/Test/Test.vue
@@ -447,14 +447,14 @@
                 <td>
                     <div v-show="!['', null, 'Référentiel'].includes(vh.typeInterventionCode)">
                         <u-input-float v-model="vh.tauxFa" is-pourc class="dinput" :data-variable="l"
-                                       @change="majTauxFi" style="width:3em"/>
+                                       @change="majTauxFi" @click="majTauxFi" style="width:3em"/>
                         <span class="pourc">%</span>
                     </div>
                 </td>
                 <td>
                     <div v-show="!['', null, 'Référentiel'].includes(vh.typeInterventionCode)">
                         <u-input-float v-model="vh.tauxFc" is-pourc class="dinput" :data-variable="l"
-                                       @change="majTauxFi" style="width:3em"/>
+                                       @change="majTauxFi" @click="majTauxFi" style="width:3em"/>
                         <span class="pourc">%</span>
                     </div>
                 </td>
@@ -806,7 +806,6 @@ export default {
                 content += (vh.structureCode ? vh.structureCode : '') + ";"
                     + (vh.nonPayable ? 'Oui' : 'Non') + ";"
                     + (vh.serviceStatutaire ? 'Oui' : 'Non') + ";"
-                    + (vh.nonPayable ? 'Oui' : 'Non') + ";"
                     + (vh.referentiel ? 'Référentiel' : (vh.typeInterventionCode ? vh.typeInterventionCode : '')) + ";"
                     + (vh.tauxFi ? vh.tauxFi.toLocaleString('fr-FR') : '') + ";"
                     + (vh.tauxFa ? vh.tauxFa.toLocaleString('fr-FR') : '') + ";"
diff --git a/module/Formule/src/Controller/TestController.php b/module/Formule/src/Controller/TestController.php
index aeff994f57..2cc8a766b5 100755
--- a/module/Formule/src/Controller/TestController.php
+++ b/module/Formule/src/Controller/TestController.php
@@ -8,7 +8,6 @@ use Application\Entity\Db\Annee;
 use Application\Service\Traits\ContextServiceAwareTrait;
 use Application\Service\Traits\ParametresServiceAwareTrait;
 use Formule\Entity\Db\Formule;
-use Formule\Entity\Db\FormuleTestIntervenant;
 use Formule\Model\FormuleCalcul;
 use Formule\Service\FormulatorServiceAwareTrait;
 use Formule\Service\TestServiceAwareTrait;
diff --git a/module/Formule/src/Service/TestService.php b/module/Formule/src/Service/TestService.php
index 75e16bf5bb..3c45bc32f4 100755
--- a/module/Formule/src/Service/TestService.php
+++ b/module/Formule/src/Service/TestService.php
@@ -232,6 +232,8 @@ class TestService extends AbstractEntityService
             unset($vh['tauxServiceDu']);
             unset($vh['tauxServiceCompl']);
 
+            $vh['tauxFi'] = round(1 - $vh['tauxFa'] - $vh['tauxFc'],2);
+
             $vhOk = ($vh['structureCode'] ?? null) !== null && ($vh['heures'] ?? null) !== null;
 
             if ($vhOk) {
-- 
GitLab