/// <summary>
        /// Performs the actual work of querying for the results.
        /// </summary>
        /// <param name="startDate">
        /// The start date.
        /// </param>
        /// <param name="endDate">
        /// The end date.
        /// </param>
        /// <returns>
        /// The <see cref="SalesOverTimeResult"/>.
        /// </returns>
        protected override SalesOverTimeResult GetResults(DateTime startDate, DateTime endDate)
        {
            var monthName = _textService.GetLocalizedMonthName(_culture, startDate.Month);

            var count = _invoiceService.CountInvoices(startDate, endDate);

            var totals = this.ActiveCurrencies.Select(c => new ResultCurrencyValue()
            {
                Currency = c.ToCurrencyDisplay(),
                Value    = startDate > DateTime.Today ? 0M : this._invoiceService.SumInvoiceTotals(startDate, endDate, c.CurrencyCode)
            }).ToList();

            return(new SalesOverTimeResult()
            {
                StartDate = startDate,
                EndDate = endDate,
                Month = monthName,
                Year = startDate.Year.ToString(),
                SalesCount = count,
                Totals = totals
            });
        }
        /// <summary>
        /// Performs the actual work of querying for the results.
        /// </summary>
        /// <param name="startDate">
        /// The start date.
        /// </param>
        /// <param name="endDate">
        /// The end date.
        /// </param>
        /// <param name="invoiceStatuses">
        /// The invoice statuses.
        /// </param>
        /// <returns>
        /// The <see cref="SalesOverTimeResult"/>.
        /// </returns>
        protected override SalesOverTimeResult GetResults(DateTime startDate, DateTime endDate, IEnumerable <InvStatus> invoiceStatuses)
        {
            var monthName       = _textService.GetLocalizedMonthName(_culture, startDate.Month);
            var checkedStatuses = invoiceStatuses.Where(x => x.Checked).Select(x => new InvoiceStatus {
                Key = x.Key
            }).ToList();

            var count = 0;

            if (checkedStatuses != null && checkedStatuses.Any())
            {
                count = _invoiceService.CountInvoices(startDate, endDate, checkedStatuses.Select(x => new InvoiceStatus {
                    Key = x.Key
                }).ToList());
            }
            else
            {
                count = _invoiceService.CountInvoices(startDate, endDate);
            }

            var totals = this.ActiveCurrencies.Select(c => new ResultCurrencyValue()
            {
                Currency = c.ToCurrencyDisplay(),
                Value    = startDate > DateTime.Today ? 0M : checkedStatuses != null && checkedStatuses.Any() ? _invoiceService.SumInvoiceTotals(startDate, endDate, c.CurrencyCode, checkedStatuses) : _invoiceService.SumInvoiceTotals(startDate, endDate, c.CurrencyCode)
            }).ToList();

            return(new SalesOverTimeResult()
            {
                StartDate = startDate,
                EndDate = endDate,
                Month = monthName,
                Year = startDate.Year.ToString(),
                SalesCount = count,
                Totals = totals
            });
        }