SickLeaving Bug on Static Checkout Fixed

This commit is contained in:
SamSys
2025-09-15 17:31:05 +03:30
parent 8eded713da
commit b2c6ad2541

View File

@@ -1801,6 +1801,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, 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<long, RollCall>, 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<long, RollCall>, 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();
//}
}