Hi Mari,
I want to sumary to make your step clearly:
Your Item = 800 (item price) + 200 (25% tax) = 1000
Shipping = 59 (shipping cost) + 11.8 (20% tax)
=> Total = 1070.8
This is number in your shipping sumary, so look like the Order Total in Order Summary is not correct. The Order Total didn't include Shipping Tax.
Could I ask you what version you're using?
I guess that you did customize the item price or ordergroup calculator or tax calculator? Could you show us your customization?
If your code is too complex, I suggest that you could contact support team and send them your customization code for better solution.
Regards,
/Son Do
Hi Son,
The way I see it is that the order total is correct, but the shipment summary is wrong.
Item price is 1000 NOK (25 % tax makes 800 +200).
Shipping cost is 59 NOK (25 % tax makes 47,2 + 11,8).
I am running latest version, but has had this issue in several versions.
In my SiteOrderFormCalculator I am overriding CalculateSubTotal so that it returns total ex tax:
protected override Money CalculateSubtotal(IOrderForm orderForm, Currency currency) { decimal sum = 0; foreach (IShipment x in orderForm.Shipments) { foreach (ILineItem item in x.LineItems) { if (!item.IsGift && item.Properties.ContainsKey(Commerce.Metadata.LineItem.PriceExVat) && item.Properties[Commerce.Metadata.LineItem.PriceExVat] != null) sum += (decimal)item.Properties[Commerce.Metadata.LineItem.PriceExVat] * item.Quantity; } } return new Money(sum, currency); }
and I also CalculateTotal:
protected override Money CalculateTotal(IOrderForm orderForm, IMarket market, Currency currency) { return this.GetSubTotal(orderForm, currency) // ex tax + _taxFactory.GetLineItemTaxTotal(orderForm) // taxes for line items + _shippingCalculator.GetShippingCost(orderForm, market, currency);// inc tax }
In my custom tax calculator I have debugged and checked that the correct amounts are returned (for simplicity I will leave out the _taxFactory impl):
protected override Money CalculateShippingTaxTotal(IShipment shipment, IMarket market, Currency currency) { var taxAmount = _taxFactory.GetShippingTaxAmount(shipment, market, currency); return new Money(taxAmount, currency); } protected override Money CalculateTaxTotal(IOrderForm orderForm, IMarket market, Currency currency) { // line item taxes var totalTaxes = _taxFactory.GetLineItemTaxTotal(orderForm); // we only care about first shipment var shipment = orderForm.Shipments.FirstOrDefault(); if(shipment != null) totalTaxes += CalculateShippingTaxTotal(shipment, market, currency); return totalTaxes; }
Hi Mari,
I'm right about your prices are including tax. If your debug value is correct then your calculators are good.
I didn't reproduce your case but currently Commerce Manager doesn't support price that included tax. That might be the reason the order sumary and shipment sumary are inconsistent.
The price that included tax will be fully support in the furture, we had planning for this.
/Son Do
Yes, my prices includes taxes. This: currently Commerce Manager doesn't support price that included tax cannot be correct.
In all commerce projects we have had prices incl tax, and we changed tax calculation workflows to support it.
Now using the new api and custom order/tax calculations, it is not supported? That sounds like a bug to me?
Hi Mari,
Current Commerce Manager couldn't verify the price or shipping cost is including tax or not. Now, it depends on how order was calculated
You're right about Shipment summary: Shipment total = item subtotal (1000) + shipping cost (59) + tax (11.80)
The issue is the shipping cost including tax and the shipping cost should back to real value 47,2.
You could modify IShippingCalculator.GetShippingCost to get real valu ShippingCost = ShippingCostIncludedTax (rate.Money) - ShippingTax (ITaxCalculator.GetShippingTaxTotal)
Refer to these document for customing IShippingCalculator.GetShippingCost:
http://world.episerver.com/documentation/developer-guides/commerce/orders/calculating-orders/
http://world.episerver.com/documentation/Class-library/?documentId=commerce/10/1E5ABECD
I tried doing that, but that will have a side effect (look at screeshot below) => the Shipping total in the order view display shows amount without tax.
I am creating orders using the new order api, but I have issues with numbers not adding up in Commerce Manager.
So lets say I have a product that costs 1000 NOK (incl VAT) and the shipping cost is 59 (incl VAT).
When creating the order I can see that calculated totals for are correct (see screenshot below), same when looking inside CM and order overview (see screenshot).
But the shipment summary is not correct. It seem to add shipping cost + tax so that shipment total becomes wrong (see screenshot).
Is this a bug inside CM or am I doing something wrong?