When adding an order if you enter an amount and hit tab it puts the amount minus 1 cent in the next couple fields - see here: http://screencast.com/t/SbVVtte8zHvk It's crazy - and critical that it be fixed. Nicole
This one has to do with floating point precision in JavaScript. In koha-tmpl/intranet-tmpl/prog/en/js/acq.js function calcNeworderTotal() we have at line number 667: var ecost = new Number(Math.floor(rrp * (100 - discount ))/100); If discount rrp is 35.55 and discount is 0.00, we get a calculation 35.55*100 In JavaScript, this evaluates to 3554.9999999999995 which then is rounded down to the next deeper integer (floor) = 3554, divided by 100 = 35.54 Same can happen with other values. As a quick workaround I replaced the line with: var ecost = rrp; if (100-discount != 100) { //Prevent rounding issues if no discount ecost = new Number(Math.floor(rrp * (100 - discount ))/100); } Now, the field gets always the correct value if there is no discount. Note: With some discount there still could be some tiny rounding errors by 1 cent.
Created attachment 9207 [details] [review] Bug 7528 - amount subtracting 1 cent Rounding issue with JavaScript and float numbers, JavaScript changed to do no calculation if discount is 0
Javascript only change to prevent discount calculation if there is no discount to calculate. Marking as Signed Off and Passed QA in one go.
Created attachment 9218 [details] [review] 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.sekjal@gmail.com>
There have been no further reports of problems so I am marking this bug resolved.