This commit is contained in:
gozareshgir
2026-01-31 15:38:47 +03:30
parent 26517c20d8
commit 6f0a579c33

View File

@@ -3929,8 +3929,18 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
foreach (var contract in seprationData)
{
var leftWork = leftWorks.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId && contract.ContarctStart <= x.LeftWorkDate && contract.ContractEnd >= x.StartWorkDate);
var start = new DateTime();
var end = new DateTime();
if (leftWork == null)
{
separation.Add(new ContractSeparationViewModel()
{
checker = false,
EmployeeId = contract.EmployeeId
});
continue;
}
for (var current = contract.ContarctStart; current <= contract.ContractEnd; current=current.AddDays(1))
{
if (start == new DateTime() && current >= checkoutSelectedStart && current <= checkoutSelectedEnd)
@@ -3942,6 +3952,27 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
{
end = current;
}
}
var leftFirstDayOfNextMonth = end.AddDays(1);
if (leftWork.HasLeft && (leftWork.LeftWorkDate <= == leftFirstDayOfNextMonth) &&
leftWork.LeftWorkDate > start)
{
var ContractEnd = leftWork.LeftWorkDate.AddDays(-1);
separation.Add(new ContractSeparationViewModel()
{
StartWorkDate = leftWork.StartWorkDate,
LeftWorkDate = leftWork.LeftWorkDate,
HasLeft = true,
ContarctStart = start.ToFarsi(),
ContractEnd = ContractEnd.ToFarsi(),
ContractStartGr = start,
ContractEndGr = ContractEnd,
checker = true,
EmployeeId = contract.EmployeeId
});
}
}