IOrderSearchService Totals and Sub Totals Reporting - Commerce 13.32.6.0

Vote:
 

using the IOrderSearchService we run reports for specific time periods and during some of those time periods we have sales and if the cart total is above 200 the customer gets free shipping.

We've noticed sometimes that the Total Revenue is sometimes less than the sub total.  Does anyone know how that's possible?

code snippet below

var orderFilter = new OrderSearchFilter
{
CreatedFrom = data.StartDate,
CreatedTo = data.EndDate.AddDays(1)
};


var orderSearchService = ServiceLocator.Current.GetInstance<IOrderSearchService>();
var searchResult = orderSearchService.FindPurchaseOrders(orderFilter);
completedTotalRev = searchResult.Orders.Sum(x => x.GetTotal()); //Sometimes lower than completedSubTotal
completedSubTotal = searchResult.Orders.Sum(x => x.GetSubTotal());



Thank you
Commerce 13.32.6.0

#293601
Edited, Dec 23, 2022 0:36
Vote:
 

bumping. anyone have any ideas? bug maybe?

#294784
Jan 16, 2023 22:54
Vote:
 

I believe getTotal is calculated by:

Total = subTotal + handlingTotal + ShippingSubTotal - OrderDiscountTotal - ShippingDiscountTotal

Lets say you have 3 orders of $200 and shipping discount of $20.

200+200+200 = $600 subtotal

200+ 200 + 200 - 20 - 20 - 20 = 540 total?

So ShippingDiscountTotal is messing up with the calculations?

#297350
Feb 27, 2023 21:06
Vote:
 

Yea the subtotal doesn't include discounts while the total does that's why it was showing like that.

#299837
Apr 10, 2023 15:40
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.