Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

PDF invoice, making product price include tax/vat
 
michlaustn
Jr. Member
 
Total Posts:  10
Joined:  2010-05-13
 

Hello,

I have set up the Magento site so that at the checkout the product price is inclusive of tax/vat.  The same applies to the invoice that is emailed to the customer.  In the back-end the item price on the invoice is shown as including tax.  However when I attempt to generate a PDF invoice, the product price does not include tax.  E.g. the selling price of a pair of trainers is £90.00, the email shows the product price as £90.00 as does the checkout and back-end.  However the PDF invoice shows the price as £75.00.

How can I make the PDF invoice reflect the same values as the other invoices?  E.g. make the product price show as £90.00 not £75.00

Thank in advance,

Michael Austin.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Patrix
Jr. Member
 
Total Posts:  28
Joined:  2009-11-27
 

Hi Michael,
that’s how I managed to resolve this issue:

You have to update this file: app\code\core\mage\sales\model\order\pdf\items\invoice\default.php

find the row relative to the Price:

'text'  => 'text'  => $order->formatPriceTxt($item->getTaxAmount()),

and replace with:

'text'  => $order->formatPriceTxt($item->getPrice() + $item->getTaxAmount()),

then the one relative to the SubTotal, replace:

'text'  => $order->formatPriceTxt($item->getRowTotal()),

with:

'text'  => $order->formatPriceTxt($item->getRowTotal() + $item->getTaxAmount()),

In order not to modify the core, you can override the change copying the file into your template folder:
app\code\local\mage\sales\model\order\pdf\items\invoice\default.php

This will keep the change untouched after updates.

Hope this helps,
Patrix

 
Magento Community Magento Community
Magento Community
Magento Community
 
FreerkB
Jr. Member
 
Total Posts:  3
Joined:  2010-04-29
 

This is not a complete solution. It does not work when the quantity not equals to 1, nor does it work when product discount is applied.

Why is the price incl tax and the rowtotal incl tax not available here? This would make the invoice generation much simpler.

 
Magento Community Magento Community
Magento Community
Magento Community
 
FreerkB
Jr. Member
 
Total Posts:  3
Joined:  2010-04-29
 

I found the solution, working for quantities > 1 and also working if discounts are applied:

Change the line:

$order->formatPriceTxt($item->getPrice()),

into:

$order->formatPriceTxt($item->getPriceInclTax()),

and change the line:

$order->formatPriceTxt($item->getRowTotal()),

into:

$order->formatPriceTxt($item->getRowTotalInclTax()),
 
Magento Community Magento Community
Magento Community
Magento Community
 
AKA_KALLE
Jr. Member
 
Total Posts:  19
Joined:  2008-08-25
 
FreerkB - 08 March 2011 01:59 AM

I found the solution, working for quantities > 1 and also working if discounts are applied:

Change the line:

$order->formatPriceTxt($item->getPrice()),

into:

$order->formatPriceTxt($item->getPriceInclTax()),

and change the line:

$order->formatPriceTxt($item->getRowTotal()),

into:

$order->formatPriceTxt($item->getRowTotalInclTax()),

Worked like a charm. thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
frowningpanda
Jr. Member
 
Total Posts:  3
Joined:  2011-01-26
 

I have been looking for a solution for this problem forever! And this worked, finally! Thank you for sharing!

 
Magento Community Magento Community
Magento Community
Magento Community
 
andysaksena
Member
 
Total Posts:  44
Joined:  2010-05-16
 

great this worked for me. Just copied the default.php from core to local and made the changes as shown above and it works.
Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
JMC1985
Jr. Member
 
Total Posts:  5
Joined:  2010-07-11
 

great simple easy fix! worked a charm also

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikevyas
Jr. Member
 
Total Posts:  8
Joined:  2012-12-09
usa
 

Thanks for the great answer. It is really working. It is the simplest solution. It helps me so much .

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top