diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderStatusDto.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderStatusDto.cs index a7be72b4..589dabad 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderStatusDto.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderStatusDto.cs @@ -8,4 +8,5 @@ public class OrderStatusDto : EntityDto public int CountOfStatusOrder { get; set; } public string OrderStatus { get; set; } public int OrderStatusId { get; set; } + public decimal TotalIncome{ get; set; } } \ No newline at end of file diff --git a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs index 3cfee27f..bb494e40 100644 --- a/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs +++ b/services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs @@ -199,6 +199,10 @@ public class OrderAppService : ApplicationService, IOrderAppService .OrderBy(p => p.CountOfStatusOrder) .ToList(); + decimal totalIncome = orders.Sum(p => p.OrderItems.Sum(p => p.Units * p.UnitPrice)); + + orderStatus.Add(new OrderStatusDto() { OrderStatus = "Total Income", TotalIncome = totalIncome }); + return orderStatus; } } \ No newline at end of file