convert completed
This commit is contained in:
@@ -18,7 +18,7 @@ public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
|
||||
|
||||
List<RotatingShiftViewModel> RotatingShiftCheck(List<GroupedRollCalls> rollCallList);
|
||||
|
||||
List<RollCallViewModel> ConvertStaticHourseToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking);
|
||||
List<RollCallViewModel> ConvertStaticHoursToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking);
|
||||
CustomizeCheckoutMandatoryViewModel CustomizeCheckoutMandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd);
|
||||
|
||||
List<LateToWorkEarlyExistSpannig> LateToWorkEarlyExit(List<GroupedRollCalls> groupedRollCall,
|
||||
|
||||
@@ -114,7 +114,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
command.EmployeeId = employeeId;
|
||||
command.ContractStartGr = contractStart;
|
||||
command.ContractEndGr = contractEnd;
|
||||
rollCallResult = ConvertStaticHourseToRollCall(command, holidayWorking);
|
||||
rollCallResult = ConvertStaticHoursToRollCall(command, holidayWorking);
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.ShiftDate.Date).Select(x => new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
@@ -157,9 +157,42 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
// CreationDate = x.CreationDate,
|
||||
// AfterSubtractRestSpan = AfterSubtract(command, x.SumOneDaySpan, x.CreationDate),
|
||||
//}).ToList();
|
||||
|
||||
|
||||
|
||||
|
||||
TimeSpan sumSpans = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
TimeSpan sumSpansWhitOutleaves = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
|
||||
|
||||
//بدست آوردن مرخصی ساعتی
|
||||
LeaveSearchModel hoursleaveSearch = new LeaveSearchModel()
|
||||
{
|
||||
EmployeeId = employeeId,
|
||||
WorkshopId = workshopId,
|
||||
LeaveType = "استحقاقی",
|
||||
PaidLeaveType = "ساعتی",
|
||||
StartLeaveGr = contractStart,
|
||||
EndLeaveGr = contractEnd,
|
||||
IsAccepted = true,
|
||||
};
|
||||
var hoursesleave = _leaveRepository.search(hoursleaveSearch);
|
||||
var hoursesleaveTimeSpansList = hoursesleave.Count > 0
|
||||
? hoursesleave.Select(x => TimeSpan.Parse(x.LeaveHourses)).ToList()
|
||||
: new List<TimeSpan>();
|
||||
|
||||
// مجموع مرخصی ساعتی
|
||||
var hoursesleaveTimeSpans = new TimeSpan(hoursesleaveTimeSpansList.Sum(x => x.Ticks));
|
||||
//کسر مرخصی ساعتی از فیش استاتیک
|
||||
if (isStaticCheckout && command.ShiftWork != "4")
|
||||
{
|
||||
// کم کردن از مجموع ساعت کار پرسنل
|
||||
sumSpans = sumSpans.Subtract(hoursesleaveTimeSpans);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//****افزودن مرخصی پرسنل به مجموع ساعات کار***
|
||||
#region AddEmployeeLeavs
|
||||
|
||||
@@ -191,10 +224,6 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
{
|
||||
if (leaveSearchResult.Any(x => x.HasShiftDuration))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
var sumSpansDouble = (sumSpans.TotalMinutes) / 60;
|
||||
if (sumSpansDouble < mandatoryHours)
|
||||
{
|
||||
@@ -209,6 +238,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
}
|
||||
|
||||
TimeSpan totalLeave = new TimeSpan(leaveSearchResult.Sum(x => x.ShiftDuration.Ticks));
|
||||
totalLeave = totalLeave.Add(hoursesleaveTimeSpans);
|
||||
var totalLeaveDouble = (totalLeave.TotalMinutes) / 60;
|
||||
if (totalLeaveDouble > starndardHoursesPerTotalDays)
|
||||
{
|
||||
@@ -255,12 +285,14 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
if (workingPerDayAve <= new TimeSpan(7, 20, 0))
|
||||
{
|
||||
sumLeave = leavingDayCout * workingPerDayAve;
|
||||
sumLeave = sumLeave.Add(hoursesleaveTimeSpans);
|
||||
}
|
||||
else
|
||||
{
|
||||
sumLeave = leavingDayCout * new TimeSpan(7, 20, 0);
|
||||
}
|
||||
|
||||
|
||||
if (sumLeave > starndardHoursesPerTotalDaysSapn)
|
||||
{
|
||||
sumSpans = sumSpans.Add(starndardHoursesPerTotalDaysSapn);
|
||||
@@ -273,7 +305,18 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
|
||||
}
|
||||
|
||||
//اگر مرخصی روزانه نداشت و فقط مرخصی ساعتی داشت
|
||||
if (leaveSearchResult.Count == 0 && hoursesleave.Count > 0)
|
||||
{
|
||||
if (hoursesleaveTimeSpans > starndardHoursesPerTotalDaysSapn)
|
||||
{
|
||||
sumSpans = sumSpans.Add(starndardHoursesPerTotalDaysSapn);
|
||||
}
|
||||
else
|
||||
{
|
||||
sumSpans = sumSpans.Add(hoursesleaveTimeSpans);
|
||||
}
|
||||
}
|
||||
Console.WriteLine(sumSpans);
|
||||
#endregion
|
||||
//***********************************//
|
||||
@@ -295,10 +338,10 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
TimeSpan Mandatory = sumSpansWhitOutleaves.Subtract(mandatoryHoursTimeSpan);
|
||||
|
||||
double mandatoryWorkWithOutleaves = (sumSpansWhitOutleaves.TotalMinutes) / 60;
|
||||
double owerTimeWork = 0;
|
||||
double overTimeWork = 0;
|
||||
if (mandatoryWorkWithOutleaves > mandatoryHours)
|
||||
{
|
||||
owerTimeWork = mandatoryWorkWithOutleaves - mandatoryHours;
|
||||
overTimeWork = mandatoryWorkWithOutleaves - mandatoryHours;
|
||||
|
||||
}
|
||||
|
||||
@@ -471,13 +514,13 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
SumWorkeTime = $"{44}";
|
||||
|
||||
//اضافه کار
|
||||
if (owerTimeWork > 0)
|
||||
if (overTimeWork > 0)
|
||||
{
|
||||
|
||||
//int mandatoryH = (int)Mandatory.TotalHours;
|
||||
//int mandatoryM = (int)(Mandatory.TotalMinutes % 60);
|
||||
int mandatoryH = (int)owerTimeWork;
|
||||
int mandatoryM = (int)Math.Round((owerTimeWork - mandatoryH) * 60);
|
||||
int mandatoryH = (int)overTimeWork;
|
||||
int mandatoryM = (int)Math.Round((overTimeWork - mandatoryH) * 60);
|
||||
overMandatoryHours = mandatoryH.ToString();
|
||||
overMandatoryMinuts = mandatoryM.ToString();
|
||||
}
|
||||
@@ -1237,7 +1280,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
}
|
||||
|
||||
|
||||
public List<RollCallViewModel> ConvertStaticHourseToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking)
|
||||
public List<RollCallViewModel> ConvertStaticHoursToRollCall(CreateWorkingHoursTemp command, bool workshopHolidyWorking)
|
||||
{
|
||||
var rollCallList = new List<RollCallViewModel>();
|
||||
#region Entities
|
||||
@@ -1451,7 +1494,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
//[12-24 : 5] [24-24 : 6] [12-36 : 7] [24-48 : 8]
|
||||
if (command.ShiftWork is "5" or "6" or "7" or "8")
|
||||
{
|
||||
int addHourse = command.ShiftWork switch
|
||||
int addHours = command.ShiftWork switch
|
||||
{
|
||||
"5" => 36,
|
||||
"6" => 48,
|
||||
@@ -1465,7 +1508,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
var startDateAndTime = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute);
|
||||
var startContract = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute);
|
||||
var endContract = new PersianDateTime(eyear, emonth, eday, 23, 59);
|
||||
for (var da = startDateAndTime; da <= endContract; da = da.AddHours(addHourse))
|
||||
for (var da = startDateAndTime; da <= endContract; da = da.AddHours(addHours))
|
||||
{
|
||||
|
||||
|
||||
@@ -1495,16 +1538,19 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
|
||||
var endCal = end - start;
|
||||
start = startComplex.AddHours(addHourse);
|
||||
start = startComplex.AddHours(addHours);
|
||||
end = start.Add(endCal);
|
||||
|
||||
}
|
||||
|
||||
int countLeveSearch = leaveSearchResult.Count(x => x.PaidLeaveType == "روزانه");
|
||||
if (countLeveSearch > 0)
|
||||
var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList();
|
||||
if (countLeves.Count > 0)
|
||||
{
|
||||
int totalDays = countLeves.Sum(x => int.Parse(x.LeaveHourses));
|
||||
|
||||
|
||||
int countRollCall = rollCallList.Count();
|
||||
int takRollCall = countLeveSearch < countRollCall ? (countRollCall - countLeveSearch) : 0;
|
||||
int takRollCall = totalDays < countRollCall ? (countRollCall - totalDays) : 0;
|
||||
rollCallList = rollCallList.Take(takRollCall).ToList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user