public void BuildWithCriteria(long countryID, long storeID, long?storeToWorldID, ViewType viewType, DateTime startDate, bool printPlannedValues, bool hideSums, SortField[] sortFields) { _viewType = viewType; if (startDate < DateTimeSql.DatetimeMin || startDate > DateTimeSql.DatetimeMax.AddDays(-7)) { throw new ValidationException("ErrorBeginDateIncorrect", null); } if (viewType == ViewType.Weekly) { if (startDate.DayOfWeek != DayOfWeek.Monday) { throw new ValidationException("ErrorBeginDateIncorrect", null); } _startDate = startDate; _endDate = DateTimeHelper.GetSunday(startDate); // Init subreport _weeklyPrintout = new WorldsTimeRecordingWeekly(); _weeklyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _weeklyPrintout; } else if (viewType == ViewType.Daily) { _viewDate = startDate; _startDate = DateTimeHelper.GetMonday(startDate); _endDate = DateTimeHelper.GetSunday(startDate); // Init subreport _dailyPrintout = new WorldsTimeRecordingDaily(); _dailyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _dailyPrintout; } _countryID = countryID; _storeID = storeID; _sortFields = sortFields; // Use A4 landscape for single world and A3 for all worlds if (storeToWorldID.HasValue) { _storeToWorldIDs = new long[] { storeToWorldID.Value }; PaperKind = PaperKind.A4; Landscape = true; } else { PaperKind = PaperKind.A3; Landscape = false; } _printPlannedValues = printPlannedValues; _hideSums = hideSums; PrintHeader(); LoadData(); // Init subreport if (viewType == ViewType.Weekly) { _weeklyPrintout = new WorldsTimeRecordingWeekly(); _weeklyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _weeklyPrintout; } else if (viewType == ViewType.Daily) { _dailyPrintout = new WorldsTimeRecordingDaily(); _dailyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _dailyPrintout; } }
public void BuildWithCriteria(long countryID, long storeID, long? storeToWorldID, ViewType viewType, DateTime startDate, bool printPlannedValues, bool hideSums, SortField[] sortFields) { _viewType = viewType; if (startDate < DateTimeSql.DatetimeMin || startDate > DateTimeSql.DatetimeMax.AddDays(-7)) { throw new ValidationException("ErrorBeginDateIncorrect", null); } if (viewType == ViewType.Weekly) { if (startDate.DayOfWeek != DayOfWeek.Monday) { throw new ValidationException("ErrorBeginDateIncorrect", null); } _startDate = startDate; _endDate = DateTimeHelper.GetSunday(startDate); // Init subreport _weeklyPrintout = new WorldsTimeRecordingWeekly(); _weeklyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _weeklyPrintout; } else if (viewType == ViewType.Daily) { _viewDate = startDate; _startDate = DateTimeHelper.GetMonday(startDate); _endDate = DateTimeHelper.GetSunday(startDate); // Init subreport _dailyPrintout = new WorldsTimeRecordingDaily(); _dailyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _dailyPrintout; } _countryID = countryID; _storeID = storeID; _sortFields = sortFields; // Use A4 landscape for single world and A3 for all worlds if (storeToWorldID.HasValue) { _storeToWorldIDs = new long[] {storeToWorldID.Value}; PaperKind = PaperKind.A4; Landscape = true; } else { PaperKind = PaperKind.A3; Landscape = false; } _printPlannedValues = printPlannedValues; _hideSums = hideSums; PrintHeader(); LoadData(); // Init subreport if (viewType == ViewType.Weekly) { _weeklyPrintout = new WorldsTimeRecordingWeekly(); _weeklyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _weeklyPrintout; } else if (viewType == ViewType.Daily) { _dailyPrintout = new WorldsTimeRecordingDaily(); _dailyPrintout.Init(_timeRecordingContext, _startDate, _printPlannedValues, _hideSums); subreportDetails.ReportSource = _dailyPrintout; } }