Bug 7528 - amount subtracting 1 cent
authormveron <veron@veron.ch>
Sun, 15 Apr 2012 15:20:16 +0000 (17:20 +0200)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Thu, 21 Jun 2012 14:07:44 +0000 (10:07 -0400)
Rounding issue with JavaScript and float numbers, JavaScript changed to do no calculation if discount is 0

Signed-off-by: Ian Walls <koha.sekjal@gmail.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>

koha-tmpl/intranet-tmpl/prog/en/js/acq.js

index b137f59..70e988e 100644 (file)
@@ -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);