From b2c6ad25414de045d644d9f0dba106867687467e Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 15 Sep 2025 17:31:05 +0330 Subject: [PATCH] SickLeaving Bug on Static Checkout Fixed --- .../Repository/RollCallMandatoryRepository.cs | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index a4aaf37f..196b4245 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -1801,6 +1801,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll var startDateAndTime = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute); var startContract = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute); var endContract = new PersianDateTime(eyear, emonth, eday, 23, 59); + var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList(); for (var da = startDateAndTime; da <= endContract; da = da.AddHours(addHours)) { @@ -1824,14 +1825,20 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll end.Second); Console.WriteLine($"{currentDateFa} - {currentDateGr.Date} - start : {startComplex} end : {endComplex}"); - rollCallList.Add(new RollCallViewModel() + + var hasLeave = countLeves.Any(x => x.StartLeaveGr <= startComplex && x.EndLeaveGr >= endComplex); + if (!hasLeave) { - StartDate = startComplex, - EndDate = endComplex, - ShiftSpan = (endComplex - startComplex), - ShiftDate = currentDateGr, - ShiftEndWithoutRest = endComplex - }); + rollCallList.Add(new RollCallViewModel() + { + StartDate = startComplex, + EndDate = endComplex, + ShiftSpan = (endComplex - startComplex), + ShiftDate = currentDateGr, + ShiftEndWithoutRest = endComplex + }); + } + var endCal = end - start; @@ -1840,16 +1847,16 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll } - var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList(); - if (countLeves.Count > 0) - { - int totalDays = countLeves.Sum(x => int.Parse(x.LeaveHourses)); + + //if (countLeves.Count > 0) + //{ + // int totalDays = countLeves.Sum(x => int.Parse(x.LeaveHourses)); - int countRollCall = rollCallList.Count(); - int takRollCall = totalDays < countRollCall ? (countRollCall - totalDays) : 0; - rollCallList = rollCallList.Take(takRollCall).ToList(); - } + // int countRollCall = rollCallList.Count(); + // int takRollCall = totalDays < countRollCall ? (countRollCall - totalDays) : 0; + // rollCallList = rollCallList.Take(takRollCall).ToList(); + //} }