Пример #1
0
        // Working with local dates and times
        public static void GenerateInvoicesForLastWeek(MerchantTribeApplication app)
        {
            Utilities.DateRange lastWeekRange = new Utilities.DateRange();
            lastWeekRange.RangeType = Utilities.DateRangeType.LastWeek;
            lastWeekRange.CalculateDatesFromType(DateTime.Now);
            List <DateTime> daysOfMonth   = new List <DateTime>();
            DateTime        counter       = lastWeekRange.StartDate;
            int             endDayOfMonth = lastWeekRange.EndDate.Day;

            while (counter.Day != endDayOfMonth)
            {
                daysOfMonth.Add(counter);
                counter = counter.AddDays(1);
            }

            daysOfMonth.Add(lastWeekRange.EndDate);
            GenerateInvoicesForDates(daysOfMonth, app);
        }
Пример #2
0
        private void AddLastWeekData(WeeklySummary result, DateTime currentLocalTime, Orders.OrderService orderService)
        {
            Utilities.DateRange rangeData = new Utilities.DateRange();
            rangeData.RangeType = Utilities.DateRangeType.LastWeek;
            rangeData.CalculateDatesFromType(currentLocalTime);

            int totalCount = 0;
            List <Orders.OrderTransaction> data = orderService.Transactions.FindForReportByDateRange(rangeData.StartDate.ToUniversalTime(),
                                                                                                     rangeData.EndDate.ToUniversalTime(),
                                                                                                     _StoreId, int.MaxValue, 1, ref totalCount);

            decimal m = 0;
            decimal t = 0;
            decimal w = 0;
            decimal r = 0;
            decimal f = 0;
            decimal s = 0;
            decimal y = 0;

            foreach (Orders.OrderTransaction ot in data)
            {
                switch (ot.TimeStampUtc.ToLocalTime().DayOfWeek)
                {
                case DayOfWeek.Monday:
                    m += ot.AmountAppliedToOrder;
                    break;

                case DayOfWeek.Tuesday:
                    t += ot.AmountAppliedToOrder;
                    break;

                case DayOfWeek.Wednesday:
                    w += ot.AmountAppliedToOrder;
                    break;

                case DayOfWeek.Thursday:
                    r += ot.AmountAppliedToOrder;
                    break;

                case DayOfWeek.Friday:
                    f += ot.AmountAppliedToOrder;
                    break;

                case DayOfWeek.Saturday:
                    s += ot.AmountAppliedToOrder;
                    break;

                case DayOfWeek.Sunday:
                    y += ot.AmountAppliedToOrder;
                    break;
                }
            }

            result.MondayLast    = m;
            result.TuesdayLast   = t;
            result.WednesdayLast = w;
            result.ThursdayLast  = r;
            result.FridayLast    = f;
            result.SaturdayLast  = s;
            result.SundayLast    = y;
        }
Пример #3
0
		protected void TicketRunDateRangePastSelect(object sender, EventArgs e)
		{
			this.SelectedDateRange = Utilities.DateRange.Old;
			this.PageNumber = 1;
			LoadMyTickets();
		}
Пример #4
0
		protected override void LoadViewState(object savedState)
		{
			base.LoadViewState(savedState);
			if (this.ViewState["PageNumber"] != null) PageNumber = (int)this.ViewState["PageNumber"];
			if (this.ViewState["SelectedDateRange"] != null) SelectedDateRange = (Utilities.DateRange)this.ViewState["SelectedDateRange"];
		}
Пример #5
0
		protected void TicketRunDateRangeCurrentSelect(object sender, EventArgs e)
		{
			this.SelectedDateRange = Utilities.DateRange.Current;
			this.PageNumber = 1;
			LoadPromoterTicketRuns();
		}
Пример #6
0
        private void AddLastWeekData(WeeklySummary result, DateTime currentLocalTime, Orders.OrderService orderService)
        {
            Utilities.DateRange rangeData = new Utilities.DateRange();
            rangeData.RangeType = Utilities.DateRangeType.LastWeek;
            rangeData.CalculateDatesFromType(currentLocalTime);

            int totalCount = 0;
            List<Orders.OrderTransaction> data = orderService.Transactions.FindForReportByDateRange(rangeData.StartDate.ToUniversalTime(),
                                                                    rangeData.EndDate.ToUniversalTime(),
                                                                    _StoreId, int.MaxValue, 1, ref totalCount);

            decimal m = 0;
            decimal t = 0;
            decimal w = 0;
            decimal r = 0;
            decimal f = 0;
            decimal s = 0;
            decimal y = 0;

            foreach (Orders.OrderTransaction ot in data)
            {
                switch (ot.TimeStampUtc.ToLocalTime().DayOfWeek)
                {
                    case DayOfWeek.Monday:
                        m += ot.AmountAppliedToOrder;
                        break;
                    case DayOfWeek.Tuesday:
                        t += ot.AmountAppliedToOrder;
                        break;
                    case DayOfWeek.Wednesday:
                        w += ot.AmountAppliedToOrder;
                        break;
                    case DayOfWeek.Thursday:
                        r += ot.AmountAppliedToOrder;
                        break;
                    case DayOfWeek.Friday:
                        f += ot.AmountAppliedToOrder;
                        break;
                    case DayOfWeek.Saturday:
                        s += ot.AmountAppliedToOrder;
                        break;
                    case DayOfWeek.Sunday:
                        y += ot.AmountAppliedToOrder;
                        break;
                }
            }

            result.MondayLast = m;
            result.TuesdayLast = t;
            result.WednesdayLast = w;
            result.ThursdayLast = r;
            result.FridayLast = f;
            result.SaturdayLast = s;
            result.SundayLast = y;
        }
Пример #7
0
        // Working with local dates and times
        public static void GenerateInvoicesForThisWeek(MerchantTribeApplication app)
        {
            Utilities.DateRange thisWeekRange = new Utilities.DateRange();
            thisWeekRange.RangeType = Utilities.DateRangeType.ThisWeek;
            thisWeekRange.CalculateDatesFromType(DateTime.Now);
            List<DateTime> daysOfMonth = new List<DateTime>();
            DateTime counter = thisWeekRange.StartDate;
            int endDayOfMonth = thisWeekRange.EndDate.Day;

            while (counter.Day != endDayOfMonth)
            {
                daysOfMonth.Add(counter);
                counter = counter.AddDays(1);
            }

            daysOfMonth.Add(thisWeekRange.EndDate);
            GenerateInvoicesForDates(daysOfMonth, app);
        }