Пример #1
0
        public JsonResult GetLinesTotalStatistic(int year)
        {
            DateTime date   = new DateTime(year, 1, 1);
            var      result = new List <LinesTotalStatisticDto>();

            using (var logic = new LineLogic()) {
                for (int i = 0; i < 12; i++)
                {
                    result.Add(logic.GetLinesTotalStatistic(date.AddMonths(i), date.AddMonths(i + 1)));
                }
            }
            return(new JsonResult {
                Data = result
            });
        }
Пример #2
0
        public HttpResponseMessage GetReportXL(DateTime startDate, DateTime endDate, int summaryYear)
        {
            using (var l = new LineLogic()) {
                var      data        = l.GetAllLinesPeriodActivities(startDate, endDate);
                DateTime date        = new DateTime(summaryYear, 1, 1);
                var      dataSummary = new List <LinesTotalStatisticDto>();
                for (int i = 0; i < 12; i++)
                {
                    dataSummary.Add(l.GetLinesTotalStatistic(date.AddMonths(i), date.AddMonths(i + 1)));
                }

                var book  = ExcellWriter.NewBook();
                var sheet = ExcellWriter.NewReportSheet(book, DEBS.Translate("Lines.Report"), "Lines Report from " + startDate.ToString("dd-MM-yyyy") + " to " + endDate.ToString("dd-MM-yyyy"), 2);
                int row   = ExcellWriter.AddLinesPeriodStatisticToSheet(sheet, 4,
                                                                        l.GetAllLinesPeriodActivities(startDate, endDate),
                                                                        l.GetLineTotalStatisticByDays(startDate, endDate)
                                                                        );
                ExcellWriter.AddLinesSummaryStatisticToSheet(sheet, row + 1, dataSummary);
                return(ExcellWriter.BookToHTTPResponseMsg(
                           book,
                           "Lines Report (" + startDate.ToString("dd-MM-yyyy") + " - " + endDate.ToString("dd-MM-yyyy") + ")"
                           ));
            }
        }