noalyss-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Noalyss-commit] [noalyss] 09/11: Operation Analytic : save_form_plan_va


From: dwm
Subject: [Noalyss-commit] [noalyss] 09/11: Operation Analytic : save_form_plan_vat_nd , check that the total is the same as the VAT ND amount
Date: Sun, 15 Dec 2024 09:51:26 -0500 (EST)

sparkyx pushed a commit to branch stable
in repository noalyss.

commit 20b5f741d172dbf30503c21f8d8434c6517f504a
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Sat Dec 14 17:18:25 2024 +0100

    Operation Analytic : save_form_plan_vat_nd , check that the total is the 
same as the VAT ND amount
---
 include/class/anc_operation.class.php | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/include/class/anc_operation.class.php 
b/include/class/anc_operation.class.php
index 49ff5aa44..70dc8f0e8 100644
--- a/include/class/anc_operation.class.php
+++ b/include/class/anc_operation.class.php
@@ -717,16 +717,15 @@ EOF;
         return $result;
     }
     /**
-     * Save the ND VAT with prorata
+     * @brief Save the ND VAT in ANL, and  distribute the amount among ANL 
Axis proportionnaly to the source
      * 
-     * @param $p_array usually $_POST
-     * @param $p_item item of the form
-     * @param $p_j_id jrnx.j_id concerned writing
-     * @param $p_nd amount nd vat
+     * @param $p_array array usually $_POST
+     * @param $p_item int nb of the item of the form
+     * @param $p_j_id int jrnx.j_id concerned writing
+     * @param $p_nd float amount nd vat
      * @see Anc_Operation::save_form_plan_vat_nd
-     * @return type
      */
-    function save_form_plan_vat_nd($p_array,$p_item,$p_j_id,$p_nd)
+    function save_form_plan_vat_nd($p_array,$p_item,$p_j_id,$p_nd):void
     {
         bcscale(4);
         extract($p_array, EXTR_SKIP);
@@ -787,12 +786,12 @@ EOF;
         {
             $tot=bcadd($tot,$a_Anc_Operation[$i]->oa_amount);
         }
-// utilité ???
-//        if ( $tot != $p_nd && count($a_Anc_Operation) > 0 )
-//        {
-//            $diff=  bcsub($tot, $p_nd);
-//            
$a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff);
-//        }
+        // security : if  tot != nd so the amount is reduced by the difference 
between computed and max
+        if ( $tot != $p_nd && count($a_Anc_Operation) > 0 )
+        {
+            $diff=  bcsub($tot, $p_nd);
+            
$a_Anc_Operation[0]->oa_amount=bcsub($a_Anc_Operation[0]->oa_amount,$diff);
+        }
         for ($i=0;$i<$nb_op;$i++)
         {
             $a_Anc_Operation[$i]->add();



reply via email to

[Prev in Thread] Current Thread [Next in Thread]