From e3edb20bb8374d13bf515cf28e4e8e0fbaec58c5 Mon Sep 17 00:00:00 2001 From: Pipiaka Date: Sat, 14 Dec 2024 19:11:02 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B6=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Reports/TableReport.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/TableReport.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/TableReport.cs index 3df4443..0aa09ea 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/TableReport.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/TableReport.cs @@ -1,4 +1,5 @@  +using Accounting_Time_It_Company.Entities; using Accounting_Time_It_Company.Repositories; using Microsoft.Extensions.Logging; @@ -29,10 +30,9 @@ internal class TableReport try { new ExcelBuilder(filePath) - .AddHeader("Сводка по движению корма", 0, 4) + .AddHeader("Сводка по работе сотрудников", 0, 4) .AddParagraph("за период", 0) - .AddTable([10, 10, 15, 15], GetData(feedId, startDate, - endDate)).Build(); + .AddTable([10, 10, 15, 15], GetData(feedId, startDate, endDate)).Build(); return true; } catch (Exception ex) @@ -42,42 +42,42 @@ internal class TableReport } } - private List GetData(int feedId, DateTime startDate, DateTime endDate) + private List GetData(int employeeId, DateTime startDate, DateTime endDate) { - var data = _feedReplenishmentRepository - .ReadFeedReplenishment() - .Where(x => x.DateReceipt >= startDate && x.DateReceipt <= - endDate && x.FeedFeedReplenishments.Any(y => y.FeedId == feedId)) + var data = _typeJobRepositories + .ReadTypeJobs() + .Where(x => x.Date >= startDate && x.Date <= endDate + && (x.WorkTimesDevelop.Any(y => y.EmployeeId == employeeId) + || x.WorkTimesManager.Any(y => y.EmployeeId == employeeId))) .Select(x => new { - x.EmployeeId, - Date = x.DateReceipt, - CountIn - = x.FeedFeedReplenishments.FirstOrDefault(y => y.FeedId == feedId)?.Count, - CountOut = (int?)null + x.ProductId, + x.Date, + CountInManager = x.WorkTimesManager.FirstOrDefault(y => y.EmployeeId == employeeId)?.Hours, + CountOutManager = (int?)null, + CountInDevelop = x.WorkTimesDevelop.FirstOrDefault(y => y.EmployeeId == employeeId)?.Hours, + CountOutDevelop = (int?)null }) - .Union( - _feedingAnimalRepository - .ReadFeedingAnimals() - .Where(x => x.FeedingDate >= startDate && - x.FeedingDate <= endDate && x.FeedId == feedId) + .Union(_vacationRepositories + .ReadVacations() + .Where(x => x.StartDate >= startDate + && x.StartDate <= endDate + && x.EmployeeId == employeeId) .Select(x => new { x.EmployeeId, - Date = - x.FeedingDate, + Date = x.StartDate, CountIn = (int?)null, CountOut = (int?)x.Ration })) .OrderBy(x => x.Date); + return new List() { item } - .Union( - data - .Select(x => new string[] { -x.EmployeeId.ToString(), x.Date.ToString(), x.CountIn?.ToString() ?? -string.Empty, x.CountOut?.ToString() ?? string.Empty})) + .Union(data.Select(x => new string[] { + x.EmployeeId.ToString(), x.Date.ToString(), x.CountIn?.ToString() ?? + string.Empty, x.CountOut?.ToString() ?? string.Empty})) .Union( [["Всего", "", data.Sum(x => x.CountIn ?? 0).ToString(), -data.Sum(x => x.CountOut ?? 0).ToString()]]) + data.Sum(x => x.CountOut ?? 0).ToString()]]) .ToList(); } }