Browse Source

Added total income

pull/110/head
malik masis 5 years ago
parent
commit
619dbe3be2
  1. 1
      services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderStatusDto.cs
  2. 4
      services/ordering/src/EShopOnAbp.OrderingService.Application/Orders/OrderAppService.cs

1
services/ordering/src/EShopOnAbp.OrderingService.Application.Contracts/Orders/OrderStatusDto.cs

@ -8,4 +8,5 @@ public class OrderStatusDto : EntityDto<Guid>
public int CountOfStatusOrder { get; set; }
public string OrderStatus { get; set; }
public int OrderStatusId { get; set; }
public decimal TotalIncome{ get; set; }
}

4
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;
}
}
Loading…
Cancel
Save