Magento – Tax credit of false. Amount only in print

Update vom 04.12.2014

Eine Anpassung, die wir gerade in einem 1.9er Shop (and, leider gibt es das Problem immernoch!) vorgenommen haben, konnte etwas helfen bei teilweisen Erstattungen. Und zwar wird hierfür die Tax.php aus dem Verzeichnis

app/code/core/Mage/Sales/Model/Order/Creditmemo/Total

in das Verzeichnis

app/code/local/Mage/Sales/Model/Order/Creditmemo/Total

kopiert und dann wie folgt angepasst. As. in line 47 should

$order = $creditmemo->getOrder();

be. Unter diese Zeile wird dann folgender Code eingefügt:

// Tax adjustment for credits
        $totalAdjusment = $creditmemo->getAdjustmentPositive()-$creditmemo->getAdjustmentNegative();
        $baseTotalAdjusment = $creditmemo->getBaseAdjustmentPositive()-$creditmemo->getBaseAdjustmentNegative();
       
        // Adjustment values already include tax in my case. Tax adjustment for credits
        $totalAdjusment = $creditmemo-($totalAdjusment*100) / 120;
        $baseTotalAdjusmentTax = $baseTotalAdjusment-($baseTotalAdjusment*100) / 120;

        $creditmemo->setGrandTotal($creditmemo->getGrandTotal()-$totalAdjusmentTax);
        $creditmemo->setBaseGrandTotal($creditmemo->getBaseGrandTotal()-$baseTotalAdjusmentTax);
        
        $totalTax  = $totalAdjusmentTax;
        $baseTotalTax  = $baseTotalAdjusmentTax;
        // ------------------------------------------

Anschließend sollten neue Gutschriften (dies geht nicht für frühere Gutschriften!) korrekt angezeigt werden.

Original Article:

It happened just, that an amount of tax credit is in no apparent reason only of a calculated expression is false. The system itself is all correct, but the expression is incorrect.

In our case, was only part of the home-country ordering credited. It was then correct in the expression of the net amount and the gross amount was true. Pointed out only the amount of tax equal to the amount of the original order. It was thus the amount of the order used for the credit.

This should be adjusted (for the expression), can intervene in the database in the appropriate place. It is the table sales_order_tax. This amount must be at the field the correct amount to be entered. This will then be displayed correctly on the printout. It will now be changed but also the amount printed on the invoice. So note, that the data is converted back, when everything is printed.

The reason, why this calculation is wrong, I could not even locate previously.

Supplement: We just had the problem (although, fortunately, in the test environment), the amounts that an extension completely confused diced. It was made of the net amount of the gross amount and then the amount of tax “new” Gross pulled off again. Thus absolutely nothing wrong. At first glance…for the second – and now it is really funny- would be the correct gross amount of the KK or passed to PayPal and have been calculated. Only the display in the backend and also on the bill gave completely contradict other amounts.
Now it was so check back into the database and search for the error, so that everything is correct. To change the display in the back was a short intervention by the search for order- or. Account numbers and then shift into the most sales_flat_XY all tables. But the devil is in the small thing. It was almost everything right. Only on the expression of the tax amount was still wrong and the lines were not correct amounts. In the back end was still wrong amount of lines.
Using the above instructions I was able to change the erroneous tax amount and then the line was missing amount. This then hides in the table and can not find sales_flat_invoice_item by catalog number or invoice number. I then searched for relevant articles and then compared. So then everything was followed correctly.

Used in Magento versions 1.4.1.1 and 1.4.1.0

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

3 comments on “Magento – Tax credit of false. Amount only in print”

  1. Thank you, dass ihr das hier veröffentlich habt, ich probiere das gleich mal aus. Ich verstehe nur nicht, wo die 120 herkommen, ist das der Umsatzsteuersatz 19% in 119 und ein wenig gerundet?

  2. Hi commercers,

    the credits / Billing adjustments in Magento are still flawed. Version: 1.9.4.0.

    Even with your code, the calculation is wrong. I think, it is because, I products 7% VAT. have in store…

    There are certainly tens of thousands of Magento installations and I can not but be the only, the tax consultant on the roof rises?

    Do you have any information about the problem?

    Regards,

    Tobias

    1. Moin Tobias!
      Running probably along the lines of “Where no plaintiff, as a programmer”. I assume, that this is so rare (Partial refund in a country and at a shop in which something like “Control” play a role), that there is no official / Developers interested.
      Im Code o.g. Code before the “120” played? Generally, it is but natural super uncomfortable if you have several tax rates.

      VG and good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *