From 649bf5338a48c163262652313a999a18d9e2b23b Mon Sep 17 00:00:00 2001 From: SamSys Date: Sat, 19 Apr 2025 19:05:07 +0330 Subject: [PATCH] HasShiftDuration - MandatoryCumpute --- CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs | 3 +++ CompanyManagment.Application/LeaveApplication.cs | 2 +- .../RollCallEmployeeStatusApplication.cs | 2 +- CompanyManagment.EFCore/Repository/LeaveRepository.cs | 4 +++- .../Repository/RollCallMandatoryRepository.cs | 5 +++++ 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs b/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs index 450305fc..2c69168f 100644 --- a/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs +++ b/CompanyManagment.App.Contracts/Leave/LeaveViewModel.cs @@ -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; } } \ No newline at end of file diff --git a/CompanyManagment.Application/LeaveApplication.cs b/CompanyManagment.Application/LeaveApplication.cs index 5928b143..2d486660 100644 --- a/CompanyManagment.Application/LeaveApplication.cs +++ b/CompanyManagment.Application/LeaveApplication.cs @@ -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; diff --git a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs index b9662278..36561ffe 100644 --- a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs @@ -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; diff --git a/CompanyManagment.EFCore/Repository/LeaveRepository.cs b/CompanyManagment.EFCore/Repository/LeaveRepository.cs index 8b7c8548..a3e580da 100644 --- a/CompanyManagment.EFCore/Repository/LeaveRepository.cs +++ b/CompanyManagment.EFCore/Repository/LeaveRepository.cs @@ -60,7 +60,9 @@ public class LeaveRepository : RepositoryBase, 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) diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index 7bcbcc29..0256af06 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -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 beatweenCheckout = leaveSearchResult.Where(x => x.StartLeaveGr >= contractStart && x.EndLeaveGr <= contractEnd).Select(x => new LeaveViewModel()