From d2d921995738d62321b352b9addb6ef2a27ceb68 Mon Sep 17 00:00:00 2001 From: Pipiaka Date: Sun, 22 Dec 2024 21:47:25 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BA=D0=BE=D1=80=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Accounting-Time-It-Company/Forms/FormEmployeeReport.cs | 7 +++++-- .../Accounting-Time-It-Company/Reports/ChartReport.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployeeReport.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployeeReport.cs index 9a182eb..45b60d2 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployeeReport.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Forms/FormEmployeeReport.cs @@ -1,6 +1,7 @@ using Accounting_Time_It_Company.Entities.Enums; using Accounting_Time_It_Company.Reports; using Accounting_Time_It_Company.Repositories; +using Accounting_Time_It_Company.Repositories.Implementations; using System; using System.Collections.Generic; using System.ComponentModel; @@ -18,12 +19,14 @@ namespace Accounting_Time_It_Company.Forms { private readonly IUnityContainer _container; - public FormEmployeeReport(IUnityContainer container, IEmployeeRepositories employeeRepositories) + public FormEmployeeReport(IUnityContainer container, IEmployeeRepositories employeeRepositories, IPostRepositories postRepositories) { InitializeComponent(); _container = container; - comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees().Where(x => x.PostId != (int)TypePost.Director).ToList(); + List DirectorId = postRepositories.ReadPosts().Where(y => y.NamePost == TypePost.Director).Select(y => y.Id).ToList(); + + comboBoxEmployee.DataSource = employeeRepositories.ReadEmployees().Where(x => DirectorId.Any(z => z != x.PostId)).ToList(); comboBoxEmployee.DisplayMember = "Name"; comboBoxEmployee.ValueMember = "Id"; } diff --git a/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/ChartReport.cs b/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/ChartReport.cs index 57c9570..28de296 100644 --- a/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/ChartReport.cs +++ b/Accounting-Time-It-Company/Accounting-Time-It-Company/Reports/ChartReport.cs @@ -33,7 +33,7 @@ internal class ChartReport { return _vacationRepositories .ReadVacations() - .Where(x => x.StartDate.Date == dateTime.Date) + .Where(x => x.StartDate.Date <= dateTime.Date && x.EndDate.Date >= dateTime.Date) .GroupBy(x => x.EmployeeId, (key, group) => new { Id = key, Count = group.Sum(x => (x.EndDate - x.StartDate).TotalHours)