From f8f7e7d3cfaed3a5e06b5c02588ab4d6a8137376 Mon Sep 17 00:00:00 2001 From: SamSys Date: Sat, 3 May 2025 20:12:05 +0330 Subject: [PATCH] report change --- .../Repository/ReportRepository.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/ReportRepository.cs b/CompanyManagment.EFCore/Repository/ReportRepository.cs index adfb2a3e..c7aa1925 100644 --- a/CompanyManagment.EFCore/Repository/ReportRepository.cs +++ b/CompanyManagment.EFCore/Repository/ReportRepository.cs @@ -1951,16 +1951,24 @@ public class ReportRepository : IReportRepository { var contractSigned = workshop.Contracts2.Count(x => x.Signature == "1"); var contractCreated = workshop.Contracts2.Count(); + int contractSignedPercent = 0; + if (contractSigned > 0) + { + contractSignedPercent = workshop.Contracts2.Any(x => x.Signature == "0") ? ((contractSigned * 100) / contractCreated) : 100; + } + else + { + contractSignedPercent = 0; + } - var checkoutSignedPercent = workshop.Contracts2.Any(x => x.Signature == "0") ? ((contractSigned * 100) / contractCreated) : 100; - if (checkoutSignedPercent < 100 && contractCreated > 0) + if (contractSignedPercent < 100 && contractCreated > 0) { var employeeNotDone = workshop.Contracts2.Where(x => x.Signature == "0").Select(l => new EmployeeNotDone() { Id = l.EmployeeId, - EmployeeFullName = workshop.LeftWorks.FirstOrDefault(x=>x.EmployeeId == l.EmployeeId)!.EmployeeFullName, + EmployeeFullName = workshop.LeftWorks.FirstOrDefault(x => x.EmployeeId == l.EmployeeId)!.EmployeeFullName, }).ToList(); return new workshopSearch() @@ -1968,7 +1976,7 @@ public class ReportRepository : IReportRepository Id = workshop.id, WorkshopFullName = workshop.WorkshopFullName, ArchiveCode = workshop.ArchiveCode, - ContractSignPercent = checkoutSignedPercent, + ContractSignPercent = contractSignedPercent, EmployeeNotDones = employeeNotDone }; }