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

Page 1 of 2
1.5.1.0. Incorrect calculation of subtotal on invoices
 
Micks
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-09-20
Amsterdam, The Netherlands
 

Hi there,

I’m having an issue with the way the subtotal on invoices is calculated.

On every invoice the shipping tax amount is added to the subtotal.

This is ONLY the case with the invoices. The subtotal in the cart, at checkout and on the order information is correct.

Any help would be greatly appreciated.
Thanks so much.

Image Attachments
invoice-totals.JPGorder-totals.JPG
 
Magento Community Magento Community
Magento Community
Magento Community
 
kenx
Jr. Member
 
Total Posts:  2
Joined:  2010-07-29
 

Hi I have the same issue and couldn’t get around of the glitch. Any advices would be very much appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
 
ryukyufire
Jr. Member
 
Total Posts:  21
Joined:  2010-07-02
Melbourne, Australia
 

I have the same issue.
Magento 1.5.1.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ryukyufire
Jr. Member
 
Total Posts:  21
Joined:  2010-07-02
Melbourne, Australia
 

I found the fix! See this bug post.
http://www.magentocommerce.com/bug-tracking/issue/?issue=11300

Thanks, toruben!

 
Magento Community Magento Community
Magento Community
Magento Community
 
kenx
Jr. Member
 
Total Posts:  2
Joined:  2010-07-29
 

Thanks for this update! But I found it’s still wrong amount in subtotal when customers used discount coupons…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Micks
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-09-20
Amsterdam, The Netherlands
 

After weeks of trying all sorts of things I finally gave up on this whole invoice thing.
I disabled the invoices in the back end and I’m now doing them by hand.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tizzalicious
Member
 
Avatar
Total Posts:  42
Joined:  2011-05-28
 

I am having the same problem.

The invoices are a mess, and they were one of the reasons I wanted a better system for my shop, it takes me way too much time to do them all by hand. I hope someone has a solution for this? I use discount codes a lot, so that part would have to be fixed too.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mark_logicspot
Jr. Member
 
Total Posts:  21
Joined:  2010-04-14
 

Does anyone know if this is fixed in 1.6 release?

I\’ve got a client who uses invoices and discounts and this is just terrible.  The code fix only goes half way and discounted invoices are still screwed.

Mark

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

Have anybody found a solution?

 
Magento Community Magento Community
Magento Community
Magento Community
 
gibbon
Jr. Member
 
Total Posts:  5
Joined:  2011-01-23
 

This bug is ridiculous, I couldn’t believe it would be display the wrong numbers.
It is fixed if you make the change in the link above (changes to tax.php and subtotal.php)
or apparently if you upgrade to magento 1.6.1 (October 19 2011)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Munich
Jr. Member
 
Total Posts:  9
Joined:  2010-10-27
 
gibbon - 20 October 2011 06:39 PM

This bug is ridiculous, I couldn’t believe it would be display the wrong numbers.
It is fixed if you make the change in the link above (changes to tax.php and subtotal.php)
or apparently if you upgrade to magento 1.6.1 (October 19 2011)

@gibbon: Did it fix the “discount” issue or only the other one?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Munich
Jr. Member
 
Total Posts:  9
Joined:  2010-10-27
 

This German thread fixes the issue:

http://www.magentocommerce.com/boards/viewthread/230901/#t343734

$allowedSubtotal $order->getSubtotal() - $order->getSubtotalInvoiced();
        
$baseAllowedSubtotal $order->getBaseSubtotal() -$order->getBaseSubtotalInvoiced();
        
$allowedSubtotalInclTax $allowedSubtotal $order->getTaxAmount() - $order->getTaxInvoiced();
        
$baseAllowedSubtotalInclTax $baseAllowedSubtotal $order->getBaseTaxAmount() - $order->getBaseTaxInvoiced();
        
        if (
$invoice->isLast()) {
            $subtotal 
$allowedSubtotal;
            
$baseSubtotal $baseAllowedSubtotal;
            
/*
            $subtotalInclTax = $allowedSubtotalInclTax;
            */
            
$baseSubtotalInclTax  $baseAllowedSubtotalInclTax;
        
else {
            $subtotal 
min($allowedSubtotal$subtotal);
            
$baseSubtotal min($baseAllowedSubtotal$baseSubtotal);
            
$subtotalInclTax min($allowedSubtotalInclTax$subtotalInclTax);
            
$baseSubtotalInclTax min($baseAllowedSubtotalInclTax$baseSubtotalInclTax);
        
}

Ich habe nur die Zeile $subtotalInclTax = $allowedSubtotalInclTax; deaktiviert, nun stimmen die Summen wieder!
(Mit der Änderung von Andreas funktioniert es auch)

ACHTUNG: schon gespeicherte Rechnungen werden nicht neu berechnet (der Wert wird in Tabelle: sales_flat_order im Feld subtotal_incl_tax gespeichert und könnte dort angepasst werden)

Für die, die es evtl. auch benötigen, habe ich die Datei zum entpacken (incl. Pfade) angehängt.
Es wird in app/code/local/Mage/Sales/Model/Order/Invoice/Total/ entpackt, damit wird die Originaldatei nicht geändert.

 
Magento Community Magento Community
Magento Community
Magento Community
 
daveloodts
Member
 
Avatar
Total Posts:  67
Joined:  2009-01-05
Belgium
 

i can confirm that the discount-bug in 1.6 is gone.
However, i either don’t like to upgrade Magento for such a minor thing. And having a big chance of messing up a live-shop.

That’s why you can only copy the following map out of 1.6; and paste it in your 1.5.

Mage - Sale - Model - Order - Invoice - Total.

okay, i’m not recommending doing any upgrades as it should. But this is a minor fault; just a wrong calculation code.
Bigger upgrades are always recommended, even if you must go throught hell to finish a magento upgrade without problems.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Micks
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-09-20
Amsterdam, The Netherlands
 
\"daveloodts\" -

i can confirm that the discount-bug in 1.6 is gone.
However, i either don\’t like to upgrade Magento for such a minor thing. And having a big chance of messing up a live-shop.

That\’s why you can only copy the following map out of 1.6; and paste it in your 1.5.

Mage - Sale - Model - Order - Invoice - Total.


okay, i\’m not recommending doing any upgrades as it should. But this is a minor fault; just a wrong calculation code.
Bigger upgrades are always recommended, even if you must go throught hell to finish a magento upgrade without problems.

Thank you all so much for your replies.

I went for the solution above.
Replaced all the files in Mage-Sales-Model-Order-Invoice-Total with the ones from 1.6.

And...it works perfectly!

Thanks Dave!

 
Magento Community Magento Community
Magento Community
Magento Community
 
mediagang
Sr. Member
 
Avatar
Total Posts:  111
Joined:  2008-01-16
Leeds UK
 

Above worked for me also. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Prikje
Jr. Member
 
Total Posts:  1
Joined:  2010-12-09
 

BTW wordt nu goed geplaats nadat ik uit de map van magento 1.6 naar magento 1.5 alles heb gekopieerd.

Mage - Sale - Model - Order - Invoice - Total.

Image Attachments
BTW pdf.PNG
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2