add new Value to Chekout
This commit is contained in:
@@ -7,6 +7,10 @@ namespace Company.Domain.CheckoutAgg;
|
||||
|
||||
public class Checkout : EntityBase
|
||||
{
|
||||
private Checkout()
|
||||
{
|
||||
|
||||
}
|
||||
public Checkout(string employeeFullName, string fathersName, string nationalCode, string dateOfBirth,
|
||||
long employeeId, string workshopName, long workshopId, string contractNo, DateTime contractStart,
|
||||
DateTime contractEnd, string month, string year, long contractId, long workingHoursId,
|
||||
@@ -16,7 +20,8 @@ public class Checkout : EntityBase
|
||||
double insuranceDeduction, double taxDeducation, double installmentDeduction,
|
||||
double salaryAidDeduction, double absenceDeduction, string sumOfWorkingDays
|
||||
, string archiveCode, string personnelCode,
|
||||
string totalClaims, string totalDeductions, double totalPayment, string signature, double marriedAllowance, bool leaveCheckout, double creditLeaves, double absencePeriod, double averageHoursPerDay, bool hasRollCall)
|
||||
string totalClaims, string totalDeductions, double totalPayment, string signature, double marriedAllowance, bool leaveCheckout,
|
||||
double creditLeaves, double absencePeriod, double averageHoursPerDay, bool hasRollCall, string overTimeWorkvalue, string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue, string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute)
|
||||
{
|
||||
EmployeeFullName = employeeFullName;
|
||||
FathersName = fathersName;
|
||||
@@ -65,6 +70,14 @@ public class Checkout : EntityBase
|
||||
AbsencePeriod = absencePeriod;
|
||||
AverageHoursPerDay = averageHoursPerDay;
|
||||
HasRollCall = hasRollCall;
|
||||
OverTimeWorkValue = overTimeWorkvalue;
|
||||
OverNightWorkValue = overNightWorkValue;
|
||||
FridayWorkValue = fridayWorkValue;
|
||||
RotatingShiftValue = rotatingShifValue;
|
||||
AbsenceValue = absenceValue;
|
||||
TotalDayOfLeaveCompute = totalDayOfLeaveCompute;
|
||||
TotalDayOfYearsCompute = totalDayOfYearsCompute;
|
||||
TotalDayOfBunosesCompute = totalDayOfBunosesCompute;
|
||||
}
|
||||
|
||||
public string EmployeeFullName { get; private set; }
|
||||
@@ -130,8 +143,45 @@ public class Checkout : EntityBase
|
||||
//میانگین ساعت کار در یک روز
|
||||
public double AverageHoursPerDay { get; private set; }
|
||||
public bool HasRollCall { get; private set; }
|
||||
/// <summary>
|
||||
/// مقدار اضافه کار
|
||||
/// </summary>
|
||||
public string OverTimeWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار شبکاری
|
||||
/// </summary>
|
||||
public string OverNightWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayWorkValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// درصد نوبت کاری
|
||||
/// </summary>
|
||||
public string RotatingShiftValue { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار غیبت
|
||||
/// </summary>
|
||||
public string AbsenceValue { get; private set; }
|
||||
|
||||
public Workshop Workshop { get; set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
/// </summary>
|
||||
public string TotalDayOfLeaveCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای سنوات
|
||||
/// </summary>
|
||||
public string TotalDayOfYearsCompute { get; private set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
|
||||
/// </summary>
|
||||
public string TotalDayOfBunosesCompute { get; private set; }
|
||||
|
||||
public Workshop Workshop { get; set; }
|
||||
//public WorkingHours WorkingHours { get; set; }
|
||||
|
||||
public void Edit(string employeeFullName, string fathersName, string nationalCode, string dateOfBirth,
|
||||
|
||||
@@ -37,9 +37,6 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
|
||||
|
||||
#region Pooya
|
||||
|
||||
List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId,
|
||||
DateTime start, DateTime end);
|
||||
|
||||
List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
|
||||
@@ -77,5 +77,48 @@ public class CheckoutViewModel
|
||||
public bool TotalPaymentHide { get; set; }
|
||||
public string IsBlockCantracingParty { get; set; }
|
||||
public bool HasRollCall { get; set; }
|
||||
public List<CheckoutDailyRollCallViewModel> MonthlyRollCall { get; set; }
|
||||
public string TotalWorkingTimeStr { get; set; }
|
||||
public string TotalPresentTimeStr { get; set; }
|
||||
public string TotalBreakTimeStr { get; set; }
|
||||
public string TotalMandatoryTimeStr { get; set; }
|
||||
public string MaritalStatus { get; set; }
|
||||
/// <summary>
|
||||
/// مقدار اضافه کار
|
||||
/// </summary>
|
||||
public string OverTimeWorkValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار شبکاری
|
||||
/// </summary>
|
||||
public string OverNightWorkValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayWorkValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// درصد نوبت کاری
|
||||
/// </summary>
|
||||
public string RotatingShiftValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار غیبت
|
||||
/// </summary>
|
||||
public string AbsenceValue { get; set; }
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
/// </summary>
|
||||
public string TotalDayOfLeaveCompute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای سنوات
|
||||
/// </summary>
|
||||
public string TotalDayOfYearsCompute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
|
||||
/// </summary>
|
||||
public string TotalDayOfBunosesCompute { get; set; }
|
||||
public List<CheckoutDailyRollCallViewModel> MonthlyRollCall { get; set; }
|
||||
}
|
||||
@@ -94,4 +94,43 @@ public class CreateCheckout
|
||||
public long UserId { get; set; }
|
||||
|
||||
public bool HasRollCall { get; set; }
|
||||
/// <summary>
|
||||
/// مقدار اضافه کار
|
||||
/// </summary>
|
||||
public string OverTimeWorkValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار شبکاری
|
||||
/// </summary>
|
||||
public string OverNightWorkValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار جمعه کاری
|
||||
/// </summary>
|
||||
public string FridayWorkValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// درصد نوبت کاری
|
||||
/// </summary>
|
||||
public string RotatingShiftValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مقدار غیبت
|
||||
/// </summary>
|
||||
public string AbsenceValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
/// </summary>
|
||||
public string TotalDayOfLeaveCompute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای سنوات
|
||||
/// </summary>
|
||||
public string TotalDayOfYearsCompute { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// تعداد روزهای محاسبه شده برای عیدی و پاداش
|
||||
/// </summary>
|
||||
public string TotalDayOfBunosesCompute { get; set; }
|
||||
}
|
||||
@@ -36,8 +36,6 @@ public interface ICheckoutApplication
|
||||
|
||||
#region Pooya
|
||||
|
||||
List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId,
|
||||
DateTime start, DateTime end);
|
||||
|
||||
List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
@@ -21,4 +21,7 @@ public class LeaveAndAbsenceViewModel
|
||||
//میانگین ساعت کار در یک روز
|
||||
public double AverageHoursPerDay { get; set; }
|
||||
|
||||
//تعداد روزهای محاسبه شده برای مزد مرخصی
|
||||
public string TotalDayOfLeaveCompute { get; set; }
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ public class ComputingViewModel
|
||||
public string TotalHolidayAndNotM { get; set; }
|
||||
public double DayliFeeComplete { get; set; }
|
||||
public string MarriedAllowance { get; set; }
|
||||
public string RotatingShiftValue { get; set; }
|
||||
public List<RotatingShiftViewModel> RotatingResultList { get; set; }
|
||||
|
||||
|
||||
|
||||
@@ -14,4 +14,6 @@ public class BunosesAndYearsPayStatus
|
||||
public DateTime ContractStart { get; set; }
|
||||
public DateTime ContractEnd { get; set; }
|
||||
public List<BunosesAndYearsPayStatus> BunosesStatusList { get; set; }
|
||||
//تعداد روزهای مورد محاسبه
|
||||
public int TotalDayCompute { get; set; }
|
||||
}
|
||||
@@ -179,7 +179,8 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
, command.DateOfBirth, command.EmployeeId, command.WorkshopName, command.WorkshopId, command.ContractNo, command.ContractStartGr, command.ContractEndGr, month, year,
|
||||
command.ContractId, command.WorkingHoursId, monthlyWage, bacicYears, consumableItem, housingAllowance
|
||||
, command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, 0, 0, command.AbsenceDeduction, sumOfWorkingDays,
|
||||
command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature,marriedAllowance,command.LeaveCheckout,command.CreditLeaves,command.AbsencePeriod,command.AverageHoursPerDay,command.HasRollCall);
|
||||
command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature,marriedAllowance,command.LeaveCheckout,command.CreditLeaves,command.AbsencePeriod,command.AverageHoursPerDay,command.HasRollCall,command.OverTimeWorkValue,command.OverNightWorkValue
|
||||
,command.FridayWorkValue, command.RotatingShiftValue,command.AbsenceValue,command.TotalDayOfLeaveCompute,command.TotalDayOfYearsCompute,command.TotalDayOfBunosesCompute);
|
||||
_checkoutRepository.CreateCkeckout(checkout);
|
||||
//_checkoutRepository.SaveChanges();
|
||||
|
||||
@@ -386,10 +387,7 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
}
|
||||
#endregion
|
||||
#region Pooya
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId, DateTime start, DateTime end)
|
||||
{
|
||||
return _checkoutRepository.GetLastCheckoutsByWorkshopId(workshopId, start, end);
|
||||
}
|
||||
|
||||
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end)
|
||||
{
|
||||
|
||||
@@ -182,10 +182,143 @@ public class RollCallApplication : IRollCallApplication
|
||||
/// <summary>
|
||||
/// افزودن حضور غیاب به صورت دستی. اگر آیدی رکورد صفر باشد رکورد جدید، در غیر این صورت ویرایش می کند
|
||||
/// </summary>
|
||||
///
|
||||
|
||||
#region ManualEditWithDates
|
||||
//public OperationResult ManualEdit(CreateOrEditEmployeeRollCall command)
|
||||
//{
|
||||
// var operation = new OperationResult();
|
||||
|
||||
// DateTime date = command.DateFa.ToGeorgianDateTime();
|
||||
// if (date == Tools.GetUndefinedDateTime())
|
||||
// return operation.Failed("فرمت تاریخ وارد شده صحیح نمی باشد");
|
||||
|
||||
// if (date >= DateTime.Now.Date)
|
||||
// {
|
||||
// return operation.Failed("امکان اضافه کردن حضور غیاب برای روز جاری و روز های آینده وجود ندارد");
|
||||
// }
|
||||
|
||||
// var twoDaysEarlier = date.AddDays(-2).Date;
|
||||
// var twoDaysLater = date.AddDays(2).Date >= DateTime.Today
|
||||
// ? (date.AddDays(1).Date >= DateTime.Today ? DateTime.Today : date.AddDays(1).Date)
|
||||
// : date.AddDays(2).Date;
|
||||
|
||||
// if (command.WorkshopId < 1)
|
||||
// {
|
||||
// return operation.Failed("خطای سیستمی");
|
||||
// }
|
||||
|
||||
// if (command.RollCallRecords == null || command.RollCallRecords.Count == 0)
|
||||
// return operation.Failed("خطای سیستمی");
|
||||
|
||||
|
||||
// if (_leaveRepository.HasDailyLeave(command.EmployeeId, command.WorkshopId, date))
|
||||
// return operation.Failed("در روز مرخصی کارمند نمی توانید حضور غیاب ثبت کنید");
|
||||
|
||||
// var employeeStatuses = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(command.EmployeeId)
|
||||
// .FirstOrDefault(x => x.WorkshopId == command.WorkshopId)?.Statuses;
|
||||
|
||||
// var employeeRollCalls = _rollCallRepository.GetEmployeeRollCallsHistoryAllInDates(command.WorkshopId, command.EmployeeId, twoDaysEarlier, twoDaysLater);
|
||||
|
||||
// //if (employeeRollCalls.Any(x => x.StartDate.Value.Date== x.EndDate == null))
|
||||
// // return operation.Failed("به دلیل عدم ثبت خروج پرسنل در این تاریخ، شما قادر به افزودن رکورد جدید نمی باشید");
|
||||
|
||||
// if (command.RollCallRecords.Any(x => string.IsNullOrWhiteSpace(x.StartTime) || string.IsNullOrWhiteSpace(x.EndTime)))
|
||||
// return operation.Failed("ساعات شروع و پایان نمیتوانند خالی باشد");
|
||||
|
||||
|
||||
// DateTime day = command.DateFa.ToGeorgianDateTime();
|
||||
// if (day == Tools.GetUndefinedDateTime())
|
||||
// return operation.Failed("خطای سیستمی");
|
||||
|
||||
// List<EditRollCall> newRollCallDates = new();
|
||||
|
||||
// foreach (var record in command.RollCallRecords)
|
||||
// {
|
||||
// if (record.StartDate.TryToGeorgianDateTime(out var startDateGr) == false || record.EndDate.TryToGeorgianDateTime(out var endDateGr) == false)
|
||||
// return operation.Failed("فرمت تاریخ صحیح نمی باشد");
|
||||
|
||||
|
||||
// if (TimeOnly.TryParse(record.StartTime, out var startTimeOnly) == false || TimeOnly.TryParse(record.EndTime, out var endTimeOnly) == false)
|
||||
// return operation.Failed("فرمت ساعت صحیح نمی باشد");
|
||||
// DateTime startDateTime = startDateGr + startTimeOnly.ToTimeSpan();
|
||||
// DateTime endDateTime = endDateGr + endTimeOnly.ToTimeSpan();
|
||||
|
||||
// if (startDateTime >= endDateTime)
|
||||
// return operation.Failed("زمان ورود نمی تواند بعد یا مساوی زمان خروج باشد");
|
||||
|
||||
// if (endDateTime.Date >= DateTime.Today)
|
||||
// return operation.Failed("نمی توانید برای روز جاری یا روز های آینده حضور غیاب ثبت کنید");
|
||||
|
||||
// var rollCall = new EditRollCall
|
||||
// {
|
||||
// StartDate = startDateTime,
|
||||
// EndDate = endDateTime,
|
||||
// Id = record.RollCallId
|
||||
// };
|
||||
// newRollCallDates.Add(rollCall);
|
||||
// }
|
||||
|
||||
// if (newRollCallDates.Any(x => newRollCallDates.Any(y => x != y && x.EndDate >= y.StartDate && x.StartDate <= y.EndDate)))
|
||||
// return operation.Failed("بازه های وارد شده با هم تداخل دارند");
|
||||
|
||||
|
||||
|
||||
|
||||
// foreach (var activity in newRollCallDates)
|
||||
// {
|
||||
|
||||
// //مرخصی روزانه در بالا چک شده است
|
||||
// var leave = _leaveRepository.GetByWorkshopIdEmployeeIdInDates(command.WorkshopId, command.EmployeeId, activity.StartDate.Value, activity.EndDate.Value)
|
||||
// .Where(x => x.PaidLeaveType == "ساعتی");
|
||||
// if (leave.Any())
|
||||
// return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
|
||||
// }
|
||||
|
||||
// if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
|
||||
// return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
// if (newRollCallDates.Any(x =>
|
||||
// x.StartDate.Value.Date < date.Date.AddDays(-1) ||
|
||||
// x.EndDate.Value.Date > date.Date.AddDays(1)))
|
||||
// {
|
||||
// return operation.Failed("حضور غیاب در حال ویرایش را نمیتوانید بیشتر از یک روز از ثبت حضور غیاب عقب تر یا جلو تر ببرید");
|
||||
// }
|
||||
|
||||
// if (newRollCallDates.Any(x => employeeRollCalls.Any(y =>
|
||||
// y.StartDate.Value.Date != command.DateFa.ToGeorgianDateTime().Date &&
|
||||
// x.EndDate >= y.StartDate.Value && x.StartDate <= y.EndDate.Value)))
|
||||
// return operation.Failed("بازه های وارد شده با حضور غیاب های مربوط به روز های قبل و بعد تداخل زمانی دارد");
|
||||
|
||||
|
||||
// var checkoutViewModels = _checkoutRepository.SimpleSearch(new CheckoutSearchModel() { WorkshopId = command.WorkshopId, EmployeeId = command.EmployeeId });
|
||||
|
||||
// if (checkoutViewModels.Any(x => x.HasRollCall && x.WorkshopId == command.WorkshopId && x.EmployeeId == command.EmployeeId &&
|
||||
// newRollCallDates.Any(y => (y.StartDate.Value.Date >= x.ContractStartGr.Date)
|
||||
// && (y.StartDate.Value.Date <= x.ContractEndGr.Date))))
|
||||
// return operation.Failed("برای بازه های وارد شده فیش حقوقی ثبت شده است");
|
||||
|
||||
|
||||
// var name = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(command.EmployeeId, command.WorkshopId).EmployeeFullName;
|
||||
// var rollCallsAsEntityModels = newRollCallDates.Select(x => new RollCall(command.WorkshopId, command.EmployeeId, name, x.StartDate, x.EndDate,
|
||||
// Convert.ToInt32(x.StartDate.Value.ToFarsi().Substring(0, 4)), Convert.ToInt32(x.StartDate.ToFarsi().Substring(5, 2)), RollCallModifyType.EditByEmployer)).ToList();
|
||||
// _rollCallRepository.RemoveEmployeeRollCallsInDate(command.WorkshopId, command.EmployeeId, date);
|
||||
|
||||
|
||||
// _rollCallRepository.AddRange(rollCallsAsEntityModels);
|
||||
// _rollCallRepository.SaveChanges();
|
||||
// return operation.Succcedded();
|
||||
//}
|
||||
#endregion
|
||||
|
||||
#region ManualEditWithoutDates_Old
|
||||
|
||||
public OperationResult ManualEdit(CreateOrEditEmployeeRollCall command)
|
||||
{
|
||||
var operation = new OperationResult();
|
||||
|
||||
|
||||
DateTime date = command.DateFa.ToGeorgianDateTime();
|
||||
if (date == Tools.GetUndefinedDateTime())
|
||||
return operation.Failed("فرمت تاریخ وارد شده صحیح نمی باشد");
|
||||
@@ -194,11 +327,12 @@ public class RollCallApplication : IRollCallApplication
|
||||
{
|
||||
return operation.Failed("امکان اضافه کردن حضور غیاب برای روز جاری و روز های آینده وجود ندارد");
|
||||
}
|
||||
|
||||
//from new
|
||||
var twoDaysEarlier = date.AddDays(-2).Date;
|
||||
var twoDaysLater = date.AddDays(2).Date >= DateTime.Today
|
||||
? (date.AddDays(1).Date >= DateTime.Today ? DateTime.Today : date.AddDays(1).Date)
|
||||
: date.AddDays(2).Date;
|
||||
//---
|
||||
|
||||
if (command.WorkshopId < 1)
|
||||
{
|
||||
@@ -208,150 +342,147 @@ public class RollCallApplication : IRollCallApplication
|
||||
if (command.RollCallRecords == null || command.RollCallRecords.Count == 0)
|
||||
return operation.Failed("خطای سیستمی");
|
||||
|
||||
|
||||
if (_leaveRepository.HasDailyLeave(command.EmployeeId, command.WorkshopId, date))
|
||||
return operation.Failed("در روز مرخصی کارمند نمی توانید حضور غیاب ثبت کنید");
|
||||
|
||||
var employeeStatuses = _rollCallEmployeeRepository.GetByEmployeeIdWithStatuses(command.EmployeeId)
|
||||
.FirstOrDefault(x => x.WorkshopId == command.WorkshopId)?.Statuses;
|
||||
|
||||
var employeeRollCalls = _rollCallRepository.GetEmployeeRollCallsHistoryAllInDates(command.WorkshopId, command.EmployeeId, twoDaysEarlier, twoDaysLater);
|
||||
|
||||
//if (employeeRollCalls.Any(x => x.StartDate.Value.Date== x.EndDate == null))
|
||||
//comented from new
|
||||
//var employeeRollCalls = _rollCallRepository.GetWorkshopEmployeeRollCallsForDate(command.WorkshopId, command.EmployeeId, date);
|
||||
|
||||
//comented from new
|
||||
//if (employeeRollCalls.Any(x => x.EndDate == null))
|
||||
// return operation.Failed("به دلیل عدم ثبت خروج پرسنل در این تاریخ، شما قادر به افزودن رکورد جدید نمی باشید");
|
||||
|
||||
|
||||
if (command.RollCallRecords.Any(x => string.IsNullOrWhiteSpace(x.StartTime) || string.IsNullOrWhiteSpace(x.EndTime)))
|
||||
return operation.Failed("ساعات شروع و پایان نمیتوانند خالی باشد");
|
||||
|
||||
#region RollCallTimes validation and parse to DateTime
|
||||
|
||||
List<(TimeOnly start, TimeOnly end, long rollCallId)> preprocessedRollCalls = new();
|
||||
try
|
||||
{
|
||||
preprocessedRollCalls = command.RollCallRecords.Select(x =>
|
||||
{
|
||||
|
||||
if (!TimeOnly.TryParseExact(x.StartTime, "HH:mm", out TimeOnly start))
|
||||
throw new Exception();
|
||||
if (!TimeOnly.TryParseExact(x.EndTime, "HH:mm", out TimeOnly end))
|
||||
throw new Exception();
|
||||
return (start, end, x.RollCallId);
|
||||
|
||||
}).ToList();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
return operation.Failed("فرمت ساعات ورودی نادرست می باشد");
|
||||
}
|
||||
|
||||
DateTime day = command.DateFa.ToGeorgianDateTime();
|
||||
if (day == Tools.GetUndefinedDateTime())
|
||||
return operation.Failed("خطای سیستمی");
|
||||
DateTime previousEnd = new DateTime();
|
||||
preprocessedRollCalls = preprocessedRollCalls.OrderBy(x => x.start).ToList();
|
||||
List<(DateTime Start, DateTime End, long RollCallId)> result = new();
|
||||
|
||||
List<EditRollCall> newRollCallDates = new();
|
||||
|
||||
foreach (var record in command.RollCallRecords)
|
||||
foreach (var item in preprocessedRollCalls)
|
||||
{
|
||||
if (record.StartDate.TryToGeorgianDateTime(out var startDateGr) == false || record.EndDate.TryToGeorgianDateTime(out var endDateGr) == false)
|
||||
return operation.Failed("فرمت تاریخ صحیح نمی باشد");
|
||||
(DateTime Start, DateTime End, long RollCallId) rollCallWithDateTime =
|
||||
new()
|
||||
{
|
||||
Start = new DateTime(DateOnly.FromDateTime(day), item.start),
|
||||
End = new DateTime(DateOnly.FromDateTime(day), item.end),
|
||||
RollCallId = item.rollCallId
|
||||
|
||||
};
|
||||
|
||||
if (TimeOnly.TryParse(record.StartTime, out var startTimeOnly) == false || TimeOnly.TryParse(record.EndTime, out var endTimeOnly) == false)
|
||||
return operation.Failed("فرمت ساعت صحیح نمی باشد");
|
||||
DateTime startDateTime = startDateGr + startTimeOnly.ToTimeSpan();
|
||||
DateTime endDateTime = endDateGr + endTimeOnly.ToTimeSpan();
|
||||
|
||||
if (startDateTime >= endDateTime)
|
||||
return operation.Failed("زمان ورود نمی تواند بعد یا مساوی زمان خروج باشد");
|
||||
|
||||
if (endDateTime.Date >= DateTime.Today)
|
||||
return operation.Failed("نمی توانید برای روز جاری یا روز های آینده حضور غیاب ثبت کنید");
|
||||
|
||||
var rollCall = new EditRollCall
|
||||
if (previousEnd != new DateTime())
|
||||
{
|
||||
StartDate = startDateTime,
|
||||
EndDate = endDateTime,
|
||||
Id = record.RollCallId
|
||||
};
|
||||
newRollCallDates.Add(rollCall);
|
||||
if (rollCallWithDateTime.Start < previousEnd)
|
||||
{
|
||||
rollCallWithDateTime.Start = rollCallWithDateTime.Start.AddDays(1);
|
||||
}
|
||||
if (rollCallWithDateTime.Start == previousEnd)
|
||||
return operation.Failed("ساعت ورود نمی تواند با ساعت خروج حضور غیاب دیگری در آن روز برابر باشد");
|
||||
|
||||
}
|
||||
while (rollCallWithDateTime.Start >= rollCallWithDateTime.End)
|
||||
{
|
||||
rollCallWithDateTime.End = rollCallWithDateTime.End.AddDays(1);
|
||||
}
|
||||
result.Add(rollCallWithDateTime);
|
||||
previousEnd = rollCallWithDateTime.End;
|
||||
}
|
||||
var firstShiftStart = result.OrderBy(x => x.Start).FirstOrDefault().Start;
|
||||
var lastShiftEnd = result.OrderByDescending(x => x.Start).FirstOrDefault().End;
|
||||
var lastShiftStart = result.OrderByDescending(x => x.Start).FirstOrDefault().Start;
|
||||
|
||||
if (newRollCallDates.Any(x => newRollCallDates.Any(y => x != y && x.EndDate >= y.StartDate && x.StartDate <= y.EndDate)))
|
||||
return operation.Failed("بازه های وارد شده با هم تداخل دارند");
|
||||
if (firstShiftStart.AddDays(1) < lastShiftEnd)
|
||||
return operation.Failed("بازه زمانی وارد شده نا معتبر است");
|
||||
if (result.Sum(x => (x.End - x.Start).TotalHours) > 24)
|
||||
{
|
||||
return operation.Failed("بازه زمانی نمیتواند بیشتر از 24 ساعت باشد");
|
||||
}
|
||||
if (firstShiftStart.Date != lastShiftStart.Date)
|
||||
return operation.Failed("شروع رکورد حضور غیاب نمی تواند در روز های بعد از تاریخ تعیین شده باشد");
|
||||
|
||||
#endregion
|
||||
|
||||
//foreach (var item in preprocessedRollCalls)
|
||||
//{
|
||||
// (DateTime Start, DateTime End, long RollCallId) rollCallWithDateTime =
|
||||
// new()
|
||||
// {
|
||||
// Start = new DateTime(DateOnly.FromDateTime(day), item.start),
|
||||
// End = new DateTime(DateOnly.FromDateTime(day), item.end),
|
||||
// RollCallId = item.rollCallId
|
||||
|
||||
// };
|
||||
|
||||
// if (previousEnd != new DateTime())
|
||||
// {
|
||||
// if (rollCallWithDateTime.Start < previousEnd)
|
||||
// {
|
||||
// rollCallWithDateTime.Start = rollCallWithDateTime.Start.AddDays(1);
|
||||
// }
|
||||
// if (rollCallWithDateTime.Start == previousEnd)
|
||||
// return operation.Failed("ساعت ورود نمی تواند با ساعت خروج حضور غیاب دیگری در آن روز برابر باشد");
|
||||
|
||||
// }
|
||||
// while (rollCallWithDateTime.Start >= rollCallWithDateTime.End)
|
||||
// {
|
||||
// rollCallWithDateTime.End = rollCallWithDateTime.End.AddDays(1);
|
||||
// }
|
||||
// result.Add(rollCallWithDateTime);
|
||||
// previousEnd = rollCallWithDateTime.End;
|
||||
//}
|
||||
//var firstShiftStart = result.OrderBy(x => x.Start).FirstOrDefault().Start;
|
||||
//var lastShiftEnd = result.OrderByDescending(x => x.Start).FirstOrDefault().End;
|
||||
//var lastShiftStart = result.OrderByDescending(x => x.Start).FirstOrDefault().Start;
|
||||
|
||||
//if (firstShiftStart.AddDays(1) < lastShiftEnd)
|
||||
// return operation.Failed("بازه زمانی وارد شده نا معتبر است");
|
||||
//if (result.Sum(x => (x.End - x.Start).TotalHours) > 24)
|
||||
//{
|
||||
// return operation.Failed("بازه زمانی نمیتواند بیشتر از 24 ساعت باشد");
|
||||
//}
|
||||
//if (firstShiftStart.Date != lastShiftStart.Date)
|
||||
// return operation.Failed("شروع رکورد حضور غیاب نمی تواند در روز های بعد از تاریخ تعیین شده باشد");
|
||||
|
||||
|
||||
foreach (var activity in newRollCallDates)
|
||||
//from new
|
||||
foreach (var activity in result)
|
||||
{
|
||||
|
||||
//مرخصی روزانه در بالا چک شده است
|
||||
var leave = _leaveRepository.GetByWorkshopIdEmployeeIdInDates(command.WorkshopId, command.EmployeeId, activity.StartDate.Value, activity.EndDate.Value)
|
||||
var leave = _leaveRepository.GetByWorkshopIdEmployeeIdInDates(command.WorkshopId, command.EmployeeId, activity.Start, activity.End)
|
||||
.Where(x => x.PaidLeaveType == "ساعتی");
|
||||
if (leave.Any())
|
||||
return operation.Failed("کارمند در بازه انتخاب شده مرخصی ساعتی دارد");
|
||||
}
|
||||
|
||||
if (newRollCallDates == null || !newRollCallDates.All(x => employeeStatuses.Any(y => x.StartDate >= y.StartDateGr && x.EndDate <= y.EndDateGr)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
if (newRollCallDates.Any(x =>
|
||||
x.StartDate.Value.Date < date.Date.AddDays(-1) ||
|
||||
x.EndDate.Value.Date > date.Date.AddDays(1)))
|
||||
if (result.Any(x =>
|
||||
x.Start.Date < date.Date.AddDays(-1) ||
|
||||
x.End.Date > date.Date.AddDays(1)))
|
||||
{
|
||||
return operation.Failed("حضور غیاب در حال ویرایش را نمیتوانید بیشتر از یک روز از ثبت حضور غیاب عقب تر یا جلو تر ببرید");
|
||||
}
|
||||
|
||||
if (newRollCallDates.Any(x => employeeRollCalls.Any(y =>
|
||||
y.StartDate.Value.Date != command.DateFa.ToGeorgianDateTime().Date &&
|
||||
x.EndDate >= y.StartDate.Value && x.StartDate <= y.EndDate.Value)))
|
||||
return operation.Failed("بازه های وارد شده با حضور غیاب های مربوط به روز های قبل و بعد تداخل زمانی دارد");
|
||||
//مهم
|
||||
//رول کال روز جاری
|
||||
#region NewValidation
|
||||
var currentDayRollCall = employeeRollCalls.FirstOrDefault(x => x.EndDate == null);
|
||||
if (currentDayRollCall != null && result.Any(x => x.End >= currentDayRollCall.StartDate))
|
||||
return operation.Failed("بازه های وارد شده با حضور غیاب جاری تداخل زمانی دارد");
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
if (result.Any(x => employeeRollCalls.Any(y =>
|
||||
y.StartDate.Value.Date != command.DateFa.ToGeorgianDateTime().Date &&
|
||||
x.End >= y.StartDate.Value && x.Start <= y.EndDate.Value)))
|
||||
return operation.Failed("بازه های وارد شده با حضور غیاب های مربوط به روز های قبل و بعد تداخل زمانی دارد");
|
||||
|
||||
var checkoutViewModels = _checkoutRepository.SimpleSearch(new CheckoutSearchModel() { WorkshopId = command.WorkshopId, EmployeeId = command.EmployeeId });
|
||||
|
||||
if (checkoutViewModels.Any(x => x.HasRollCall && x.WorkshopId == command.WorkshopId && x.EmployeeId == command.EmployeeId &&
|
||||
newRollCallDates.Any(y => (y.StartDate.Value.Date >= x.ContractStartGr.Date)
|
||||
&& (y.StartDate.Value.Date <= x.ContractEndGr.Date))))
|
||||
result.Any(y => (y.Start.Date >= x.ContractStartGr.Date)
|
||||
&& (y.Start.Date <= x.ContractEndGr.Date))))
|
||||
return operation.Failed("برای بازه های وارد شده فیش حقوقی ثبت شده است");
|
||||
|
||||
//return operation.Failed("برای بازه های وارد شده فیش حقوقی ثبت شده است، برای ویرایش حضور و غیاب باید فیش حقوقی را پاک کنید");
|
||||
|
||||
//if (_customizeCheckoutRepository.Exists(x =>
|
||||
// newRollCallDates.Any(y => y.Start.Date >= x.ContractStart.Date &&
|
||||
// y.Start.Date <= x.ContractEnd.Date)))
|
||||
// return operation.Failed("برای بازه های وارد شده فیش حقوقی غیر رسمی نهایی ثبت شده است");
|
||||
//---
|
||||
|
||||
|
||||
//if (_customizeCheckoutTempRepository.Exists(x =>
|
||||
// newRollCallDates.Any(y => y.Start.Date >= x.ContractStart.Date &&
|
||||
// y.Start.Date <= x.ContractEnd.Date)))
|
||||
// return operation.Failed("برای بازه های وارد شده فیش حقوقی غیر رسمی موقت شده است");
|
||||
if (result == null || !result.All(x => employeeStatuses.Any(y => x.Start >= y.StartDateGr || x.End <= y.EndDateGr)))
|
||||
return operation.Failed("کارمند در بازه وارد شده غیر فعال است");
|
||||
|
||||
|
||||
var name = _rollCallEmployeeRepository.GetByEmployeeIdAndWorkshopId(command.EmployeeId, command.WorkshopId).EmployeeFullName;
|
||||
var rollCallsAsEntityModels = newRollCallDates.Select(x => new RollCall(command.WorkshopId, command.EmployeeId, name, x.StartDate, x.EndDate,
|
||||
Convert.ToInt32(x.StartDate.Value.ToFarsi().Substring(0, 4)), Convert.ToInt32(x.StartDate.ToFarsi().Substring(5, 2)), RollCallModifyType.EditByEmployer)).ToList();
|
||||
var rollCallsAsEntityModels = result.Select(x => new RollCall(command.WorkshopId, command.EmployeeId, name, x.Start, x.End,
|
||||
Convert.ToInt32(x.Start.ToFarsi().Substring(0, 4)), Convert.ToInt32(x.Start.ToFarsi().Substring(5, 2)), RollCallModifyType.EditByEmployer)).ToList();
|
||||
_rollCallRepository.RemoveEmployeeRollCallsInDate(command.WorkshopId, command.EmployeeId, date);
|
||||
|
||||
|
||||
@@ -360,6 +491,7 @@ public class RollCallApplication : IRollCallApplication
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public List<RollCallViewModel> GetWorkshopEmployeeRollCallsForDate(long workshopId, long employeeId, string dateFa)
|
||||
{
|
||||
|
||||
@@ -268,6 +268,7 @@ public class CompanyContext : DbContext
|
||||
{
|
||||
var assembly = typeof(PersonalContractingpartyMapping).Assembly;
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(assembly);
|
||||
modelBuilder.Entity<RollCall>().HasQueryFilter(x => x.RollCallModifyType != RollCallModifyType.Undefined);
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,16 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
|
||||
builder.Property(x => x.AverageHoursPerDay);
|
||||
builder.Property(x => x.HasRollCall);
|
||||
|
||||
builder.HasOne(x => x.Workshop)
|
||||
builder.Property(x => x.OverTimeWorkValue).HasMaxLength(10);
|
||||
builder.Property(x => x.OverNightWorkValue).HasMaxLength(10);
|
||||
builder.Property(x => x.FridayWorkValue).HasMaxLength(10);
|
||||
builder.Property(x => x.RotatingShiftValue).HasMaxLength(10);
|
||||
builder.Property(x => x.AbsenceValue).HasMaxLength(10);
|
||||
builder.Property(x => x.TotalDayOfLeaveCompute).HasMaxLength(10);
|
||||
builder.Property(x => x.TotalDayOfYearsCompute).HasMaxLength(10);
|
||||
builder.Property(x => x.TotalDayOfBunosesCompute).HasMaxLength(10);
|
||||
|
||||
builder.HasOne(x => x.Workshop)
|
||||
.WithMany(x => x.Checkouts)
|
||||
.HasForeignKey(x => x.WorkshopId);
|
||||
|
||||
|
||||
7829
CompanyManagment.EFCore/Migrations/20241227233126_addValuesToChekout.Designer.cs
generated
Normal file
7829
CompanyManagment.EFCore/Migrations/20241227233126_addValuesToChekout.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,73 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addValuesToChekout : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "AbsenceValue",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FridayWorkValue",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OverNightWorkValue",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OverTimeWorkvalue",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RotatingShifValue",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AbsenceValue",
|
||||
table: "Checkouts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FridayWorkValue",
|
||||
table: "Checkouts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OverNightWorkValue",
|
||||
table: "Checkouts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OverTimeWorkvalue",
|
||||
table: "Checkouts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RotatingShifValue",
|
||||
table: "Checkouts");
|
||||
}
|
||||
}
|
||||
}
|
||||
7829
CompanyManagment.EFCore/Migrations/20241228124236_CurrectionNameOnCheckout.Designer.cs
generated
Normal file
7829
CompanyManagment.EFCore/Migrations/20241228124236_CurrectionNameOnCheckout.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class CurrectionNameOnCheckout : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "OverTimeWorkvalue",
|
||||
table: "Checkouts",
|
||||
newName: "OverTimeWorkValue");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "RotatingShifValue",
|
||||
table: "Checkouts",
|
||||
newName: "RotatingShiftValue");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "OverTimeWorkValue",
|
||||
table: "Checkouts",
|
||||
newName: "OverTimeWorkvalue");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "RotatingShiftValue",
|
||||
table: "Checkouts",
|
||||
newName: "RotatingShifValue");
|
||||
}
|
||||
}
|
||||
}
|
||||
7841
CompanyManagment.EFCore/Migrations/20241231151246_NewValuesToChekout.Designer.cs
generated
Normal file
7841
CompanyManagment.EFCore/Migrations/20241231151246_NewValuesToChekout.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,51 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class NewValuesToChekout : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TotalDayOfBunosesCompute",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TotalDayOfLeaveCompute",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TotalDayOfYearsCompute",
|
||||
table: "Checkouts",
|
||||
type: "nvarchar(10)",
|
||||
maxLength: 10,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalDayOfBunosesCompute",
|
||||
table: "Checkouts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalDayOfLeaveCompute",
|
||||
table: "Checkouts");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TotalDayOfYearsCompute",
|
||||
table: "Checkouts");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,6 +192,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<double>("AbsencePeriod")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("AbsenceValue")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("ArchiveCode")
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
@@ -248,6 +252,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<double>("FridayPay")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("FridayWorkValue")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<bool>("HasRollCall")
|
||||
.HasColumnType("bit");
|
||||
|
||||
@@ -290,6 +298,14 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<double>("NightworkPay")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("OverNightWorkValue")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("OverTimeWorkValue")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<double>("OvertimePay")
|
||||
.HasColumnType("float");
|
||||
|
||||
@@ -300,6 +316,10 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<double?>("RewardPay")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("RotatingShiftValue")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<double>("SalaryAidDeduction")
|
||||
.HasColumnType("float");
|
||||
|
||||
@@ -321,6 +341,18 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b.Property<string>("TotalDayOfBunosesCompute")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("TotalDayOfLeaveCompute")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("TotalDayOfYearsCompute")
|
||||
.HasMaxLength(10)
|
||||
.HasColumnType("nvarchar(10)");
|
||||
|
||||
b.Property<string>("TotalDeductions")
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
@@ -96,93 +96,12 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
public void CreateCkeckout(Checkout command)
|
||||
{
|
||||
//var employeeFullName = new SqlParameter("@EmployeeFullName", SqlDbType.NVarChar, 50);
|
||||
//employeeFullName.Value = command.EmployeeFullName;
|
||||
//var isActiveString = new SqlParameter("@IsActiveString", SqlDbType.NVarChar, 10);
|
||||
//isActiveString.Value = "true";
|
||||
//var signature = new SqlParameter("@Signature", SqlDbType.NVarChar, 20);
|
||||
//signature.Value = "0";
|
||||
//var fathersName = new SqlParameter("@FathersName", SqlDbType.NVarChar, 20);
|
||||
//fathersName.Value = command.FathersName;
|
||||
//var nationalCode = new SqlParameter("@NationalCode", SqlDbType.NVarChar, 10);
|
||||
//nationalCode.Value = command.NationalCode;
|
||||
//var dateOfBirth = new SqlParameter("@DateOfBirth", SqlDbType.NVarChar, 10);
|
||||
//dateOfBirth.Value = command.DateOfBirth;
|
||||
//var employeeId = new SqlParameter("@EmployeeId", SqlDbType.BigInt);
|
||||
//employeeId.Value = command.EmployeeId;
|
||||
//var workshopName = new SqlParameter("@WorkshopName", SqlDbType.NVarChar, 70);
|
||||
//workshopName.Value = command.WorkshopName;
|
||||
//var workshopId = new SqlParameter("@WorkshopId", SqlDbType.BigInt);
|
||||
//workshopId.Value = command.WorkshopId;
|
||||
//var contractNo = new SqlParameter("@ContractNo", SqlDbType.NVarChar, 50);
|
||||
//contractNo.Value = command.ContractNo;
|
||||
//var contractStart = new SqlParameter("@ContractStart", SqlDbType.DateTime2);
|
||||
//contractStart.Value = command.ContractStart;
|
||||
//var contractEnd = new SqlParameter("@ContractEnd", SqlDbType.DateTime2);
|
||||
//contractEnd.Value = command.ContractEnd;
|
||||
//var month = new SqlParameter("@Month", SqlDbType.NVarChar, 10);
|
||||
//month.Value = command.Month;
|
||||
//var year = new SqlParameter("@Year", SqlDbType.NVarChar, 4);
|
||||
//year.Value = command.Year;
|
||||
//var contractId = new SqlParameter("@ContractId", SqlDbType.BigInt);
|
||||
//contractId.Value = command.ContractId;
|
||||
//var workingHoursId = new SqlParameter("@WorkingHoursId", SqlDbType.BigInt);
|
||||
//workingHoursId.Value = command.WorkingHoursId;
|
||||
//var monthlySalary = new SqlParameter("@MonthlySalary", SqlDbType.Float);
|
||||
//monthlySalary.Value = command.MonthlySalary;
|
||||
//var baseYearsPay = new SqlParameter("@BaseYearsPay", SqlDbType.Float);
|
||||
//baseYearsPay.Value = command.BaseYearsPay;
|
||||
//var consumableItems = new SqlParameter("@ConsumableItems", SqlDbType.Float);
|
||||
//consumableItems.Value = command.ConsumableItems;
|
||||
//var housingAllowance = new SqlParameter("@HousingAllowance", SqlDbType.Float);
|
||||
//housingAllowance.Value = command.HousingAllowance;
|
||||
//var overtimePay = new SqlParameter("@OvertimePay", SqlDbType.Float);
|
||||
//overtimePay.Value = command.OvertimePay;
|
||||
//var nightworkPay = new SqlParameter("@NightworkPay", SqlDbType.Float);
|
||||
//nightworkPay.Value = command.NightworkPay;
|
||||
//var fridayPay = new SqlParameter("@FridayPay", SqlDbType.Float);
|
||||
//fridayPay.Value = command.FridayPay;
|
||||
//var missionPay = new SqlParameter("@MissionPay", SqlDbType.Float);
|
||||
//missionPay.Value = command.MissionPay;
|
||||
//var shiftPay = new SqlParameter("@ShiftPay", SqlDbType.Float);
|
||||
//shiftPay.Value = command.ShiftPay;
|
||||
//var familyAllowance = new SqlParameter("@FamilyAllowance", SqlDbType.Float);
|
||||
//familyAllowance.Value = command.FamilyAllowance;
|
||||
//var bonusesPay = new SqlParameter("@BonusesPay", SqlDbType.Float);
|
||||
//bonusesPay.Value = command.BonusesPay;
|
||||
//var yearsPay = new SqlParameter("@YearsPay", SqlDbType.Float);
|
||||
//yearsPay.Value = command.YearsPay;
|
||||
//var leavePay = new SqlParameter("@LeavePay", SqlDbType.Float);
|
||||
//leavePay.Value = command.LeavePay;
|
||||
//var insuranceDeduction = new SqlParameter("@InsuranceDeduction", SqlDbType.Float);
|
||||
//insuranceDeduction.Value = command.InsuranceDeduction;
|
||||
//var taxDeducation = new SqlParameter("@TaxDeducation", SqlDbType.Float);
|
||||
//taxDeducation.Value = command.TaxDeducation;
|
||||
//var installmentDeduction = new SqlParameter("@InstallmentDeduction", SqlDbType.Float);
|
||||
//installmentDeduction.Value = command.InstallmentDeduction;
|
||||
//var salaryAidDeduction = new SqlParameter("@SalaryAidDeduction", SqlDbType.Float);
|
||||
//salaryAidDeduction.Value = command.SalaryAidDeduction;
|
||||
//var absenceDeduction = new SqlParameter("@AbsenceDeduction", SqlDbType.Float);
|
||||
//absenceDeduction.Value = command.AbsenceDeduction;
|
||||
//var creationDate = new SqlParameter("@CreationDate", SqlDbType.DateTime2);
|
||||
//creationDate.Value = DateTime.Now;
|
||||
//var archiveCode = new SqlParameter("@ArchiveCode", SqlDbType.NVarChar, 15);
|
||||
//archiveCode.Value = command.ArchiveCode;
|
||||
//var personnelCode = new SqlParameter("@PersonnelCode", SqlDbType.NVarChar, 10);
|
||||
//personnelCode.Value = command.PersonnelCode;
|
||||
//var sumOfWorkingDays = new SqlParameter("@SumOfWorkingDays", SqlDbType.NVarChar, 6);
|
||||
//sumOfWorkingDays.Value = command.SumOfWorkingDays;
|
||||
//var totalClaims = new SqlParameter("@TotalClaims", SqlDbType.NVarChar, 25);
|
||||
//totalClaims.Value = command.TotalClaims;
|
||||
//var totalDeductions = new SqlParameter("@TotalDeductions", SqlDbType.NVarChar, 25);
|
||||
//totalDeductions.Value = command.TotalDeductions;
|
||||
//var totalPayment = new SqlParameter("@TotalPayment", SqlDbType.Float);
|
||||
//totalPayment.Value = command.TotalPayment;
|
||||
|
||||
var creationDates = DateTime.Now;
|
||||
|
||||
//var result = await _context.Database.ExecuteSqlInterpolatedAsync($"EXEC InsertQuery_Checkout {id},{employeeFullName},{isActiveString},{signature},{fathersName},{nationalCode},{dateOfBirth},{employeeId},{workshopName},{workshopId},{contractNo},{contractStart},{contractEnd},{month},{year},{contractId},{workingHoursId},{monthlySalary},{baseYearsPay},{consumableItems},{housingAllowance},{overtimePay},{nightworkPay},{fridayPay},{missionPay},{shiftPay},{familyAllowance},{bonusesPay},{yearsPay},{leavePay},{insuranceDeduction},{taxDeducation},{installmentDeduction},{salaryAidDeduction},{absenceDeduction},{creationDate},{archiveCode},{personnelCode},{sumOfWorkingDays},{totalClaims},{taxDeducation},{totalPayment}");
|
||||
var result = _context.Database.ExecuteSqlInterpolated(
|
||||
$"EXEC InsertQuery_CreateChekoute {command.EmployeeFullName},{"true"},{command.Signature},{command.FathersName},{command.NationalCode},{command.DateOfBirth},{command.EmployeeId},{command.WorkshopName},{command.WorkshopId},{command.ContractNo},{command.ContractStart},{command.ContractEnd},{command.Month},{command.Year},{command.ContractId},{command.WorkingHoursId},{command.MonthlySalary},{command.BaseYearsPay},{command.ConsumableItems},{command.HousingAllowance},{command.OvertimePay},{command.NightworkPay},{command.FridayPay},{command.MissionPay},{command.ShiftPay},{command.FamilyAllowance},{command.BonusesPay},{command.YearsPay},{command.LeavePay},{command.InsuranceDeduction},{command.TaxDeducation},{command.InstallmentDeduction},{command.SalaryAidDeduction},{command.AbsenceDeduction},{creationDates},{command.ArchiveCode},{command.PersonnelCode},{command.SumOfWorkingDays},{command.TotalClaims},{command.TotalDeductions},{command.TotalPayment},{0},{command.MarriedAllowance},{command.AbsencePeriod},{command.AverageHoursPerDay},{command.CreditLeaves},{command.LeaveCheckout},{command.HasRollCall}");
|
||||
$"EXEC InsertQuery_CreateChekoute {command.EmployeeFullName},{"true"},{command.Signature},{command.FathersName},{command.NationalCode},{command.DateOfBirth},{command.EmployeeId},{command.WorkshopName},{command.WorkshopId},{command.ContractNo},{command.ContractStart},{command.ContractEnd},{command.Month},{command.Year},{command.ContractId},{command.WorkingHoursId},{command.MonthlySalary},{command.BaseYearsPay},{command.ConsumableItems},{command.HousingAllowance},{command.OvertimePay},{command.NightworkPay},{command.FridayPay},{command.MissionPay},{command.ShiftPay},{command.FamilyAllowance},{command.BonusesPay},{command.YearsPay},{command.LeavePay},{command.InsuranceDeduction},{command.TaxDeducation},{command.InstallmentDeduction},{command.SalaryAidDeduction},{command.AbsenceDeduction},{creationDates},{command.ArchiveCode},{command.PersonnelCode},{command.SumOfWorkingDays},{command.TotalClaims},{command.TotalDeductions},{command.TotalPayment},{0},{command.MarriedAllowance},{command.AbsencePeriod},{command.AverageHoursPerDay},{command.CreditLeaves},{command.LeaveCheckout},{command.HasRollCall},{command.OverTimeWorkValue},{command.OverNightWorkValue},{command.FridayWorkValue},{command.RotatingShiftValue},{command.AbsenceValue}, {command.TotalDayOfLeaveCompute},{command.TotalDayOfYearsCompute},{command.TotalDayOfBunosesCompute}");
|
||||
}
|
||||
|
||||
|
||||
@@ -537,164 +456,176 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
|
||||
}
|
||||
|
||||
public List<CheckoutViewModel> PrintAll(List<long> id)
|
||||
{
|
||||
var query = new List<CheckoutViewModel>();
|
||||
foreach (var item in id)
|
||||
{
|
||||
var ch = _context.CheckoutSet.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
FathersName = x.FathersName,
|
||||
NationalCode = x.NationalCode,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
WorkshopName = x.WorkshopName,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
PersonnelCode = x.PersonnelCode,
|
||||
PersonnelCodeInt = Convert.ToInt32(x.PersonnelCode),
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
ConsumableItems = x.ConsumableItems.ToMoney(),
|
||||
HousingAllowance = x.HousingAllowance.ToMoney(),
|
||||
OvertimePay = x.OvertimePay.ToMoney(),
|
||||
NightworkPay = x.NightworkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
MissionPay = x.MissionPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
YearsPay = x.YearsPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeducation.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.AbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoneyNullable(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
IsLeft = false,
|
||||
LeftWorkDate = "",
|
||||
LastDayOfWork = "",
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
HasRollCall = x.HasRollCall
|
||||
}).SingleOrDefault(x => x.Id == item);
|
||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||
ch.WorkshopName = workshopName.WorkshopName;
|
||||
ch.TotalPaymentHide = workshopName.TotalPaymentHide;
|
||||
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == ch.WorkshopId)
|
||||
.Select(x => x.EmployerId);
|
||||
var employerlist = _context.Employers.Where(x => emp.Contains(x.id));
|
||||
var employers = new List<EmprViewModel>();
|
||||
public List<CheckoutViewModel> PrintAll(List<long> id)
|
||||
{
|
||||
var query = new List<CheckoutViewModel>();
|
||||
foreach (var item in id)
|
||||
{
|
||||
var ch = _context.CheckoutSet.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
FathersName = x.FathersName,
|
||||
NationalCode = x.NationalCode,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
WorkshopName = x.WorkshopName,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
PersonnelCode = x.PersonnelCode,
|
||||
PersonnelCodeInt = Convert.ToInt32(x.PersonnelCode),
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
ConsumableItems = x.ConsumableItems.ToMoney(),
|
||||
HousingAllowance = x.HousingAllowance.ToMoney(),
|
||||
OvertimePay = x.OvertimePay.ToMoney(),
|
||||
NightworkPay = x.NightworkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
MissionPay = x.MissionPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
YearsPay = x.YearsPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeducation.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.AbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoneyNullable(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
IsLeft = false,
|
||||
LeftWorkDate = "",
|
||||
LastDayOfWork = "",
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
HasRollCall = x.HasRollCall,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
OverTimeWorkValue = x.OverTimeWorkValue,
|
||||
OverNightWorkValue = x.OverNightWorkValue,
|
||||
FridayWorkValue = x.FridayWorkValue,
|
||||
RotatingShiftValue = x.RotatingShiftValue,
|
||||
AbsenceValue = x.AbsenceValue,
|
||||
MaritalStatus = "",
|
||||
TotalDayOfLeaveCompute = x.TotalDayOfLeaveCompute,
|
||||
TotalDayOfYearsCompute = x.TotalDayOfYearsCompute,
|
||||
TotalDayOfBunosesCompute = x.TotalDayOfBunosesCompute
|
||||
|
||||
foreach (var em in employerlist)
|
||||
{
|
||||
var employer = new EmprViewModel()
|
||||
{
|
||||
EmployerFullName = em.FName + " " + em.LName,
|
||||
IsLegal = em.IsLegal,
|
||||
};
|
||||
employers.Add(employer);
|
||||
}
|
||||
}).SingleOrDefault(x => x.Id == item);
|
||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||
ch.WorkshopName = workshopName.WorkshopName;
|
||||
ch.TotalPaymentHide = workshopName.TotalPaymentHide;
|
||||
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == ch.WorkshopId)
|
||||
.Select(x => x.EmployerId);
|
||||
var employerlist = _context.Employers.Where(x => emp.Contains(x.id));
|
||||
var employers = new List<EmprViewModel>();
|
||||
|
||||
ch.EmployerList = employers;
|
||||
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(ch.ContractId);
|
||||
ch.CreateWorkingHoursTemp = workingHours;
|
||||
var AbsenceDeduction = ch.AbsenceDeduction.MoneyToDouble();
|
||||
var InstallmentDeduction = ch.InstallmentDeduction.MoneyToDouble();
|
||||
var InsuranceDeduction = ch.InsuranceDeduction.MoneyToDouble();
|
||||
var SalaryAidDeduction = ch.SalaryAidDeduction.MoneyToDouble();
|
||||
var TaxDeducation = ch.TaxDeducation.MoneyToDouble();
|
||||
var TotalDeduction = AbsenceDeduction + InsuranceDeduction + InstallmentDeduction + SalaryAidDeduction +
|
||||
TaxDeducation;
|
||||
ch.TotalDeductions = TotalDeduction.ToMoney();
|
||||
|
||||
foreach (var em in employerlist)
|
||||
{
|
||||
var employer = new EmprViewModel()
|
||||
{
|
||||
EmployerFullName = em.FName + " " + em.LName,
|
||||
IsLegal = em.IsLegal,
|
||||
};
|
||||
employers.Add(employer);
|
||||
}
|
||||
|
||||
var leftWorkSearch = new LeftWorkSearchModel() { WorkshopId = ch.WorkshopId, EmployeeId = ch.EmployeeId };
|
||||
var leftworkResult = _leftWorkRepository.search(leftWorkSearch).FirstOrDefault();
|
||||
var leftCheck = _leftWorkRepository.CheckoutleftWorkCheck(ch.ContractStartGr, ch.WorkshopId, ch.EmployeeId);
|
||||
var contractLeftWorkDate = ch.ContractEndGr.AddDays(1);
|
||||
if (leftCheck != null && leftCheck.LeftWorkDateGr == contractLeftWorkDate)
|
||||
{
|
||||
ch.IsLeft = true;
|
||||
ch.LeftWorkDate = leftCheck.LeftWorkDate;
|
||||
ch.LastDayOfWork = ch.ContractEndGr.ToFarsi();
|
||||
}
|
||||
//var checkBonusesPay = leftworkResult != null && leftworkResult.AddBonusesPay;
|
||||
//var checkYearsPay = leftworkResult != null && leftworkResult.AddYearsPay;
|
||||
//var checkLeavePay = leftworkResult != null && leftworkResult.AddLeavePay;
|
||||
|
||||
//if (!checkBonusesPay || !checkYearsPay || !checkLeavePay)
|
||||
//{
|
||||
// double sumOfBonusAndYearsPay = 0;
|
||||
// if (!checkBonusesPay)
|
||||
// {
|
||||
// var bonusesPay = ch.BonusesPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += bonusesPay;
|
||||
// ch.BonusesPay = "0";
|
||||
|
||||
// }
|
||||
|
||||
// if (!checkYearsPay)
|
||||
// {
|
||||
// var yearsPay = ch.YearsPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += yearsPay;
|
||||
// ch.YearsPay = "0";
|
||||
// }
|
||||
|
||||
// if (!checkLeavePay)
|
||||
// {
|
||||
// var leavePay = ch.LeavePay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += leavePay;
|
||||
// ch.LeavePay = "0";
|
||||
// }
|
||||
// var totalClaimsDouble = ch.TotalClaims.MoneyToDouble();
|
||||
// var totalClaims = totalClaimsDouble - sumOfBonusAndYearsPay;
|
||||
// ch.TotalClaims = totalClaims.ToMoney();
|
||||
|
||||
// var totalPayment = totalClaims - TotalDeduction;
|
||||
// ch.TotalPayment = totalPayment.ToMoney();
|
||||
ch.MaritalStatus = _context.Employees.Find(ch.EmployeeId)?.MaritalStatus;
|
||||
ch.EmployerList = employers;
|
||||
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(ch.ContractId);
|
||||
ch.CreateWorkingHoursTemp = workingHours;
|
||||
var AbsenceDeduction = ch.AbsenceDeduction.MoneyToDouble();
|
||||
var InstallmentDeduction = ch.InstallmentDeduction.MoneyToDouble();
|
||||
var InsuranceDeduction = ch.InsuranceDeduction.MoneyToDouble();
|
||||
var SalaryAidDeduction = ch.SalaryAidDeduction.MoneyToDouble();
|
||||
var TaxDeducation = ch.TaxDeducation.MoneyToDouble();
|
||||
var TotalDeduction = AbsenceDeduction + InsuranceDeduction + InstallmentDeduction + SalaryAidDeduction +
|
||||
TaxDeducation;
|
||||
ch.TotalDeductions = TotalDeduction.ToMoney();
|
||||
|
||||
|
||||
//}
|
||||
var leftWorkSearch = new LeftWorkSearchModel() { WorkshopId = ch.WorkshopId, EmployeeId = ch.EmployeeId };
|
||||
var leftworkResult = _leftWorkRepository.search(leftWorkSearch).FirstOrDefault();
|
||||
var leftCheck = _leftWorkRepository.CheckoutleftWorkCheck(ch.ContractStartGr, ch.WorkshopId, ch.EmployeeId);
|
||||
var contractLeftWorkDate = ch.ContractEndGr.AddDays(1);
|
||||
if (leftCheck != null && leftCheck.LeftWorkDateGr == contractLeftWorkDate)
|
||||
{
|
||||
ch.IsLeft = true;
|
||||
ch.LeftWorkDate = leftCheck.LeftWorkDate;
|
||||
ch.LastDayOfWork = ch.ContractEndGr.ToFarsi();
|
||||
}
|
||||
//var checkBonusesPay = leftworkResult != null && leftworkResult.AddBonusesPay;
|
||||
//var checkYearsPay = leftworkResult != null && leftworkResult.AddYearsPay;
|
||||
//var checkLeavePay = leftworkResult != null && leftworkResult.AddLeavePay;
|
||||
|
||||
//if (ch.WorkshopId == 40 || ch.WorkshopId == 68 || ch.WorkshopId == 44 || ch.WorkshopId == 45 || ch.WorkshopId == 280)
|
||||
//{
|
||||
// ch.TotalClaims = "";
|
||||
// ch.TotalDeductions = "";
|
||||
// ch.TotalPayment = "";
|
||||
//}
|
||||
if (ch.TotalPaymentHide == false)
|
||||
{
|
||||
ch.TotalClaims = "";
|
||||
ch.TotalDeductions = "";
|
||||
ch.TotalPayment = "";
|
||||
}
|
||||
if (ch.HasRollCall)
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||
query.Add(ch);
|
||||
}
|
||||
//if (!checkBonusesPay || !checkYearsPay || !checkLeavePay)
|
||||
//{
|
||||
// double sumOfBonusAndYearsPay = 0;
|
||||
// if (!checkBonusesPay)
|
||||
// {
|
||||
// var bonusesPay = ch.BonusesPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += bonusesPay;
|
||||
// ch.BonusesPay = "0";
|
||||
|
||||
query = query.OrderBy(x => x.PersonnelCodeInt).ToList();
|
||||
int printNumer = 0;
|
||||
foreach (var rec in query)
|
||||
{
|
||||
printNumer += 1;
|
||||
rec.PrintCounter = printNumer;
|
||||
}
|
||||
return query;
|
||||
}
|
||||
// }
|
||||
|
||||
public CheckoutLeavePrintViewModel PrintLeave(long id)
|
||||
// if (!checkYearsPay)
|
||||
// {
|
||||
// var yearsPay = ch.YearsPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += yearsPay;
|
||||
// ch.YearsPay = "0";
|
||||
// }
|
||||
|
||||
// if (!checkLeavePay)
|
||||
// {
|
||||
// var leavePay = ch.LeavePay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += leavePay;
|
||||
// ch.LeavePay = "0";
|
||||
// }
|
||||
// var totalClaimsDouble = ch.TotalClaims.MoneyToDouble();
|
||||
// var totalClaims = totalClaimsDouble - sumOfBonusAndYearsPay;
|
||||
// ch.TotalClaims = totalClaims.ToMoney();
|
||||
|
||||
// var totalPayment = totalClaims - TotalDeduction;
|
||||
// ch.TotalPayment = totalPayment.ToMoney();
|
||||
|
||||
|
||||
//}
|
||||
|
||||
//if (ch.WorkshopId == 40 || ch.WorkshopId == 68 || ch.WorkshopId == 44 || ch.WorkshopId == 45 || ch.WorkshopId == 280)
|
||||
//{
|
||||
// ch.TotalClaims = "";
|
||||
// ch.TotalDeductions = "";
|
||||
// ch.TotalPayment = "";
|
||||
//}
|
||||
if (ch.TotalPaymentHide == false)
|
||||
{
|
||||
ch.TotalClaims = "";
|
||||
ch.TotalDeductions = "";
|
||||
ch.TotalPayment = "";
|
||||
}
|
||||
if (ch.HasRollCall)
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||
query.Add(ch);
|
||||
}
|
||||
|
||||
query = query.OrderBy(x => x.PersonnelCodeInt).ToList();
|
||||
int printNumer = 0;
|
||||
foreach (var rec in query)
|
||||
{
|
||||
printNumer += 1;
|
||||
rec.PrintCounter = printNumer;
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
public CheckoutLeavePrintViewModel PrintLeave(long id)
|
||||
{
|
||||
var ch = _context.CheckoutSet.Select(x => new CheckoutLeavePrintViewModel()
|
||||
{
|
||||
@@ -797,153 +728,164 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
return ch;
|
||||
}
|
||||
|
||||
public CheckoutViewModel PrintOne(long id)
|
||||
{
|
||||
var ch = _context.CheckoutSet.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
FathersName = x.FathersName,
|
||||
NationalCode = x.NationalCode,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
WorkshopName = x.WorkshopName,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
ConsumableItems = x.ConsumableItems.ToMoney(),
|
||||
HousingAllowance = x.HousingAllowance.ToMoney(),
|
||||
OvertimePay = x.OvertimePay.ToMoney(),
|
||||
NightworkPay = x.NightworkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
MissionPay = x.MissionPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
YearsPay = x.YearsPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeducation.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.AbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoneyNullable(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
IsLeft = false,
|
||||
LeftWorkDate = "",
|
||||
LastDayOfWork = "",
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
HasRollCall = x.HasRollCall
|
||||
|
||||
}).SingleOrDefault(x => x.Id == id);
|
||||
public CheckoutViewModel PrintOne(long id)
|
||||
{
|
||||
var ch = _context.CheckoutSet.Select(x => new CheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId,
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
FathersName = x.FathersName,
|
||||
NationalCode = x.NationalCode,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
WorkshopName = x.WorkshopName,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
ConsumableItems = x.ConsumableItems.ToMoney(),
|
||||
HousingAllowance = x.HousingAllowance.ToMoney(),
|
||||
OvertimePay = x.OvertimePay.ToMoney(),
|
||||
NightworkPay = x.NightworkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
MissionPay = x.MissionPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
YearsPay = x.YearsPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeducation.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.AbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoneyNullable(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
IsLeft = false,
|
||||
LeftWorkDate = "",
|
||||
LastDayOfWork = "",
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
HasRollCall = x.HasRollCall,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
OverTimeWorkValue = x.OverTimeWorkValue,
|
||||
OverNightWorkValue = x.OverNightWorkValue,
|
||||
FridayWorkValue = x.FridayWorkValue,
|
||||
RotatingShiftValue = x.RotatingShiftValue,
|
||||
AbsenceValue = x.AbsenceValue,
|
||||
MaritalStatus = "",
|
||||
TotalDayOfLeaveCompute = x.TotalDayOfLeaveCompute,
|
||||
TotalDayOfYearsCompute = x.TotalDayOfYearsCompute,
|
||||
TotalDayOfBunosesCompute = x.TotalDayOfBunosesCompute
|
||||
|
||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||
ch.WorkshopName = workshopName.WorkshopName;
|
||||
ch.TotalPaymentHide = workshopName.TotalPaymentHide;
|
||||
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == ch.WorkshopId)
|
||||
.Select(x => x.EmployerId);
|
||||
var employerlist = _context.Employers.Where(x => emp.Contains(x.id));
|
||||
var employers = new List<EmprViewModel>();
|
||||
|
||||
foreach (var em in employerlist)
|
||||
{
|
||||
var employer = new EmprViewModel()
|
||||
{
|
||||
EmployerFullName = em.FName + " " + em.LName,
|
||||
IsLegal = em.IsLegal,
|
||||
};
|
||||
employers.Add(employer);
|
||||
}
|
||||
}).SingleOrDefault(x => x.Id == id);
|
||||
|
||||
ch.EmployerList = employers;
|
||||
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(ch.ContractId);
|
||||
ch.CreateWorkingHoursTemp = workingHours;
|
||||
var AbsenceDeduction = ch.AbsenceDeduction.MoneyToDouble();
|
||||
var InstallmentDeduction = ch.InstallmentDeduction.MoneyToDouble();
|
||||
var InsuranceDeduction = ch.InsuranceDeduction.MoneyToDouble();
|
||||
var SalaryAidDeduction = ch.SalaryAidDeduction.MoneyToDouble();
|
||||
var TaxDeducation = ch.TaxDeducation.MoneyToDouble();
|
||||
var workshopName = _context.Workshops.FirstOrDefault(x => x.id == ch.WorkshopId);
|
||||
ch.WorkshopName = workshopName.WorkshopName;
|
||||
ch.TotalPaymentHide = workshopName.TotalPaymentHide;
|
||||
var emp = _context.WorkshopEmployers.Where(x => x.WorkshopId == ch.WorkshopId)
|
||||
.Select(x => x.EmployerId);
|
||||
var employerlist = _context.Employers.Where(x => emp.Contains(x.id));
|
||||
var employers = new List<EmprViewModel>();
|
||||
|
||||
var TotalDeduction = AbsenceDeduction + InsuranceDeduction + InstallmentDeduction + SalaryAidDeduction +
|
||||
TaxDeducation;
|
||||
ch.TotalDeductions = TotalDeduction.ToMoney();
|
||||
foreach (var em in employerlist)
|
||||
{
|
||||
var employer = new EmprViewModel()
|
||||
{
|
||||
EmployerFullName = em.FName + " " + em.LName,
|
||||
IsLegal = em.IsLegal,
|
||||
};
|
||||
employers.Add(employer);
|
||||
}
|
||||
ch.MaritalStatus = _context.Employees.Find(ch.EmployeeId)?.MaritalStatus;
|
||||
ch.EmployerList = employers;
|
||||
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(ch.ContractId);
|
||||
ch.CreateWorkingHoursTemp = workingHours;
|
||||
var AbsenceDeduction = ch.AbsenceDeduction.MoneyToDouble();
|
||||
var InstallmentDeduction = ch.InstallmentDeduction.MoneyToDouble();
|
||||
var InsuranceDeduction = ch.InsuranceDeduction.MoneyToDouble();
|
||||
var SalaryAidDeduction = ch.SalaryAidDeduction.MoneyToDouble();
|
||||
var TaxDeducation = ch.TaxDeducation.MoneyToDouble();
|
||||
|
||||
|
||||
var leftWorkSearch = new LeftWorkSearchModel() {WorkshopId = ch.WorkshopId, EmployeeId = ch.EmployeeId};
|
||||
var leftworkResult = _leftWorkRepository.search(leftWorkSearch).FirstOrDefault();
|
||||
var leftCheck = _leftWorkRepository.CheckoutleftWorkCheck(ch.ContractStartGr, ch.WorkshopId, ch.EmployeeId);
|
||||
var contractLeftWorkDate = ch.ContractEndGr.AddDays(1);
|
||||
if (leftCheck != null && leftCheck.LeftWorkDateGr == contractLeftWorkDate)
|
||||
{
|
||||
ch.IsLeft = true;
|
||||
ch.LeftWorkDate = leftCheck.LeftWorkDate;
|
||||
ch.LastDayOfWork = ch.ContractEndGr.ToFarsi();
|
||||
}
|
||||
var TotalDeduction = AbsenceDeduction + InsuranceDeduction + InstallmentDeduction + SalaryAidDeduction +
|
||||
TaxDeducation;
|
||||
ch.TotalDeductions = TotalDeduction.ToMoney();
|
||||
|
||||
//var checkBonusesPay = leftworkResult != null && leftworkResult.AddBonusesPay;
|
||||
//var checkYearsPay = leftworkResult != null && leftworkResult.AddYearsPay;
|
||||
//var checkLeavePay = leftworkResult != null && leftworkResult.AddLeavePay;
|
||||
|
||||
//if (!checkBonusesPay || !checkYearsPay || !checkLeavePay)
|
||||
//{
|
||||
// double sumOfBonusAndYearsPay = 0;
|
||||
// if (!checkBonusesPay)
|
||||
// {
|
||||
// var bonusesPay = ch.BonusesPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += bonusesPay;
|
||||
// ch.BonusesPay = "0";
|
||||
var leftWorkSearch = new LeftWorkSearchModel() { WorkshopId = ch.WorkshopId, EmployeeId = ch.EmployeeId };
|
||||
var leftworkResult = _leftWorkRepository.search(leftWorkSearch).FirstOrDefault();
|
||||
var leftCheck = _leftWorkRepository.CheckoutleftWorkCheck(ch.ContractStartGr, ch.WorkshopId, ch.EmployeeId);
|
||||
var contractLeftWorkDate = ch.ContractEndGr.AddDays(1);
|
||||
if (leftCheck != null && leftCheck.LeftWorkDateGr == contractLeftWorkDate)
|
||||
{
|
||||
ch.IsLeft = true;
|
||||
ch.LeftWorkDate = leftCheck.LeftWorkDate;
|
||||
ch.LastDayOfWork = ch.ContractEndGr.ToFarsi();
|
||||
}
|
||||
|
||||
// }
|
||||
//var checkBonusesPay = leftworkResult != null && leftworkResult.AddBonusesPay;
|
||||
//var checkYearsPay = leftworkResult != null && leftworkResult.AddYearsPay;
|
||||
//var checkLeavePay = leftworkResult != null && leftworkResult.AddLeavePay;
|
||||
|
||||
// if (!checkYearsPay)
|
||||
// {
|
||||
// var yearsPay = ch.YearsPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += yearsPay;
|
||||
// ch.YearsPay = "0";
|
||||
// }
|
||||
//if (!checkBonusesPay || !checkYearsPay || !checkLeavePay)
|
||||
//{
|
||||
// double sumOfBonusAndYearsPay = 0;
|
||||
// if (!checkBonusesPay)
|
||||
// {
|
||||
// var bonusesPay = ch.BonusesPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += bonusesPay;
|
||||
// ch.BonusesPay = "0";
|
||||
|
||||
// if (!checkLeavePay)
|
||||
// {
|
||||
// var leavePay = ch.LeavePay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += leavePay;
|
||||
// ch.LeavePay = "0";
|
||||
// }
|
||||
// var totalClaimsDouble = ch.TotalClaims.MoneyToDouble();
|
||||
// var totalClaims = totalClaimsDouble - sumOfBonusAndYearsPay;
|
||||
// ch.TotalClaims = totalClaims.ToMoney();
|
||||
// }
|
||||
|
||||
// var totalPayment = totalClaims - TotalDeduction;
|
||||
// ch.TotalPayment = totalPayment.ToMoney();
|
||||
// if (!checkYearsPay)
|
||||
// {
|
||||
// var yearsPay = ch.YearsPay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += yearsPay;
|
||||
// ch.YearsPay = "0";
|
||||
// }
|
||||
|
||||
//}
|
||||
// if (!checkLeavePay)
|
||||
// {
|
||||
// var leavePay = ch.LeavePay.MoneyToDouble();
|
||||
// sumOfBonusAndYearsPay += leavePay;
|
||||
// ch.LeavePay = "0";
|
||||
// }
|
||||
// var totalClaimsDouble = ch.TotalClaims.MoneyToDouble();
|
||||
// var totalClaims = totalClaimsDouble - sumOfBonusAndYearsPay;
|
||||
// ch.TotalClaims = totalClaims.ToMoney();
|
||||
|
||||
//if (ch.WorkshopId == 40 || ch.WorkshopId == 68 || ch.WorkshopId == 44 || ch.WorkshopId == 45 || ch.WorkshopId == 280)
|
||||
//{
|
||||
// ch.TotalClaims = "";
|
||||
// ch.TotalDeductions = "";
|
||||
// ch.TotalPayment = "";
|
||||
//}
|
||||
if(ch.TotalPaymentHide == false)
|
||||
{
|
||||
ch.TotalClaims = "";
|
||||
ch.TotalDeductions = "";
|
||||
ch.TotalPayment = "";
|
||||
}
|
||||
if(ch.HasRollCall)
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||
// var totalPayment = totalClaims - TotalDeduction;
|
||||
// ch.TotalPayment = totalPayment.ToMoney();
|
||||
|
||||
return ch;
|
||||
}
|
||||
//}
|
||||
|
||||
public OperationResult RemoveCheckout(long id)
|
||||
//if (ch.WorkshopId == 40 || ch.WorkshopId == 68 || ch.WorkshopId == 44 || ch.WorkshopId == 45 || ch.WorkshopId == 280)
|
||||
//{
|
||||
// ch.TotalClaims = "";
|
||||
// ch.TotalDeductions = "";
|
||||
// ch.TotalPayment = "";
|
||||
//}
|
||||
if (ch.TotalPaymentHide == false)
|
||||
{
|
||||
ch.TotalClaims = "";
|
||||
ch.TotalDeductions = "";
|
||||
ch.TotalPayment = "";
|
||||
}
|
||||
if (ch.HasRollCall)
|
||||
ch.MonthlyRollCall = _rollCallRepository.GetEmployeeRollCallsForMonth(ch.EmployeeId, ch.WorkshopId, ch.ContractStartGr, ch.ContractEndGr);
|
||||
|
||||
return ch;
|
||||
}
|
||||
|
||||
public OperationResult RemoveCheckout(long id)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var item = _context.CheckoutSet.FirstOrDefault(x => x.id == id);
|
||||
@@ -1480,24 +1422,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
#endregion
|
||||
|
||||
#region Pooya
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId, DateTime start, DateTime end)
|
||||
{
|
||||
var leftWorkEmployees = _context.LeftWorkList.Where(x => x.WorkshopId == workshopId && x.LeftWorkDate.AddDays(-1).Date >= start.Date &&
|
||||
x.StartWorkDate.Date <= end).Select(x => x.EmployeeId).ToList();
|
||||
|
||||
//var leftWorkInsuranceEmployees = _context.LeftWorkInsuranceList.Where(x => x.WorkshopId == workshopId &&
|
||||
// (x.LeftWorkDate == null || x.LeftWorkDate.Value.Date.AddDays(-1) >= start.Date) &&
|
||||
// x.StartWorkDate.Date <= end).Select(x => x.EmployeeId).ToList();
|
||||
|
||||
//var workingEmployees = leftWorkEmployees.Concat(leftWorkInsuranceEmployees).Distinct();
|
||||
|
||||
return _context.CheckoutSet.Where(x => x.ContractEnd.Date <= end && x.ContractEnd.Date >= start && x.WorkshopId == workshopId && leftWorkEmployees.Contains(x.EmployeeId)).GroupBy(x => x.EmployeeId).Select(x => new
|
||||
{
|
||||
EmployeeId = x.Key,
|
||||
CheckoutEnd = x.Max(y => y.ContractEnd),
|
||||
CheckoutStart = x.Max(y => y.ContractStart),
|
||||
}).AsEnumerable().Select(x => (x.EmployeeId, x.CheckoutStart, x.CheckoutEnd)).ToList();
|
||||
}
|
||||
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end)
|
||||
{
|
||||
|
||||
@@ -366,9 +366,12 @@ public class LeaveRepository : RepositoryBase<long, Leave>, ILeaveRepository
|
||||
#region Pooya
|
||||
public bool HasDailyLeave(long employeeId, long workshopId, DateTime date)
|
||||
{
|
||||
return _context.LeaveList.Where(x => (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه") ||
|
||||
x.LeaveType == "استعلاجی")
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartLeave.Date <= date.Date && x.EndLeave.Date >= date.Date) != null;
|
||||
return _context.LeaveList
|
||||
.Where(x => (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه") ||
|
||||
x.LeaveType == "استعلاجی")
|
||||
.FirstOrDefault(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId &&
|
||||
x.StartLeave.Date <= date.Date && x.EndLeave.Date >= date.Date) != null;
|
||||
|
||||
}
|
||||
public List<LeaveViewModel> GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime start, DateTime end)
|
||||
{
|
||||
|
||||
@@ -374,6 +374,7 @@ CreateWorkingHoursTemp command, long leavId)
|
||||
//****** نوبت کاری و شب کاری ****
|
||||
#region RotatingShiftCheckAndNightWorkOver22
|
||||
|
||||
string shiftPayValue = "0";
|
||||
List<RotatingShiftViewModel> rotatingResultList = RotatingShiftCheck(groupedRollCall);
|
||||
var moriningCount = rotatingResultList.Count(x => x.IsMorningShift);
|
||||
var eveningCount = rotatingResultList.Count(x => x.IsEveningShift);
|
||||
@@ -445,7 +446,7 @@ CreateWorkingHoursTemp command, long leavId)
|
||||
#endregion
|
||||
//******* محاسبه مبلغ نوبت کاری *************
|
||||
#region ShiftPayPercent
|
||||
|
||||
|
||||
if (rotatingFaResult != "نوبت کاری ندارد" || rotatingFaResult != "")
|
||||
{
|
||||
var TotalDays = (command.ContractEndGr - command.ContractStartGr).TotalDays + 1;
|
||||
@@ -454,16 +455,19 @@ CreateWorkingHoursTemp command, long leavId)
|
||||
{
|
||||
var shiftPyaPercent = DailyFeeNumberType * 10 / 100;
|
||||
ShiftPayResult = shiftPyaPercent * TotalDays;
|
||||
shiftPayValue = "10";
|
||||
}
|
||||
else if (rotatingFaResult == "صبح و عصر و شب")
|
||||
{
|
||||
var shiftPyaPercent = DailyFeeNumberType * 15 / 100;
|
||||
ShiftPayResult = shiftPyaPercent * TotalDays;
|
||||
shiftPayValue = "15";
|
||||
}
|
||||
else if (rotatingFaResult == "صبح و شب" || rotatingFaResult == "عصر و شب")
|
||||
{
|
||||
var shiftPyaPercent = DailyFeeNumberType * 22.5 / 100;
|
||||
ShiftPayResult = shiftPyaPercent * TotalDays;
|
||||
shiftPayValue = "22.5";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,6 +503,7 @@ CreateWorkingHoursTemp command, long leavId)
|
||||
TotalHolidayAndNotM = totalHolidaysAndNotM.ToString(),
|
||||
DayliFeeComplete = dayliFeeComplete,
|
||||
MarriedAllowance = MarriedAllowanceStr,
|
||||
RotatingShiftValue = shiftPayValue
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -4,9 +4,11 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.RollCallAgg;
|
||||
using Company.Domain.RollCallEmployeeAgg;
|
||||
using CompanyManagment.App.Contracts.HolidayItem;
|
||||
using CompanyManagment.App.Contracts.RollCall;
|
||||
using MD.PersianDateTime.Standard;
|
||||
@@ -538,62 +540,100 @@ public class RollCallRepository : RepositoryBase<long, RollCall>, IRollCallRepos
|
||||
//سوابق غیبت
|
||||
public List<RollCallsByDateViewModel> GetWorkshopAbsentHistory(long workshopId, DateTime startSearch, DateTime endSearch)
|
||||
{
|
||||
if (endSearch.Date == DateTime.Now.Date)
|
||||
endSearch = endSearch.AddDays(-1);
|
||||
//get leaves for workshop that have been activated in dateIndex date
|
||||
var leavesQuery = _context.LeaveList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.IsAccepted && (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")) &&
|
||||
x.EndLeave.Date >= startSearch.Date && x.StartLeave.Date <= endSearch.Date);
|
||||
if (endSearch.Date == DateTime.Now.Date)
|
||||
endSearch = endSearch.AddDays(-1);
|
||||
//get leaves for workshop that have been activated in dateIndex date
|
||||
var leavesQuery = _context.LeaveList.Where(x => x.WorkshopId == workshopId &&
|
||||
x.IsAccepted && (x.LeaveType == "استعلاجی" || (x.LeaveType == "استحقاقی" && x.PaidLeaveType == "روزانه")) &&
|
||||
x.EndLeave.Date >= startSearch.Date && x.StartLeave.Date <= endSearch.Date);
|
||||
|
||||
//roll calls for current workshop where shift start is in dateIndex date (filters today's shifts)
|
||||
var rollCallsQuery = _context.RollCalls
|
||||
.Where(x => x.WorkshopId == workshopId && x.StartDate.HasValue &&
|
||||
x.StartDate.Value.Date >= startSearch.Date && x.StartDate.Value.Date <= endSearch.Date &&
|
||||
x.RollCallModifyType != RollCallModifyType.Undefined);
|
||||
//roll calls for current workshop where shift start is in dateIndex date (filters today's shifts)
|
||||
var rollCallsQuery = _context.RollCalls
|
||||
.Where(x => x.WorkshopId == workshopId && x.StartDate.HasValue &&
|
||||
x.StartDate.Value.Date >= startSearch.Date && x.StartDate.Value.Date <= endSearch.Date &&
|
||||
x.RollCallModifyType != RollCallModifyType.Undefined);
|
||||
|
||||
|
||||
var withPersonnelCode = _context.PersonnelCodeSet.Where(x => x.WorkshopId == workshopId);
|
||||
var withPersonnelCode = _context.PersonnelCodeSet.Where(x => x.WorkshopId == workshopId);
|
||||
|
||||
//get active employees of workshop in dateIndex date
|
||||
var activeEmployeesQuery =
|
||||
_context.RollCallEmployees.Include(x => x.EmployeesStatus)
|
||||
.Where(x => x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.EndDate.Date >= startSearch && y.StartDate.Date <= endSearch) &&
|
||||
withPersonnelCode.Any(y => y.EmployeeId == x.EmployeeId));
|
||||
//get active employees of workshop in dateIndex date
|
||||
var activeEmployeesQuery =
|
||||
_context.RollCallEmployees.Include(x => x.EmployeesStatus)
|
||||
.Where(x => x.WorkshopId == workshopId &&
|
||||
x.EmployeesStatus.Any(y => y.EndDate.Date >= startSearch && y.StartDate.Date <= endSearch) &&
|
||||
withPersonnelCode.Any(y => y.EmployeeId == x.EmployeeId));
|
||||
|
||||
var employeeSettingsList =
|
||||
_context.CustomizeWorkshopEmployeeSettings.Where(x => x.WorkshopId == workshopId).ToList();
|
||||
var rollCallsList = rollCallsQuery.ToList();
|
||||
var activatedEmployeesList = activeEmployeesQuery.ToList();
|
||||
var leavesList = leavesQuery.ToList();
|
||||
|
||||
var rollCallsList = rollCallsQuery.ToList();
|
||||
var activatedEmployeesList = activeEmployeesQuery.ToList();
|
||||
var leavesList = leavesQuery.ToList();
|
||||
//start search year may be in another year
|
||||
var holidays1 = _holidayItemApplication.Search(new HolidayItemSearchModel()
|
||||
{
|
||||
HolidayYear = startSearch.ToFarsiYear()
|
||||
});
|
||||
var holidays2 = _holidayItemApplication.Search(new HolidayItemSearchModel()
|
||||
{
|
||||
HolidayYear = endSearch.ToFarsiYear()
|
||||
});
|
||||
var totalHolidays = holidays1.Concat(holidays2).Distinct().ToList();
|
||||
int daysCount = (int)((endSearch.Date - startSearch.Date).TotalDays + 1);
|
||||
List<DateTime> days = Enumerable.Range(0, daysCount).Select(x => startSearch.Date.AddDays(x)).ToList();
|
||||
List<RollCallsByDateViewModel> result = new();
|
||||
foreach (var day in days)
|
||||
{
|
||||
|
||||
List<RollCallEmployee> activatedEmployeesListInDay = new();
|
||||
|
||||
//in working days everyone should be present
|
||||
if (day.DayOfWeek != DayOfWeek.Friday && totalHolidays.All(x => x.HolidaydateGr != day))
|
||||
{
|
||||
activatedEmployeesListInDay = activatedEmployeesList;
|
||||
}
|
||||
|
||||
int daysCount = (int)((endSearch.Date - startSearch.Date).TotalDays + 1);
|
||||
List<DateTime> days = Enumerable.Range(0, daysCount).Select(x => startSearch.Date.AddDays(x)).ToList();
|
||||
List<RollCallsByDateViewModel> result = new();
|
||||
foreach (var day in days)
|
||||
{
|
||||
var item = new RollCallsByDateViewModel()
|
||||
{
|
||||
DateGr = day,
|
||||
DateFa = day.ToFarsi(),
|
||||
ActiveEmployees = activatedEmployeesList.Where(x => x.EmployeesStatus.Any(y => y.StartDate.Date <= day && y.EndDate.Date >= day) &&
|
||||
!leavesList.Any(y => y.EmployeeId == x.EmployeeId && y.StartLeave.Date <= day && y.EndLeave.Date >= day) &&
|
||||
!rollCallsList.Any(rc => rc.EmployeeId == x.EmployeeId && rc.StartDate.Value.Date == day.Date))
|
||||
.Select(x => new RollCallViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId
|
||||
}),
|
||||
IsHoliday = _holidayItemApplication.IsHoliday(day),
|
||||
IsFriday = day.DayOfWeek == DayOfWeek.Friday
|
||||
};
|
||||
result.Add(item);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//in fridays, friday workers should be present
|
||||
else if (day.DayOfWeek == DayOfWeek.Friday)
|
||||
{
|
||||
activatedEmployeesListInDay = activatedEmployeesList
|
||||
.Join(employeeSettingsList.Where(x => x.FridayWork != FridayWork.Default)
|
||||
, x => x.EmployeeId, y => y.EmployeeId,
|
||||
(x, y) => x).ToList();
|
||||
}
|
||||
|
||||
//in holidays holiday worksers should be present
|
||||
else
|
||||
{
|
||||
activatedEmployeesListInDay = activatedEmployeesList
|
||||
.Join(employeeSettingsList.Where(x => x.HolidayWork != HolidayWork.Default)
|
||||
, x => x.EmployeeId, y => y.EmployeeId,
|
||||
(x, y) => x).ToList();
|
||||
}
|
||||
var item = new RollCallsByDateViewModel()
|
||||
{
|
||||
DateGr = day,
|
||||
DayOfWeekFa = day.DayOfWeek.DayOfWeeKToPersian(),
|
||||
DateFa = day.ToFarsi(),
|
||||
ActiveEmployees = activatedEmployeesListInDay.Where(x =>
|
||||
x.EmployeesStatus.Any(y => y.StartDate.Date <= day && y.EndDate.AddDays(-1).Date >= day) &&
|
||||
!leavesList.Any(y => y.EmployeeId == x.EmployeeId && y.StartLeave.Date <= day && y.EndLeave.Date >= day) &&
|
||||
!rollCallsList.Any(rc => rc.EmployeeId == x.EmployeeId && rc.StartDate!.Value.Date == day.Date))
|
||||
.Select(x => new RollCallViewModel()
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
EmployeeFullName = x.EmployeeFullName,
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId
|
||||
}),
|
||||
IsHoliday = _holidayItemApplication.IsHoliday(day),
|
||||
IsFriday = day.DayOfWeek == DayOfWeek.Friday
|
||||
};
|
||||
result.Add(item);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//گزارش آنلاین حضور غیاب کارگاه
|
||||
public CurrentDayRollCall GetWorkshopCurrentDayRollCalls(long workshopId)
|
||||
|
||||
@@ -1122,6 +1122,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
case "OnCheckoutOfMonth":
|
||||
var totalCheckoutDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalCheckoutDays;
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalCheckoutDays);
|
||||
break;
|
||||
//محاسبه در پایان سال به شرطی که قرارداد منتهی به پایان سال باشد
|
||||
case "OnEndOfYear"://درپایان سال
|
||||
@@ -1130,7 +1131,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
else if (isOldContract && contractEnd > start1403)
|
||||
{
|
||||
if ((hasleft && leftWorkDate <= separationEndDate) || (checkoutMonth == "12" && separationEndDate == contractEnd))
|
||||
@@ -1159,6 +1161,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - startComputeDay).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1168,6 +1171,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
PersianDateTime endPeriod = (separationStartDate.AddDays(-1)).ToPersianDateTime();
|
||||
List<BunosesAndYearsPayStatus> nullDateList = new List<BunosesAndYearsPayStatus>();
|
||||
double sumOfOldYearsPay = 0;
|
||||
var oldTotaldays = 0;
|
||||
for (var startDate = startPeriod; startDate <= endPeriod; startDate = startDate.AddMonths(1))
|
||||
{
|
||||
var searchStart = ($"{startDate}").ToGeorgianDateTime();
|
||||
@@ -1189,6 +1193,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
int foundTotaldays = Convert.ToInt32(foundCheckout.SumOfWorkingDays);
|
||||
double foundDayliWage = foundMonthlySalary / foundTotaldays;
|
||||
double foundYearsPay = ((foundDayliWage * 30) / 365) * foundTotaldays;
|
||||
oldTotaldays += foundTotaldays;
|
||||
sumOfOldYearsPay += foundYearsPay;
|
||||
}
|
||||
|
||||
@@ -1196,7 +1201,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
double lastMonthYearsPay = ((daylyWage * 30) / 365) * totalDays;
|
||||
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays + oldTotaldays);
|
||||
finalResult.YearsPay = lastMonthYearsPay + sumOfOldYearsPay;
|
||||
finalResult.BunosesStatusList = nullDateList;
|
||||
|
||||
@@ -1228,7 +1233,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - startComputeDay).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
else
|
||||
{
|
||||
var checkoutList = _context.CheckoutSet.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId &&
|
||||
@@ -1237,6 +1243,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
PersianDateTime endPeriod = (separationStartDate.AddDays(-1)).ToPersianDateTime();
|
||||
List<BunosesAndYearsPayStatus> nullDateList = new List<BunosesAndYearsPayStatus>();
|
||||
double sumOfOldYearsPay = 0;
|
||||
var oldTotaldays = 0;
|
||||
for (var startDate = startPeriod; startDate <= endPeriod; startDate = startDate.AddMonths(1))
|
||||
{
|
||||
var searchStart = ($"{startDate}").ToGeorgianDateTime();
|
||||
@@ -1258,6 +1265,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
int foundTotaldays = Convert.ToInt32(foundCheckout.SumOfWorkingDays);
|
||||
double foundDayliWage = foundMonthlySalary / foundTotaldays;
|
||||
double foundYearsPay = ((foundDayliWage * 30) / 365) * foundTotaldays;
|
||||
oldTotaldays += foundTotaldays;
|
||||
sumOfOldYearsPay += foundYearsPay;
|
||||
}
|
||||
|
||||
@@ -1265,7 +1273,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
double lastMonthYearsPay = ((daylyWage * 30) / 365) * totalDays;
|
||||
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays + oldTotaldays);
|
||||
finalResult.YearsPay = lastMonthYearsPay + sumOfOldYearsPay;
|
||||
finalResult.BunosesStatusList = nullDateList;
|
||||
|
||||
@@ -1285,7 +1293,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
else if (isOldContract && contractEnd > start1403)
|
||||
{
|
||||
|
||||
@@ -1299,7 +1308,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
var startComputeDay = startWorkDate >= startDayOfYearGr ? startWorkDate : startDayOfYearGr;
|
||||
var totalDays = (separationEndDate - startComputeDay).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
}
|
||||
else if (!isOldContract)
|
||||
{
|
||||
@@ -1308,7 +1318,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalDays = (separationEndDate - startWorkDate).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1319,14 +1330,16 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
else if (isOldContract && contractEnd > start1403)
|
||||
{
|
||||
if ((hasleft && leftWorkDate <= separationEndDate) || separationEndDate == contractEnd)
|
||||
{
|
||||
var totalDays = (separationEndDate - contractStart).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
|
||||
}else if (!isOldContract)
|
||||
{
|
||||
@@ -1334,7 +1347,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - contractStart).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1348,21 +1362,24 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
var startComputeDay = startWorkDate >= start1403 ? startWorkDate : start1403;
|
||||
var totalDays = (separationEndDate - startComputeDay).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
}
|
||||
else if (contractStart < start1403 && contractEnd < start1403)// قبل از 1403
|
||||
{
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
finalResult.YearsPay = (daylyWage * 30) / 365 * totalDays;
|
||||
//if ((hasleft && leftWorkDate <= separationEndDate) || separationEndDate == contractEnd)// اگر ترک کار کرده بود یا فیش آخر قراداد بود
|
||||
//{
|
||||
// var totalDays = (separationEndDate - contractStart).TotalDays + 1;
|
||||
// result = (daylyWage * 30) / 365 * totalDays;
|
||||
//}
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
//if ((hasleft && leftWorkDate <= separationEndDate) || separationEndDate == contractEnd)// اگر ترک کار کرده بود یا فیش آخر قراداد بود
|
||||
//{
|
||||
// var totalDays = (separationEndDate - contractStart).TotalDays + 1;
|
||||
// result = (daylyWage * 30) / 365 * totalDays;
|
||||
//}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
finalResult.YearsPay = 0;
|
||||
finalResult.TotalDayCompute = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1497,6 +1514,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = resCanToLeave.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = hoursePerDay;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{(separationEndDate - separationStartDate).TotalDays + 1}";
|
||||
|
||||
break;
|
||||
//محاسبه در پایان سال به شرطی که قرارداد منتهی به پایان سال باشد
|
||||
@@ -1518,7 +1537,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = resEndOfYear.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = hoursePerDay;
|
||||
}
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{resEndOfYear.CountChekoutDays}";
|
||||
|
||||
}
|
||||
else if(isOldContract && contractEnd > start1403)
|
||||
{
|
||||
var startDate = startWorkDate >= start1403 ? startWorkDate: start1403;
|
||||
@@ -1562,7 +1584,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = end.FirstOrDefault()!.WorkingPerDayHourses;
|
||||
|
||||
}
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{endOfYearRes.CountChekoutDays}";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
@@ -1578,8 +1603,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = 0;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = endOfYearRes.WorkingPerDayHourses;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute ="0";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!isOldContract)
|
||||
{
|
||||
@@ -1619,18 +1646,20 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
result.LeaveCheckout = true;
|
||||
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{endOfYearRes.CountChekoutDays}";
|
||||
|
||||
//مزد مرخصی
|
||||
//result.LeavPay = endOfYearRes.CanToLeave * leavePayPerHours;
|
||||
//مزد مرخصی
|
||||
//result.LeavPay = endOfYearRes.CanToLeave * leavePayPerHours;
|
||||
|
||||
//مدت غیبت
|
||||
//result.AbsencePeriod = endOfYearRes.PeriodOfAbsence;
|
||||
//کسری غیبت
|
||||
//result.AbsenceDeduction = endOfYearRes.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
//result.AverageHoursPerDay = endOfYearRes.WorkingPerDayHourses;
|
||||
//مدت غیبت
|
||||
//result.AbsencePeriod = endOfYearRes.PeriodOfAbsence;
|
||||
//کسری غیبت
|
||||
//result.AbsenceDeduction = endOfYearRes.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
//result.AverageHoursPerDay = endOfYearRes.WorkingPerDayHourses;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
@@ -1645,8 +1674,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = endOfYearRes.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = endOfYearRes.WorkingPerDayHourses;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute ="0";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1692,7 +1723,9 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = res.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = res.WorkingPerDayHourses;
|
||||
}
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{res.CountChekoutDays}";
|
||||
}
|
||||
else
|
||||
{
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
@@ -1707,8 +1740,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = res.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = res.WorkingPerDayHourses;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"0";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (!isOldContract)
|
||||
@@ -1733,7 +1768,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = res.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = res.WorkingPerDayHourses;
|
||||
}
|
||||
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{res.CountChekoutDays}";
|
||||
}
|
||||
else
|
||||
{
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
@@ -1748,8 +1786,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = res.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = res.WorkingPerDayHourses;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"0";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1771,8 +1811,11 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = resEndOfContract.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = hoursePerDay;
|
||||
}
|
||||
else if ((isOldContract && contractEnd > start1403) || (!isOldContract))
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{(separationEndDate - separationEndDate).TotalDays + 1}";
|
||||
|
||||
}
|
||||
else if ((isOldContract && contractEnd > start1403) || (!isOldContract))
|
||||
{
|
||||
var resEndOfContract = LeftWorkCantoleaveList(contractStart, separationEndDate, workshopId, employeeId, hasleft, leftWorkDate, fridayStartToEnd, officialHoliday, totalHoursH, totalHorsM, separationStartDate)
|
||||
.FirstOrDefault(x => x.ContractStart == separationStartDate);
|
||||
@@ -1794,7 +1837,9 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = resEndOfContract.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = resEndOfContract.WorkingPerDayHourses;
|
||||
}
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{resEndOfContract.CountChekoutDays}";
|
||||
}
|
||||
else
|
||||
{
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
@@ -1809,8 +1854,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = resEndOfContract.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = resEndOfContract.WorkingPerDayHourses;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"0";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1843,7 +1890,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = ress.PeriodOfAbsence * absenceDeductionPerHourses; ;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = ress.WorkingPerDayHourses;
|
||||
}
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{ress.CountChekoutDays}";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
@@ -1858,8 +1908,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = ress.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = ress.WorkingPerDayHourses;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"0";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (contractEnd < start1403)// قبل از 1403
|
||||
{
|
||||
@@ -1878,8 +1930,10 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
result.AbsenceDeduction = resCanTo1402.PeriodOfAbsence * absenceDeductionPerHourses;
|
||||
//میانگین ساعت کار در یک روز
|
||||
result.AverageHoursPerDay = hoursePerDay;
|
||||
// تعداد روزهایی که برای پرسنل مرخصی حساب شده
|
||||
result.TotalDayOfLeaveCompute = $"{totalChekoutDays}";
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = new LeaveAndAbsenceViewModel();
|
||||
@@ -2979,15 +3033,17 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalCheckoutDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
finalResult.Bunoses = ((daylyWage * 60) / 365) * totalCheckoutDays;
|
||||
|
||||
break;
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalCheckoutDays);
|
||||
|
||||
break;
|
||||
case "OnEndOfYear"://درپایان سال
|
||||
|
||||
if (isOldContract && contractEnd < start1403)
|
||||
{
|
||||
var totaltDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
finalResult.Bunoses = ((daylyWage * 60) / 365) * totaltDays;
|
||||
}
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totaltDays);
|
||||
}
|
||||
else if (isOldContract && contractEnd > start1403)
|
||||
{
|
||||
|
||||
@@ -3017,6 +3073,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - startComputeDay).TotalDays + 1;
|
||||
finalResult.Bunoses = ((daylyWage * 60) / 365) * totalDays;
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3026,6 +3083,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
PersianDateTime endPeriod = (separationStartDate.AddDays(-1)).ToPersianDateTime();
|
||||
List<BunosesAndYearsPayStatus> nullDateList = new List<BunosesAndYearsPayStatus>();
|
||||
double sumOfOldBonuses = 0;
|
||||
var oldTotalDays = 0;
|
||||
for (var startDate = startPeriod; startDate <= endPeriod; startDate = startDate.AddMonths(1))
|
||||
{
|
||||
var searchStart = ($"{startDate}").ToGeorgianDateTime();
|
||||
@@ -3047,6 +3105,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
int foundTotaldays = Convert.ToInt32(foundCheckout.SumOfWorkingDays);
|
||||
double foundDayliWage = foundMonthlySalary / foundTotaldays;
|
||||
double foundYearsPay = ((foundDayliWage * 60) / 365) * foundTotaldays;
|
||||
oldTotalDays += foundTotaldays;
|
||||
sumOfOldBonuses += foundYearsPay;
|
||||
}
|
||||
|
||||
@@ -3054,7 +3113,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
double lastMonthBonuses = ((daylyWage * 60) / 365) * totalDays;
|
||||
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays + oldTotalDays);
|
||||
finalResult.Bunoses = lastMonthBonuses + sumOfOldBonuses;
|
||||
finalResult.BunosesStatusList = nullDateList;
|
||||
}
|
||||
@@ -3095,6 +3154,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
PersianDateTime endPeriod = (separationStartDate.AddDays(-1)).ToPersianDateTime();
|
||||
List<BunosesAndYearsPayStatus> nullDateList = new List<BunosesAndYearsPayStatus>();
|
||||
double sumOfOldBonuses = 0;
|
||||
var oldTotalDays = 0;
|
||||
for (var startDate = startPeriod; startDate <= endPeriod; startDate = startDate.AddMonths(1))
|
||||
{
|
||||
var searchStart = ($"{startDate}").ToGeorgianDateTime();
|
||||
@@ -3116,6 +3176,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
int foundTotaldays = Convert.ToInt32(foundCheckout.SumOfWorkingDays);
|
||||
double foundDayliWage = foundMonthlySalary / foundTotaldays;
|
||||
double foundYearsPay = ((foundDayliWage * 60) / 365) * foundTotaldays;
|
||||
oldTotalDays += foundTotaldays;
|
||||
sumOfOldBonuses += foundYearsPay;
|
||||
}
|
||||
|
||||
@@ -3123,7 +3184,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
double lastMonthBonuses = ((daylyWage * 60) / 365) * totalDays;
|
||||
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays + oldTotalDays);
|
||||
finalResult.Bunoses = lastMonthBonuses + sumOfOldBonuses;
|
||||
finalResult.BunosesStatusList = nullDateList;
|
||||
}
|
||||
@@ -3168,6 +3229,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
{
|
||||
var totalDays = (separationEndDate - startComputeDay).TotalDays + 1;
|
||||
finalResult.Bunoses = ((daylyWage * 60) / 365) * totalDays;
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -3177,6 +3239,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
PersianDateTime endPeriod = (separationStartDate.AddDays(-1)).ToPersianDateTime();
|
||||
List<BunosesAndYearsPayStatus> nullDateList = new List<BunosesAndYearsPayStatus>();
|
||||
double sumOfOldBonuses = 0;
|
||||
var oldTotalDays = 0;
|
||||
for (var startDate = startPeriod; startDate <= endPeriod; startDate = startDate.AddMonths(1))
|
||||
{
|
||||
var searchStart = ($"{startDate}").ToGeorgianDateTime();
|
||||
@@ -3198,6 +3261,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
int foundTotaldays = Convert.ToInt32(foundCheckout.SumOfWorkingDays);
|
||||
double foundDayliWage = foundMonthlySalary / foundTotaldays;
|
||||
double foundBonuses = ((foundDayliWage * 60) / 365) * foundTotaldays;
|
||||
oldTotalDays += foundTotaldays;
|
||||
sumOfOldBonuses += foundBonuses;
|
||||
}
|
||||
|
||||
@@ -3205,7 +3269,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
double lastMonthBonuses = ((daylyWage * 60) / 365) * totalDays;
|
||||
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays + oldTotalDays);
|
||||
finalResult.Bunoses = lastMonthBonuses + sumOfOldBonuses;
|
||||
finalResult.BunosesStatusList = nullDateList;
|
||||
}
|
||||
@@ -3244,6 +3308,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
PersianDateTime endPeriod = (separationStartDate.AddDays(-1)).ToPersianDateTime();
|
||||
List<BunosesAndYearsPayStatus> nullDateList = new List<BunosesAndYearsPayStatus>();
|
||||
double sumOfOldBonuses = 0;
|
||||
var oldTotalDays = 0;
|
||||
for (var startDate = startPeriod; startDate <= endPeriod; startDate = startDate.AddMonths(1))
|
||||
{
|
||||
var searchStart = ($"{startDate}").ToGeorgianDateTime();
|
||||
@@ -3265,6 +3330,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
int foundTotaldays = Convert.ToInt32(foundCheckout.SumOfWorkingDays);
|
||||
double foundDayliWage = foundMonthlySalary / foundTotaldays;
|
||||
double foundBonuses = ((foundDayliWage * 60) / 365) * foundTotaldays;
|
||||
oldTotalDays += foundTotaldays;
|
||||
sumOfOldBonuses += foundBonuses;
|
||||
}
|
||||
|
||||
@@ -3272,7 +3338,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
var totalDays = (separationEndDate - separationStartDate).TotalDays + 1;
|
||||
double lastMonthBonuses = ((daylyWage * 60) / 365) * totalDays;
|
||||
|
||||
finalResult.TotalDayCompute = Convert.ToInt32(totalDays + oldTotalDays);
|
||||
finalResult.Bunoses = lastMonthBonuses + sumOfOldBonuses;
|
||||
finalResult.BunosesStatusList = nullDateList;
|
||||
}
|
||||
@@ -3317,6 +3383,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
default:
|
||||
finalResult.Bunoses = 0;
|
||||
finalResult.TotalDayCompute = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Query.AdminReports.Models;
|
||||
using System.Data;
|
||||
using _0_Framework.Application;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
namespace Query.AdminReports.Handlers
|
||||
{
|
||||
@@ -13,87 +12,97 @@ namespace Query.AdminReports.Handlers
|
||||
List<WorkshopWithRollCallServiceQueryModel> Handle(WorkshopWithRollCallServiceQueryParameters parameters);
|
||||
}
|
||||
|
||||
public class GetWorkshopWithRollCallHandler: IGetWorkshopWithRollCallHandler
|
||||
public class GetWorkshopWithRollCallHandler : IGetWorkshopWithRollCallHandler
|
||||
{
|
||||
private readonly CompanyContext _companyContext;
|
||||
private readonly CompanyContext _companyContext;
|
||||
|
||||
public GetWorkshopWithRollCallHandler(CompanyContext companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
public GetWorkshopWithRollCallHandler(CompanyContext companyContext)
|
||||
{
|
||||
_companyContext = companyContext;
|
||||
}
|
||||
|
||||
public List<WorkshopWithRollCallServiceQueryModel> Handle(WorkshopWithRollCallServiceQueryParameters parameters)
|
||||
{
|
||||
var now = DateTime.Now.Date;
|
||||
var lastWeek = now.AddDays(-7);
|
||||
public List<WorkshopWithRollCallServiceQueryModel> Handle(WorkshopWithRollCallServiceQueryParameters parameters)
|
||||
{
|
||||
var now = DateTime.Now.Date;
|
||||
var lastWeek = now.AddDays(-7);
|
||||
|
||||
|
||||
//workshop filter by parameters
|
||||
var rollCallServiceQuery = _companyContext.RollCallServices.AsSplitQuery();
|
||||
var allWorkshops = _companyContext.Workshops.Select(x => new { x.id, x.WorkshopFullName });
|
||||
//workshop filter by parameters
|
||||
var rollCallServiceQuery = _companyContext.RollCallServices.AsQueryable();
|
||||
var allWorkshops = _companyContext.Workshops.Select(x => new { x.id, x.WorkshopFullName });
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(parameters.WorkshopName))
|
||||
allWorkshops = allWorkshops.Where(x => x.WorkshopFullName.Contains(parameters.WorkshopName));
|
||||
if (!string.IsNullOrWhiteSpace(parameters.RollCallServiceType))
|
||||
rollCallServiceQuery = rollCallServiceQuery.Where(x => x.ServiceType == parameters.RollCallServiceType);
|
||||
if (!string.IsNullOrWhiteSpace(parameters.WorkshopName))
|
||||
allWorkshops = allWorkshops.Where(x => x.WorkshopFullName.Contains(parameters.WorkshopName));
|
||||
|
||||
var workshopsWithService = rollCallServiceQuery.Join(allWorkshops, x => x.WorkshopId, y => y.id, (rcs, workshop) =>
|
||||
new WorkshopWithRollCallServiceQueryModel()
|
||||
{
|
||||
WorkshopId = workshop.id,
|
||||
RollCallServiceType = rcs.ServiceType,
|
||||
WorkshopName = workshop.WorkshopFullName,
|
||||
MaxPersonValid = rcs.MaxPersonValid,
|
||||
IsActive = rcs.StartService <= DateTime.Now && rcs.EndService >= DateTime.Now,
|
||||
ServiceStartFa=rcs.StartService.ToFarsi(),
|
||||
ServiceEndFa=rcs.EndService.ToFarsi()
|
||||
if (!string.IsNullOrWhiteSpace(parameters.RollCallServiceType))
|
||||
rollCallServiceQuery = rollCallServiceQuery.Where(x => x.ServiceType == parameters.RollCallServiceType);
|
||||
if (!string.IsNullOrWhiteSpace(parameters.IsActive))
|
||||
{
|
||||
if (parameters.IsActive.ToLower() == "active")
|
||||
rollCallServiceQuery = rollCallServiceQuery.Where(x => x.StartService.Date <= now && x.EndService.Date >= now);
|
||||
else if (parameters.IsActive.ToLower() == "deactive")
|
||||
rollCallServiceQuery = rollCallServiceQuery.Where(x => x.EndService.Date < now || x.StartService.Date > now);
|
||||
|
||||
}
|
||||
|
||||
var workshopsWithService = rollCallServiceQuery.Join(allWorkshops, x => x.WorkshopId, y => y.id, (rcs, workshop) =>
|
||||
new WorkshopWithRollCallServiceQueryModel()
|
||||
{
|
||||
WorkshopId = workshop.id,
|
||||
RollCallServiceType = rcs.ServiceType,
|
||||
WorkshopName = workshop.WorkshopFullName,
|
||||
MaxPersonValid = rcs.MaxPersonValid,
|
||||
IsActive = rcs.StartService <= DateTime.Now && rcs.EndService >= DateTime.Now,
|
||||
ServiceStart = rcs.StartService,
|
||||
ServiceEnd = rcs.EndService
|
||||
});
|
||||
|
||||
|
||||
//workshop population
|
||||
var workshopLeftWorks = _companyContext.Workshops.Where(x => workshopsWithService.Any(y => y.WorkshopId == x.id)).Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
.Select(x => new
|
||||
{
|
||||
WorkshopId = x.id,
|
||||
LeftWorks = x.LeftWorks.Where(y => y.StartWorkDate <= lastWeek && y.LeftWorkDate > now).Select(y => y.EmployeeId),
|
||||
LeftWorkInsurances = x.LeftWorkInsurances.Where(y => y.StartWorkDate <= lastWeek && (y.LeftWorkDate > now || y.LeftWorkDate == null)).Select(y => y.EmployeeId)
|
||||
}).ToList();
|
||||
//workshop population
|
||||
var workshopLeftWorks = _companyContext.Workshops.Where(x => workshopsWithService.Any(y => y.WorkshopId == x.id)).Include(x => x.LeftWorks).Include(x => x.LeftWorkInsurances)
|
||||
.Select(x => new
|
||||
{
|
||||
WorkshopId = x.id,
|
||||
LeftWorks = x.LeftWorks.Where(y => y.StartWorkDate <= lastWeek && y.LeftWorkDate > now).Select(y => y.EmployeeId),
|
||||
LeftWorkInsurances = x.LeftWorkInsurances.Where(y => y.StartWorkDate <= lastWeek && (y.LeftWorkDate > now || y.LeftWorkDate == null)).Select(y => y.EmployeeId)
|
||||
}).ToList();
|
||||
|
||||
var workshopsWorkingEmployeesList = workshopLeftWorks
|
||||
.Select(x => new { x.WorkshopId, TotalWorkingEmployeesCount = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct().Count() }).ToList();
|
||||
var workshopsWorkingEmployeesList = workshopLeftWorks
|
||||
.Select(x => new { x.WorkshopId, TotalWorkingEmployeesCount = x.LeftWorks.Concat(x.LeftWorkInsurances).Distinct().Count() }).ToList();
|
||||
|
||||
|
||||
|
||||
var activeEmployees = _companyContext.RollCallEmployees.Include(x => x.EmployeesStatus).Where(x => x.EmployeesStatus.Any(y =>
|
||||
y.EndDate.Date >= now) && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => new { x.WorkshopId, x.EmployeeId });
|
||||
var activeEmployees = _companyContext.RollCallEmployees.Include(x => x.EmployeesStatus).Where(x => x.EmployeesStatus.Any(y =>
|
||||
y.EndDate.Date >= now) && workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => new { x.WorkshopId, x.EmployeeId });
|
||||
|
||||
var lastWeekRollCalls = _companyContext.RollCalls.Where(x => x.StartDate.HasValue && x.StartDate.Value >= lastWeek
|
||||
&& workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).GroupBy(x => x.EmployeeId).Select(x => x.Key);
|
||||
var lastWeekRollCalls = _companyContext.RollCalls.Where(x => x.StartDate.HasValue && x.StartDate.Value >= lastWeek
|
||||
&& workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).GroupBy(x => x.EmployeeId).Select(x => x.Key);
|
||||
|
||||
|
||||
var leaves = _companyContext.LeaveList.Where(x => x.StartLeave <= lastWeek && x.EndLeave >= now && (x.LeaveType == "استعلاجی" || x.PaidLeaveType == "روزانه")
|
||||
&& workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => x.EmployeeId);
|
||||
var leaves = _companyContext.LeaveList.Where(x => x.StartLeave <= lastWeek && x.EndLeave >= now && (x.LeaveType == "استعلاجی" || x.PaidLeaveType == "روزانه")
|
||||
&& workshopsWithService.Any(y => y.WorkshopId == x.WorkshopId)).Select(x => x.EmployeeId);
|
||||
|
||||
|
||||
var activeEmployeesList = activeEmployees.ToList();
|
||||
var lastWeekRollCallsList = lastWeekRollCalls.ToList();
|
||||
var leavesList = leaves.ToList();
|
||||
var workshopsWithServiceList = workshopsWithService.ToList();
|
||||
return workshopsWithServiceList.Select(x => new WorkshopWithRollCallServiceQueryModel()
|
||||
{
|
||||
IsActive = x.IsActive,
|
||||
ServiceStartFa = x.ServiceStartFa,
|
||||
ServiceEndFa = x.ServiceEndFa,
|
||||
WorkshopId = x.WorkshopId,
|
||||
RollCallServiceType = x.RollCallServiceType,
|
||||
MaxPersonValid = x.MaxPersonValid,
|
||||
WorkshopName = x.WorkshopName,
|
||||
ActiveEmployeesCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId),
|
||||
ActiveEmployeesWithRollCallInLastWeekCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId &&
|
||||
lastWeekRollCalls.Contains(y.EmployeeId) && !leavesList.Contains(y.EmployeeId)),
|
||||
TotalEmployeesCount = workshopsWorkingEmployeesList.FirstOrDefault(y => y.WorkshopId == x.WorkshopId).TotalWorkingEmployeesCount
|
||||
}).OrderByDescending(x=>x.IsActive).ToList();
|
||||
var activeEmployeesList = activeEmployees.ToList();
|
||||
var lastWeekRollCallsList = lastWeekRollCalls.ToList();
|
||||
var leavesList = leaves.ToList();
|
||||
var workshopsWithServiceList = workshopsWithService.ToList();
|
||||
return workshopsWithServiceList.GroupBy(x => x.WorkshopId).Select(x =>
|
||||
x.OrderByDescending(y => y.ServiceStart).First()).Select(x => new WorkshopWithRollCallServiceQueryModel()
|
||||
{
|
||||
IsActive = x.IsActive,
|
||||
ServiceStartFa = x.ServiceStart.ToFarsi(),
|
||||
ServiceEndFa = x.ServiceEnd.ToFarsi(),
|
||||
WorkshopId = x.WorkshopId,
|
||||
RollCallServiceType = x.RollCallServiceType,
|
||||
MaxPersonValid = x.MaxPersonValid,
|
||||
WorkshopName = x.WorkshopName,
|
||||
ActiveEmployeesCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId),
|
||||
ActiveEmployeesWithRollCallInLastWeekCount = activeEmployeesList.Count(y => y.WorkshopId == x.WorkshopId &&
|
||||
lastWeekRollCallsList.Contains(y.EmployeeId) && !leavesList.Contains(y.EmployeeId)),
|
||||
TotalEmployeesCount = workshopsWorkingEmployeesList.FirstOrDefault(y => y.WorkshopId == x.WorkshopId)?.TotalWorkingEmployeesCount ?? 0
|
||||
}).OrderByDescending(x => x.IsActive).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,29 +1,32 @@
|
||||
namespace Query.AdminReports.Models
|
||||
{
|
||||
public class WorkshopWithRollCallServiceQueryModel
|
||||
{
|
||||
public string WorkshopName { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string RollCallServiceType { get; set; }
|
||||
public class WorkshopWithRollCallServiceQueryModel
|
||||
{
|
||||
public string WorkshopName { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string RollCallServiceType { get; set; }
|
||||
|
||||
public int TotalEmployeesCount { get; set; }
|
||||
public int TotalEmployeesCount { get; set; }
|
||||
|
||||
public int ActiveEmployeesCount { get; set; }
|
||||
public int ActiveEmployeesCount { get; set; }
|
||||
|
||||
public int ActiveEmployeesWithRollCallInLastWeekCount { get; set; }
|
||||
public int ActiveEmployeesWithRollCallInLastWeekCount { get; set; }
|
||||
|
||||
|
||||
public float ActiveEmployeesWithRollCallPercentage
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((float)ActiveEmployeesWithRollCallInLastWeekCount / ActiveEmployeesCount) * 100;
|
||||
}
|
||||
}
|
||||
public float ActiveEmployeesWithRollCallPercentage
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((float)ActiveEmployeesWithRollCallInLastWeekCount / ActiveEmployeesCount) * 100;
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxPersonValid { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public string ServiceStartFa { get; set; }
|
||||
public string ServiceEndFa { get; set; }
|
||||
}
|
||||
}
|
||||
public int MaxPersonValid { get; set; }
|
||||
public bool IsActive { get; set; }
|
||||
public DateTime ServiceStart { get; set; }
|
||||
public DateTime ServiceEnd { get; set; }
|
||||
|
||||
public string ServiceStartFa { get; set; }
|
||||
public string ServiceEndFa { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
public class WorkshopWithRollCallServiceQueryParameters
|
||||
{
|
||||
public string WorkshopName { get; set; }
|
||||
public string RollCallServiceType { get; set; }
|
||||
public string WorkshopName { get; set; }
|
||||
public string RollCallServiceType { get; set; }
|
||||
public string IsActive { get; set; }
|
||||
}
|
||||
@@ -18,6 +18,7 @@ using CompanyManagment.App.Contracts.WorkingHoursItems;
|
||||
using CompanyManagment.App.Contracts.WorkingHoursTemp;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using Humanizer;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
@@ -514,12 +515,13 @@ public class IndexModel : PageModel
|
||||
//اگر تصفیه حساب پاک شده برای عیدی یا سنوات وجود داشت
|
||||
if (bunosesPay.NotCompleted || yearsPay.NotCompleted)
|
||||
{
|
||||
|
||||
List<BunosesAndYearsPayStatus> lostCheckoutsDates = new List<BunosesAndYearsPayStatus>();
|
||||
if ((bunosesPay.NotCompleted && yearsPay.NotCompleted) || (bunosesPay.NotCompleted && !yearsPay.NotCompleted))
|
||||
lostCheckoutsDates = bunosesPay.BunosesStatusList;
|
||||
if(!bunosesPay.NotCompleted && yearsPay.NotCompleted)
|
||||
lostCheckoutsDates = yearsPay.BunosesStatusList;
|
||||
|
||||
|
||||
foreach (var found in lostCheckoutsDates)
|
||||
{
|
||||
ComputingViewModel foundMandatoryCompute = new ComputingViewModel();
|
||||
@@ -567,12 +569,14 @@ public class IndexModel : PageModel
|
||||
{
|
||||
double foundBonuses = ((foundDayliWage * 60) / 365) * foundTotaldays;
|
||||
bunosesPay.Bunoses += foundBonuses;
|
||||
bunosesPay.TotalDayCompute += foundTotaldays;
|
||||
}
|
||||
|
||||
if (yearsPay.NotCompleted)
|
||||
{
|
||||
double foundBonuses = ((foundDayliWage * 30) / 365) * foundTotaldays;
|
||||
yearsPay.YearsPay += foundBonuses;
|
||||
yearsPay.TotalDayCompute += foundTotaldays;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -657,7 +661,15 @@ public class IndexModel : PageModel
|
||||
TotalHolidaysAndNotH = mandatoryCompute.TotalHolidayAndNotH,
|
||||
TotalHolidaysAndNotM = mandatoryCompute.TotalHolidayAndNotM,
|
||||
DailFeeComplete = mandatoryCompute.DayliFeeComplete,
|
||||
HasRollCall = hasRollCall
|
||||
HasRollCall = hasRollCall,
|
||||
OverTimeWorkValue = $"{Convert.ToInt32(mandatoryCompute.OverTimeWorkH):00}:{Convert.ToInt32(mandatoryCompute.OverTimeWorkM):00}",
|
||||
OverNightWorkValue = $"{Convert.ToInt32(mandatoryCompute.OverNightWorkH):00}:{Convert.ToInt32(mandatoryCompute.OverNightWorkM):00}",
|
||||
FridayWorkValue = $"{Friday}",
|
||||
RotatingShiftValue = mandatoryCompute.RotatingShiftValue,
|
||||
AbsenceValue = "0",
|
||||
TotalDayOfLeaveCompute = leavePayNew.TotalDayOfLeaveCompute,
|
||||
TotalDayOfYearsCompute = yearsPay.YearsPay > 0 ? $"{yearsPay.TotalDayCompute}" : "0",
|
||||
TotalDayOfBunosesCompute = bunosesPay.Bunoses > 0 ? $"{bunosesPay.TotalDayCompute}" : "0",
|
||||
};
|
||||
_checkoutApplication.Create(command);
|
||||
|
||||
@@ -7246,6 +7258,7 @@ public class IndexModel : PageModel
|
||||
|
||||
#region RtatingStatus
|
||||
|
||||
string shiftpayValue = "0";
|
||||
var moriningCount = rotatingResultList.Count(x => x.IsMorningShift);
|
||||
var eveningCount = rotatingResultList.Count(x => x.IsEveningShift);
|
||||
var nightCount = rotatingResultList.Count(x => x.IsNightShift);
|
||||
@@ -7289,16 +7302,20 @@ public class IndexModel : PageModel
|
||||
{
|
||||
var shiftPyaPercent = DailyFeeNumberType * 10 / 100;
|
||||
ShiftPayResult = shiftPyaPercent * TotalDays;
|
||||
shiftpayValue = "10";
|
||||
|
||||
}
|
||||
else if (rotatingFaResult == "صبح و عصر و شب")
|
||||
{
|
||||
var shiftPyaPercent = DailyFeeNumberType * 15 / 100;
|
||||
ShiftPayResult = shiftPyaPercent * TotalDays;
|
||||
shiftpayValue = "15";
|
||||
}
|
||||
else if (rotatingFaResult == "صبح و شب" || rotatingFaResult == "عصر و شب")
|
||||
{
|
||||
var shiftPyaPercent = DailyFeeNumberType * 22.5 / 100;
|
||||
ShiftPayResult = shiftPyaPercent * TotalDays;
|
||||
shiftpayValue = "22.5";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7336,7 +7353,8 @@ public class IndexModel : PageModel
|
||||
TotalHolidayAndNotH = totalHolidaysAndNotH.ToString(),
|
||||
TotalHolidayAndNotM = totalHolidaysAndNotM.ToString(),
|
||||
DayliFeeComplete = dayliFeeComplete,
|
||||
MarriedAllowance = MarriedAllowanceStr
|
||||
MarriedAllowance = MarriedAllowanceStr,
|
||||
RotatingShiftValue = shiftpayValue
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@
|
||||
</form>
|
||||
|
||||
<!--<script src="~/AdminTheme/assets/js/workingHoursPrintable.js"></script>-->
|
||||
<script src="~/AdminTheme/assets/printjs/print.min.js"></script>
|
||||
@* <script src="~/AdminTheme/assets/printjs/print.min.js"></script> *@
|
||||
|
||||
<script>
|
||||
|
||||
@@ -372,7 +372,6 @@
|
||||
}
|
||||
document.getElementById("MainModal").style.visibility = "hidden";
|
||||
setTimeout(function () {
|
||||
|
||||
printElement(document.getElementById("printThis"));
|
||||
}, 500);
|
||||
});
|
||||
@@ -380,6 +379,8 @@
|
||||
|
||||
var close = document.getElementById("closingOnePrint");
|
||||
function printElement(elem) {
|
||||
debugger;
|
||||
|
||||
var domClone = elem.cloneNode(true);
|
||||
|
||||
var $printSection = document.getElementById("printSection");
|
||||
|
||||
@@ -10,13 +10,9 @@
|
||||
background-color: #fef2f2 !important;
|
||||
border: 1px solid #eb3434 !important;
|
||||
}
|
||||
|
||||
.modalRollCallWidth {
|
||||
max-width: 550px;
|
||||
}
|
||||
|
||||
.modal-dialog, .modal-content {
|
||||
height: 470px;
|
||||
height: 420px;
|
||||
}
|
||||
|
||||
.timeWorkTitle {
|
||||
@@ -37,7 +33,6 @@
|
||||
|
||||
.groupBox .form-control {
|
||||
background-color: #ffffff;
|
||||
padding: .375rem .35rem;
|
||||
}
|
||||
|
||||
.groupBox .form-control::placeholder {
|
||||
@@ -64,13 +59,12 @@
|
||||
.btnRemoveTimeWork {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
background-color: #F87171;
|
||||
border-radius: 7px;
|
||||
/* padding: 3px; */
|
||||
width: 63px;
|
||||
height: 24px;
|
||||
font-size: 12px;
|
||||
padding: 3px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.ShowMessage {
|
||||
@@ -87,64 +81,9 @@
|
||||
}
|
||||
|
||||
.heightControll {
|
||||
height: 240px;
|
||||
height: 190px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
|
||||
.allSumtxt {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #7f7f7f;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
.startDatetxt {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #7f7f7f;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
.endDatetxt {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #7f7f7f;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
.cusDateTime {
|
||||
width: 66px;
|
||||
}
|
||||
|
||||
@@media (max-width: 768px) {
|
||||
.cusDateTime {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.startDatetxt {
|
||||
font-size: 10px;
|
||||
font-weight: 800;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.endDatetxt {
|
||||
font-size: 10px;
|
||||
font-weight: 800;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.form-control-date {
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
@@ -162,61 +101,33 @@
|
||||
<div class="row">
|
||||
<div class="col-12 my-1">
|
||||
<div class="select-alert">
|
||||
<div class="position-relative">
|
||||
<select class="form-select select2OptionAddModal" aria-label="انتخاب پرسنل ..." name="Command.EmployeeId" id="employeeSelectAddModal">
|
||||
</select>
|
||||
<span class="allSumtxt"></span>
|
||||
</div>
|
||||
<select class="form-select select2OptionAddModal" aria-label="انتخاب پرسنل ..." name="Command.EmployeeId" id="employeeSelectAddModal">
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<input class="form-control form-control-date-main text-center" name="Command.DateFa" placeholder="تاریخ" style="direction: ltr" />
|
||||
<input class="form-control form-control-date text-center" name="Command.DateFa" placeholder="تاریخ" style="direction: ltr" />
|
||||
</div>
|
||||
|
||||
<div class="heightControll">
|
||||
<div class="col-12" id="appendChildTimeWorkHtml">
|
||||
<div class="groupBox">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
|
||||
<div class="col-12 mb-2 mt-1">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">
|
||||
نوبت اول
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="timeWorkTitle ti">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-end d-flex justify-content-end">
|
||||
<div class="removeBtn">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">
|
||||
نوبت اول
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<div class="d-flex flex-column flex-md-row align-items-center gap-1">
|
||||
<div class="position-relative">
|
||||
<span class="startDatetxt"></span>
|
||||
<input type="text" class="form-control text-end form-control-date StartDate" name="Command.RollCallRecords[0].StartDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime" name="Command.RollCallRecords[0].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[0].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="d-flex flex-column-reverse flex-md-row align-items-center gap-1">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime me-1" name="Command.RollCallRecords[0].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control text-start form-control-date EndDate" name="Command.RollCallRecords[0].EndDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
<span class="endDatetxt"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[0].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
@@ -275,8 +186,7 @@
|
||||
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
|
||||
var saveRollCallWorkTimeAjax = `@Url.Page("./CaseHistory", "ManualCreateOrEdit")`;
|
||||
var employeeListAjax = `@Url.Page("./CaseHistory", "EmployeeList")`;
|
||||
|
||||
var checkEmployeeData = `@Url.Page("./CaseHistory", "CheckEmployeeData")`;
|
||||
var dayOfWeekDataUrl = `@Url.Page("./CaseHistory", "DayOfWeek")`;
|
||||
var totalWorkingDataUrl = `@Url.Page("./CaseHistory", "TotalWorking")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/ModalAddRollCall.js?ver=@clientVersion"></script>
|
||||
@@ -21,7 +21,7 @@
|
||||
}
|
||||
|
||||
.modal-dialog, .modal-content {
|
||||
height: 470px;
|
||||
height: 420px;
|
||||
}
|
||||
|
||||
.timeWorkTitle {
|
||||
@@ -42,7 +42,6 @@
|
||||
|
||||
.groupBox .form-control {
|
||||
background-color: #ffffff;
|
||||
padding: .375rem .35rem;
|
||||
}
|
||||
|
||||
.groupBox .form-control::placeholder {
|
||||
@@ -69,13 +68,12 @@
|
||||
.btnRemoveTimeWork {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
justify-content: center;
|
||||
background-color: #F87171;
|
||||
border-radius: 7px;
|
||||
/* padding: 3px; */
|
||||
width: 63px;
|
||||
height: 24px;
|
||||
font-size: 12px;
|
||||
padding: 3px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.ShowMessage {
|
||||
@@ -92,119 +90,9 @@
|
||||
}
|
||||
|
||||
.heightControll {
|
||||
height: 240px;
|
||||
height: 190px;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.irregularText {
|
||||
color: #5C5C5C;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.irregularBox {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
background-color: #F5F5F5;
|
||||
border-radius: 9px;
|
||||
border: 1px solid #E7E7E7;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.irrregularContent {
|
||||
flex-shrink: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
transform: translateX(100%);
|
||||
transition: transform 1s ease-in-out, opacity 1s ease-in-out;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.irrregularContent.active {
|
||||
transform: translateX(0);
|
||||
opacity: 1;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.navButton {
|
||||
background-color: transparent;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 10px 20px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
margin: 10px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: 4px;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
.navigation svg path {
|
||||
transition: fill 0.3s ease;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.allSumtxt {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: #7f7f7f;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
|
||||
.startDatetxt {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #7f7f7f;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
.endDatetxt {
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
color: #7f7f7f;
|
||||
position: absolute;
|
||||
top: 7px;
|
||||
left: 6px;
|
||||
}
|
||||
|
||||
.cusDateTime {
|
||||
width: 66px;
|
||||
}
|
||||
|
||||
@@media (max-width: 768px){
|
||||
.cusDateTime {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.startDatetxt {
|
||||
font-size: 10px;
|
||||
font-weight: 800;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.endDatetxt {
|
||||
font-size: 10px;
|
||||
font-weight: 800;
|
||||
top: 10px;
|
||||
}
|
||||
|
||||
.form-control-date {
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
@@ -222,16 +110,13 @@
|
||||
<div class="row">
|
||||
<div class="col-12 my-1">
|
||||
<div class="select-alert">
|
||||
<input type="hidden" name="Command.EmployeeId" value="@Model.EmployeeId" />
|
||||
<div class="position-relative">
|
||||
<input class="form-control disable" value="@Model.EmployeeFullName" placeholder="نام پرسنل" />
|
||||
<span class="allSumtxt"></span>
|
||||
</div>
|
||||
<input type="hidden" id="employeeID" name="Command.EmployeeId" value="@Model.EmployeeId" />
|
||||
<input class="form-control disable" value="@Model.EmployeeFullName" placeholder="نام پرسنل" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<input type="hidden" name="Command.DateFa" value="@Model.DateFa" />
|
||||
<input id="dateFa" type="hidden" name="Command.DateFa" value="@Model.DateFa" />
|
||||
<input class="form-control form-control-date text-center disable" value="@Model.DateFa" placeholder="تاریخ" style="direction: ltr" />
|
||||
</div>
|
||||
|
||||
@@ -277,62 +162,37 @@
|
||||
|
||||
<div class="groupBox">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
<div class="col-12 mb-2 mt-1">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 text-start">
|
||||
<div class="timeWorkTitle">
|
||||
نوبت @txtString
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="timeWorkTitle ti">
|
||||
@item.TotalWorkingHours
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-end d-flex justify-content-end">
|
||||
@if (index == 0)
|
||||
{
|
||||
<div class="removeBtn">
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="removeBtn">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
||||
<path d="M6.875 11H15.125" stroke="white"/>
|
||||
</svg>
|
||||
<span class="text-white ms-1">حذف</span>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">
|
||||
نوبت @txtString
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<div class="d-flex flex-column flex-md-row align-items-center gap-1">
|
||||
<div class="position-relative">
|
||||
<span class="startDatetxt">@item.StartDayOfWeekFa</span>
|
||||
<input type="text" class="form-control text-end form-control-date StartDate" name="Command.RollCallRecords[@index].StartDate" value="@item.StartDateFa" placeholder="0000/00/00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime" name="Command.RollCallRecords[@index].StartTime" placeholder="00:00" value="@item.StartTimeString" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[@index].StartTime" placeholder="00:00" value="@item.StartTimeString" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<div class="d-flex flex-column-reverse flex-md-row align-items-center gap-1">
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime" name="Command.RollCallRecords[@index].EndTime" placeholder="00:00" value="@item.EndTimeString" style="direction: ltr;">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control text-start form-control-date EndDate" name="Command.RollCallRecords[@index].EndDate" value="@item.EndDateFa" placeholder="0000/00/00" style="direction: ltr;">
|
||||
<span class="endDatetxt">@item.EndDayOfWeekFa</span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[@index].EndTime" placeholder="00:00" value="@item.EndTimeString" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
@if (index == 0)
|
||||
{
|
||||
<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white" />
|
||||
<path d="M6.875 11H15.125" stroke="white" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -344,44 +204,23 @@
|
||||
{
|
||||
<div class="groupBox">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
<div class="col-12 mb-1">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 text-start">
|
||||
<div class="timeWorkTitle">
|
||||
نوبت اول
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="timeWorkTitle ti">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-end d-flex justify-content-end">
|
||||
<div class="removeBtn">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">
|
||||
نوبت اول
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<div class="d-flex flex-column flex-md-row align-items-center gap-1">
|
||||
<div class="position-relative">
|
||||
<span class="startDatetxt"></span>
|
||||
<input type="text" class="form-control text-end form-control-date StartDate" name="Command.RollCallRecords[0].StartDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime" name="Command.RollCallRecords[0].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[0].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<div class="d-flex flex-column-reverse flex-md-row align-items-center gap-1">
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime" name="Command.RollCallRecords[0].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control text-start form-control-date EndDate" name="Command.RollCallRecords[0].EndDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
<span class="endDatetxt"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[0].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
|
||||
<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -440,140 +279,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-12 my-1 d-none">
|
||||
<div class="irregularBox">
|
||||
<div class="row d-flex align-items-center">
|
||||
<div class="col-2">
|
||||
<div class="navigation">
|
||||
<button type="button" id="prevBox" class="navButton">
|
||||
<svg width="21" height="24" viewBox="0 0 21 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M19.5 9.40192C21.5 10.5566 21.5 13.4434 19.5 14.5981L4.5 23.2583C2.5 24.413 -1.17888e-06 22.9697 -1.07793e-06 20.6603L-3.2083e-07 3.33974C-2.19883e-07 1.03034 2.5 -0.413032 4.5 0.741669L19.5 9.40192Z" fill="#2DBDBD" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-8 position-relative overflow-hidden">
|
||||
<div class="irrregularContent active">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">شروع بکار</div>
|
||||
<input type="text" class="form-control text-center dateTimeIrregular" name="" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">پایان کار</div>
|
||||
<input type="text" class="form-control text-center dateTimeIrregular" name="" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@* if the date is same, then need col-12 *@
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">1403/08/25</div>
|
||||
<div class="irregularText">شنبه</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">1403/08/26</div>
|
||||
<div class="irregularText">یکشنبه</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="irrregularContent">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">شروع بکار</div>
|
||||
<input type="text" class="form-control text-center dateTimeIrregular" name="" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">پایان کار</div>
|
||||
<input type="text" class="form-control text-center dateTimeIrregular" name="" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@* if the date is same, then need col-12 *@
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">1403/08/25</div>
|
||||
<div class="irregularText">شنبه</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">1403/08/26</div>
|
||||
<div class="irregularText">یکشنبه</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="irrregularContent">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">شروع بکار</div>
|
||||
<input type="text" class="form-control text-center dateTimeIrregular" name="" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">پایان کار</div>
|
||||
<input type="text" class="form-control text-center dateTimeIrregular" name="" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@* if the date is same, then need col-12 *@
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">1403/08/25</div>
|
||||
<div class="irregularText">شنبه</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="form-group text-center">
|
||||
<div class="irregularText">1403/08/26</div>
|
||||
<div class="irregularText">یکشنبه</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-2">
|
||||
<div class="navigation">
|
||||
<button type="button" id="nextBox" class="navButton">
|
||||
<svg width="21" height="24" viewBox="0 0 21 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M1.5 14.5981C-0.500003 13.4434 -0.5 10.5566 1.5 9.40192L16.5 0.741669C18.5 -0.413032 21 1.03034 21 3.33974L21 20.6603C21 22.9697 18.5 24.413 16.5 23.2583L1.5 14.5981Z" fill="#2DBDBD" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="ShowMessage d-none">
|
||||
<p class="m-0" id="ShowSettingMessage"></p>
|
||||
</div>
|
||||
<div class="ShowMessage d-none">
|
||||
<p class="m-0" id="ShowSettingMessage"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -605,9 +316,7 @@
|
||||
var antiForgeryToken = $('@Html.AntiForgeryToken()').val();
|
||||
var saveRollCallWorkTimeAjax = `@Url.Page("./CaseHistory", "ManualCreateOrEdit")`;
|
||||
var loadByEmployeeRollCallWorkTimeAjax = `@Url.Page("./CaseHistory", "ManualCreateOrEdit")`;
|
||||
var dayOfWeekDataUrl = `@Url.Page("./CaseHistory", "DayOfWeek")`;
|
||||
var totalWorkingDataUrl = `@Url.Page("./CaseHistory", "TotalWorking")`;
|
||||
|
||||
//var itemsEditableDatesData = @@Html.Raw(Json.Serialize(Model.EditableDates));
|
||||
var employeeListAjax = `@Url.Page("./CaseHistory", "EmployeeList")`;
|
||||
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/rollcall/js/ModalEditRollCall.js?ver=@clientVersion"></script>
|
||||
@@ -36,7 +36,7 @@
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12 my-1">
|
||||
<input type="hidden" asp-for="EmployeeId" />
|
||||
<input type="hidden" id="employeeId" asp-for="EmployeeId" />
|
||||
|
||||
<div style="border: 1px solid #DADADA; background-color: #F6F6F6; padding: 6px; color: #4d4d4d; border-radius: 8px; font-size: 13px; text-align: center;">
|
||||
@Model.EmployeeFullName
|
||||
@@ -187,5 +187,6 @@
|
||||
var PrintOneMobileUrl = `#showmodal=@Url.Page("/Company/Employees/Leave", "PrintOneMobile")`;
|
||||
var computeLeaveHourlyAjax = `@Url.Page("/Company/Employees/Leave", "ComputeLeaveHourly")`;
|
||||
var computeLeaveDailyAjax = `@Url.Page("/Company/Employees/Leave", "ComputeLeaveDaily")`;
|
||||
var startLeave = `@Model.StartLeave`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/workflow/js/leavecreate.js?ver=@clientVersion"></script>
|
||||
@@ -12,7 +12,7 @@
|
||||
//"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]is[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;"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
$("#modalWorkshopFullname").text($('#caseHistoryWorkshopFullname').text());
|
||||
$('.btn-register').addClass('disable');
|
||||
|
||||
@@ -9,33 +10,13 @@
|
||||
});
|
||||
|
||||
// فعال و غیر فعال شدن برای تنظیمات ساعت کاری براساس ورودی هایی که اعمال میشود
|
||||
if ($('#employeeSelectAddModal').val() !== '0' && $('.form-control-date-main').val() !== '') {
|
||||
if ($('#employeeSelectAddModal').val() !== '0' && $('.form-control-date').val() !== '') {
|
||||
$('.heightControll').removeClass('disable');
|
||||
} else {
|
||||
$('.heightControll').addClass('disable');
|
||||
}
|
||||
|
||||
$(".form-control-date-main").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
});
|
||||
|
||||
$(".form-control-date").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
@@ -44,12 +25,6 @@
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
@@ -63,22 +38,13 @@
|
||||
$(".btnAddTimeWork").on("click", function () {
|
||||
var currentCount = $('.groupBox').length;
|
||||
var $inputs = $('.dateTime');
|
||||
var $inputsDate = $('.form-control-date');
|
||||
var allFilled = true;
|
||||
|
||||
$inputsDate.each(function () {
|
||||
if ($(this).val() === '') {
|
||||
allFilled = false;
|
||||
$('.btn-register').addClass('disable');
|
||||
showAlert('ابتدا تاریخ و ساعت شروع و پایان را وارد نمائید.', $(this));
|
||||
}
|
||||
});
|
||||
|
||||
$inputs.each(function () {
|
||||
if ($(this).val() === '') {
|
||||
allFilled = false;
|
||||
$('.btn-register').addClass('disable');
|
||||
showAlert('ابتدا تاریخ و ساعت شروع و پایان را وارد نمائید.', $(this));
|
||||
showAlert('ابتدا ساعت شروع و پایان را وارد نمائید.', $(this));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,97 +74,36 @@
|
||||
var timeWorkHtml = `
|
||||
<div class="groupBox timeWork">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
<div class="col-12 mb-2">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 text-start">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="timeWorkTitle ti">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-end d-flex justify-content-end">
|
||||
<div class="removeBtn">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
||||
<path d="M6.875 11H15.125" stroke="white"/>
|
||||
</svg>
|
||||
<span class="text-white ms-1">حذف</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<div class="d-flex flex-column flex-md-row align-items-center gap-1">
|
||||
<div class="position-relative">
|
||||
<span class="startDatetxt"></span>
|
||||
<input type="text" class="form-control text-end form-control-date StartDate" name="Command.RollCallRecords[${currentCount}].StartDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime ms-1" name="Command.RollCallRecords[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<div class="d-flex flex-column-reverse flex-md-row align-items-center gap-1">
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime me-1" name="Command.RollCallRecords[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control text-start form-control-date EndDate" name="Command.RollCallRecords[${currentCount}].EndDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
<span class="endDatetxt"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
||||
<path d="M6.875 11H15.125" stroke="white"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$('#appendChildTimeWorkHtml').append(timeWorkHtml);
|
||||
|
||||
|
||||
const newStartDateInput = $(`input[name="Command.RollCallRecords[${currentCount}].StartDate"]`);
|
||||
const newEndDateInput = $(`input[name="Command.RollCallRecords[${currentCount}].EndDate"]`);
|
||||
const newStartTimeInput = $(`input[name="Command.RollCallRecords[${currentCount}].StartTime"]`);
|
||||
const newEndTimeInput = $(`input[name="Command.RollCallRecords[${currentCount}].EndTime"]`);
|
||||
|
||||
newStartDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
newEndDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newStartTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newEndTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
new Cleave(`input[name="Command.RollCallRecords[${currentCount}].StartTime"]`, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
new Cleave(newEndTimeInput[0], {
|
||||
new Cleave(`input[name="Command.RollCallRecords[${currentCount}].EndTime"]`, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
@@ -255,14 +160,6 @@ function updateAddButtonText(currentCount) {
|
||||
}
|
||||
|
||||
let allFilled = true;
|
||||
$('.form-control-date').each(function () {
|
||||
const value = $(this).val().trim();
|
||||
if (value === "" || !dateValidCheck(value)) {
|
||||
allFilled = false;
|
||||
return false; // Break the loop
|
||||
}
|
||||
});
|
||||
|
||||
$('.dateTime').each(function () {
|
||||
const value = $(this).val().trim();
|
||||
if (value === "" || !timeValidCheck(value)) {
|
||||
@@ -305,116 +202,37 @@ function ajaxPersonals() {
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('keyup', ".dateTime, .form-control-date", function () {
|
||||
$(document).on('keyup', ".dateTime", function () {
|
||||
let $input = $(this);
|
||||
let value = $input.val();
|
||||
let lengthValue = value.length;
|
||||
let currentCount = $('.groupBox').length;
|
||||
|
||||
const $groupBox = $input.closest('.groupBox');
|
||||
|
||||
const startDate = $groupBox.find('.StartDate').val();
|
||||
const startTime = $groupBox.find('[name*="StartTime"]').val();
|
||||
const endDate = $groupBox.find('.EndDate').val();
|
||||
const endTime = $groupBox.find('[name*="EndTime"]').val();
|
||||
|
||||
// Validate input based on the field type
|
||||
if ($input.hasClass('form-control-date')) {
|
||||
// Date validation logic
|
||||
if (lengthValue >= 10) {
|
||||
if (!dateValidCheck(value)) {
|
||||
showAlert('تاریخ را به درستی وارد نمائید', $input);
|
||||
} else {
|
||||
clearAlert($input);
|
||||
dayOfWeekLoad(this, value);
|
||||
}
|
||||
if (lengthValue >= 5) {
|
||||
if (!timeValidCheck(value)) {
|
||||
showAlert('ساعت را به درستی وارد نمائید', $input);
|
||||
updateAddButtonText(currentCount);
|
||||
} else {
|
||||
if ($input.hasClass('StartDate')) {
|
||||
$groupBox.find('.startDatetxt').text('');
|
||||
} else if ($input.hasClass('EndDate')) {
|
||||
$groupBox.find('.endDatetxt').text('');
|
||||
}
|
||||
}
|
||||
} else if ($input.hasClass('dateTime')) {
|
||||
if (lengthValue >= 5) {
|
||||
if (!timeValidCheck(value)) {
|
||||
showAlert('ساعت را به درستی وارد نمائید', $input);
|
||||
} else {
|
||||
clearAlert($input);
|
||||
}
|
||||
clearAlert($input);
|
||||
// validateAllTimes();
|
||||
updateAddButtonText(currentCount);
|
||||
|
||||
// focusNextTimeInput($input);
|
||||
}
|
||||
} else {
|
||||
updateAddButtonText(currentCount);
|
||||
}
|
||||
|
||||
//if (startDate.length >= 10 && endDate.length >= 10) {
|
||||
// if (!validateDates(startDate, endDate)) {
|
||||
// showAlert('حضور غیاب در حال ویرایش را نمیتوانید بیشتر از یک روز از ثبت حضور غیاب عقب تر یا جلو تر ببرید', $input);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (startDate.length >= 10 && startTime.length >= 5 && endDate.length >= 10 && endTime.length >= 5) {
|
||||
totalWorkingDataLoad(startDate, startTime, endDate, endTime, $groupBox);
|
||||
}
|
||||
|
||||
updateAddButtonText(currentCount);
|
||||
});
|
||||
|
||||
//function validateDates(startDate, endDate) {
|
||||
// return itemsEditableDatesData.some(entry => entry.startFa === startDate && entry.endFa === endDate);
|
||||
//function focusNextTimeInput(currentInput) {
|
||||
// var inputs = $(".dateTime");
|
||||
// var currentIndex = inputs.index(currentInput);
|
||||
|
||||
// if (currentIndex !== -1 && currentIndex < inputs.length - 1) {
|
||||
// $(inputs[currentIndex + 1]).focus();
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
function dayOfWeekLoad(input, value) {
|
||||
$.ajax({
|
||||
url: dayOfWeekDataUrl,
|
||||
type: 'GET',
|
||||
data: { dateFa: value },
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
const $groupBox = $(input).closest('.groupBox');
|
||||
if ($(input).hasClass('StartDate')) {
|
||||
$groupBox.find('.startDatetxt').text(response.message);
|
||||
} else if ($(input).hasClass('EndDate')) {
|
||||
$groupBox.find('.endDatetxt').text(response.message);
|
||||
}
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function totalWorkingDataLoad(startDateVal, startTimeVal, endDateVal, endTimeVal, $groupBox) {
|
||||
$.ajax({
|
||||
url: totalWorkingDataUrl,
|
||||
type: 'GET',
|
||||
data: { startDate: startDateVal, startTime: startTimeVal, endDate: endDateVal, endTime: endTimeVal },
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
$groupBox.find('.ti').text(response.message);
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function showAlert(message, inputElement) {
|
||||
inputElement.addClass("errored");
|
||||
$('.alert-msg').show().find('p').text(message);
|
||||
@@ -433,11 +251,47 @@ function timeValidCheck(value) {
|
||||
return timePattern.test(value);
|
||||
}
|
||||
|
||||
function dateValidCheck(value) {
|
||||
const datePattern = /^\d{4}\/(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])$/;
|
||||
return datePattern.test(value);
|
||||
}
|
||||
//function validateAllTimes() {
|
||||
// let timeRanges = [];
|
||||
|
||||
// $(".groupBox").each(function () {
|
||||
// let startTime = $(this).find('input[name*="StartTime"]').val();
|
||||
// let endTime = $(this).find('input[name*="EndTime"]').val();
|
||||
|
||||
// if (startTime.length === 5 && endTime.length === 5) {
|
||||
// let startParts = startTime.split(':');
|
||||
// let endParts = endTime.split(':');
|
||||
// let startInMinutes = parseInt(startParts[0]) * 60 + parseInt(startParts[1]);
|
||||
// let endInMinutes = parseInt(endParts[0]) * 60 + parseInt(endParts[1]);
|
||||
// timeRanges.push({ start: startInMinutes, end: endInMinutes });
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Check for conflicts and order
|
||||
// for (let i = 0; i < timeRanges.length; i++) {
|
||||
// for (let j = 0; j < i; j++) {
|
||||
// if (timeRanges[i].start >= timeRanges[i].end) {
|
||||
// showAlert('زمان شروع باید قبل از زمان پایان باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Check for overlap with previous entries
|
||||
// if (timeRanges[i].start < timeRanges[j].end && timeRanges[i].end > timeRanges[j].start) {
|
||||
// showAlert('زمانها نباید تداخل داشته باشند', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
|
||||
// return;
|
||||
// }
|
||||
// // Check if the current start time is before the previous start time
|
||||
// if (i > 0 && timeRanges[i].start < timeRanges[i - 1].start) {
|
||||
// showAlert('ساعت جدید نباید کوچکتر از ساعتهای قبلی باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//$(document).on('click', '.btn-register', function () {
|
||||
|
||||
//});
|
||||
|
||||
$('.btn-register').click(function() {
|
||||
var loading = $('.btn-register .spinner-loading');
|
||||
@@ -460,16 +314,18 @@ $('.btn-register').click(function() {
|
||||
$('.alert-success-msg').hide();
|
||||
$('.alert-success-msg p').text('');
|
||||
loading.hide();
|
||||
$('#MainModal').modal('hide');
|
||||
//window.location.reload();
|
||||
}, 2000);
|
||||
|
||||
hasData = true;
|
||||
dateIndex = 0;
|
||||
dateEmployeeIndex = null;
|
||||
$('#caseHistoryLoadData').html('');
|
||||
caseHistoryLoadAjax();
|
||||
loadUntilHeightExceeds();
|
||||
$('#MainModal').modal('hide');
|
||||
setTimeout(function () {
|
||||
hasData = true;
|
||||
dateIndex = 0;
|
||||
dateEmployeeIndex = null;
|
||||
$('#caseHistoryLoadData').html('');
|
||||
caseHistoryLoadAjax();
|
||||
loadUntilHeightExceeds();
|
||||
}, 1000);
|
||||
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
@@ -490,7 +346,7 @@ $('.btn-register').click(function() {
|
||||
|
||||
$(document).on('change', '#employeeSelectAddModal', function () {
|
||||
const employeeId = $('#employeeSelectAddModal').val();
|
||||
const dateFa = $('.form-control-date-main').val();
|
||||
const dateFa = $('.form-control-date').val();
|
||||
|
||||
// Toggle .heightControll based on conditions
|
||||
toggleHeightControl();
|
||||
@@ -501,11 +357,13 @@ $(document).on('change', '#employeeSelectAddModal', function () {
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('keyup', '.form-control-date-main', function () {
|
||||
$(document).on('keyup', '.form-control-date', function () {
|
||||
// Toggle .heightControll based on conditions
|
||||
toggleHeightControl();
|
||||
|
||||
// Trigger fetching of roll call data if input length is valid
|
||||
const employeeId = $('#employeeSelectAddModal').val();
|
||||
const dateFa = $('.form-control-date-main').val();
|
||||
const dateFa = $('.form-control-date').val();
|
||||
|
||||
if (dateFa.length >= 10 && employeeId !== '0') {
|
||||
fetchAndDisplayRollCallData(employeeId, dateFa);
|
||||
@@ -514,7 +372,7 @@ $(document).on('keyup', '.form-control-date-main', function () {
|
||||
|
||||
|
||||
function toggleHeightControl() {
|
||||
if ($('#employeeSelectAddModal').val() !== '0' && $('.form-control-date-main').val().length >= 10) {
|
||||
if ($('#employeeSelectAddModal').val() !== '0' && $('.form-control-date').val().length >= 10) {
|
||||
$('.heightControll').removeClass('disable');
|
||||
$('.btn-register').removeClass('disable');
|
||||
} else {
|
||||
@@ -523,9 +381,6 @@ function toggleHeightControl() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//var itemsEditableDatesData = [];
|
||||
// Function to handle the AJAX request and generate HTML for roll call data
|
||||
function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
let htmlElement = '';
|
||||
@@ -540,13 +395,12 @@ function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
data: { 'employeeId': employeeId, 'date': dateFa },
|
||||
success: function (response) {
|
||||
const rollCallData = response.data;
|
||||
//itemsEditableDatesData = response.editableDates;
|
||||
|
||||
// console.log(response);
|
||||
console.log(response);
|
||||
|
||||
if (response.hasLeave) {
|
||||
htmlElement = `
|
||||
<div class="text-center">برای این پرسنل مرخصی ثبت شده است.</div>
|
||||
<div class="text-center">این پرسنل مرخصی ثبت شده است.</div>
|
||||
`;
|
||||
$('#appendChildTimeWorkHtml').html(htmlElement);
|
||||
$('.btn-register').addClass('disable');
|
||||
@@ -589,108 +443,51 @@ function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
}
|
||||
|
||||
htmlElement += `<div class="groupBox timeWork">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
<div class="col-12 mb-2">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 text-start">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="timeWorkTitle ti">
|
||||
${employee.totalWorkingHours}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-end d-flex justify-content-end">`;
|
||||
if (indexRollCallTime === 0) {
|
||||
htmlElement += `<div class="removeBtn"></div>`;
|
||||
} else {
|
||||
htmlElement += `<div class="removeBtn">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
||||
<path d="M6.875 11H15.125" stroke="white"/>
|
||||
</svg>
|
||||
<span class="text-white ms-1">حذف</span>
|
||||
</button>
|
||||
</div>`;
|
||||
}
|
||||
htmlElement += `
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row align-items-center justify-content-between">
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[${indexRollCallTime}].StartTime" value="${employee.startTimeString}" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[${indexRollCallTime}].EndTime" value="${employee.endTimeString}" placeholder="00:00" style="direction: ltr;">
|
||||
</div>`;
|
||||
|
||||
if (indexRollCallTime === 0) {
|
||||
htmlElement += `<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
</div>`;
|
||||
} else {
|
||||
htmlElement += `<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
||||
<path d="M6.875 11H15.125" stroke="white"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>`;
|
||||
}
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<div class="d-flex flex-column flex-md-row align-items-center gap-1">
|
||||
<div class="position-relative">
|
||||
<span class="startDatetxt">${employee.startDayOfWeekFa}</span>
|
||||
<input type="text" class="form-control text-end form-control-date StartDate" name="Command.RollCallRecords[${indexRollCallTime}].StartDate" value="${employee.startDateFa}" placeholder="0000/00/00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime ms-1" name="Command.RollCallRecords[${indexRollCallTime}].StartTime" value="${employee.startTimeString}" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<div class="d-flex flex-column-reverse flex-md-row align-items-center gap-1">
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime me-1" name="Command.RollCallRecords[${indexRollCallTime}].EndTime" value="${employee.endTimeString}" placeholder="00:00" style="direction: ltr;">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control text-start form-control-date EndDate" name="Command.RollCallRecords[${indexRollCallTime}].EndDate" value="${employee.endDateFa}" placeholder="0000/00/00" style="direction: ltr;">
|
||||
<span class="endDatetxt">${employee.endDayOfWeekFa}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
htmlElement += `</div>
|
||||
</div>`;
|
||||
|
||||
$('#appendChildTimeWorkHtml').html(htmlElement);
|
||||
|
||||
const newStartDateInput = $(`input[name="Command.RollCallRecords[${indexRollCallTime}].StartDate"]`);
|
||||
const newEndDateInput = $(`input[name="Command.RollCallRecords[${indexRollCallTime}].EndDate"]`);
|
||||
const newStartTimeInput = $(`input[name="Command.RollCallRecords[${indexRollCallTime}].StartTime"]`);
|
||||
const newEndTimeInput = $(`input[name="Command.RollCallRecords[${indexRollCallTime}].EndTime"]`);
|
||||
|
||||
newStartDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
newEndDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newStartTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newEndTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
new Cleave(newEndTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
// Apply time formatting with Cleave.js
|
||||
new Cleave(`input[name="Command.RollCallRecords[${indexRollCallTime}].StartTime"]`,
|
||||
{
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
new Cleave(`input[name="Command.RollCallRecords[${indexRollCallTime}].EndTime"]`,
|
||||
{
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
// Update add button text
|
||||
updateAddButtonText(indexRollCallTime + 1);
|
||||
@@ -707,44 +504,19 @@ function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
|
||||
htmlElement += `<div class="groupBox timeWork">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
|
||||
<div class="col-12 mb-2">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 text-start">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="timeWorkTitle ti">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-end d-flex justify-content-end">
|
||||
<div class="removeBtn">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<div class="d-flex flex-column flex-md-row align-items-center gap-1">
|
||||
<div class="position-relative">
|
||||
<span class="startDatetxt"></span>
|
||||
<input type="text" class="form-control text-end form-control-date StartDate" name="Command.RollCallRecords[0].StartDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime ms-1" name="Command.RollCallRecords[0].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[0].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<div class="d-flex flex-column-reverse flex-md-row align-items-center gap-1">
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime me-1" name="Command.RollCallRecords[0].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control text-start form-control-date EndDate" name="Command.RollCallRecords[0].EndDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
<span class="endDatetxt"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[0].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
@@ -753,51 +525,18 @@ function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
|
||||
$('#appendChildTimeWorkHtml').html(htmlElement);
|
||||
|
||||
const newStartDateInput = $(`input[name="Command.RollCallRecords[0].StartDate"]`);
|
||||
const newEndDateInput = $(`input[name="Command.RollCallRecords[0].EndDate"]`);
|
||||
const newStartTimeInput = $(`input[name="Command.RollCallRecords[0].StartTime"]`);
|
||||
const newEndTimeInput = $(`input[name="Command.RollCallRecords[0].EndTime"]`);
|
||||
// Apply time formatting with Cleave.js
|
||||
new Cleave(`input[name="Command.RollCallRecords[0].StartTime"]`,
|
||||
{
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
newStartDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
newEndDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newStartTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newEndTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
new Cleave(newEndTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
new Cleave(`input[name="Command.RollCallRecords[0].EndTime"]`,
|
||||
{
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,6 @@ $(document).ready(function () {
|
||||
$('.btn-register').addClass('disable');
|
||||
|
||||
$(".form-control-date").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
@@ -20,25 +14,6 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
});
|
||||
|
||||
$(".dateTimeIrregular").each(function () {
|
||||
let element = $(this);
|
||||
element.on('input', function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
@@ -50,22 +25,13 @@ $(document).ready(function () {
|
||||
$(".btnAddTimeWork").on("click", function () {
|
||||
var currentCount = $('.groupBox').length;
|
||||
var $inputs = $('.dateTime');
|
||||
var $inputsDate = $('.form-control-date');
|
||||
var allFilled = true;
|
||||
|
||||
$inputsDate.each(function () {
|
||||
if ($(this).val() === '') {
|
||||
allFilled = false;
|
||||
$('.btn-register').addClass('disable');
|
||||
showAlert('ابتدا تاریخ و ساعت شروع و پایان را وارد نمائید.', $(this));
|
||||
}
|
||||
});
|
||||
|
||||
$inputs.each(function () {
|
||||
if ($(this).val() === '') {
|
||||
allFilled = false;
|
||||
$('.btn-register').addClass('disable');
|
||||
showAlert('ابتدا تاریخ و ساعت شروع و پایان را وارد نمائید.', $(this));
|
||||
showAlert('ابتدا ساعت شروع و پایان را وارد نمائید.', $(this));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -96,97 +62,36 @@ $(document).ready(function () {
|
||||
var timeWorkHtml = `
|
||||
<div class="groupBox timeWork">
|
||||
<div class="row align-items-center justify-content-between">
|
||||
<div class="col-12 mb-2">
|
||||
<div class="row align-items-center">
|
||||
<div class="col-4 text-start">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="timeWorkTitle ti">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-end d-flex justify-content-end">
|
||||
<div class="removeBtn">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
||||
<path d="M6.875 11H15.125" stroke="white"/>
|
||||
</svg>
|
||||
<span class="text-white ms-1">حذف</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">نوبت ${namePlacementPersian}</div>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">از</div>
|
||||
<div class="d-flex flex-column flex-md-row align-items-center gap-1">
|
||||
<div class="position-relative">
|
||||
<span class="startDatetxt"></span>
|
||||
<input type="text" class="form-control text-end form-control-date StartDate" name="Command.RollCallRecords[${currentCount}].StartDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime" name="Command.RollCallRecords[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[${currentCount}].StartTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<div class="col-6 d-flex align-items-center">
|
||||
<div class="col-4 d-flex align-items-center">
|
||||
<div class="timeWorkTitle">الی</div>
|
||||
<div class="d-flex flex-column-reverse flex-md-row align-items-center gap-1">
|
||||
<input type="text" class="form-control text-center cusDateTime dateTime" name="Command.RollCallRecords[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
<div class="position-relative">
|
||||
<input type="text" class="form-control text-start form-control-date EndDate" name="Command.RollCallRecords[${currentCount}].EndDate" placeholder="0000/00/00" style="direction: ltr;">
|
||||
<span class="endDatetxt"></span>
|
||||
</div>
|
||||
</div>
|
||||
<input type="text" class="form-control text-center dateTime" name="Command.RollCallRecords[${currentCount}].EndTime" placeholder="00:00" style="direction: ltr;">
|
||||
</div>
|
||||
<div class="col-2 d-flex align-items-center justify-content-end">
|
||||
<button type="button" class="btnRemoveTimeWork">
|
||||
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white"/>
|
||||
<path d="M6.875 11H15.125" stroke="white"/>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
$('#appendChildTimeWorkHtml').append(timeWorkHtml);
|
||||
|
||||
const newStartDateInput = $(`input[name="Command.RollCallRecords[${currentCount}].StartDate"]`);
|
||||
const newEndDateInput = $(`input[name="Command.RollCallRecords[${currentCount}].EndDate"]`);
|
||||
const newStartTimeInput = $(`input[name="Command.RollCallRecords[${currentCount}].StartTime"]`);
|
||||
const newEndTimeInput = $(`input[name="Command.RollCallRecords[${currentCount}].EndTime"]`);
|
||||
|
||||
newStartDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
newEndDateInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newStartTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
newEndTimeInput.on('input', function () {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
new Cleave(`input[name="Command.RollCallRecords[${currentCount}].StartTime"]`, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
|
||||
new Cleave(newEndTimeInput[0], {
|
||||
new Cleave(`input[name="Command.RollCallRecords[${currentCount}].EndTime"]`, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
});
|
||||
@@ -197,11 +102,11 @@ $(document).ready(function () {
|
||||
$(".btnAddTimeWork").hide();
|
||||
}
|
||||
|
||||
|
||||
// Update Remove button enable/disable state
|
||||
updateRemoveButtons();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on("click", ".btnRemoveTimeWork", function () {
|
||||
$(this).closest(".groupBox").remove();
|
||||
var currentCount = $('.groupBox').length;
|
||||
@@ -215,75 +120,6 @@ $(document).ready(function () {
|
||||
// Update Remove button enable/disable state
|
||||
updateRemoveButtons();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
const $boxes = $('.irrregularContent');
|
||||
const $forwardArrow = $('#nextBox').parent().find('svg path:first-child');
|
||||
const $backwardArrow = $('#prevBox').parent().find('svg path:first-child');
|
||||
let currentIndex = 0;
|
||||
|
||||
const updateBoxes = () => {
|
||||
$boxes.each((index, box) => {
|
||||
const $box = $(box);
|
||||
if (index < currentIndex) {
|
||||
// Previous boxes
|
||||
$box.css({
|
||||
transform: 'translateX(-100%)',
|
||||
opacity: 0,
|
||||
position: 'absolute',
|
||||
});
|
||||
} else if (index === currentIndex) {
|
||||
// Current box
|
||||
$box.addClass('active').css({
|
||||
transform: 'translateX(0)',
|
||||
opacity: 1,
|
||||
position: 'relative',
|
||||
});
|
||||
} else {
|
||||
// Next boxes
|
||||
$box.css({
|
||||
transform: 'translateX(100%)',
|
||||
opacity: 0,
|
||||
position: 'absolute',
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
if (currentIndex === 0) {
|
||||
$backwardArrow.attr('fill', '#D9D9D9');
|
||||
$forwardArrow.attr('fill', '#2DBDBD');
|
||||
} else if (currentIndex === $boxes.length - 1) {
|
||||
$backwardArrow.attr('fill', '#2DBDBD');
|
||||
$forwardArrow.attr('fill', '#D9D9D9');
|
||||
} else {
|
||||
$backwardArrow.attr('fill', '#2DBDBD');
|
||||
$forwardArrow.attr('fill', '#2DBDBD');
|
||||
}
|
||||
};
|
||||
|
||||
$('#nextBox').on('click', function () {
|
||||
if (currentIndex < $boxes.length - 1) {
|
||||
currentIndex++;
|
||||
updateBoxes();
|
||||
}
|
||||
});
|
||||
|
||||
$('#prevBox').on('click', function () {
|
||||
if (currentIndex > 0) {
|
||||
currentIndex--;
|
||||
updateBoxes();
|
||||
}
|
||||
});
|
||||
|
||||
updateBoxes();
|
||||
//--------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
});
|
||||
function updateRemoveButtons() {
|
||||
$(".btnRemoveTimeWork").addClass("disable");
|
||||
@@ -311,14 +147,6 @@ function updateAddButtonText(currentCount) {
|
||||
}
|
||||
|
||||
let allFilled = true;
|
||||
$('.form-control-date').each(function () {
|
||||
const value = $(this).val().trim();
|
||||
if (value === "" || !dateValidCheck(value)) {
|
||||
allFilled = false;
|
||||
return false; // Break the loop
|
||||
}
|
||||
});
|
||||
|
||||
$('.dateTime').each(function () {
|
||||
const value = $(this).val().trim();
|
||||
if (value === "" || !timeValidCheck(value)) {
|
||||
@@ -334,112 +162,36 @@ function updateAddButtonText(currentCount) {
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('keyup', ".dateTime, .form-control-date", function () {
|
||||
$(document).on('keyup', ".dateTime", function () {
|
||||
let $input = $(this);
|
||||
let value = $input.val();
|
||||
let lengthValue = value.length;
|
||||
let currentCount = $('.groupBox').length;
|
||||
|
||||
const $groupBox = $input.closest('.groupBox');
|
||||
|
||||
const startDate = $groupBox.find('.StartDate').val();
|
||||
const startTime = $groupBox.find('[name*="StartTime"]').val();
|
||||
const endDate = $groupBox.find('.EndDate').val();
|
||||
const endTime = $groupBox.find('[name*="EndTime"]').val();
|
||||
|
||||
// Validate input based on the field type
|
||||
if ($input.hasClass('form-control-date')) {
|
||||
// Date validation logic
|
||||
if (lengthValue >= 10) {
|
||||
if (!dateValidCheck(value)) {
|
||||
showAlert('تاریخ را به درستی وارد نمائید', $input);
|
||||
} else {
|
||||
clearAlert($input);
|
||||
dayOfWeekLoad(this, value);
|
||||
}
|
||||
if (lengthValue >= 5) {
|
||||
if (!timeValidCheck(value)) {
|
||||
showAlert('ساعت را به درستی وارد نمائید', $input);
|
||||
updateAddButtonText(currentCount);
|
||||
} else {
|
||||
if ($input.hasClass('StartDate')) {
|
||||
$groupBox.find('.startDatetxt').text('');
|
||||
} else if ($input.hasClass('EndDate')) {
|
||||
$groupBox.find('.endDatetxt').text('');
|
||||
}
|
||||
}
|
||||
} else if ($input.hasClass('dateTime')) {
|
||||
if (lengthValue >= 5) {
|
||||
if (!timeValidCheck(value)) {
|
||||
showAlert('ساعت را به درستی وارد نمائید', $input);
|
||||
} else {
|
||||
clearAlert($input);
|
||||
}
|
||||
clearAlert($input);
|
||||
// validateAllTimes();
|
||||
updateAddButtonText(currentCount);
|
||||
|
||||
// focusNextTimeInput($input);
|
||||
}
|
||||
} else {
|
||||
updateAddButtonText(currentCount);
|
||||
}
|
||||
|
||||
//if (startDate.length >= 10 && endDate.length >= 10) {
|
||||
// if (!validateDates(startDate, endDate)) {
|
||||
// showAlert('حضور غیاب در حال ویرایش را نمیتوانید بیشتر از یک روز از ثبت حضور غیاب عقب تر یا جلو تر ببرید', $input);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (startDate.length >= 10 && startTime.length >= 5 && endDate.length >= 10 && endTime.length >= 5) {
|
||||
totalWorkingDataLoad(startDate, startTime, endDate, endTime, $groupBox);
|
||||
}
|
||||
|
||||
updateAddButtonText(currentCount);
|
||||
});
|
||||
|
||||
//function validateDates(startDate, endDate) {
|
||||
// return itemsEditableDatesData.some(entry => entry.startFa === startDate && entry.endFa === endDate);
|
||||
//}
|
||||
//function focusNextTimeInput(currentInput) {
|
||||
// var inputs = $(".dateTime");
|
||||
// var currentIndex = inputs.index(currentInput);
|
||||
|
||||
function dayOfWeekLoad(input, value) {
|
||||
$.ajax({
|
||||
url: dayOfWeekDataUrl,
|
||||
type: 'GET',
|
||||
data: { dateFa: value },
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
const $groupBox = $(input).closest('.groupBox');
|
||||
if ($(input).hasClass('StartDate')) {
|
||||
$groupBox.find('.startDatetxt').text(response.message);
|
||||
} else if ($(input).hasClass('EndDate')) {
|
||||
$groupBox.find('.endDatetxt').text(response.message);
|
||||
}
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
function totalWorkingDataLoad(startDateVal, startTimeVal, endDateVal, endTimeVal, $groupBox) {
|
||||
$.ajax({
|
||||
url: totalWorkingDataUrl,
|
||||
type: 'GET',
|
||||
data: { startDate: startDateVal, startTime: startTimeVal, endDate: endDateVal, endTime: endTimeVal },
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
$groupBox.find('.ti').text(response.message);
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
// if (currentIndex !== -1 && currentIndex < inputs.length - 1) {
|
||||
// $(inputs[currentIndex + 1]).focus();
|
||||
// }
|
||||
//}
|
||||
|
||||
function showAlert(message, inputElement) {
|
||||
inputElement.addClass("errored");
|
||||
@@ -459,14 +211,53 @@ function timeValidCheck(value) {
|
||||
return timePattern.test(value);
|
||||
}
|
||||
|
||||
function dateValidCheck(value) {
|
||||
const datePattern = /^\d{4}\/(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])$/;
|
||||
return datePattern.test(value);
|
||||
}
|
||||
//function validateAllTimes() {
|
||||
// let timeRanges = [];
|
||||
|
||||
// $(".groupBox").each(function () {
|
||||
// let startTime = $(this).find('input[name*="StartTime"]').val();
|
||||
// let endTime = $(this).find('input[name*="EndTime"]').val();
|
||||
|
||||
// if (startTime.length === 5 && endTime.length === 5) {
|
||||
// let startParts = startTime.split(':');
|
||||
// let endParts = endTime.split(':');
|
||||
// let startInMinutes = parseInt(startParts[0]) * 60 + parseInt(startParts[1]);
|
||||
// let endInMinutes = parseInt(endParts[0]) * 60 + parseInt(endParts[1]);
|
||||
// timeRanges.push({ start: startInMinutes, end: endInMinutes });
|
||||
// }
|
||||
// });
|
||||
|
||||
// // Check for conflicts and order
|
||||
// for (let i = 0; i < timeRanges.length; i++) {
|
||||
// for (let j = 0; j < i; j++) {
|
||||
// if (timeRanges[i].start >= timeRanges[i].end) {
|
||||
// showAlert('زمان شروع باید قبل از زمان پایان باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// // Check for overlap with previous entries
|
||||
// if (timeRanges[i].start < timeRanges[j].end && timeRanges[i].end > timeRanges[j].start) {
|
||||
// showAlert('زمانها نباید تداخل داشته باشند', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
|
||||
// return;
|
||||
// }
|
||||
// // Check if the current start time is before the previous start time
|
||||
// if (i > 0 && timeRanges[i].start < timeRanges[i - 1].start) {
|
||||
// showAlert('ساعت جدید نباید کوچکتر از ساعتهای قبلی باشد', $(".groupBox").eq(i).find('input[name*="StartTime"]'));
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
$('.btn-register').click(function () {
|
||||
|
||||
var dateFa = $('#dateFa').val().replaceAll("/", "");
|
||||
var dateEmployeeID = $('#employeeID').val() + '-' + dateFa;
|
||||
|
||||
var loading = $('.btn-register .spinner-loading');
|
||||
|
||||
var data = $('#create-form').serialize();
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
@@ -497,19 +288,34 @@ $('.btn-register').click(function () {
|
||||
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
||||
switch (menuActive) {
|
||||
case "absent":
|
||||
loadWorkFlowsAbsentsList();
|
||||
/*loadWorkFlowsAbsentsList();*/
|
||||
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`absent_${dateFa}`);
|
||||
updateMainWorkFlow(`absentMain_${dateFa}`);
|
||||
break;
|
||||
case "cut":
|
||||
LoadWorkFlowsCutList();
|
||||
//LoadWorkFlowsCutList();
|
||||
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`cut_${dateFa}`);
|
||||
updateMainWorkFlow(`cutMain_${dateFa}`);
|
||||
break;
|
||||
case "lunchBreak":
|
||||
loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`break_${dateFa}`);
|
||||
updateMainWorkFlow(`breakMain_${dateFa}`);
|
||||
break;
|
||||
case "undefined":
|
||||
loadUndefinedRollCallsList();
|
||||
//loadUndefinedRollCallsList();
|
||||
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`undefined_${dateFa}`);
|
||||
updateMainWorkFlow(`undefinedMain_${dateFa}`);
|
||||
break;
|
||||
case "overlappingLeave":
|
||||
loadOverlappingLeavesList();
|
||||
//loadOverlappingLeavesList();
|
||||
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`leave_${dateFa}`);
|
||||
updateMainWorkFlow(`leaveMain_${dateFa}`);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
@@ -528,7 +334,28 @@ $('.btn-register').click(function () {
|
||||
$('#MainModal').modal('hide');
|
||||
}
|
||||
|
||||
//window.location.reload();
|
||||
|
||||
|
||||
//loading.show();
|
||||
//$('.alert-success-msg').show();
|
||||
//$('.alert-success-msg p').text(response.message);
|
||||
//setTimeout(function () {
|
||||
// $('.alert-success-msg').hide();
|
||||
// $('.alert-success-msg p').text('');
|
||||
// loading.hide();
|
||||
// //$('#MainModal').modal('hide');
|
||||
// window.location.reload();
|
||||
//}, 2000);
|
||||
|
||||
//setTimeout(function () {
|
||||
// window.location.reload();
|
||||
// //hasData = true;
|
||||
// //dateIndex = 0;
|
||||
// //dateEmployeeIndex = null;
|
||||
// //$('#caseHistoryLoadData').html('');
|
||||
// //caseHistoryLoadAjax();
|
||||
// //loadUntilHeightExceeds();
|
||||
//}, 1000);
|
||||
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
|
||||
@@ -122,6 +122,9 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
var dateFa = startLeave.replaceAll("/", "");
|
||||
var dateEmployeeID = $('#employeeId').val() + '-' + dateFa;
|
||||
|
||||
if ($('.errored').length < 1) {
|
||||
$.ajax({
|
||||
async: false,
|
||||
@@ -145,24 +148,59 @@
|
||||
_RefreshCountMenu();
|
||||
CountWorkFlowOfAbsentAndCut();
|
||||
|
||||
//var menuActive = $('#navbar-animmenu li.active').data('menu');
|
||||
//switch (menuActive) {
|
||||
// case "absent":
|
||||
// loadWorkFlowsAbsentsList();
|
||||
// break;
|
||||
// case "cut":
|
||||
// LoadWorkFlowsCutList();
|
||||
// break;
|
||||
// case "lunchBreak":
|
||||
// loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
// break;
|
||||
// case "undefined":
|
||||
// loadUndefinedRollCallsList();
|
||||
// break;
|
||||
// case "overlappingLeave":
|
||||
// loadOverlappingLeavesList();
|
||||
// break;
|
||||
// default:
|
||||
//}
|
||||
|
||||
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
||||
switch (menuActive) {
|
||||
case "absent":
|
||||
loadWorkFlowsAbsentsList();
|
||||
/*loadWorkFlowsAbsentsList();*/
|
||||
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`absent_${dateFa}`);
|
||||
updateMainWorkFlow(`absentMain_${dateFa}`);
|
||||
break;
|
||||
case "cut":
|
||||
LoadWorkFlowsCutList();
|
||||
//LoadWorkFlowsCutList();
|
||||
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`cut_${dateFa}`);
|
||||
updateMainWorkFlow(`cutMain_${dateFa}`);
|
||||
break;
|
||||
case "lunchBreak":
|
||||
loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`break_${dateFa}`);
|
||||
updateMainWorkFlow(`breakMain_${dateFa}`);
|
||||
break;
|
||||
case "undefined":
|
||||
loadUndefinedRollCallsList();
|
||||
//loadUndefinedRollCallsList();
|
||||
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`undefined_${dateFa}`);
|
||||
updateMainWorkFlow(`undefinedMain_${dateFa}`);
|
||||
break;
|
||||
case "overlappingLeave":
|
||||
loadOverlappingLeavesList();
|
||||
//loadOverlappingLeavesList();
|
||||
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`leave_${dateFa}`);
|
||||
updateMainWorkFlow(`leaveMain_${dateFa}`);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -168,7 +168,7 @@ function loadWorkFlowsAbsentsList() {
|
||||
if (data.length > 0) {
|
||||
data.forEach(function(item) {
|
||||
html += `
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsAbsents('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div id="absentMain_${item.dateTimeFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsAbsents('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div class="col-2 col-md-4 text-start">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--content">
|
||||
@@ -205,7 +205,7 @@ function loadWorkFlowsAbsentsList() {
|
||||
</div>`;
|
||||
|
||||
html += `<div class="w-100 operation-div">
|
||||
<div class="operations-btns-main dateTimeFa_${item.dateTimeFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
<div id="absent_${item.dateTimeFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_${item.dateTimeFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
</div></div>`;
|
||||
});
|
||||
|
||||
@@ -256,7 +256,7 @@ function loadEmployeeListByWorkFlowsAbsents(date) {
|
||||
|
||||
data.rollCallWorkFlowPerDayViewModels.forEach(function (rollCallItem, i) {
|
||||
html += `<div></div>
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row">
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-absent-employee-date="${rollCallItem.employeeId + `-` + data.dateTimeFa.replaceAll("/", "")}">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--heading d-none">
|
||||
ردیف
|
||||
@@ -347,7 +347,7 @@ async function LoadWorkFlowsCutList() {
|
||||
if (data.length > 0) {
|
||||
data.forEach(function (item) {
|
||||
htmlCutList += `
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsCut('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div id="cutMain_${item.dateTimeFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsCut('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div class="col-2 col-md-4 text-start">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--content">
|
||||
@@ -383,7 +383,7 @@ async function LoadWorkFlowsCutList() {
|
||||
</div>`;
|
||||
|
||||
htmlCutList += `<div class="w-100 operation-div">
|
||||
<div class="operations-btns-main dateTimeFa_cut_${item.dateTimeFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
<div id="cut_${item.dateTimeFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_cut_${item.dateTimeFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
</div></div>`;
|
||||
});
|
||||
} else {
|
||||
@@ -428,7 +428,7 @@ function loadEmployeeListByWorkFlowsCut(date) {
|
||||
|
||||
data.rollCallWorkFlowPerDayViewModels.forEach(function (rollCallItem, i) {
|
||||
html += `<div></div>
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row">
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-cut-employee-date="${rollCallItem.employeeId + `-` + data.dateTimeFa.replaceAll("/", "")}">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--heading d-none">
|
||||
ردیف
|
||||
@@ -459,7 +459,7 @@ function loadEmployeeListByWorkFlowsCut(date) {
|
||||
<div class="Rtable-cell position-relative width4 bg-filter d-flex justify-content-end">
|
||||
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
||||
|
||||
<button type="button" class="btn-workflow-accept" onclick="confirmCutAlert(${rollCallItem.rollCallId})">
|
||||
<button type="button" class="btn-workflow-accept" onclick="confirmCutAlert(${rollCallItem.rollCallId}, ${rollCallItem.employeeId}, '${data.dateTimeFa.replaceAll("/", "")}')">
|
||||
<span class="mx-1">تایید</span>
|
||||
</button>
|
||||
|
||||
@@ -516,7 +516,7 @@ async function loadWorkFlowEmployeesWithoutLunchBreakList() {
|
||||
if (data.length > 0) {
|
||||
data.forEach(function (item) {
|
||||
htmlLunchBreakList += `
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsEmployeesWithoutLunchBreak('${item.dateGr}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div id="breakMain_${item.dateFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByWorkFlowsEmployeesWithoutLunchBreak('${item.dateGr}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div class="col-2 col-md-4 text-start">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--content">
|
||||
@@ -552,7 +552,7 @@ async function loadWorkFlowEmployeesWithoutLunchBreakList() {
|
||||
</div>`;
|
||||
|
||||
htmlLunchBreakList += `<div class="w-100 operation-div">
|
||||
<div class="operations-btns-main dateTimeFa_without_lunch_break_${item.dateFa.replaceAll("/", "")}"" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
<div id="breack_${item.dateFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_without_lunch_break_${item.dateFa.replaceAll("/", "")}" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
</div></div>`;
|
||||
});
|
||||
} else {
|
||||
@@ -598,7 +598,7 @@ function loadEmployeeListByWorkFlowsEmployeesWithoutLunchBreak(date) {
|
||||
|
||||
data.rollCallConfirmedWithoutLunchList.forEach(function (rollCallItem, i) {
|
||||
html += `<div></div>
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row">
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-break-employee-date="${rollCallItem.employeeId + `-` + data.dateFa.replaceAll("/", "")}">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--heading d-none">
|
||||
ردیف
|
||||
@@ -629,7 +629,7 @@ function loadEmployeeListByWorkFlowsEmployeesWithoutLunchBreak(date) {
|
||||
<div class="Rtable-cell position-relative width4 bg-filter d-flex justify-content-end">
|
||||
<div class="Rtable-cell--content text-center d-block d-md-flex align-items-center gap-1 h-100">
|
||||
|
||||
<button type="button" class="btn-workflow-accept" onclick="confirmWithoutLunchBreakAlert(${rollCallItem.rollCallId})">
|
||||
<button type="button" class="btn-workflow-accept" onclick="confirmWithoutLunchBreakAlert(${rollCallItem.rollCallId}, ${rollCallItem.employeeId}, '${data.dateFa.replaceAll("/", "")}')">
|
||||
<span class="mx-1">تایید</span>
|
||||
</button>
|
||||
|
||||
@@ -687,7 +687,7 @@ async function loadUndefinedRollCallsList() {
|
||||
data.forEach(function (item) {
|
||||
|
||||
htmlUndefinedList += `
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByUndefinedRollCalls('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div id="undefinedMain_${item.dateTimeFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByUndefinedRollCalls('${item.dateTime}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div class="col-2 col-md-4 text-start">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--content">
|
||||
@@ -723,7 +723,7 @@ async function loadUndefinedRollCallsList() {
|
||||
</div>`;
|
||||
|
||||
htmlUndefinedList += `<div class="w-100 operation-div">
|
||||
<div class="operations-btns-main dateTimeFa_without_undefined_${item.dateTimeFa.replaceAll("/", "")}"" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
<div id="undefined_${item.dateTimeFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_without_undefined_${item.dateTimeFa.replaceAll("/", "")}"" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
</div></div>`;
|
||||
});
|
||||
} else {
|
||||
@@ -769,7 +769,7 @@ function loadEmployeeListByUndefinedRollCalls(date) {
|
||||
|
||||
data.rollCallWorkFlowPerDayViewModels.forEach(function (rollCallItem, i) {
|
||||
html += `<div></div>
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row">
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-undefined-employee-date="${rollCallItem.employeeId + `-` + data.dateTimeFa.replaceAll("/", "")}">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--heading d-none">
|
||||
ردیف
|
||||
@@ -854,7 +854,7 @@ async function loadOverlappingLeavesList() {
|
||||
data.forEach(function (item) {
|
||||
|
||||
htmlOverlappingLeavesList += `
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByOverlappingLeaves('${item.date}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div id="leaveMain_${item.dateFa.replaceAll("/", "")}" class="Rtable-row Rtable-row--head align-items-center d-flex sticky openActionMain" onclick="loadEmployeeListByOverlappingLeaves('${item.date}')" style="background: #58B3B3;border: none !important; cursor: pointer; ">
|
||||
<div class="col-2 col-md-4 text-start">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--content">
|
||||
@@ -890,7 +890,7 @@ async function loadOverlappingLeavesList() {
|
||||
</div>`;
|
||||
|
||||
htmlOverlappingLeavesList += `<div class="w-100 operation-div">
|
||||
<div class="operations-btns-main dateTimeFa_overlapping_leaves_${item.dateFa.replaceAll("/", "")}"" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
<div id="leave_${item.dateFa.replaceAll("/", "")}" class="operations-btns-main dateTimeFa_overlapping_leaves_${item.dateFa.replaceAll("/", "")}"" style="padding: 1px 10px 0 10px; background: rgb(255, 255, 255); box-shadow: none;width: 100%;">
|
||||
</div></div>`;
|
||||
});
|
||||
} else {
|
||||
@@ -935,9 +935,8 @@ function loadEmployeeListByOverlappingLeaves(date) {
|
||||
if (data.employeesList.length > 0) {
|
||||
|
||||
data.employeesList.forEach(function (rollCallItem, i) {
|
||||
console.log(rollCallItem);
|
||||
html += `<div></div>
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row">
|
||||
<div class="Rtable-row align-items-center position-relative workflow-list employee-row" data-leave-employee-date="${rollCallItem.employeeId + `-` + data.dateFa.replaceAll("/", "")}">
|
||||
<div class="Rtable-cell width1">
|
||||
<div class="Rtable-cell--heading d-none">
|
||||
ردیف
|
||||
@@ -1034,6 +1033,7 @@ function confirmAbsentAlert(employeeId, dateFa) {
|
||||
}
|
||||
|
||||
function confirmAbsent(employeeId, dateFa) {
|
||||
var dateEmployeeID = employeeId + '-' + dateFa.replaceAll("/", "");
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
@@ -1052,10 +1052,41 @@ function confirmAbsent(employeeId, dateFa) {
|
||||
$('.alert-success-msg p').text('');
|
||||
}, 1000);
|
||||
|
||||
LoadWorkFlowsCutList();
|
||||
loadWorkFlowsAbsentsList();
|
||||
loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
loadUndefinedRollCallsList();
|
||||
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
||||
switch (menuActive) {
|
||||
case "absent":
|
||||
/*loadWorkFlowsAbsentsList();*/
|
||||
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`absent_${dateFa.replaceAll("/", "") }`);
|
||||
updateMainWorkFlow(`absentMain_${dateFa.replaceAll("/", "") }`);
|
||||
break;
|
||||
case "cut":
|
||||
//LoadWorkFlowsCutList();
|
||||
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`cut_${dateFa.replaceAll("/", "") }`);
|
||||
updateMainWorkFlow(`cutMain_${dateFa.replaceAll("/", "") }`);
|
||||
break;
|
||||
case "lunchBreak":
|
||||
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`break_${dateFa.replaceAll("/", "") }`);
|
||||
updateMainWorkFlow(`breakMain_${dateFa.replaceAll("/", "") }`);
|
||||
break;
|
||||
case "undefined":
|
||||
//loadUndefinedRollCallsList();
|
||||
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`undefined_${dateFa.replaceAll("/", "") }`);
|
||||
updateMainWorkFlow(`undefinedMain_${dateFa.replaceAll("/", "") }`);
|
||||
break;
|
||||
case "overlappingLeave":
|
||||
//loadOverlappingLeavesList();
|
||||
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`leave_${dateFa.replaceAll("/", "") }`);
|
||||
updateMainWorkFlow(`leaveMain_${dateFa.replaceAll("/", "") }`);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
@@ -1075,7 +1106,7 @@ function showModalEditRollCall(employeeId, dateFa) {
|
||||
window.location.href = `#showmodal=/Client/Company/RollCall/CaseHistory?employeeId=${employeeId}&date=${dateFa}&handler=Edit`;
|
||||
}
|
||||
|
||||
function confirmCutAlert(rollCallId) {
|
||||
function confirmCutAlert(rollCallId, employeeId, dateFa) {
|
||||
swal({
|
||||
title: "آیا از تایید این پرسنل اطمینان دارید؟",
|
||||
text: "",
|
||||
@@ -1088,12 +1119,13 @@ function confirmCutAlert(rollCallId) {
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
confirmCut(rollCallId);
|
||||
confirmCut(rollCallId, employeeId, dateFa);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function confirmCut(rollCallId) {
|
||||
function confirmCut(rollCallId, employeeId, dateFa) {
|
||||
var dateEmployeeID = employeeId + '-' + dateFa;
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
@@ -1112,10 +1144,62 @@ function confirmCut(rollCallId) {
|
||||
$('.alert-success-msg p').text('');
|
||||
}, 1000);
|
||||
|
||||
LoadWorkFlowsCutList();
|
||||
loadWorkFlowsAbsentsList();
|
||||
loadUndefinedRollCallsList();
|
||||
loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
|
||||
//var menuActive = $('#navbar-animmenu li.active').data('menu');
|
||||
//switch (menuActive) {
|
||||
// case "absent":
|
||||
// loadWorkFlowsAbsentsList();
|
||||
// break;
|
||||
// case "cut":
|
||||
// LoadWorkFlowsCutList();
|
||||
// break;
|
||||
// case "lunchBreak":
|
||||
// loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
// break;
|
||||
// case "undefined":
|
||||
// loadUndefinedRollCallsList();
|
||||
// break;
|
||||
// case "overlappingLeave":
|
||||
// loadOverlappingLeavesList();
|
||||
// break;
|
||||
// default:
|
||||
//}
|
||||
|
||||
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
||||
switch (menuActive) {
|
||||
case "absent":
|
||||
/*loadWorkFlowsAbsentsList();*/
|
||||
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`absent_${dateFa}`);
|
||||
updateMainWorkFlow(`absentMain_${dateFa}`);
|
||||
break;
|
||||
case "cut":
|
||||
//LoadWorkFlowsCutList();
|
||||
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`cut_${dateFa}`);
|
||||
updateMainWorkFlow(`cutMain_${dateFa}`);
|
||||
break;
|
||||
case "lunchBreak":
|
||||
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`break_${dateFa}`);
|
||||
updateMainWorkFlow(`breakMain_${dateFa}`);
|
||||
break;
|
||||
case "undefined":
|
||||
//loadUndefinedRollCallsList();
|
||||
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`undefined_${dateFa}`);
|
||||
updateMainWorkFlow(`undefinedMain_${dateFa}`);
|
||||
break;
|
||||
case "overlappingLeave":
|
||||
//loadOverlappingLeavesList();
|
||||
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`leave_${dateFa}`);
|
||||
updateMainWorkFlow(`leaveMain_${dateFa}`);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
@@ -1131,7 +1215,7 @@ function confirmCut(rollCallId) {
|
||||
});
|
||||
}
|
||||
|
||||
function confirmWithoutLunchBreakAlert(rollCallId) {
|
||||
function confirmWithoutLunchBreakAlert(rollCallId, employeeId, dateFa) {
|
||||
swal({
|
||||
title: "آیا از تایید این پرسنل اطمینان دارید؟",
|
||||
text: "",
|
||||
@@ -1144,12 +1228,13 @@ function confirmWithoutLunchBreakAlert(rollCallId) {
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
confirmWithoutLunchBreak(rollCallId);
|
||||
confirmWithoutLunchBreak(rollCallId, employeeId, dateFa);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function confirmWithoutLunchBreak(rollCallId) {
|
||||
function confirmWithoutLunchBreak(rollCallId, employeeId, dateFa) {
|
||||
var dateEmployeeID = employeeId + '-' + dateFa;
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
@@ -1168,9 +1253,41 @@ function confirmWithoutLunchBreak(rollCallId) {
|
||||
$('.alert-success-msg p').text('');
|
||||
}, 1000);
|
||||
|
||||
LoadWorkFlowsCutList();
|
||||
loadWorkFlowsAbsentsList();
|
||||
loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
var menuActive = $('#navbar-animmenu li.active').data('menu');
|
||||
switch (menuActive) {
|
||||
case "absent":
|
||||
/*loadWorkFlowsAbsentsList();*/
|
||||
$(`[data-absent-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`absent_${dateFa}`);
|
||||
updateMainWorkFlow(`absentMain_${dateFa}`);
|
||||
break;
|
||||
case "cut":
|
||||
//LoadWorkFlowsCutList();
|
||||
$(`[data-cut-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`cut_${dateFa}`);
|
||||
updateMainWorkFlow(`cutMain_${dateFa}`);
|
||||
break;
|
||||
case "lunchBreak":
|
||||
//loadWorkFlowEmployeesWithoutLunchBreakList();
|
||||
$(`[data-break-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`break_${dateFa}`);
|
||||
updateMainWorkFlow(`breakMain_${dateFa}`);
|
||||
break;
|
||||
case "undefined":
|
||||
//loadUndefinedRollCallsList();
|
||||
$(`[data-undefined-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`undefined_${dateFa}`);
|
||||
updateMainWorkFlow(`undefinedMain_${dateFa}`);
|
||||
break;
|
||||
case "overlappingLeave":
|
||||
//loadOverlappingLeavesList();
|
||||
$(`[data-leave-employee-date="${dateEmployeeID}"]`).remove();
|
||||
updateIndexesWorkFlow(`leave_${dateFa}`);
|
||||
updateMainWorkFlow(`leaveMain_${dateFa}`);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
@@ -1259,4 +1376,29 @@ async function CountWorkFlowOfAbsentAndCut() {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateIndexesWorkFlow(dateDiv) {
|
||||
let index = 1;
|
||||
|
||||
$(`#${dateDiv} .employee-row:visible .table-number`).each(function () {
|
||||
$(this).text(index++);
|
||||
});
|
||||
}
|
||||
|
||||
function updateMainWorkFlow(dateDiv) {
|
||||
let indexMain = 1;
|
||||
|
||||
$(`#${dateDiv} .number-of-count`).each(function () {
|
||||
var text = Number($(this).text());
|
||||
$(this).text(text - 1);
|
||||
|
||||
if (text - 1 === 0) {
|
||||
$(`#${dateDiv}`).remove();
|
||||
|
||||
//$(`.openActionMain .Rtable-cell.width1 .Rtable-cell--content span`).each(function () {
|
||||
// $(this).text(indexMain++);
|
||||
//});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -89,7 +89,7 @@ public class WorkFlowApplication : IWorkFlowApplication
|
||||
count += (await GetAbsentRollCallWorkFlows(workshopId))?.Count ?? 0;
|
||||
count += (await GetRollCallWorkFlowsCutByBgService(workshopId))?.Count ?? 0;
|
||||
count += (await GetEmployeesWithoutLunchBreak(workshopId))?.Count ?? 0;
|
||||
count += (await GetRollCallsOverlappingLeaves(workshopId))?.Count ?? 0;
|
||||
//count += (await GetRollCallsOverlappingLeaves(workshopId))?.Count ?? 0;
|
||||
count += (await GetUndefinedRollCalls(workshopId))?.Count ?? 0;
|
||||
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ namespace WorkFlow.Infrastructure.ACL.Checkout
|
||||
{
|
||||
public interface IWorkFlowCheckoutACL
|
||||
{
|
||||
List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
|
||||
List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(
|
||||
long workshopId, DateTime start, DateTime end);
|
||||
}
|
||||
@@ -24,10 +23,7 @@ namespace WorkFlow.Infrastructure.ACL.Checkout
|
||||
_checkoutApplication = checkoutApplication;
|
||||
}
|
||||
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopId(long workshopId, DateTime start, DateTime end)
|
||||
{
|
||||
return _checkoutApplication.GetLastCheckoutsByWorkshopId(workshopId, start, end);
|
||||
}
|
||||
|
||||
public List<(long EmployeeId, DateTime CheckoutStart, DateTime CheckoutEnd)> GetLastCheckoutsByWorkshopIdForWorkFlow(long workshopId, DateTime start, DateTime end)
|
||||
{
|
||||
return _checkoutApplication.GetLastCheckoutsByWorkshopIdForWorkFlow(workshopId, start, end);
|
||||
|
||||
Reference in New Issue
Block a user