Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Fix #388 - (Admin) Bug Statistics in bestseller

supportd4eb9543cf11
diff --git a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
index e1a70c143..7aa797d9c 100644
--- a/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
+++ b/src/Business/Grand.Business.System/Services/Reports/OrderReportService.cs
@@ -396,7 +396,7 @@ namespace Grand.Business.System.Services.Reports
var query = from p in builderquery
from item in p.OrderItems
- select item;
+ select new {VendorId = item.VendorId, ProductId = item.ProductId, Quantity = item.Quantity, PriceInclTax = item.PriceInclTax, Rate = p.Rate };
if (!string.IsNullOrEmpty(vendorId))
{
@@ -405,7 +405,7 @@ namespace Grand.Business.System.Services.Reports
var queryItem = query.GroupBy(x => new { ProductId = x.ProductId }).Select(x => new BestsellersReportLine() {
ProductId = x.Key.ProductId,
- TotalAmount = x.Sum(y => y.PriceInclTax),
+ TotalAmount = x.Sum(y => y.PriceInclTax / y.Rate),
TotalQuantity = x.Sum(y => y.Quantity)
});