Taxes calculation error Bug

jmagne
jmagne
Offline
0
Hi,
I have a big problem with tax calculation.
In Quebec, Canada, we have two applicable taxes.
Federal tax: 5%
Provincial tax: 9,975%
The problem is that the provincial tax is always rounded to 9,98% even if I set 3 decimals in the component settings and the currency.

This is very wrong as we do not charge the correct amount of taxes!
Please provide a fix.

Accepted Answer

Wednesday, November 29 2017, 05:17 PM - #Permalink
0
ok yes, it's a small bug.

there's a DB field that is missing 2 decimals.

if you have access to your DB, it is very easy to fix.

just go to table "#__invoices_tax_invoice" and change 'value' to DECIMAL(10,4)

this is the actual MySQL query you need to perform:

ALTER TABLE `#__invoices_tax_invoice` CHANGE `value` `value` DECIMAL(10,4) NOT NULL;


Make sure to replace the "#_" on the table name by your actual prefix.
The reply is currently minimized Show
Responses (8)
  • Accepted Answer

    Tuesday, November 28 2017, 04:39 PM - #Permalink
    0
    hi

    have you set the parameter "Number of decimals on form inputs" to 3?
    The reply is currently minimized Show
  • Accepted Answer

    jmagne
    jmagne
    Offline
    Tuesday, November 28 2017, 04:43 PM - #Permalink
    0
    Yes,

    That's the parameter named 'decimals_editing'
    Also I noticed in your code that you read the parameter 'decimals' defaulted to 2. The parameter is not resent in the config.xml file so this always get the value '2'
    I tried adding this parameter to the config.xml file and set it to 3. Same result, the taxes always get rounded to 2 decimals.

    I use version 3.0.0
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 28 2017, 04:50 PM - #Permalink
    0
    so, the tax is rounded to 2 decimals when displaying, not in the form.. is that correct? can you make a couple screenshots? one of the form (the "items" tab) and another one of the final, rendered invoice?
    The reply is currently minimized Show
  • Accepted Answer

    jmagne
    jmagne
    Offline
    Tuesday, November 28 2017, 05:17 PM - #Permalink
    0
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, November 28 2017, 05:21 PM - #Permalink
    0
    hi

    thanks for the screenshots. however I still don't see the problem. the LAST picture (invoice display), is that from the invoice with tax set to 9,975 or 9,98?

    I mean, in the picture where the tax is 9,975, the tax is calculated and display in 2 decimals. You want to display only 2 decimals, don't you? or you want to display 3?

    I mean, the numbers I see on https://www.dropbox.com/s/vzgduat6gydrle1/create_invoice.png?dl=0 are all correct... the final result is rounded to 2 decimals, as indicated by the Canadian dollar settings (second picture)
    The reply is currently minimized Show
  • Accepted Answer

    jmagne
    jmagne
    Offline
    Tuesday, November 28 2017, 05:49 PM - #Permalink
    0
    Problem is still present..
    Here is another set of screenshots with item amount of 1000$ because the 100$ was confusing with the currency rounding.

    When I create the invoice the taxe rate displayed in the edit field id 9,975% so this tax amount is 99,75$
    https://www.dropbox.com/s/yyfku90giso2f7x/create_v2.png?dl=0

    I hit the save button and go to order display and the tax amount is 99,8%
    https://www.dropbox.com/s/etcpntxkjo98k1p/display_v2.png?dl=0

    If I go back to order edit, the tax rate is rounded to 9,98% witch is wrong.
    https://www.dropbox.com/s/0hfzkkxyvy8mjsp/edit_v2.png?dl=0
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, November 29 2017, 05:08 PM - #Permalink
    0
    ok thanks, I see the problem now. When saving it is rounding down to 2 decimals.

    let me see if I can replicate this on my end.

    will keep you posted.
    The reply is currently minimized Show
  • Accepted Answer

    jmagne
    jmagne
    Offline
    Wednesday, November 29 2017, 06:00 PM - #Permalink
    0
    Awesome. Thank you!
    The reply is currently minimized Show
Your Reply