PrestaShop Forums: PDF Invoice Total (tax excl.) incorrect - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

NYC

Vous parlez français ? par ici !


PDF Invoice Total (tax excl.) incorrect


PDF Invoice Total (tax excl.) incorrect

#1 MrBaseball34

    PrestaShop Fanatic

  • 07 May 2010
  • Members
  • PipPipPipPip
  • 1107 posts

Posted 29 July 2010 - 01:09 PM

Product is a downloadable product. Price is $9.99

Why would Total (tax excl) be $9.98 on the PDF invoice?


Total products (tax excl.) : $9.99
Total products (tax incl.) : $10.81
Total (tax excl.) : $9.98
Total (tax incl.) : $10.81


Where would I look that up?

#2

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 29 July 2010 - 04:09 PM

will be todo with rounding.

Look at preferences in your back office and you can select the different types of rounding. either superior, inferior or classical.

Unfortunately rounding of numbers has always been problematic and needs careful consideration in software development. If its any consolation the financial industry probably spends millions every year on this very same problem when testing and implementing bespoke software, and many a developer has cursed the outcomes of rounding up and down on decimal places.

#3

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 29 July 2010 - 04:12 PM

It just really looks bad to customers, regardless of the reasons.

so what's the difference? They have no explanations:

Quote

You can choose the rounding of prices, rounding always superior, inferior or classical rounding.


#4

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 29 July 2010 - 04:30 PM

BTW, I'm using PS v1.3.1.1

With superior rounding:

Total products (tax excl.) : $10.00
Total products (tax incl.) : $10.82
Total (tax excl.) : $9.99
Total (tax incl.) : $10.82


With classical rounding:

Total products (tax excl.) : $9.99
Total products (tax incl.) : $10.81
Total (tax excl.) : $9.98
Total (tax incl.) : $10.81


With inferior rounding:

Total products (tax excl.) : $9.98
Total products (tax incl.) : $10.81
Total (tax excl.) : $9.98
Total (tax incl.) : $10.81


I just don't see how it can be so difficult to get this correct when there is only ONE product in the cart.

I can understand if there are many items in the cart but not when there is only one and the price is 9.99000.
It should not round at all if there is only one item in the cart, for sure.

I also don't see how it can get two different totals with either superior or classical if there is only one item.

The "Total products (tax excl.)" should be the EXACT same as "Total (tax excl.)"

While inferior rounding produces the same values, it does NOT reflect the actual price of the product.

I see this as a BUG...

#5

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 29 July 2010 - 05:31 PM

it is a bug.

Personally not delved much into the actual code of pretashop.

But going by your initial testing my first assumption would be that the rounding of the variables are not standardized. i.e. looks like calculations and rounding from including tax price whereas elswhere in code it rounding from excluding tax

PS the below is all purely speculation as i have not looked closely at undelying code and only based on experience for normal reasons this happens.

eg looking at your prices and tax the tax rate is 8.25% so 9.99 +8.25% tax = 10.814175 so rounding depending where it down will be different when working out total excluding tax depending how it is done. eg working out price before tax will work out different from 10.814175 than would with 10.81. These should be done as too seperate calculations from the initial pre-tax prices but im assuming they are all worked out from the initial rounded up and down figure totals then rounding conducted again on them.


As said in previous post though finding the right balance so works out perfect 100% of the time is a developers nightmare are times

#6

    PrestaShop Newbie

  • 15 Dec 2011
  • Members
  • Pip
  • 0 posts

Posted 29 July 2010 - 05:49 PM

It is my understanding that the Tools:displayPrice() function is what is being used. If they are feeding in an already rounded price to that, it will be rounded again.

Me thinks that they should always use raw amounts for calculations, including calculating the totals to 6 decimal places like it is set in the shop, and round only for display. It looks like they may be doing something different.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users