diff --git a/html/js/acc_currency.js b/html/js/acc_currency.js index 0fb6fdf71..fdf49ab2a 100644 --- a/html/js/acc_currency.js +++ b/html/js/acc_currency.js @@ -115,7 +115,7 @@ function CurrencyCompute(p_rate,p_update) console.log("rate is nan" + rate); rate=1; } - var tot=tvac*rate; + var tot=tvac/rate; tot=Math.round(tot*100)/100; $(p_update).innerHTML=tot; @@ -148,11 +148,11 @@ function CurrencyComputeMisc(p_rate,p_update) console.log("rate is nan" + rate); rate=1; } - var totDeb=debAmount*rate; + var totDeb=debAmount/rate; totDeb=Math.round(totDeb*100)/100; $('default_currency_deb').innerHTML=totDeb; - var totCred=credAmount*rate; + var totCred=credAmount/rate; totCred=Math.round(totCred*100)/100; $('default_currency_cred').innerHTML=totCred; diff --git a/include/class/acc_ledger_sold.class.php b/include/class/acc_ledger_sold.class.php index ba973c007..0714584f4 100644 --- a/include/class/acc_ledger_sold.class.php +++ b/include/class/acc_ledger_sold.class.php @@ -309,7 +309,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $amount_currency = bcmul(${'e_march' . $i . '_price'}, ${'e_quant' . $i}); // convert amount to currency - $amount=bcmul($amount_currency,$p_currency_rate); + $amount=bcdiv($amount_currency,$p_currency_rate); $tot_amount = bcadd($tot_amount, $amount); $tot_amount = round($tot_amount, 2); @@ -363,7 +363,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $l->load(); $tva_item_currency = bcmul($amount, $l->get_parameter('rate')); } - $tva_item=bcmul($tva_item_currency,$p_currency_rate); + $tva_item=bcdiv($tva_item_currency,$p_currency_rate); $tva_item=round($tva_item,2); if (isset($tva[$idx_tva])) { @@ -413,7 +413,7 @@ class Acc_Ledger_Sold extends Acc_Ledger { $op->save_form_plan($_POST, $i, $j_id); } - $price_euro=bcmul(${'e_march'.$i.'_price'}, $p_currency_rate); + $price_euro=bcdiv(${'e_march'.$i.'_price'}, $p_currency_rate); if ($g_parameter->MY_TVA_USE == 'Y') { /* save into quant_sold */ $r = $this->db->exec_sql("select insert_quant_sold ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", array(null, /* 1 */ @@ -942,12 +942,13 @@ class Acc_Ledger_Sold extends Acc_Ledger { // Add the sum $decalage=($g_parameter->MY_TVA_USE == 'Y')?'