Author Topic: Totals mismatch  (Read 1357 times)

maxxer

  • Jr. Member
  • **
  • Posts: 76
Totals mismatch
« on: February 11, 2013, 16:53:37 pm »
Hi.

In a shop of ours we're having problems with totals: decimals mismatch...
Given the summary in the attached table, at first you can see that tax sum doesn't match.

On the background, I have a taxable amount of 312,53369, which summed to the tax amount (65,5837) results in a total of 378,11739, which is the unrounded total. But if I consider the taxable amount and apply VAT (21% in our case), the result is 378,16576, which is a 0.04€ gap from the printed value on the order or invoice. This difference is too much, and customers are complaining.

How can I make the visual values being usable in manual calculations? Should I set in configuration all prices to 2 decimals?
thanks

[attachment cleanup by admin]

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8891
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Totals mismatch
« Reply #1 on: February 11, 2013, 17:35:19 pm »
but 21% of 312,53369 = 65,632074 (not 65,5837) = 378,16576 (there's the 4 cents)

where does the 65,5837 come from?

312.53    add VAT 21% (65.63 ) =   378.16

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

maxxer

  • Jr. Member
  • **
  • Posts: 76
Re: Totals mismatch
« Reply #2 on: February 11, 2013, 17:41:41 pm »
where does the 65,5837 come from?

Taxable (288.56369) + Shipping taxable (23.97) = 312.53369

These are from vm database...
thanks

maxxer

  • Jr. Member
  • **
  • Posts: 76
Re: Totals mismatch
« Reply #3 on: February 11, 2013, 18:01:14 pm »
I tried placing the same order with 2 decimals calc all over the config but still having problems. Now in the database I have:
Taxable: 288.57000
Shipment: 23.97
SUM: 312,54
SUM + 21% -> 378,1734
SUM + 65.58 = 378,12

Order tax: 60.55000
Shipment tax: 5.03000
SUM: 65.58

Order total: 378,12


So I still have a mismatch in manual calc....

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8891
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Totals mismatch
« Reply #4 on: February 11, 2013, 18:11:42 pm »
Order tax: 60.55000

this is wrong - it should be 60.5997

ship tax correct

can you display all the pricing on your product pages to find out at which stage this is happening?

i.e is the tax incl. price correct on the product details - in the cart etc etc -
do a simple round number product so any error is easy to see..
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

maxxer

  • Jr. Member
  • **
  • Posts: 76
Re: Totals mismatch
« Reply #5 on: February 11, 2013, 18:26:12 pm »
From a quick search in the db I have one row which could be the culprit:
Product item price: 4.54545
Product tax: 0.95
product_item_price+product_tax: 5.49545
product_quantity: 6
(product_item_price+product_tax)*product_quantity: 32.97270
product_subtotal_with_tax: 33.00

Now the problem is to understand why...
Other lines are ok, even other lines with qty>1

maxxer

  • Jr. Member
  • **
  • Posts: 76
Re: Totals mismatch
« Reply #6 on: February 11, 2013, 18:30:22 pm »
Apparently item tax is calculated using all the decimals, while doing the same with only two decimals returns the 3 missing €cents ...

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8891
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Totals mismatch
« Reply #7 on: February 11, 2013, 19:08:01 pm »
is this only happening on multi item orders?
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

maxxer

  • Jr. Member
  • **
  • Posts: 76
Re: Totals mismatch
« Reply #8 on: February 12, 2013, 11:09:48 am »
is this only happening on multi item orders?
Apparently it's a matter of quantity.
Given the following constants:
Code: [Select]
Product item price: 4.54545
Product tax: 0.95000
Price + tax: 5.49545 (A)
For the different quantities:
QTYA * QTYproduct_subtotal_with_tax
15.495455.50000
210.9909011.00000
316.4863516.50000

As you can see starting from 3 items the issue is raised. While a 0.01 is acceptable, increasing the quantity increases the error...
How can I mitigate it?
thanks!

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8891
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.4.2
Re: Totals mismatch
« Reply #9 on: February 12, 2013, 16:10:46 pm »
this is all done in administrator/components/com_virtuemart/helpers/calculationh.php &
administrator/components/com_virtuemart/models/product.php

you need to start echoing out each stage to try and get an idea where the rounding errors are occurring

e.g. in the function getProductPrices() etc...
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

maxxer

  • Jr. Member
  • **
  • Posts: 76
Re: Totals mismatch
« Reply #10 on: February 12, 2013, 17:16:52 pm »
I will, but it looks strange to me that nobody else ever experienced this issue...