noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 21/33: Cosmetic #2082 : OD parfois ajout diff


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 21/33: Cosmetic #2082 : OD parfois ajout différence de change
Date: Thu, 11 Nov 2021 06:02:48 -0500 (EST)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 0b248e54bab50b7204f08b2390b1807cd2cb0853
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Thu Oct 14 18:54:17 2021 +0200

    Cosmetic #2082 : OD parfois ajout différence de change
---
 include/class/acc_ledger.class.php      | 12 +++++++++---
 include/template/ledger_detail_misc.php |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/class/acc_ledger.class.php 
b/include/class/acc_ledger.class.php
index 778eba8..a9cfcab 100644
--- a/include/class/acc_ledger.class.php
+++ b/include/class/acc_ledger.class.php
@@ -1394,8 +1394,13 @@ class Acc_Ledger  extends jrn_def_sql
                 $operation_currency->insert();
                 
                 $tot_amount=bcadd($tot_amount,round($acc_op->amount, 2));
-                $tot_deb+=($acc_op->type=='d')?$acc_op->amount:0;
-                $tot_cred+=($acc_op->type=='c')?$acc_op->amount:0;
+                
+                if ( $acc_op->type == 'd') {
+                    $tot_deb=bcadd($tot_deb, $acc_op->amount);
+                }elseif ( $acc_op->type == 'c') {
+                    $tot_cred=bcadd($tot_cred,$acc_op->amount);
+                }
+                
                 if ($g_parameter->MY_ANALYTIC!="nu")
                 {
                     if ($g_parameter->match_analytic( $poste)==TRUE)
@@ -1420,7 +1425,8 @@ class Acc_Ledger  extends jrn_def_sql
             }// loop for each item
             $acc_end=new Acc_Operation($this->db);
             // Check the balance 
-            if ( $tot_deb != $tot_cred ) {
+            if ( bcsub($tot_deb,$tot_cred,2) != 0 && $currency_code != 0) 
+            {
                 
                 $diff=bcsub($tot_cred, $tot_deb);
                 // store the difference in currency_rounded_delta
diff --git a/include/template/ledger_detail_misc.php 
b/include/template/ledger_detail_misc.php
index d5b723a..46f94bd 100644
--- a/include/template/ledger_detail_misc.php
+++ b/include/template/ledger_detail_misc.php
@@ -192,7 +192,7 @@ $amount_idx=0; $sum_prod_currency=0;
     if ( $obj->det->currency_id != 0 ) {
         $cur_amount=$cn->get_value("select oc_amount from operation_currency 
where j_id=$1",
                 [$q[$e]['j_id']]);
-        $row.=td(nbm($cur_amount,4),' class="num" ');
+        $row.=td(nbm($cur_amount,2),' class="num" ');
     }
     echo tr($row,$class);
 



reply via email to

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