[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 16/21: Operation Analytic : save_form_plan_va
From: |
dwm |
Subject: |
[Noalyss-commit] [noalyss] 16/21: 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:39 -0500 (EST) |
sparkyx pushed a commit to branch unstable
in repository noalyss.
commit c23357bf325bdff84abe8fed3e387f4f436a4fd9
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] 15/21: improve Operation detail : show Analytic imputation for VAT Not Deductible, (continued)
- [Noalyss-commit] [noalyss] 15/21: improve Operation detail : show Analytic imputation for VAT Not Deductible, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 04/21: css : font size rem or % , remove all fixed font-size in px, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 20/21: VAT ND Analytic : fix bug, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 07/21: NEW #0002395: C0TVA : pouvoir choisir la contrepartie pour l'autoliquidation, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 06/21: FIX : some doc in comment, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 21/21: Esthetic, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 11/21: FIX : javascript id$ function, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 09/21: FIX : Tax_Summary->check fails when there is no data, check was not correct, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 05/21: WIP : CSS : use variables, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 08/21: Convert upgrade.sql to upgrade202.sql, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 16/21: Operation Analytic : save_form_plan_vat_nd , check that the total is the same as the VAT ND amount,
dwm <=
- [Noalyss-commit] [noalyss] 14/21: improve doc, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 19/21: Integrate stash, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 10/21: FIX : Tax_Summary->check fails when there is no data, check was not correct, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 17/21: Documentation, dwm, 2024/12/15
- [Noalyss-commit] [noalyss] 18/21: Code improve Todo List to finish , allow a empty date, dwm, 2024/12/15