HasShiftDuration - MandatoryCumpute

This commit is contained in:
SamSys
2025-04-19 19:05:07 +03:30
parent 52e1d0a78b
commit 649bf5338a
5 changed files with 13 additions and 3 deletions

View File

@@ -24,4 +24,7 @@ public class LeaveViewModel
public DateTime CreationDate { get; set; }
public int DayCounter { get; set; }
public TimeSpan ShiftDuration { get; set; }
public bool HasShiftDuration { get; set; }
}

View File

@@ -175,7 +175,7 @@ public class LeaveApplication : ILeaveApplication
var shiftStartDateTime = new DateTime(new DateOnly(), shiftStart);
var shiftEndDateTime = new DateTime(new DateOnly(), shiftEnd);
if (shiftEndDateTime < shiftStartDateTime)
if (shiftEndDateTime <= shiftStartDateTime)
shiftEndDateTime = shiftEndDateTime.AddDays(1);
shiftDuration = shiftEndDateTime - shiftStartDateTime;
hasShiftDuration = true;

View File

@@ -98,7 +98,7 @@ namespace CompanyManagment.Application
//368 پیتزا امیر آماده سازی
//367 پیتزا امیر رستوران
//286 مرکز توان بخشی رسالت *
bool skipRollCallByWorkshopId = workshopId is 11 or 585 or 604 or 605 or 368 or 367 or 286;
bool skipRollCallByWorkshopId = workshopId is 11 or 585 or 604 or 605 or 368 or 367;
//#if DEBUG
// skipRollCallByWorkshopId = workshopId is 11 or 585 or 604 or 605 or 368 or 367;

View File

@@ -60,7 +60,9 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
IsAccepted = x.IsAccepted,
Decription = x.Decription,
Year = x.Year,
Month = x.Month
Month = x.Month,
HasShiftDuration = x.HasShiftDuration,
ShiftDuration = x.ShiftDuration,
});
if (searchModel.WorkshopId != 0 && searchModel.EmployeeId != 0)

View File

@@ -129,6 +129,11 @@ CreateWorkingHoursTemp command, bool holidayWorking)
var leaveSearchResult = _leaveRepository.search(leaveSearch);
if (leaveSearchResult.Count > 0)
{
//if (leaveSearchResult.Any(x => x.HasShiftDuration))
//{
// TimeSpan totalLeave = new TimeSpan(leaveSearchResult.Sum(x => x.ShiftDuration.Ticks));
//}
int leavingDayCout = 0;
//مرخصی های مابین
List<LeaveViewModel> beatweenCheckout = leaveSearchResult.Where(x => x.StartLeaveGr >= contractStart && x.EndLeaveGr <= contractEnd).Select(x => new LeaveViewModel()