Exemple #1
0
        protected virtual async Task <IPagedList <SalesSummaryReportLine> > GetSalesSummaryReportAsync(SalesSummarySearchModel searchModel)
        {
            //get parameters to filter orders
            var orderStatus    = searchModel.OrderStatusId > 0 ? (OrderStatus?)searchModel.OrderStatusId : null;
            var paymentStatus  = searchModel.PaymentStatusId > 0 ? (PaymentStatus?)searchModel.PaymentStatusId : null;
            var startDateValue = !searchModel.StartDate.HasValue ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(searchModel.StartDate.Value, await _dateTimeHelper.GetCurrentTimeZoneAsync());
            var endDateValue = !searchModel.EndDate.HasValue ? null
                : (DateTime?)_dateTimeHelper.ConvertToUtcTime(searchModel.EndDate.Value, await _dateTimeHelper.GetCurrentTimeZoneAsync()).AddDays(1);

            //get sales summary
            var salesSummary = await _orderReportService.SalesSummaryReportAsync(
                createdFromUtc : startDateValue,
                createdToUtc : endDateValue,
                os : orderStatus,
                ps : paymentStatus,
                billingCountryId : searchModel.BillingCountryId,
                groupBy : (GroupByOptions)searchModel.SearchGroupId,
                categoryId : searchModel.CategoryId,
                productId : searchModel.ProductId,
                manufacturerId : searchModel.ManufacturerId,
                storeId : searchModel.StoreId,
                pageIndex : searchModel.Page - 1, pageSize : searchModel.PageSize);

            return(salesSummary);
        }