Compare commits

..

2 Commits

Author SHA1 Message Date
925f43214c fix checkout bug 2025-06-02 22:02:33 +03:30
SamSys
dec5666eb7 changes 2025-06-02 21:37:27 +03:30
42 changed files with 5867 additions and 15853 deletions

View File

@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Microsoft.EntityFrameworkCore.Design.Internal;
@@ -14,7 +12,8 @@ public class BaseCustomizeEntity : EntityBase
}
public BaseCustomizeEntity(FridayPay fridayPay, OverTimePay overTimePay,
BaseYearsPay baseYearsPay, BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, BreakTime breakTime,int leavePermittedDays,List<WeeklyOffDay> weeklyOffDays)
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
FridayWork fridayWork, HolidayWork holidayWork, BreakTime breakTime,int leavePermittedDays)
{
FridayPay = fridayPay;
@@ -30,10 +29,10 @@ public class BaseCustomizeEntity : EntityBase
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
BreakTime = breakTime;
LeavePermittedDays = leavePermittedDays;
WeeklyOffDays = weeklyOffDays.Select(x=> new WeeklyOffDay(x.DayOfWeek)).ToList();
}
/// <summary>
@@ -118,28 +117,4 @@ public class BaseCustomizeEntity : EntityBase
public BreakTime BreakTime { get; protected set; }
public List<WeeklyOffDay> WeeklyOffDays { get; set; }
public void FridayWorkToWeeklyDayOfWeek()
{
if (FridayWork == FridayWork.Default && !WeeklyOffDays.Any(x => x.DayOfWeek == DayOfWeek.Friday))
{
WeeklyOffDays.Add(new WeeklyOffDay(DayOfWeek.Friday));
}
}
}
public class WeeklyOffDay
{
public WeeklyOffDay(DayOfWeek dayOfWeek)
{
DayOfWeek = dayOfWeek;
}
public long Id { get; set; }
public DayOfWeek DayOfWeek { get; set; }
public long ParentId { get; set; }
}

View File

@@ -27,13 +27,12 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, long employeeId,
long workshopId, double salary, long customizeWorkshopGroupSettingId,
ICollection<CustomizeWorkshopEmployeeSettingsShift> customizeWorkshopEmployeeSettingsShifts,
HolidayWork holidayWork, IrregularShift irregularShift, WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime,
int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts
, List<WeeklyOffDay> weeklyOffDays) :
FridayWork fridayWork,
HolidayWork holidayWork, IrregularShift irregularShift, WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts) :
base(fridayPay, overTimePay,
baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, holidayWork, breakTime, leavePermittedDays,weeklyOffDays)
earlyExit, fridayWork, holidayWork, breakTime, leavePermittedDays)
{
CustomizeWorkshopGroupSettingId = customizeWorkshopGroupSettingId;
IsSettingChanged = false;
@@ -83,6 +82,7 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
/// <param name="fineAbsenceDeduction">جریمه غیبت</param>
/// <param name="lateToWork">تاخیر در ورود</param>
/// <param name="earlyExit">تعجیل درخروج</param>
/// <param name="fridayWork">آیا در روز های جمعه موظف به کار است</param>
/// <param name="holidayWork">آیا در تعطیلات رسمی موظف به کار است</param>
/// <param name="workshopIrregularShifts">نوع شیفت کاری </param>
/// <param name="workshopShiftStatus">آیا شیفت منظم است یا نا منظم</param>
@@ -91,7 +91,7 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
HolidayWork holidayWork, IrregularShift irregularShift, bool isSettingChange, int leavePermittedDays)
FridayWork fridayWork, HolidayWork holidayWork, IrregularShift irregularShift, bool isSettingChange, int leavePermittedDays)
{
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
@@ -99,6 +99,7 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
Salary = salary;
IsSettingChanged = isSettingChange;
FridayWork = fridayWork;
HolidayWork = holidayWork;
LeavePermittedDays = leavePermittedDays;
}
@@ -111,8 +112,8 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
public void SimpleEdit(
ICollection<CustomizeWorkshopEmployeeSettingsShift> employeeSettingsShift,
IrregularShift irregularShift,
WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, bool isShiftChange,HolidayWork holidayWork,
ICollection<CustomizeRotatingShift> rotatingShifts,List<WeeklyOffDay> weeklyOffDays)
WorkshopShiftStatus workshopShiftStatus, BreakTime breakTime, bool isShiftChange, FridayWork fridayWork, HolidayWork holidayWork,
ICollection<CustomizeRotatingShift> rotatingShifts)
{
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChanged = isShiftChange;
@@ -125,8 +126,9 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
: new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts);
CustomizeRotatingShifts = workshopShiftStatus == WorkshopShiftStatus.Rotating ? rotatingShifts : [];
FridayWork = fridayWork;
HolidayWork = holidayWork;
WeeklyOffDays = weeklyOffDays;
}
@@ -267,6 +269,4 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity
IsShiftChanged = isShiftChange;
}
}

View File

@@ -27,12 +27,11 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay,
BonusesPay bonusesPay, NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays,
ICollection<CustomizeRotatingShift> rotatingShifts, List<WeeklyOffDay> weeklyOffDays) :
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork,
HolidayWork holidayWork, BreakTime breakTime, WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, int leavePermittedDays, ICollection<CustomizeRotatingShift> rotatingShifts) :
base(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, holidayWork, breakTime, leavePermittedDays,weeklyOffDays)
earlyExit, fridayWork, holidayWork, breakTime, leavePermittedDays)
{
GroupName = groupName;
Salary = salary;
@@ -77,7 +76,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, FridayWork fridayWork,
HolidayWork holidayWork, IrregularShift irregularShift, ICollection<CustomizeRotatingShift> rotatingShifts,
WorkshopShiftStatus workshopShiftStatus, long customizeWorkshopSettingId, BreakTime breakTime, int leavePermittedDays)
{
@@ -97,6 +96,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
LeavePermittedDays = leavePermittedDays;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
@@ -123,7 +123,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
{
GroupName = groupName;
Salary = salary;
@@ -140,6 +140,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
IsSettingChange = isSettingChange;
LeavePermittedDays = leavePermittedDays;
@@ -153,7 +154,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays);
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays);
}
}
public void EditAndOverwriteOnAllEmployees(string groupName, double salary,
@@ -161,13 +162,14 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay, ShiftPay shiftPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, FamilyAllowance familyAllowance,
LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction,
LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
LateToWork lateToWork, EarlyExit earlyExit, FridayWork fridayWork, HolidayWork holidayWork, bool isSettingChange, int leavePermittedDays)
{
SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay
, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction,
lateToWork, earlyExit);
GroupName = groupName;
Salary = salary;
FridayWork = fridayWork;
HolidayWork = holidayWork;
IsSettingChange = isSettingChange;
LeavePermittedDays = leavePermittedDays;
@@ -180,7 +182,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
{
item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay
, NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction,
LateToWork, EarlyExit, HolidayWork, IrregularShift, false, leavePermittedDays);
LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays);
}
}
@@ -193,7 +195,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
public void EditSimpleAndOverwriteOnEmployee(string groupName, IEnumerable<long> employeeIds,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts, WorkshopShiftStatus workshopShiftStatus,
IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts, List<WeeklyOffDay> weeklyOffDays)
IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange, FridayWork fridayWork, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
@@ -207,11 +209,9 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
FridayWork = fridayWork;
HolidayWork = holidayWork;
WeeklyOffDays = weeklyOffDays;
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
if (isShiftChange)
@@ -227,15 +227,15 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
IrregularShift, WorkshopShiftStatus, BreakTime, false, HolidayWork, newRotatingShifts,WeeklyOffDays.ToList());
IrregularShift, WorkshopShiftStatus, BreakTime, false, FridayWork, HolidayWork, newRotatingShifts);
}
}
public void EditSimpleAndOverwriteOnAllEmployees(string groupName,
ICollection<CustomizeWorkshopGroupSettingsShift> customizeWorkshopGroupSettingsShifts,
WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,
HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts ,List<WeeklyOffDay> weeklyOffDays)
WorkshopShiftStatus workshopShiftStatus, IrregularShift irregularShift, BreakTime breakTime, bool isShiftChange,
FridayWork fridayWork, HolidayWork holidayWork, ICollection<CustomizeRotatingShift> rotatingShifts)
{
GroupName = groupName;
CustomizeWorkshopGroupSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopGroupSettingsShifts : [];
@@ -251,8 +251,8 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
BreakTime = new BreakTime(breakTime.HasBreakTimeValue, breakTime.BreakTimeValue);
IsShiftChange = isShiftChange;
HolidayWork = holidayWork;
FridayWork = fridayWork;
WeeklyOffDays = weeklyOffDays;
//var employeeSettingsShift = customizeWorkshopGroupSettingsShifts
// .Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList();
@@ -262,7 +262,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
.ToList();
item.SimpleEdit(customizeWorkshopGroupSettingsShifts
.Select(x => new CustomizeWorkshopEmployeeSettingsShift(x.StartTime, x.EndTime, x.Placement)).ToList(),
irregularShift, workshopShiftStatus, breakTime, false, HolidayWork, newRotatingShifts,WeeklyOffDays.ToList());
irregularShift, workshopShiftStatus, breakTime, false, FridayWork, HolidayWork, newRotatingShifts);
}
}
@@ -298,14 +298,13 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity
IrregularShift irregularShift = new(IrregularShift.StartTime, IrregularShift.EndTime,
IrregularShift.WorkshopIrregularShifts);
BreakTime breakTime = new(BreakTime.HasBreakTimeValue, BreakTime.BreakTimeValue);
List<WeeklyOffDay> weeklyOffDays = WeeklyOffDays.Select(x => new WeeklyOffDay(x.DayOfWeek)).ToList();
var rotatingShift = CustomizeRotatingShifts.Select(x => new CustomizeRotatingShift(x.StartTime, x.EndTime)).ToList();
var customizeWorkshopEmployeeSettings = new CustomizeWorkshopEmployeeSettings(fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay,
marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, lateToWork,
earlyExit, employeeId, workshopId, Salary, id, shifts, HolidayWork, irregularShift,
WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift, weeklyOffDays);
earlyExit, employeeId, workshopId, Salary, id, shifts, FridayWork, HolidayWork, irregularShift,
WorkshopShiftStatus, breakTime, LeavePermittedDays, rotatingShift);
CustomizeWorkshopEmployeeSettingsCollection.Add(customizeWorkshopEmployeeSettings);
}

View File

@@ -17,7 +17,7 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
public CustomizeWorkshopSettings(long workshopId,
ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts, int leavePermittedDays,
WorkshopShiftStatus workshopShiftStatus,HolidayWork holidayWork, List<WeeklyOffDay> weeklyOffDays)
WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
{
FridayPay = new FridayPay(FridayPayType.None, 0);
OverTimePay = new OverTimePay(OverTimePayType.None, 0);
@@ -38,10 +38,11 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
OverTimeThresholdMinute = 0;
Currency = Currency.Rial;
MaxMonthDays = MaxMonthDays.Default;
FridayWork = fridayWork;
HolidayWork = holidayWork;
BonusesPaysInEndOfMonth = BonusesPaysInEndOfYear.EndOfYear;
WorkshopShiftStatus = workshopShiftStatus;
WeeklyOffDays = weeklyOffDays;
HolidayWork = holidayWork;
if (workshopShiftStatus == WorkshopShiftStatus.Irregular)
return;
@@ -91,7 +92,8 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
public void Edit(FridayPay fridayPay, OverTimePay overTimePay, BaseYearsPay baseYearsPay, BonusesPay bonusesPay,
NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay,
FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, HolidayWork holidayWork, BonusesPaysInEndOfYear bonusesPaysInEndOfYear,
FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit,
FridayWork fridayWork, HolidayWork holidayWork, BonusesPaysInEndOfYear bonusesPaysInEndOfYear,
int leavePermittedDays, BaseYearsPayInEndOfYear baseYearsPayInEndOfYear, int overTimeThresholdMinute)
{
FridayPay = fridayPay;
@@ -107,6 +109,7 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
FineAbsenceDeduction = fineAbsenceDeduction;
LateToWork = lateToWork;
EarlyExit = earlyExit;
FridayWork = fridayWork;
HolidayWork = holidayWork;
BonusesPaysInEndOfMonth = bonusesPaysInEndOfYear;
LeavePermittedDays = leavePermittedDays;
@@ -124,18 +127,19 @@ public class CustomizeWorkshopSettings : BaseCustomizeEntity
}
public void ChangeWorkshopShifts(ICollection<CustomizeWorkshopSettingsShift> customizeWorkshopSettingsShifts,
WorkshopShiftStatus workshopShiftStatus,HolidayWork holidayWork, List<WeeklyOffDay> weeklyOffDays)
WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
{
WorkshopShiftStatus = workshopShiftStatus;
HolidayWork = holidayWork;
FridayWork = fridayWork;
CustomizeWorkshopSettingsShifts = workshopShiftStatus == WorkshopShiftStatus.Regular ? customizeWorkshopSettingsShifts : new List<CustomizeWorkshopSettingsShift>();
WeeklyOffDays = weeklyOffDays;
if (workshopShiftStatus == WorkshopShiftStatus.Regular)
{
var date = new DateOnly();
var firstStartShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MinBy(x => x.Placement).StartTime);
var lastEndShift = new DateTime(date, CustomizeWorkshopSettingsShifts.MaxBy(x => x.Placement).EndTime);
if (lastEndShift > firstStartShift)
firstStartShift = firstStartShift.AddDays(1);
var offSet = (firstStartShift - lastEndShift).Divide(2);

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
@@ -17,9 +16,8 @@ public class CreateCustomizeWorkshopGroupSettings
public IrregularShift IrregularShift { get; set; }
public BreakTime BreakTime { get; set; }
public int LeavePermittedDays { get; set; }
//public FridayWork FridayWork { get; set; }
public FridayWork FridayWork { get; set; }
public HolidayWork HolidayWork { get; set; }
public List<DayOfWeek> OffDayOfWeeks { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
}

View File

@@ -1,5 +1,4 @@
using System;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
@@ -21,18 +20,16 @@ public class CreateCustomizeWorkshopSettings
public BreakTime BreakTime { get; set; }
///// <summary>
///// آیا جمعه کار میکند یا نه
///// </summary>
//public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا جمعه کار میکند یا نه
/// </summary>
public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا در روز های تعطیل کار میکند
/// </summary>
public HolidayWork HolidayWork { get; set; }
public List<DayOfWeek> OffDays { get; set; }

View File

@@ -1,5 +1,4 @@
using System;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using System.Collections.Generic;
@@ -21,8 +20,7 @@ public class CustomizeWorkshopEmployeeSettingsViewModel
public bool ChangeSettingEmployeeShiftIsChange { get; set; }
public BreakTime BreakTime { get; set; }
public HolidayWork HolidayWork { get; set; }
//public FridayWork FridayWork { get; set; }
public FridayWork FridayWork { get; set; }
public int LeavePermittedDays { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShiftsViewModels { get; set; }
public List<DayOfWeek> WeeklyOffDays { get; set; }
}

View File

@@ -1,5 +1,4 @@
using System;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
@@ -73,19 +72,17 @@ public class EditCustomizeEmployeeSettings:CreateCustomizeEmployeeSettings
/// </summary>
public EarlyExitViewModel EarlyExit { get; set; }
///// <summary>
///// آیا جمعه کار میکند یا نه
///// </summary>
//public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا جمعه کار میکند یا نه
/// </summary>
public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا در روز های تعطیل کار میکند
/// </summary>
public HolidayWork HolidayWork { get; set; }
public List<DayOfWeek> WeeklyOffDays { get; set; }
public long Id { get; set; }
public long Id { get; set; }
public string Salary { get; set; }
public string NameGroup { get; set; }
public string EmployeeFullName { get; set; }
@@ -94,5 +91,4 @@ public class EditCustomizeEmployeeSettings:CreateCustomizeEmployeeSettings
public IEnumerable<CustomizeWorkshopShiftViewModel> ShiftViewModel { get; set; }
public ICollection<CustomizeRotatingShiftsViewModel> CustomizeRotatingShifts{ get; set; }
public BreakTime BreakTime { get; set; }
}

View File

@@ -1,8 +1,6 @@
using System;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using CompanyManagment.App.Contracts.CustomizeWorkshopSettings.ValueObjectsViewModel;
using System.Collections.Generic;
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
namespace CompanyManagment.App.Contracts.CustomizeWorkshopSettings;
@@ -77,18 +75,16 @@ public class EditCustomizeWorkshopGroupSettings : CreateCustomizeWorkshopGroupSe
/// </summary>
public EarlyExitViewModel EarlyExit { get; set; }
///// <summary>
///// آیا جمعه کار میکند یا نه
///// </summary>
//public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا جمعه کار میکند یا نه
/// </summary>
public FridayWork FridayWork { get; set; }
/// <summary>
/// آیا در روز های تعطیل کار میکند
/// </summary>
public HolidayWork HolidayWork { get; set; }
//public List<DayOfWeek> WeeklyOffDays { get; set; }
public bool IsShiftChanged { get; set; }
public bool IsSettingChanged { get; set; }
}

View File

@@ -1,5 +1,4 @@
using System;
using _0_Framework.Application;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using CompanyManagment.App.Contracts.Employee;
@@ -52,14 +51,11 @@ public interface ICustomizeWorkshopSettingsApplication
/// </summary>
/// <param name="shiftViewModels">شیفت هت</param>
/// <param name="customizeWorkshopSettingsId">آیدی تنظیمات کارگاه</param>
/// <param name="workshopShiftStatus"></param>
/// <param name="holidayWork"></param>
/// <param name="weeklyOffDays"></param>
/// <param name="replaceChangedGroups"></param>
/// <param name="workshopShiftStatus"></param>
/// <returns></returns>
OperationResult EditWorkshopSettingShifts(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus,
HolidayWork holidayWork, List<DayOfWeek> weeklyOffDays);
long customizeWorkshopSettingsId,WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork);
// It will Get the Workshop Settings with its groups and the employees of groups.
CustomizeWorkshopSettingsViewModel GetWorkshopSettingsByWorkshopId(long workshopId, AuthViewModel auth);

View File

@@ -228,14 +228,7 @@ public class CustomizeWorkshopEmployeeSettingsMapping : IEntityTypeConfiguration
});
builder.OwnsMany(x => x.WeeklyOffDays, offDay =>
{
offDay.HasKey(x => x.Id);
offDay.Property(x => x.DayOfWeek).HasConversion<string>().HasMaxLength(15);
offDay.WithOwner().HasForeignKey(x => x.ParentId);
});
builder.OwnsMany(x => x.CustomizeRotatingShifts);
builder.OwnsMany(x => x.CustomizeRotatingShifts);
}
}

View File

@@ -227,15 +227,7 @@ public class CustomizeWorkshopGroupSettingsMapping : IEntityTypeConfiguration<Cu
});
builder.OwnsMany(x => x.WeeklyOffDays, offDay =>
{
offDay.HasKey(x => x.Id);
offDay.Property(x => x.DayOfWeek).HasConversion<string>().HasMaxLength(15);
offDay.WithOwner().HasForeignKey(x => x.ParentId);
});
builder.OwnsMany(x => x.CustomizeRotatingShifts);
builder.OwnsMany(x => x.CustomizeRotatingShifts);
builder.HasOne(x => x.CustomizeWorkshopSettings).WithMany(x => x.CustomizeWorkshopGroupSettingsCollection)

View File

@@ -221,12 +221,6 @@ public class CustomizeWorkshopSettingsMapping:IEntityTypeConfiguration<Customize
});
builder.OwnsMany(x => x.WeeklyOffDays, offDay =>
{
offDay.HasKey(x => x.Id);
offDay.Property(x => x.DayOfWeek).HasConversion<string>().HasMaxLength(15);
offDay.WithOwner().HasForeignKey(x => x.ParentId);
});
builder.HasMany(x => x.CustomizeWorkshopGroupSettingsCollection).WithOne(x => x.CustomizeWorkshopSettings)

View File

@@ -1,106 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addoffDaystocws : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CustomizeWorkshopEmployeeSettings_WeeklyOffDays",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DayOfWeek = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopEmployeeSettings_WeeklyOffDays", x => x.Id);
table.ForeignKey(
name: "FK_CustomizeWorkshopEmployeeSettings_WeeklyOffDays_CustomizeWorkshopEmployeeSettings_ParentId",
column: x => x.ParentId,
principalTable: "CustomizeWorkshopEmployeeSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopGroupSettings_WeeklyOffDays",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DayOfWeek = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopGroupSettings_WeeklyOffDays", x => x.Id);
table.ForeignKey(
name: "FK_CustomizeWorkshopGroupSettings_WeeklyOffDays_CustomizeWorkshopGroupSettings_ParentId",
column: x => x.ParentId,
principalTable: "CustomizeWorkshopGroupSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "CustomizeWorkshopSettings_WeeklyOffDays",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DayOfWeek = table.Column<string>(type: "nvarchar(15)", maxLength: 15, nullable: false),
ParentId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CustomizeWorkshopSettings_WeeklyOffDays", x => x.Id);
table.ForeignKey(
name: "FK_CustomizeWorkshopSettings_WeeklyOffDays_CustomizeWorkshopSettings_ParentId",
column: x => x.ParentId,
principalTable: "CustomizeWorkshopSettings",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopEmployeeSettings_WeeklyOffDays_ParentId",
table: "CustomizeWorkshopEmployeeSettings_WeeklyOffDays",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopGroupSettings_WeeklyOffDays_ParentId",
table: "CustomizeWorkshopGroupSettings_WeeklyOffDays",
column: "ParentId");
migrationBuilder.CreateIndex(
name: "IX_CustomizeWorkshopSettings_WeeklyOffDays_ParentId",
table: "CustomizeWorkshopSettings_WeeklyOffDays",
column: "ParentId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CustomizeWorkshopEmployeeSettings_WeeklyOffDays");
migrationBuilder.DropTable(
name: "CustomizeWorkshopGroupSettings_WeeklyOffDays");
migrationBuilder.DropTable(
name: "CustomizeWorkshopSettings_WeeklyOffDays");
}
}
}

View File

@@ -7433,32 +7433,6 @@ namespace CompanyManagment.EFCore.Migrations
.HasForeignKey("CustomizeWorkshopEmployeeSettingsid");
});
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.Base.WeeklyOffDay", "WeeklyOffDays", b1 =>
{
b1.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("Id"));
b1.Property<string>("DayOfWeek")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("nvarchar(15)");
b1.Property<long>("ParentId")
.HasColumnType("bigint");
b1.HasKey("Id");
b1.HasIndex("ParentId");
b1.ToTable("CustomizeWorkshopEmployeeSettings_WeeklyOffDays");
b1.WithOwner()
.HasForeignKey("ParentId");
});
b.Navigation("BaseYearsPay");
b.Navigation("BonusesPay");
@@ -7494,8 +7468,6 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("OverTimePay");
b.Navigation("ShiftPay");
b.Navigation("WeeklyOffDays");
});
modelBuilder.Entity("Company.Domain.CustomizeWorkshopGroupSettingsAgg.Entities.CustomizeWorkshopGroupSettings", b =>
@@ -8019,32 +7991,6 @@ namespace CompanyManagment.EFCore.Migrations
.HasForeignKey("CustomizeWorkshopGroupSettingsid");
});
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.Base.WeeklyOffDay", "WeeklyOffDays", b1 =>
{
b1.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("Id"));
b1.Property<string>("DayOfWeek")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("nvarchar(15)");
b1.Property<long>("ParentId")
.HasColumnType("bigint");
b1.HasKey("Id");
b1.HasIndex("ParentId");
b1.ToTable("CustomizeWorkshopGroupSettings_WeeklyOffDays");
b1.WithOwner()
.HasForeignKey("ParentId");
});
b.Navigation("BaseYearsPay");
b.Navigation("BonusesPay");
@@ -8080,8 +8026,6 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("OverTimePay");
b.Navigation("ShiftPay");
b.Navigation("WeeklyOffDays");
});
modelBuilder.Entity("Company.Domain.CustomizeWorkshopSettingsAgg.Entities.CustomizeWorkshopSettings", b =>
@@ -8532,32 +8476,6 @@ namespace CompanyManagment.EFCore.Migrations
.HasForeignKey("CustomizeWorkshopSettingsid");
});
b.OwnsMany("_0_Framework.Domain.CustomizeCheckoutShared.Base.WeeklyOffDay", "WeeklyOffDays", b1 =>
{
b1.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property<long>("Id"));
b1.Property<string>("DayOfWeek")
.IsRequired()
.HasMaxLength(15)
.HasColumnType("nvarchar(15)");
b1.Property<long>("ParentId")
.HasColumnType("bigint");
b1.HasKey("Id");
b1.HasIndex("ParentId");
b1.ToTable("CustomizeWorkshopSettings_WeeklyOffDays");
b1.WithOwner()
.HasForeignKey("ParentId");
});
b.Navigation("BaseYearsPay");
b.Navigation("BonusesPay");
@@ -8586,8 +8504,6 @@ namespace CompanyManagment.EFCore.Migrations
b.Navigation("ShiftPay");
b.Navigation("WeeklyOffDays");
b.Navigation("Workshop");
});

View File

@@ -26,6 +26,7 @@ public class CustomizeWorkshopEmployeeSettingsRepository(CompanyContext companyC
return new();
return new EditCustomizeEmployeeSettings()
{
FridayWork = entity.FridayWork,
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
LateToWork = new()
{

View File

@@ -265,7 +265,7 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
var entity = _companyContext.CustomizeWorkshopGroupSettings.AsSplitQuery().FirstOrDefault(x => x.id == groupId);
return new EditCustomizeWorkshopGroupSettings()
{
//FridayWork = entity.FridayWork,
FridayWork = entity.FridayWork,
FridayPay = new (){ FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
LateToWork = new()
{
@@ -338,8 +338,8 @@ public class CustomizeWorkshopGroupSettingsRepository(CompanyContext companyCont
{
EndTime = x.EndTime.ToString("HH:mm"),
StartTime = x.StartTime.ToString("HH:mm")
}).ToList(),
OffDayOfWeeks = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
}).ToList()
};
}

View File

@@ -159,6 +159,7 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
return new();
var viewModel = new EditCustomizeWorkshopSettings()
{
FridayWork = entity.FridayWork,
FridayPay = new() { FridayPayType = entity.FridayPay.FridayPayType, Value = entity.FridayPay.Value },
LateToWork = new()
{
@@ -233,8 +234,7 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
LeavePermittedDays = entity.LeavePermittedDays,
BaseYearsPayInEndOfYear = entity.BaseYearsPayInEndOfYear,
WorkshopId = entity.WorkshopId,
WorkshopShiftStatus = entity.WorkshopShiftStatus,
OffDays = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
WorkshopShiftStatus = entity.WorkshopShiftStatus
};
return viewModel;
@@ -261,8 +261,8 @@ public class CustomizeWorkshopSettingsRepository(CompanyContext companyContext,
Id = entity.id,
WorkshopId = entity.WorkshopId,
WorkshopShiftStatus = entity.WorkshopShiftStatus,
HolidayWork = entity.HolidayWork,
OffDays = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList()
FridayWork = entity.FridayWork,
HolidayWork = entity.HolidayWork
};
}

View File

@@ -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)

View File

@@ -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

View File

@@ -25,12 +25,12 @@
height: 28cm;
margin: 3mm 5mm 0 5mm; ">
<div class="row" dir="rtl">
<div class="col-xs-3 d-inline-block"></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"><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>

View File

@@ -228,7 +228,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
}
public IActionResult OnPostEditSettingWorkTime(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, long workshopId,FridayWork fridayWork,HolidayWork holidayWork,List<DayOfWeek> offDayOfWeeks)
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, long workshopId,FridayWork fridayWork,HolidayWork holidayWork)
{
if (workshopId < 1)
return new JsonResult(new
@@ -240,7 +240,7 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.RollCall
//Todo:Vafa!!
//Todo: Vafa : to in ja bool replaceChange group ro ezafe kon. hatman ham workshopShiftStatus az front pas bede be in.
var result = _customizeWorkshopSettingsApplication
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, holidayWork, offDayOfWeeks);
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, fridayWork, holidayWork);
return new JsonResult(new
{

View File

@@ -58,14 +58,14 @@
<div class="col-12 group-container">
<div class="titleSettingRollCall">وضعیت فعالیت مجموعه در روز های جمعه</div>
@* <div class="form-group my-1 group">
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
<div class="col-12">

View File

@@ -56,14 +56,14 @@
<div class="col-12 group-container">
<div class="titleSettingRollCall">وضعیت فعالیت مجموعه در روز های جمعه</div>
@* <div class="form-group my-1 group">
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
<div class="col-12">

View File

@@ -29,14 +29,14 @@
<div class="col-12 group-container">
<div class="titleSettingRollCall">وضعیت فعالیت مجموعه در روز های جمعه</div>
@* <div class="form-group my-1 group">
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
<div class="col-12">

View File

@@ -240,10 +240,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
BreakTime = employee.BreakTime,
WorkshopShiftStatus = employee.WorkshopShiftStatus,
IrregularShift = employee.IrregularShift,
//FridayWork = employee.FridayWork,
FridayWork = employee.FridayWork,
HolidayWork = employee.HolidayWork,
CustomizeRotatingShifts = employee.CustomizeRotatingShiftsViewModels,
WeeklyOffDays = employee.WeeklyOffDays
CustomizeRotatingShifts = employee.CustomizeRotatingShiftsViewModels
};
return Partial("ModalEditEmployeeFromGroup", command);
}

View File

@@ -310,7 +310,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
}
public IActionResult OnPostEditSettingWorkTime(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork,List<DayOfWeek> offDayOfWeeks)
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus,FridayWork fridayWork,HolidayWork holidayWork)
{
var workshopHash = User.FindFirstValue("WorkshopSlug");
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
@@ -324,7 +324,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall
//Todo:Vafa!!
//Todo: Vafa : to in ja bool replaceChange group ro ezafe kon. hatman ham workshopShiftStatus az front pas bede be in.
var result = _customizeWorkshopSettingsApplication
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, holidayWork, offDayOfWeeks);
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus,fridayWork, holidayWork);
return new JsonResult(new
{

View File

@@ -230,14 +230,14 @@
<div class="col-6 p-0">
<div class="group-container">
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
@* <div class="d-flex form-group my-1 group">
<div class="d-flex form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))"/>
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="d-flex form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))"/>
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
</div>

View File

@@ -389,14 +389,14 @@
<div class="col-6 p-0">
<div class="group-container">
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
@* <div class="d-flex form-group my-1 group">
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
</div>

View File

@@ -400,14 +400,14 @@
<div class="col-6 p-0">
<div class="group-container">
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
@* <div class="d-flex form-group my-1 group">
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
</div>

View File

@@ -162,14 +162,14 @@
<div class="col-6 p-0">
<div class="group-container">
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
@* <div class="d-flex form-group my-1 group">
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))"/>
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))"/>
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
</div>

View File

@@ -103,7 +103,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall._WorkshopSetting
}
public IActionResult OnPostEditSettingWorkTime(List<CustomizeWorkshopShiftViewModel> shiftViewModels,
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, FridayWork fridayWork, HolidayWork holidayWork,List<DayOfWeek> offDayOfWeeks)
long customizeWorkshopSettingsId, WorkshopShiftStatus workshopShiftStatus, FridayWork fridayWork, HolidayWork holidayWork)
{
var workshopHash = User.FindFirstValue("WorkshopSlug");
var workshopId = _passwordHasher.SlugDecrypt(workshopHash);
@@ -115,7 +115,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.RollCall._WorkshopSetting
});
var result = _customizeWorkshopSettingsApplication
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, holidayWork, offDayOfWeeks);
.EditWorkshopSettingShifts(shiftViewModels, customizeWorkshopSettingsId, workshopShiftStatus, fridayWork, holidayWork);
return new JsonResult(new
{

View File

@@ -98,14 +98,14 @@
<div class="col-6 p-0">
<div class="group-container">
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
@* <div class="d-flex form-group my-1 group">
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
</div>

View File

@@ -162,14 +162,14 @@
<div class="col-6 p-0">
<div class="group-container">
@* <div class="lableCheckBreakTime">وضعیت فعالیت مجموعه در روز های جمعه</div> *@
@* <div class="d-flex form-group my-1 group">
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))"/>
<label for="Friday1" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="d-flex form-group my-1 group">
<input type="radio" name="FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))"/>
<label for="Friday2" class="lableCheckBreakTime">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
</div>

View File

@@ -15,14 +15,14 @@
</div>
<div class="col-12 group-container">
<div class="titleSettingRollCall">تعطیلات جمعه</div>
@* <div class="form-group my-1 group">
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
<div class="col-12">

View File

@@ -16,14 +16,14 @@
</div>
<div class="col-12 group-container">
<div class="titleSettingRollCall">تعطیلات جمعه</div>
@* <div class="form-group my-1 group">
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
<div class="col-12">

View File

@@ -14,14 +14,14 @@
</div>
<div class="col-12 group-container">
<div class="titleSettingRollCall">تعطیلات جمعه</div>
@* <div class="form-group my-1 group">
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday1" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.Default ? "checked" : "") value="@((int)(FridayWork.Default))" />
<label for="Friday1">پرسنل در روزهای جمعه کار نمی‌کند.</label>
</div>
<div class="form-group my-1 group">
<input type="radio" name="Command.FridayWork" id="Friday2" class="form-check-input Main-Radio" @(Model.FridayWork == FridayWork.WorkInFriday ? "checked" : "") value="@((int)(FridayWork.WorkInFriday))" />
<label for="Friday2">پرسنل در روزهای جمعه کار می‌کند.</label>
</div> *@
</div>
</div>
<div class="col-12">

View File

@@ -1,8 +1,6 @@
using System.Diagnostics;
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
using CompanyManagment.App.Contracts.AdminMonthlyOverview;
using CompanyManagment.EFCore;
using Microsoft.EntityFrameworkCore;
using ServiceHost.Areas.AdminNew.Pages.Company.RollCall;
namespace ServiceHost.Test;
@@ -20,38 +18,9 @@ public class Tester
public async Task Test()
{
// await AdminMonthlyOverviewTest();
//await ChangeFridayWorkToWeeklyDayOfWeek();
// await AdminMonthlyOverviewTest();
}
private async Task ChangeFridayWorkToWeeklyDayOfWeek()
{
var employeeSettingsEnumerable =await _companyContext.CustomizeWorkshopEmployeeSettings.Where(x=>x.FridayWork ==FridayWork.Default).ToListAsync();
foreach (var employeeSetting in employeeSettingsEnumerable)
{
employeeSetting.FridayWorkToWeeklyDayOfWeek();
}
var groupSettings = await _companyContext.CustomizeWorkshopGroupSettings
.Where(x => x.FridayWork == FridayWork.Default).ToListAsync();
foreach (var groupSetting in groupSettings)
{
groupSetting.FridayWorkToWeeklyDayOfWeek();
}
var workshopSettings = await _companyContext.CustomizeWorkshopSettings
.Where(x => x.FridayWork == FridayWork.Default).ToListAsync();
foreach (var workshopSetting in workshopSettings)
{
workshopSetting.FridayWorkToWeeklyDayOfWeek();
}
await _companyContext.SaveChangesAsync();
}
private async Task AdminMonthlyOverviewTest()
{
var acc = _companyContext.WorkshopAccounts.FirstOrDefault(x => x.AccountId == 322);

View File

@@ -12,8 +12,8 @@
//"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True"
//server
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;",
//"MesbahDb": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]is[3019]#@ATt;TrustServerCertificate=true;",
//local
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",