checkoutBug Fixed
This commit is contained in:
@@ -60,8 +60,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
_leaveRepository = leaveRepository;
|
||||
_holidayItemRepository = holidayItemRepository;
|
||||
_testDbContext = testDbContext;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#region OfficialChckout
|
||||
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
|
||||
@@ -108,8 +108,8 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
.Include(x => x.CustomizeWorkshopGroupSettings).FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
//اگر ساعت استراحت پرسنل وجود نداشت صفر است
|
||||
var breakTime = settings == null ? new BreakTime(false, new TimeOnly()) : settings.BreakTime;
|
||||
|
||||
var breakTimeEntity = settings == null ? new BreakTime(false, new TimeOnly()) : settings.BreakTime;
|
||||
var endOfFarvardin = "1404/01/31".ToGeorgianDateTime();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -145,16 +145,31 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
BreakTimeSpan = x.BreakTimeSpan
|
||||
}).ToList();
|
||||
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => new GroupedRollCalls()
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x =>
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(),
|
||||
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - CalculateBreakTime(x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
BreakTime = CalculateBreakTime(x.First().BreakTimeSpan, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
TimeSpan breakTime;
|
||||
if (contractStart > endOfFarvardin)
|
||||
{
|
||||
breakTime = CalculateBreakTime(
|
||||
x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)));
|
||||
}
|
||||
else
|
||||
{
|
||||
breakTime = CalculateBreakTime(breakTimeEntity, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)));
|
||||
}
|
||||
return new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value })
|
||||
.ToList(),
|
||||
HasFriday = x.Any(s =>
|
||||
s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday ||
|
||||
s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - breakTime,
|
||||
|
||||
BreakTime = breakTime,
|
||||
};
|
||||
}).OrderBy(x => x.CreationDate).ToList();
|
||||
}
|
||||
|
||||
@@ -728,52 +743,52 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب
|
||||
/// </summary>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="contractStart"></param>
|
||||
/// <param name="contractEnd"></param>
|
||||
/// <returns></returns>
|
||||
public (bool hasRollCall, TimeSpan sumOfSpan) GetRollCallWorkingSpan(long employeeId, long workshopId,
|
||||
DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
//bool hasRollcall =
|
||||
// _rollCallEmployeeRepository.HasRollCallRecord(employeeId, workshopId, contractStart, contractEnd);
|
||||
//if (!hasRollcall)
|
||||
// return (false, new TimeSpan());
|
||||
List<RollCallViewModel> rollCallResult;
|
||||
List<GroupedRollCalls> groupedRollCall;
|
||||
|
||||
|
||||
rollCallResult = _context.RollCalls.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date &&
|
||||
x.StartDate.Value.Date <= contractEnd.Date && x.EndDate != null).Select(x => new RollCallViewModel()
|
||||
{
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
ShiftSpan = (x.EndDate.Value - x.StartDate.Value),
|
||||
CreationDate = x.ShiftDate,
|
||||
BreakTimeSpan = x.BreakTimeSpan
|
||||
}).ToList();
|
||||
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(),
|
||||
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - CalculateBreakTime(x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
BreakTime = CalculateBreakTime(x.First().BreakTimeSpan, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
}).OrderBy(x => x.CreationDate).ToList();
|
||||
/// <summary>
|
||||
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب
|
||||
/// </summary>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="workshopId"></param>
|
||||
/// <param name="contractStart"></param>
|
||||
/// <param name="contractEnd"></param>
|
||||
/// <returns></returns>
|
||||
public (bool hasRollCall, TimeSpan sumOfSpan) GetRollCallWorkingSpan(long employeeId, long workshopId,
|
||||
DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
//bool hasRollcall =
|
||||
// _rollCallEmployeeRepository.HasRollCallRecord(employeeId, workshopId, contractStart, contractEnd);
|
||||
//if (!hasRollcall)
|
||||
// return (false, new TimeSpan());
|
||||
List<RollCallViewModel> rollCallResult;
|
||||
List<GroupedRollCalls> groupedRollCall;
|
||||
|
||||
|
||||
TimeSpan sumSpans = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
return (true, sumSpans);
|
||||
}
|
||||
rollCallResult = _context.RollCalls.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date &&
|
||||
x.StartDate.Value.Date <= contractEnd.Date && x.EndDate != null).Select(x => new RollCallViewModel()
|
||||
{
|
||||
StartDate = x.StartDate,
|
||||
EndDate = x.EndDate,
|
||||
ShiftSpan = (x.EndDate.Value - x.StartDate.Value),
|
||||
CreationDate = x.ShiftDate,
|
||||
BreakTimeSpan = x.BreakTimeSpan
|
||||
}).ToList();
|
||||
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(),
|
||||
HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - CalculateBreakTime(x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
BreakTime = CalculateBreakTime(x.First().BreakTimeSpan, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))),
|
||||
|
||||
}).OrderBy(x => x.CreationDate).ToList();
|
||||
|
||||
|
||||
TimeSpan sumSpans = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
return (true, sumSpans);
|
||||
}
|
||||
|
||||
|
||||
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd, string shiftwork, bool hasRollCall, CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
@@ -939,19 +954,19 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
|
||||
|
||||
//public static TimeSpan CalculateBreakTime(BreakTime breakTime, TimeSpan sumOneDaySpan)
|
||||
//{
|
||||
// if (breakTime.BreakTimeType != BreakTimeType.WithTime)
|
||||
// return new TimeSpan();
|
||||
public static TimeSpan CalculateBreakTime(BreakTime breakTime, TimeSpan sumOneDaySpan)
|
||||
{
|
||||
if (breakTime.BreakTimeType != BreakTimeType.WithTime)
|
||||
return new TimeSpan();
|
||||
|
||||
// var breakTimeSpan = breakTime.BreakTimeValue.ToTimeSpan();
|
||||
var breakTimeSpan = breakTime.BreakTimeValue.ToTimeSpan();
|
||||
|
||||
// if (breakTimeSpan * 2 >= sumOneDaySpan)
|
||||
// return new TimeSpan();
|
||||
if (breakTimeSpan * 2 >= sumOneDaySpan)
|
||||
return new TimeSpan();
|
||||
|
||||
// return breakTimeSpan; ;
|
||||
return breakTimeSpan; ;
|
||||
|
||||
//}
|
||||
}
|
||||
public static TimeSpan CalculateBreakTime(TimeSpan breakTimeSpan, TimeSpan sumOneDaySpan)
|
||||
{
|
||||
if (breakTimeSpan * 2 >= sumOneDaySpan)
|
||||
@@ -2090,7 +2105,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
var starTimeSingel1 = Convert.ToDateTime(shift1Start);
|
||||
var endTimeSingel2 = Convert.ToDateTime(shift1End);
|
||||
|
||||
bool hasRestTime = false;
|
||||
bool hasRestTime = false;
|
||||
|
||||
|
||||
shift1StartGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, starTimeSingel1.Hour, starTimeSingel1.Minute, 0);
|
||||
@@ -2099,92 +2114,92 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
if (shift1EndGr.TimeOfDay < shift1StartGr.TimeOfDay)
|
||||
shift1EndGr = shift1EndGr.AddDays(1);
|
||||
|
||||
var shiftEndWithoutRest = shift1EndGr;
|
||||
var shiftEndWithoutRest = shift1EndGr;
|
||||
|
||||
var shiftSpan = (shift1EndGr - shift1StartGr);
|
||||
if (restTime > TimeSpan.Zero && shiftSpan >= restTime)
|
||||
{
|
||||
hasRestTime = true;
|
||||
shift1EndGr = shift1EndGr.Subtract(restTime);
|
||||
shiftSpan = (shift1EndGr - shift1StartGr);
|
||||
|
||||
}
|
||||
var shiftSpan = (shift1EndGr - shift1StartGr);
|
||||
if (restTime > TimeSpan.Zero && shiftSpan >= restTime)
|
||||
{
|
||||
hasRestTime = true;
|
||||
shift1EndGr = shift1EndGr.Subtract(restTime);
|
||||
shiftSpan = (shift1EndGr - shift1StartGr);
|
||||
|
||||
if (!leaveSearchResult.Any(x => x.StartLeaveGr < shift1EndGr && x.EndLeaveGr > shift1StartGr && x.PaidLeaveType =="روزانه"))
|
||||
{
|
||||
var hourseLeaveTypeResult = leaveSearchResult.FirstOrDefault(x =>
|
||||
x.StartLeaveGr < shift1EndGr && x.EndLeaveGr > shift1StartGr && x.PaidLeaveType == "ساعتی");
|
||||
if (hourseLeaveTypeResult == null)
|
||||
{
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = shift1StartGr,
|
||||
EndDate = shift1EndGr,
|
||||
ShiftSpan = shiftSpan,
|
||||
ShiftDate = shift1StartGr,
|
||||
}
|
||||
|
||||
if (!leaveSearchResult.Any(x => x.StartLeaveGr < shift1EndGr && x.EndLeaveGr > shift1StartGr && x.PaidLeaveType == "روزانه"))
|
||||
{
|
||||
var hourseLeaveTypeResult = leaveSearchResult.FirstOrDefault(x =>
|
||||
x.StartLeaveGr < shift1EndGr && x.EndLeaveGr > shift1StartGr && x.PaidLeaveType == "ساعتی");
|
||||
if (hourseLeaveTypeResult == null)
|
||||
{
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = shift1StartGr,
|
||||
EndDate = shift1EndGr,
|
||||
ShiftSpan = shiftSpan,
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = shiftEndWithoutRest
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (hourseLeaveTypeResult.StartLeaveGr <= shift1StartGr && hourseLeaveTypeResult.EndLeaveGr < shift1EndGr)
|
||||
{
|
||||
//leave <-------------------->
|
||||
//shift <---------------------------------->
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = hourseLeaveTypeResult.EndLeaveGr,
|
||||
EndDate = shift1EndGr,
|
||||
ShiftSpan = (shift1EndGr - hourseLeaveTypeResult.EndLeaveGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = shiftEndWithoutRest
|
||||
if (hourseLeaveTypeResult.StartLeaveGr <= shift1StartGr && hourseLeaveTypeResult.EndLeaveGr < shift1EndGr)
|
||||
{
|
||||
//leave <-------------------->
|
||||
//shift <---------------------------------->
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = hourseLeaveTypeResult.EndLeaveGr,
|
||||
EndDate = shift1EndGr,
|
||||
ShiftSpan = (shift1EndGr - hourseLeaveTypeResult.EndLeaveGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = shiftEndWithoutRest
|
||||
|
||||
});
|
||||
}
|
||||
else if (hourseLeaveTypeResult.StartLeaveGr > shift1StartGr && hourseLeaveTypeResult.EndLeaveGr < shift1EndGr)
|
||||
{
|
||||
//leave <-------------------->
|
||||
//shift <---------------------------------->
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = shift1StartGr,
|
||||
EndDate = hourseLeaveTypeResult.StartLeaveGr,
|
||||
ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift1StartGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = hourseLeaveTypeResult.StartLeaveGr
|
||||
});
|
||||
}
|
||||
else if (hourseLeaveTypeResult.StartLeaveGr > shift1StartGr && hourseLeaveTypeResult.EndLeaveGr < shift1EndGr)
|
||||
{
|
||||
//leave <-------------------->
|
||||
//shift <---------------------------------->
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = shift1StartGr,
|
||||
EndDate = hourseLeaveTypeResult.StartLeaveGr,
|
||||
ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift1StartGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = hourseLeaveTypeResult.StartLeaveGr
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = hourseLeaveTypeResult.EndLeaveGr,
|
||||
EndDate = shift1EndGr,
|
||||
ShiftSpan = (shift1EndGr - hourseLeaveTypeResult.EndLeaveGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = shiftEndWithoutRest
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = hourseLeaveTypeResult.EndLeaveGr,
|
||||
EndDate = shift1EndGr,
|
||||
ShiftSpan = (shift1EndGr - hourseLeaveTypeResult.EndLeaveGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = shiftEndWithoutRest
|
||||
|
||||
});
|
||||
}
|
||||
else if (hourseLeaveTypeResult.StartLeaveGr > shift1StartGr && hourseLeaveTypeResult.EndLeaveGr >= shift1EndGr)
|
||||
{
|
||||
//leave <-------------------->
|
||||
//shift <---------------------------------->
|
||||
});
|
||||
}
|
||||
else if (hourseLeaveTypeResult.StartLeaveGr > shift1StartGr && hourseLeaveTypeResult.EndLeaveGr >= shift1EndGr)
|
||||
{
|
||||
//leave <-------------------->
|
||||
//shift <---------------------------------->
|
||||
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = shift1StartGr,
|
||||
EndDate = hourseLeaveTypeResult.StartLeaveGr,
|
||||
ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift1StartGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = hourseLeaveTypeResult.StartLeaveGr
|
||||
result.Add(new RollCallViewModel()
|
||||
{
|
||||
BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero,
|
||||
StartDate = shift1StartGr,
|
||||
EndDate = hourseLeaveTypeResult.StartLeaveGr,
|
||||
ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift1StartGr),
|
||||
ShiftDate = shift1StartGr,
|
||||
ShiftEndWithoutRest = hourseLeaveTypeResult.StartLeaveGr
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -3021,13 +3036,13 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
|
||||
var endFarvarding = new DateTime(2025, 4, 20);
|
||||
if (contractStart>endFarvarding)
|
||||
if (contractStart > endFarvarding)
|
||||
{
|
||||
customizeWorkshopEmployeeSettings=_context.CustomizeWorkshopEmployeeSettings
|
||||
customizeWorkshopEmployeeSettings = _context.CustomizeWorkshopEmployeeSettings
|
||||
.AsSplitQuery().AsNoTracking().FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
|
||||
customizeWorkshopSettings =_context.CustomizeWorkshopSettings.AsNoTracking().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
customizeWorkshopSettings = _context.CustomizeWorkshopSettings.AsNoTracking().FirstOrDefault(x => x.WorkshopId == workshopId);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -3982,40 +3997,40 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<LoanInstallmentViewModel> LoanInstallmentForCheckout(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
return _context.Loans
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.SelectMany(x => x.LoanInstallments)
|
||||
.Where(i => i.InstallmentDate >= contractStart && i.InstallmentDate <= contractEnd && i.IsActive == IsActive.True)
|
||||
.Select(x => new LoanInstallmentViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Month = x.Month,
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.AmountForMonth.ToMoney(),
|
||||
Year = x.Year,
|
||||
AmountDouble = x.AmountForMonth,
|
||||
RemainingAmount = _context.Loans.SelectMany(l => l.LoanInstallments).Where(i => i.LoanId == x.LoanId && i.IsActive == IsActive.True && i.InstallmentDate > x.InstallmentDate)
|
||||
.Sum(i => i.AmountForMonth).ToMoney(),
|
||||
LoanAmount = _context.Loans.FirstOrDefault(l => l.id == x.LoanId).Amount.ToMoney()
|
||||
}).ToList();
|
||||
}
|
||||
public List<LoanInstallmentViewModel> LoanInstallmentForCheckout(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
return _context.Loans
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.SelectMany(x => x.LoanInstallments)
|
||||
.Where(i => i.InstallmentDate >= contractStart && i.InstallmentDate <= contractEnd && i.IsActive == IsActive.True)
|
||||
.Select(x => new LoanInstallmentViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Month = x.Month,
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.AmountForMonth.ToMoney(),
|
||||
Year = x.Year,
|
||||
AmountDouble = x.AmountForMonth,
|
||||
RemainingAmount = _context.Loans.SelectMany(l => l.LoanInstallments).Where(i => i.LoanId == x.LoanId && i.IsActive == IsActive.True && i.InstallmentDate > x.InstallmentDate)
|
||||
.Sum(i => i.AmountForMonth).ToMoney(),
|
||||
LoanAmount = _context.Loans.FirstOrDefault(l => l.id == x.LoanId).Amount.ToMoney()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<SalaryAidViewModel> SalaryAidsForCheckout(long employeeId, long workshopId, DateTime checkoutStart, DateTime checkoutEnd)
|
||||
{
|
||||
return _context.SalaryAids
|
||||
.Where(x => x.CalculationDate >= checkoutStart && x.CalculationDate <= checkoutEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
CalculationDateTimeGe = x.CalculationDate,
|
||||
CalculationDateTimeFa = x.CalculationDate.ToFarsi(),
|
||||
Id = x.id
|
||||
}).ToList();
|
||||
}
|
||||
public List<SalaryAidViewModel> SalaryAidsForCheckout(long employeeId, long workshopId, DateTime checkoutStart, DateTime checkoutEnd)
|
||||
{
|
||||
return _context.SalaryAids
|
||||
.Where(x => x.CalculationDate >= checkoutStart && x.CalculationDate <= checkoutEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
CalculationDateTimeGe = x.CalculationDate,
|
||||
CalculationDateTimeFa = x.CalculationDate.ToFarsi(),
|
||||
Id = x.id
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private void CreateRewardForBirthDay(long employeeId, long workshopId, double amount, int month, int year,
|
||||
DateTime contractStart)
|
||||
|
||||
@@ -152,16 +152,16 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
public List<CheckoutDailyRollCallViewModel> GetEmployeeRollCallsForMonth(long employeeId, long workshopId, DateTime startMonthDay, DateTime endMonthDay)
|
||||
{
|
||||
var firstDayOfMonth = $"{startMonthDay.ToFarsi().Substring(0,8)}01".ToGeorgianDateTime();
|
||||
|
||||
var endFarvardin = "1404/01/31".ToGeorgianDateTime();
|
||||
//گرفتن ساعت استراحت پرسنل از تنظیمات
|
||||
#region breakTime
|
||||
//BaseCustomizeEntity settings = _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery().FirstOrDefault(x =>
|
||||
// x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
////اگر ساعت استراحت پرسنل وجود نداشت صفر است
|
||||
//var breakTime = settings == null ? new BreakTime(false, new TimeOnly()) : settings.BreakTime;
|
||||
BaseCustomizeEntity settings = _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery().FirstOrDefault(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId);
|
||||
//اگر ساعت استراحت پرسنل وجود نداشت صفر است
|
||||
var breakTime = settings == null ? new BreakTime(false, new TimeOnly()) : settings.BreakTime;
|
||||
#endregion
|
||||
|
||||
var rollCalls = _context.RollCalls.Where(x =>
|
||||
var rollCalls = _context.RollCalls.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate != null && x.EndDate != null && x.RollCallModifyType != RollCallModifyType.Undefined &&
|
||||
x.ShiftDate.Date >= startMonthDay && x.ShiftDate.Date <= endMonthDay).ToList();
|
||||
|
||||
@@ -224,26 +224,30 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
|
||||
var rollCallTimeSpanPerDay =
|
||||
new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => (y.EndDate - y.StartDate)!.Value.Ticks));
|
||||
var breakTimePerDay = RollCallMandatoryRepository.CalculateBreakTime(x.First().BreakTimeSpan, rollCallTimeSpanPerDay);
|
||||
TimeSpan breakTimePerDay ;
|
||||
if(startMonthDay>endFarvardin)
|
||||
breakTimePerDay= RollCallMandatoryRepository.CalculateBreakTime(x.First().BreakTimeSpan, rollCallTimeSpanPerDay);
|
||||
else
|
||||
breakTimePerDay = RollCallMandatoryRepository.CalculateBreakTime(breakTime, rollCallTimeSpanPerDay);
|
||||
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = orderedRollcalls.FirstOrDefault().StartDate.Value.ToString("HH:mm"),
|
||||
EndDate1 = orderedRollcalls.FirstOrDefault().EndDate.Value.ToString("HH:mm"),
|
||||
{
|
||||
StartDate1 = orderedRollcalls.FirstOrDefault().StartDate.Value.ToString("HH:mm"),
|
||||
EndDate1 = orderedRollcalls.FirstOrDefault().EndDate.Value.ToString("HH:mm"),
|
||||
|
||||
StartDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.StartDate?.ToString("HH:mm") ?? "",
|
||||
EndDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.EndDate?.ToString("HH:mm") ?? "",
|
||||
StartDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.StartDate?.ToString("HH:mm") ?? "",
|
||||
EndDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.EndDate?.ToString("HH:mm") ?? "",
|
||||
|
||||
TotalhourseSpan = rollCallTimeSpanPerDay - breakTimePerDay,
|
||||
TotalhourseSpan = rollCallTimeSpanPerDay - breakTimePerDay,
|
||||
|
||||
BreakTimeTimeSpan = breakTimePerDay,
|
||||
BreakTimeTimeSpan = breakTimePerDay,
|
||||
|
||||
DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(),
|
||||
RollCallDateFa = x.Key.Date.ToFarsi(),
|
||||
DateTimeGr = x.Key.Date,
|
||||
IsSliced = x.Count() > 2,
|
||||
IsAbsent = false
|
||||
};
|
||||
DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(),
|
||||
RollCallDateFa = x.Key.Date.ToFarsi(),
|
||||
DateTimeGr = x.Key.Date,
|
||||
IsSliced = x.Count() > 2,
|
||||
IsAbsent = false
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -24,35 +24,35 @@
|
||||
border-radius: 10px;
|
||||
height: 28cm;
|
||||
margin: 3mm 5mm 0 5mm; ">
|
||||
<div class="row" dir="rtl">
|
||||
<div class="col-xs-3 d-inline-block"><fieldset style="border: 1px solid black; border-radius: 15px; padding: 1px 15px 1px 15px; margin-top: 5px; width: 70%; font-size: 12px; text-align: center;"> @Model.ContractNo</fieldset></div>
|
||||
<div class="col-xs-6 d-inline-block text-center">
|
||||
<p style="font-size: 18px; font-family: 'IranNastaliq' !important; margin-top:0 !important;">بسمه تعالی</p>
|
||||
<p style="font-size: 15px; font-weight: bold; margin: 2px;">فیش حقوقی و رسید پرداخت حقوق</p>
|
||||
</div>
|
||||
<div class="col-xs-3 d-inline-block"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="headerInfo">
|
||||
<div class="row" style="font-size: 12px; margin-bottom: 3px;">
|
||||
<div class="col-xs-12" style="padding: 0 10px;">
|
||||
<div style="display: flex;align-items: center;border-bottom: 1px solid #000000 !important;height: 23px;">
|
||||
<div style="width: 34%; padding: 3px 0 !important;">
|
||||
<div>
|
||||
<span class="cusSpanTitle">اینجانب</span>
|
||||
<span>@Model.EmployeeFullName</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 22%; padding: 3px 0 !important; border-right: 1px solid #000000 !important;">
|
||||
<span class="cusSpanTitle">نام پدر<span>:</span></span>
|
||||
@if (string.IsNullOrWhiteSpace(@Model.FathersName))
|
||||
{
|
||||
<span style="visibility: hidden">""</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@Model.FathersName</span>
|
||||
<div class="row" dir="rtl">
|
||||
<div class="col-xs-3 d-inline-block"><fieldset style="border: 1px solid black; border-radius: 15px; padding: 1px 15px 1px 15px; margin-top: 5px; width: 70%; font-size: 12px; text-align: center;"> @Model.ContractNo</fieldset></div>
|
||||
<div class="col-xs-6 d-inline-block text-center">
|
||||
<p style="font-size: 18px; font-family: 'IranNastaliq' !important; margin-top:0 !important;">بسمه تعالی</p>
|
||||
<p style="font-size: 15px; font-weight: bold; margin: 2px;">فیش حقوقی و رسید پرداخت حقوق</p>
|
||||
</div>
|
||||
<div class="col-xs-3 d-inline-block"></div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="headerInfo">
|
||||
<div class="row" style="font-size: 12px; margin-bottom: 3px;">
|
||||
<div class="col-xs-12" style="padding: 0 10px;">
|
||||
<div style="display: flex;align-items: center;border-bottom: 1px solid #000000 !important;height: 23px;">
|
||||
<div style="width: 34%; padding: 3px 0 !important;">
|
||||
<div>
|
||||
<span class="cusSpanTitle">اینجانب</span>
|
||||
<span>@Model.EmployeeFullName</span>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 22%; padding: 3px 0 !important; border-right: 1px solid #000000 !important;">
|
||||
<span class="cusSpanTitle">نام پدر<span>:</span></span>
|
||||
@if (string.IsNullOrWhiteSpace(@Model.FathersName))
|
||||
{
|
||||
<span style="visibility: hidden">""</span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@Model.FathersName</span>
|
||||
|
||||
}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user