FirstDayOfMonth
This commit is contained in:
@@ -151,6 +151,7 @@ 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();
|
||||
|
||||
//گرفتن ساعت استراحت پرسنل از تنظیمات
|
||||
#region breakTime
|
||||
@@ -169,8 +170,8 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.EndLeave.Date >= startMonthDay.Date &&
|
||||
x.StartLeave.Date <= endMonthDay.Date).ToList();
|
||||
|
||||
var year = Convert.ToInt32(startMonthDay.ToFarsi().Substring(0, 4));
|
||||
var month = Convert.ToInt32(startMonthDay.ToFarsi().Substring(5, 2));
|
||||
var year = Convert.ToInt32(firstDayOfMonth.ToFarsi().Substring(0, 4));
|
||||
var month = Convert.ToInt32(firstDayOfMonth.ToFarsi().Substring(5, 2));
|
||||
var firstDayOfCurrentMonth = new DateTime(year, month, 1, new PersianCalendar());
|
||||
|
||||
|
||||
@@ -193,7 +194,7 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
HolidayYear = startMonthDay.ToFarsiYear()
|
||||
});
|
||||
//all the dates from start to end, to be compared with present days to get absent dates
|
||||
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date).ToList();
|
||||
var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => firstDayOfCurrentMonth.AddDays(offset).Date).ToList();
|
||||
|
||||
var absentRecords = completeDaysList
|
||||
.ExceptBy(rollCalls.Select(x => x.ShiftDate.Date), y => y.Date)
|
||||
|
||||
Reference in New Issue
Block a user