From f7219fe62ebe4aa0d6bfd9be28c7a151d3c6ea65 Mon Sep 17 00:00:00 2001 From: mveron Date: Sun, 15 Apr 2012 17:20:16 +0200 Subject: [PATCH] Bug 7528 - amount subtracting 1 cent Rounding issue with JavaScript and float numbers, JavaScript changed to do no calculation if discount is 0 Signed-off-by: Ian Walls --- koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index b137f59..70e988e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -664,7 +664,10 @@ function calcNeworderTotal(){ //do real stuff var rrp = new Number(listprice*exchangerate); - var ecost = new Number(Math.floor(rrp * (100 - discount ))/100); + var ecost = rrp; + if (100-discount != 100) { //Prevent rounding issues if no discount + ecost = new Number(Math.floor(rrp * (100 - discount ))/100); + } var GST = new Number(0); if (gst_on) { rrp=rrp * (1+f.gstrate.value / 100); -- 1.7.0.4