diff --git a/include/class/acc_ledger.class.php b/include/class/acc_ledger.class.php index 778eba88d..a9cfcab2b 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 d5b723aed..46f94bdcc 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);