From 2edfb98b6a246e085d214355629d060f94f2fcf1 Mon Sep 17 00:00:00 2001 From: vasmaae Date: Tue, 24 Dec 2024 14:16:39 -0800 Subject: [PATCH] fix excel report with sum --- .../Reports/TableReport.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/PIbd-23_Gutorov_I.A._IT-Company/Reports/TableReport.cs b/PIbd-23_Gutorov_I.A._IT-Company/Reports/TableReport.cs index 2217019..7ec93e3 100644 --- a/PIbd-23_Gutorov_I.A._IT-Company/Reports/TableReport.cs +++ b/PIbd-23_Gutorov_I.A._IT-Company/Reports/TableReport.cs @@ -43,7 +43,7 @@ internal class TableReport { var data = _contractRepository .ReadContracts(customerId: customerId, dateFrom: startDate, dateTo: endDate) - .GroupBy(x => x.ConclusionDate) + .GroupBy(x => x.ExecutorFullName) .Select(x => new { x.First().ExecutorFullName, @@ -54,7 +54,7 @@ internal class TableReport .Union( _contractRepository .ReadContracts(customerId: customerId, dateFrom: startDate, dateTo: endDate) - .GroupBy(x => x.Deadline) + .GroupBy(x => x.ExecutorFullName) .Select(x => new { x.First().ExecutorFullName, @@ -69,12 +69,12 @@ internal class TableReport return new List() { item } .Union(data.Select(x => new string[] { x.ExecutorFullName, - x.Date.ToString(), - x.CountIn?.ToString() ?? string.Empty, - x.CountOut?.ToString() ?? string.Empty + x.Date.ToString("dd.MM.yyyy"), + x.CountIn?.ToString("N0") ?? string.Empty, + x.CountOut?.ToString("N0") ?? string.Empty })) .Union( - [["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(), data.Sum(x => x.CountOut ?? 0).ToString()]]) + [["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString("N0"), data.Sum(x => x.CountOut ?? 0).ToString("N0")]]) .ToList(); } }