[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();
- [Noalyss-commit] [noalyss] branch stable updated (87930cbe3 -> c64f356cf), dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 02/11: FIX : some doc in comment, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 01/11: NEW #0002395: C0TVA : pouvoir choisir la contrepartie pour l'autoliquidation, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 08/11: improve Operation detail : show Analytic imputation for VAT Not Deductible, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 07/11: improve doc, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 09/11: Operation Analytic : save_form_plan_vat_nd , check that the total is the same as the VAT ND amount,
dwm <=
- [Noalyss-commit] [noalyss] 11/11: VAT ND Analytic : fix bug, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 05/11: FIX P0TVA when no data, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 10/11: Documentation, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 04/11: FIX : Tax_Summary->check fails when there is no data, check was not correct, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 06/11: New : label cannot be empty, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 03/11: Convert upgrade.sql to upgrade202.sql, dwm, 2024/12/15