2

I have used "Magento ver. 1.9.2.1", I have added fixed discount to order items.

Using discount Order placed successfully and sales -> order shows correct order total but when create invoice then invoice total shows discount amount with tax.But I want to shows discount amount without tax.

For example order total with discount Rs 10 shown in figure: enter image description here

And when I create invoice for this order then discount amount(Rs 10) shows after adding tax 11.45 ( where tax 14.5% ) as shown in figure :

enter image description here

How to shows discount amount in create invoice template without adding tax?

  • Have you found any solution for above ? please share with me thanks in advance... – dp4solve Mar 25 '16 at 11:11
  • Hello @dp4solve, I have posted solution for this question. – Vinaya Maheshwari Mar 26 '16 at 5:22
2

I have changed discount calculation for quote items in sales_quote_collect_totals_after observer event as below :

Before :

...
foreach($quote->getAllItems() as $item)
{
    $discountpercent = $discountAmount * ( $item->getPrice() /  $quote->getSubtotal() );
    $basediscountpercent = $baseDiscount * ( $item->getBasePrice() / $quote->getBaseSubtotal() );

    $item->setDiscountAmount((($item->getDiscountAmount() + $discountpercent) * $item->getQty()));
    $item->setBaseDiscountAmount((($item->getBaseDiscountAmount() + $basediscountpercent) * $item->getQty()))->save();
}
...

After :

...
$grandTotal = $quote->getGrandTotal();
$baseGrandTotal = $quote->getBaseGrandTotal();
$shippingAmount = $quote->getShippingAddress()->getShippingAmount();

foreach($quote->getAllItems() as $item)
{
    $discountpercent = $discountAmount * ( $item->getPriceInclTax() /  ($grandTotal-$shippingAmount) );
    $basediscountpercent = $baseDiscount * ( $item->getBasePriceInclTax() / ($baseGrandTotal-$shippingAmount) );

    $item->setDiscountAmount((($item->getDiscountAmount() + $discountpercent) * $item->getQty()));
    $item->setBaseDiscountAmount((($item->getBaseDiscountAmount() + $basediscountpercent) * $item->getQty()))->save();
}
...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.