[Koha-bugs] [Bug 7495] New: Tax calculations problem for new orders.

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Feb 2 22:12:26 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7495

             Bug #: 7495
           Summary: Tax calculations problem for new orders.
    Classification: Unclassified
 Change sponsored?: ---
           Product: Koha
           Version: rel_3_6
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Acquisitions
        AssignedTo: henridamien at koha-fr.org
        ReportedBy: fcapovilla at live.ca
         QAContact: koha.sekjal at gmail.com


When creating a new order, the automatic tax calculations may sometimes be
wrong because of loss of precision.

Example :
With gist=0, create a new order and put 18.99 into the "Vendor price" field.
The "Budgeted cost" and "Total" fields are automatically set to 18.98 when they
should be 19.99
The same happens with 16.99 .

Possible cause of the problem :
http://stackoverflow.com/questions/3730019/why-not-use-double-or-float-to-represent-currency

Here are some utility functions that could be used to correct the problem :
function to_Cents(val) {
    return Math.round(val*100);
}

function to_Dollars(val) {
    return (Math.round(val)/100).toFixed(2);
}

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the Koha-bugs mailing list