If this is your first visit, check our documentation. To post, register or login.
Forums / Code Matters / Bug Reports / Admin invoice does not display item price including tax correctly

Admin invoice does not display item price including tax correctly

Started by richard7315 on 4 Sep 2024, 11:36 AM · Views: 2,327

Results 1 to 5 of 5
4 Sep 2024, 11:36 AM
#1
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Admin invoice does not display item price including tax correctly

Hi,
I am currently testing a temporary 2.0.1 site. I have enabled the “Display Prices with Tax” setting in Admin > Configuration > My Store. Tax is set at 20%.

The price inc tax on the admin invoice is not displaying correctly. It is showing the same price as the ex tax price. Please see attached screenshot showing the invoice.

Please can someone look into this and confirm if it is a bug.
Many thanks
Richard

4 Sep 2024, 12:41 PM
#2
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Admin invoice does not display item price including tax correctly

There are two settings. Enable the "Display Prices with Tax in Admin" setting.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

4 Sep 2024, 2:54 PM
#3
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,760
Plugin Contributions:
56

Re: Admin invoice does not display item price including tax correctly

It looks good in 2.1.0 alpha 2. I haven't had a chance to test in 2.0.1.

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

4 Sep 2024, 3:51 PM
#4
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: Admin invoice does not display item price including tax correctly

Hi swguy
Thank you for your reply – I was attempting to replicate a rounding error and I had forgotten to enable both settings.

I now have both settings enabled and the ex/inc tax figures are now displaying. Unfortunately, there seems to be a minor bug which causes the item sub-total to not match the order sub-total.

This issue occurs when the item quantity is 2 or more. Please see the attached admin invoice screenshot which shows an example of the problem.

Item sub-total displays as £6.76

Order sub-total displays as £6.77

The order confirmation emails only show the £6.77 figure for both sub-totals, which is correct.

The sub-totals displayed in the basket and checkout confirmation pages are also correct (£6.77).

Unfortunately the figures are incorrect on the checkout success page – the second screenshot shows how the figures appear.

I believe this is a rounding error in the calculations for the item sub-total. It appears the item price inc tax may have been rounded before being multiplied by 2.
I have noticed this issue on many occasions on a live site (1.5.7c). When multiple items are purchased the difference can be larger than 1 penny. It would be much appreciated if you could look into this issue.
Many thanks
Richard

18 Nov 2024, 5:52 PM
#5
richard7315 avatar

richard7315

New Zenner

Join Date:
Jul 2017
Location:
West Midlands, UK
Posts:
51
Plugin Contributions:
1

Re: Admin invoice does not display item price including tax correctly

Hi,
I have just been testing the new beta version of 2.1.0. Unfortunately it appears the rounding issue is still present in the latest version (the screenshots in my last post show the issue).

I believe the following code in admin/invoice.php needs to be changed from:

if (DISPLAY_PRICE_WITH_TAX_ADMIN == 'true') {
                $priceIncTax = $currencies->format(zen_round(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']), $decimals) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
            

  } else {
                $priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);
              }

To the following:

$priceIncTax = $currencies->format(zen_add_tax($order->products[$i]['final_price'], $order->products[$i]['tax']) * $order->products[$i]['qty'], true, $order->info['currency'], $order->info['currency_value']);

It would be much appreciated if the Zen Cart team could double check this fix and apply it to future versions.

I’m unsure which file needs to be edited to fix the checkout success page rounding issue (see screenshot 2 from my last post). If anyone has any idea where the checkout success totals are displayed/rounded please let me know.

Many thanks
Richard