Cosmetic #2082 : OD parfois ajout différence de change

This commit is contained in:
sparkyx 2021-10-14 18:54:17 +02:00
parent 14e3c50eb3
commit 0b248e54ba
2 changed files with 10 additions and 4 deletions

View file

@ -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

View file

@ -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);