diff --git a/AccountManagement.Application.Contracts/Task/EditTask.cs b/AccountManagement.Application.Contracts/Task/EditTask.cs index 7769c629..f70c6706 100644 --- a/AccountManagement.Application.Contracts/Task/EditTask.cs +++ b/AccountManagement.Application.Contracts/Task/EditTask.cs @@ -21,4 +21,5 @@ public class EditTask:CreateTask public List AssignsLists { get; set; } public bool HasTicket { get; set; } public long TaskScheduleId { get; set; } + public bool HasRequest { get; set; } } \ No newline at end of file diff --git a/AccountManagement.Application.Contracts/Task/TaskViewModel.cs b/AccountManagement.Application.Contracts/Task/TaskViewModel.cs index 30c4562b..56fa2fab 100644 --- a/AccountManagement.Application.Contracts/Task/TaskViewModel.cs +++ b/AccountManagement.Application.Contracts/Task/TaskViewModel.cs @@ -48,6 +48,7 @@ public class TaskViewModel public bool CanDelete { get; set; } public bool CanAssign { get; set; } public bool CanCheckRequests { get; set; } + public bool HasRequest { get; set; } public AssignViewModel AssignedReceiverViewModel { get; set; } public TaskScheduleType ScheduleType { get; set; } diff --git a/AccountManagement.Application.Contracts/TaskSchedule/TaskScheduleDetailsViewModel.cs b/AccountManagement.Application.Contracts/TaskSchedule/TaskScheduleDetailsViewModel.cs index 637f1fbb..12b40d31 100644 --- a/AccountManagement.Application.Contracts/TaskSchedule/TaskScheduleDetailsViewModel.cs +++ b/AccountManagement.Application.Contracts/TaskSchedule/TaskScheduleDetailsViewModel.cs @@ -15,6 +15,8 @@ public class TaskScheduleDetailsViewModel public string ContractingPartyName { get; set; } public string Title { get; set; } public string Description { get; set; } + public string Count { get; set; } + public string FirstEndTaskDate { get; set; } public List Medias { get; set; } } \ No newline at end of file diff --git a/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs index 4a41b01e..84e805e5 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/TaskRepository.cs @@ -106,14 +106,16 @@ public class TaskRepository : RepositoryBase, ITaskRepository { res.EndTaskDate = _accountContext.Assigns.First(a => a.TaskId == res.Id && a.AssignedId == userId) .EndTaskDate.ToFarsi(); - + var userAssign = res.AssignViewModels.First(x => x.AssignedId == userId); res.AssignViewModels = res.AssignViewModels.Where(x => x.AssignedId == userId).ToList(); - res.IsDone = res.AssignViewModels.First(x => x.AssignedId == userId).IsDone; - res.IsCancel = res.AssignViewModels.First(x => x.AssignedId == userId).IsCancel; + res.IsDone = userAssign.IsDone; + res.IsCancel = userAssign.IsCancel; + res.HasRequest = userAssign.IsCanceledRequest || userAssign.TimeRequest || + userAssign.IsDoneRequest; } - if (res.TaskScheduleId>0) + if (res.TaskScheduleId > 0) { var taskSchedule = _accountContext.TaskSchedules.FirstOrDefault(x => x.id == res.TaskScheduleId); @@ -121,7 +123,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository res.ScheduleType = taskSchedule.Type; res.ScheduleCount = taskSchedule.Count; res.ScheduleUnitNumber = taskSchedule.UnitNumber; - } + } //_accountContext.Tasks.Where(x => x.id == TaskId).Select(x => new EditTask() @@ -160,8 +162,6 @@ public class TaskRepository : RepositoryBase, ITaskRepository Remove(task); } - - public List GetRequestedTasks(TaskSearchModel searchModel) { var accountId = long.Parse(_contextAccessor.HttpContext.User.FindFirst("AccountId").Value); @@ -900,7 +900,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository AcceptedTimeRequest = x.AcceptedTimeRequest, IsCancelRequest = x.IsCancelRequest, ContractingPartyName = x.ContractingPartyName, - Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel), + Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel, false), MediaCount = x.MediaCount, HasAttachment = x.MediaCount > 0, SelfName = x.SelfName, @@ -1229,7 +1229,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository AcceptedTimeRequest = x.AcceptedTimeRequest, IsCancelRequest = x.IsCancelRequest, ContractingPartyName = x.ContractingPartyName, - Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel), + Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel, false), MediaCount = x.MediaCount, HasAttachment = x.MediaCount > 0, SelfName = x.SelfName, @@ -1788,7 +1788,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository AcceptedTimeRequest = x.AcceptedTimeRequest, IsCancelRequest = x.IsCancelRequest, ContractingPartyName = x.ContractingPartyName, - Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel), + Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel, false), MediaCount = x.MediaCount, HasAttachment = x.MediaCount > 0, SelfName = x.SelfName, @@ -2056,7 +2056,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository TaskScheduleId = x.TaskScheduleId - }).ToList(); + }).ToList(); final = final.Select(x => new TaskViewModel() @@ -2082,7 +2082,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository AcceptedTimeRequest = x.AcceptedTimeRequest, IsCancelRequest = x.IsCancelRequest, ContractingPartyName = x.ContractingPartyName, - Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel), + Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel, false), MediaCount = x.MediaCount, HasAttachment = x.MediaCount > 0, SelfName = x.SelfName, @@ -2095,7 +2095,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository ScheduleUnitType = x.ScheduleUnitType, TaskScheduleId = x.TaskScheduleId - }).ToList(); + }).ToList(); final = final.Select(x => new TaskViewModel() { @@ -2149,12 +2149,15 @@ public class TaskRepository : RepositoryBase, ITaskRepository ScheduleUnitType = x.ScheduleUnitType, TaskScheduleId = x.TaskScheduleId - }).ToList(); + }).ToList(); return final; } - public string SetTasksColors(DateTime date, bool isCancel) + public string SetTasksColors(DateTime date, bool isCancel, bool hasRequest) { + if (hasRequest) + return "red"; + if (isCancel) { //return "brown"; @@ -2390,7 +2393,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository public List GetTasksByTaskScheduleId(long taskScheduleId) { - return _accountContext.Tasks.Include(x=>x.Assigns).Where(x => x.TaskScheduleId != null && x.TaskScheduleId == taskScheduleId).ToList(); + return _accountContext.Tasks.Include(x => x.Assigns).Where(x => x.TaskScheduleId != null && x.TaskScheduleId == taskScheduleId).ToList(); } @@ -2658,7 +2661,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository AcceptedTimeRequest = x.AcceptedTimeRequest, IsCancelRequest = x.IsCancelRequest, ContractingPartyName = x.ContractingPartyName, - Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel), + Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel, false), MediaCount = x.MediaCount, HasAttachment = x.MediaCount > 0, SelfName = x.SelfName, @@ -2722,6 +2725,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository { var accountId = long.Parse(_contextAccessor.HttpContext.User.FindFirst("AccountId").Value); var positionValue = int.Parse(_contextAccessor.HttpContext.User.FindFirst("PositionValue").Value); + var today = DateTime.Today; var emptyAcc = new AccountViewModel() { Fullname = "-", @@ -2731,7 +2735,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository var raw = _accountContext.Assigns.Include(x => x.Task).ThenInclude(x => x.TaskMedias) .ThenInclude(x => x.Media) .Where(x => - x.Task.IsActiveString == "true" && x.AssignedId == accountId && (!x.IsCanceledRequest && !x.TimeRequest && !x.IsDoneRequest) && x.Task.TicketId == null); + x.Task.IsActiveString == "true" && x.AssignedId == accountId && x.Task.TicketId == null); if (!string.IsNullOrWhiteSpace(searchModel.GeneralSearch)) { raw = raw.Where(x => @@ -2764,6 +2768,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository MediaCount = _accountContext.TaskMedias.Count(m => m.TaskId == x.Task.id), Description = x.Task.Description, IsDoneRequest = x.IsDoneRequest, + }); if (!string.IsNullOrWhiteSpace(searchModel.GeneralSearch)) { @@ -2802,7 +2807,8 @@ public class TaskRepository : RepositoryBase, ITaskRepository ContractingPartyName = x.ContractingPartyName, MediaCount = x.MediaCount, Description = x.Description, - IsDoneRequest = x.IsDoneRequest + IsDoneRequest = x.IsDoneRequest, + HasRequest = x.IsCancelRequest || x.RequestTime || x.IsDoneRequest }); if (!string.IsNullOrWhiteSpace(searchModel.StartDate) && !string.IsNullOrWhiteSpace(searchModel.EndDate)) { @@ -2871,8 +2877,10 @@ public class TaskRepository : RepositoryBase, ITaskRepository } - var orderResult = result.OrderByDescending(x => x.IsCancel ? 0 : 1).ThenBy(x => x.IsDone ? 1 : 0) - .ThenBy(x => x.EndTaskDateGE); + var orderResult = result.OrderBy(x => x.IsDone || x.IsCancel) + .ThenByDescending(x => x.EndTaskDateGE <= today.AddDays(1) && !x.HasRequest) + .ThenByDescending(x => x.HasRequest) + .ThenBy(x => x.EndTaskDateGE); // مرتب‌سازی داخلی بر اساس تاریخ var final = orderResult.Skip(searchModel.PageIndex).Take(30).ToList(); @@ -2906,7 +2914,8 @@ public class TaskRepository : RepositoryBase, ITaskRepository MediaCount = x.MediaCount, SelfName = x.SelfName, Description = x.Description, - IsDoneRequest = x.IsDoneRequest + IsDoneRequest = x.IsDoneRequest, + HasRequest = x.IsDoneRequest || x.RequestTime || x.IsCancelRequest }).ToList(); @@ -2934,7 +2943,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository AcceptedTimeRequest = x.AcceptedTimeRequest, IsCancelRequest = x.IsCancelRequest, ContractingPartyName = x.ContractingPartyName, - Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel), + Color = x.IsDone ? "green" : SetTasksColors(x.EndTaskDateGE, x.IsCancel, x.HasRequest), MediaCount = x.MediaCount, HasAttachment = x.MediaCount > 0, SelfName = x.SelfName, @@ -2993,6 +3002,7 @@ public class TaskRepository : RepositoryBase, ITaskRepository AssignedName = "-", AssignedPositionValue = 0 }, + HasRequest = x.IsCancelRequest || x.RequestTime || x.IsDoneRequest }).ToList(); return final; } diff --git a/AccountMangement.Infrastructure.EFCore/Repository/TaskScheduleRepository.cs b/AccountMangement.Infrastructure.EFCore/Repository/TaskScheduleRepository.cs index 7228b20b..6563e91d 100644 --- a/AccountMangement.Infrastructure.EFCore/Repository/TaskScheduleRepository.cs +++ b/AccountMangement.Infrastructure.EFCore/Repository/TaskScheduleRepository.cs @@ -3,25 +3,26 @@ using System.Threading.Tasks; using _0_Framework.Application; using _0_Framework.InfraStructure; using AccountManagement.Application.Contracts.Media; +using AccountManagement.Application.Contracts.Task; using AccountManagement.Application.Contracts.TaskSchedule; using AccountManagement.Domain.TaskScheduleAgg; using Microsoft.EntityFrameworkCore; namespace AccountMangement.Infrastructure.EFCore.Repository; -public class TaskScheduleRepository: RepositoryBase, ITaskScheduleRepository +public class TaskScheduleRepository : RepositoryBase, ITaskScheduleRepository { private readonly AccountContext _accountContext; - public TaskScheduleRepository(AccountContext accountContext):base(accountContext) + public TaskScheduleRepository(AccountContext accountContext) : base(accountContext) { _accountContext = accountContext; } public async Task GetDetails(long id) { - var taskSchedule=await _accountContext.TaskSchedules.Include(x=>x.TasksList).ThenInclude(x=>x.Assigns) - .Include(x=>x.TasksList).ThenInclude(x=>x.TaskMedias).ThenInclude(x=>x.Media).FirstOrDefaultAsync(x => x.id == id); + var taskSchedule = await _accountContext.TaskSchedules.Include(x => x.TasksList).ThenInclude(x => x.Assigns) + .Include(x => x.TasksList).ThenInclude(x => x.TaskMedias).ThenInclude(x => x.Media).FirstOrDefaultAsync(x => x.id == id); if (taskSchedule == null) { return null; @@ -29,7 +30,7 @@ public class TaskScheduleRepository: RepositoryBase, ITaskSc var firstTaskDetails = taskSchedule.TasksList.First(); - var firstTimeAssigns = firstTaskDetails.Assigns.Where(x=>x.FirstTimeCreation).ToList(); + var firstTimeAssigns = firstTaskDetails.Assigns.Where(x => x.FirstTimeCreation).ToList(); var assignedIds = firstTimeAssigns.Select(x => x.AssignedId).ToList(); @@ -46,13 +47,15 @@ public class TaskScheduleRepository: RepositoryBase, ITaskSc Title = firstTaskDetails.Title, Description = firstTaskDetails.Description, ContractingPartyName = firstTaskDetails.ContractingPartyName, - AssignedName = assignedAccounts.Select(x=>x.Fullname).ToList(), + AssignedName = assignedAccounts.Select(x => x.Fullname).ToList(), CreationDateFa = firstTaskDetails.CreationDate.ToFarsi(), SenderName = sender.Fullname, TaskScheduleType = taskSchedule.Type, TaskScheduleUnitType = taskSchedule.UnitType, UnitNumber = taskSchedule.UnitNumber, - Medias = firstTaskDetails.TaskMedias.Select(x=> new MediaViewModel() + Count = taskSchedule.Type == TaskScheduleType.Limited ? taskSchedule.Count : "نامحدود", + FirstEndTaskDate = firstTaskDetails.Assigns.FirstOrDefault()?.EndTaskDate.ToFarsi() ?? "", + Medias = firstTaskDetails.TaskMedias.Select(x => new MediaViewModel() { Category = x.Media.Category, Id = x.MediaId, diff --git a/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs b/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs index 3dfb1eaa..134682a0 100644 --- a/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs +++ b/CompanyManagment.App.Contracts/Checkout/CheckoutViewModel.cs @@ -122,6 +122,16 @@ public class CheckoutViewModel /// تعداد روزهای محاسبه شده برای عیدی و پاداش /// public string TotalDayOfBunosesCompute { get; set; } + + /// + /// مدت مرخصی استعلاجی + /// + public string TotalSickLeave { get; set; } + + /// + /// مدت مرخصی استحقاقی + /// + public string TotalPaidLeave { get; set; } public List MonthlyRollCall { get; set; } public List InstallmentViewModels { get; set; } public List SalaryAidViewModels { get; set; } diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs index 5470fcaa..227aa0d4 100644 --- a/CompanyManagment.Application/CheckoutApplication.cs +++ b/CompanyManagment.Application/CheckoutApplication.cs @@ -52,73 +52,85 @@ public class CheckoutApplication : ICheckoutApplication string month = string.Empty; switch (smonth) { - case 1: month = "فروردین"; + case 1: + month = "فروردین"; break; - case 2: month = "اردیبهشت"; + case 2: + month = "اردیبهشت"; break; - case 3:month = "خرداد"; + case 3: + month = "خرداد"; break; - case 4: month = "تیر"; + case 4: + month = "تیر"; break; - case 5: month = "مرداد"; + case 5: + month = "مرداد"; break; - case 6: month = "شهریور"; + case 6: + month = "شهریور"; break; - case 7:month = "مهر"; + case 7: + month = "مهر"; break; - case 8: month = "آبان"; + case 8: + month = "آبان"; break; - case 9: month = "آذر"; + case 9: + month = "آذر"; break; - case 10: month = "دی"; + case 10: + month = "دی"; break; - case 11: month = "بهمن"; + case 11: + month = "بهمن"; break; - case 12: month = "اسفند"; + case 12: + month = "اسفند"; break; } var year = syear.ToString(); - #region SickLeav + #region SickLeav - //var serachModel = new LeaveSearchModel() - //{ - // EmployeeId = command.EmployeeId, - // WorkshopId = command.WorkshopId, - // LeaveType = "استعلاجی", - // StartLeave = command.ContractStart, - // EndLeave = command.ContractEnd, - // IsAccepted = true, - //}; - //var leavList = _leaveApplication.search(serachModel); - // int sickLeaveCount = 0; - //if (leavList.Count > 0) - //{ - - // foreach (var leave in leavList) - // { - // if (leave.StartLeaveGr < command.ContractStartGr && leave.EndLeaveGr <= command.ContractEndGr) - // { - // int res = (int)((leave.EndLeaveGr - command.ContractStartGr).TotalDays +1); - // sickLeaveCount += res; - // } - // else if (leave.StartLeaveGr >= command.ContractStartGr && leave.EndLeaveGr > command.ContractEndGr) - // { - // int res = (int)((command.ContractEndGr - leave.StartLeaveGr).TotalDays + 1); - // sickLeaveCount += res; - // } - // else - // { - // int res = (int)((leave.EndLeaveGr - leave.StartLeaveGr).TotalDays + 1); - // sickLeaveCount += res; - // } - - // } - //} + //var serachModel = new LeaveSearchModel() + //{ + // EmployeeId = command.EmployeeId, + // WorkshopId = command.WorkshopId, + // LeaveType = "استعلاجی", + // StartLeave = command.ContractStart, + // EndLeave = command.ContractEnd, + // IsAccepted = true, + //}; + //var leavList = _leaveApplication.search(serachModel); + // int sickLeaveCount = 0; + //if (leavList.Count > 0) + //{ - #endregion + // foreach (var leave in leavList) + // { + // if (leave.StartLeaveGr < command.ContractStartGr && leave.EndLeaveGr <= command.ContractEndGr) + // { + // int res = (int)((leave.EndLeaveGr - command.ContractStartGr).TotalDays +1); + // sickLeaveCount += res; + // } + // else if (leave.StartLeaveGr >= command.ContractStartGr && leave.EndLeaveGr > command.ContractEndGr) + // { + // int res = (int)((command.ContractEndGr - leave.StartLeaveGr).TotalDays + 1); + // sickLeaveCount += res; + // } + // else + // { + // int res = (int)((leave.EndLeaveGr - leave.StartLeaveGr).TotalDays + 1); + // sickLeaveCount += res; + // } - var dayliWage = command.DayliWage.MoneyToDouble(); + // } + //} + + #endregion + + var dayliWage = command.DayliWage.MoneyToDouble(); // کمک هزینه اقلام var consumableItem = command.ConsumableItems.MoneyToDouble(); //حق اولاد @@ -128,8 +140,8 @@ public class CheckoutApplication : ICheckoutApplication //حق تاهل var marriedAllowance = command.MarriedAllowance.MoneyToDouble(); var MontlyYearsBunos = - _yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage,command.WorkingWeeklyTime,command.officialholiday,command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd,command.DailFeeComplete,command.HasRollCall, command.HolidayWorking, command.ShiftWork); - //دستمزد ماهانه + _yearlySalaryRepository.GetMontlyBunosYears(command.WeeklyTime, command.ContractStartGr, command.ContractEndGr, dayliWage, command.WorkingWeeklyTime, command.officialholiday, command.friday, command.TotalHolidaysAndNotH, command.TotalHolidaysAndNotM, command.Basic, command.FridayStarttoEnd, command.DailFeeComplete, command.HasRollCall, command.HolidayWorking, command.ShiftWork); + //دستمزد ماهانه var monthlyWage = MontlyYearsBunos.MontlyWage; //سنوات var years = command.YearsPay; @@ -147,7 +159,7 @@ public class CheckoutApplication : ICheckoutApplication //حق بیمه سهم کارگر var insuranceDeduction = (monthlyWage + bacicYears + consumableItem + housingAllowance + marriedAllowance) * 7 / 100; - if (command.OvertimePay > 0 && command.AbsenceDeduction>0) + if (command.OvertimePay > 0 && command.AbsenceDeduction > 0) { if (command.AbsenceDeduction >= command.OvertimePay) { @@ -165,14 +177,14 @@ public class CheckoutApplication : ICheckoutApplication var checkoutEnd = checkoutStart.FindeEndOfMonth(); var salaryAids = _rollCallMandatoryRepository.SalaryAidsForCheckout(command.EmployeeId, command.WorkshopId, checkoutStart.ToGeorgianDateTime(), checkoutEnd.ToGeorgianDateTime()) - .Select(x => new CheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa,x.Id)).ToList(); + .Select(x => new CheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa, x.Id)).ToList(); command.SalaryAidDeduction = salaryAids.Sum(x => x.Amount.MoneyToDouble()); var loanInstallments = _rollCallMandatoryRepository.LoanInstallmentForCheckout(command.EmployeeId, command.WorkshopId, command.ContractStartGr, command.ContractEndGr) - .Select(x => new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount,x.Id)).ToList(); + .Select(x => new CheckoutLoanInstallment(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList(); command.InstallmentDeduction = loanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble()); @@ -196,14 +208,14 @@ public class CheckoutApplication : ICheckoutApplication command.Signature = "0"; } - - - var checkout = new Checkout(command.EmployeeFullName, command.FathersName ,command.NationalCode + + + var checkout = new Checkout(command.EmployeeFullName, command.FathersName, command.NationalCode , 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, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays, - 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,loanInstallments, salaryAids); + 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, loanInstallments, salaryAids); _checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult(); //_checkoutRepository.SaveChanges(); @@ -214,7 +226,7 @@ public class CheckoutApplication : ICheckoutApplication } - + } public OperationResult Edit(EditCheckout command) @@ -230,7 +242,7 @@ public class CheckoutApplication : ICheckoutApplication public async Task> Search(CheckoutSearchModel searchModel) { var result = new List(); - var query =await _checkoutRepository.SearchForMainCheckout(searchModel); + var query = await _checkoutRepository.SearchForMainCheckout(searchModel); query = query.Select(x => new CheckoutViewModel() { Id = x.Id, @@ -268,7 +280,7 @@ public class CheckoutApplication : ICheckoutApplication // // .Select(x => x.EmployerId).FirstOrDefault(); // //var employerName = _context.Employers?.FirstOrDefault(x => x.id == employeId).FullName; // // = employerName; - + //} return query; @@ -288,31 +300,30 @@ public class CheckoutApplication : ICheckoutApplication return new(); result.ForEach(x => { - if (x.HasRollCall) - { - int yearFa; - int monthFa; - try - { - yearFa = int.Parse(oneRecord.Year); - monthFa = oneRecord.Month.ToMonthByStringValue(); - } - catch (Exception e) - { - return; - } - double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa); - int mandatoryWholeHours = (int)mandatoryHours; - int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60); - var totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(y => y.TotalhourseSpan.Ticks)); - var totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(y => y.BreakTimeTimeSpan.Ticks)); - var totalPresent = totalWorking + totalBreakTime; - x.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-"); - x.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-"); - x.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-"); - x.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-"); + + int yearFa; + int monthFa; + try + { + yearFa = int.Parse(oneRecord.Year); + monthFa = oneRecord.Month.ToMonthByStringValue(); } + catch (Exception e) + { + return; + } + double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa); + int mandatoryWholeHours = (int)mandatoryHours; + int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60); + var totalWorking = new TimeSpan(x.MonthlyRollCall.Sum(y => y.TotalhourseSpan.Ticks)); + var totalBreakTime = new TimeSpan(x.MonthlyRollCall.Sum(y => y.BreakTimeTimeSpan.Ticks)); + var totalPresent = totalWorking + totalBreakTime; + x.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-"); + x.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-"); + x.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-"); + x.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-"); + }); return result; } @@ -321,31 +332,29 @@ public class CheckoutApplication : ICheckoutApplication { var result = _checkoutRepository.PrintOne(id); - if (result.HasRollCall) + int yearFa; + int monthFa; + try { - int yearFa; - int monthFa; - try - { - yearFa = int.Parse(result.Year); - monthFa = result.Month.ToMonthByStringValue(); - } - catch (Exception e) - { - return new(); - } - double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa); - int mandatoryWholeHours = (int)mandatoryHours; - int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60); - var totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)); - var totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks)); - var totalPresent = totalWorking + totalBreakTime; - - result.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-"); - result.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-"); - result.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-"); - result.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-"); + yearFa = int.Parse(result.Year); + monthFa = result.Month.ToMonthByStringValue(); } + catch (Exception e) + { + return new(); + } + double mandatoryHours = _mandatoryHoursApplication.GetMandatoryHoursByYearAndMonth(yearFa, monthFa); + int mandatoryWholeHours = (int)mandatoryHours; + int mandatoryMinutes = (int)((mandatoryHours - mandatoryWholeHours) * 60); + var totalWorking = new TimeSpan(result.MonthlyRollCall.Sum(x => x.TotalhourseSpan.Ticks)); + var totalBreakTime = new TimeSpan(result.MonthlyRollCall.Sum(x => x.BreakTimeTimeSpan.Ticks)); + var totalPresent = totalWorking + totalBreakTime; + + result.TotalWorkingTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalWorking.TotalHours, totalWorking.Minutes, "-"); + result.TotalBreakTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalBreakTime.TotalHours, totalBreakTime.Minutes, "-"); + result.TotalPresentTimeStr = Tools.ToFarsiHoursAndMinutes((int)totalPresent.TotalHours, totalPresent.Minutes, "-"); + result.TotalMandatoryTimeStr = Tools.ToFarsiHoursAndMinutes(mandatoryWholeHours, mandatoryMinutes, "-"); + return result; } @@ -408,7 +417,7 @@ public class CheckoutApplication : ICheckoutApplication _checkoutRepository.SaveChanges(); - + return opration.Succcedded(); } @@ -423,7 +432,7 @@ public class CheckoutApplication : ICheckoutApplication var checkout = _checkoutRepository.Get(id); var totalClaimsDouble = checkout.TotalClaims.MoneyToDouble(); var totalDeductionsDouble = checkout.TotalDeductions.MoneyToDouble(); - totalClaimsDouble = (double) (totalClaimsDouble - checkout.RewardPay); + totalClaimsDouble = (double)(totalClaimsDouble - checkout.RewardPay); totalDeductionsDouble = totalDeductionsDouble - checkout.SalaryAidDeduction; var totalClaims = totalClaimsDouble + rewardPay; diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index 0741bfe8..e4117180 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Data; +using System.Globalization; using System.Linq; using System.Threading.Tasks; using _0_Framework.Application; @@ -11,9 +12,11 @@ using Company.Domain.RollCallAgg; using CompanyManagment.App.Contracts.Checkout; using CompanyManagment.App.Contracts.Contract; using CompanyManagment.App.Contracts.Employee; +using CompanyManagment.App.Contracts.HolidayItem; using CompanyManagment.App.Contracts.Leave; using CompanyManagment.App.Contracts.LeftWork; using CompanyManagment.App.Contracts.Loan; +using CompanyManagment.App.Contracts.RollCall; using CompanyManagment.App.Contracts.SalaryAid; using CompanyManagment.App.Contracts.WorkingHours; using CompanyManagment.App.Contracts.WorkingHoursTemp; @@ -37,8 +40,9 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos private readonly IConfiguration _configuration; private readonly ILeftWorkRepository _leftWorkRepository; private readonly IRollCallRepository _rollCallRepository; + private readonly IRollCallMandatoryRepository _rollCallMandatoryRepository; - public CheckoutRepository(IAuthHelper authHelper, CompanyContext context, IConfiguration configuration, ILeftWorkRepository leftWorkRepository, IWorkingHoursTempApplication workingHoursTempApplication, IRollCallRepository rollCallRepository) : base(context) + public CheckoutRepository(IAuthHelper authHelper, CompanyContext context, IConfiguration configuration, ILeftWorkRepository leftWorkRepository, IWorkingHoursTempApplication workingHoursTempApplication, IRollCallRepository rollCallRepository, IRollCallMandatoryRepository rollCallMandatoryRepository) : base(context) { _authHelper = authHelper; @@ -47,6 +51,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos _leftWorkRepository = leftWorkRepository; _workingHoursTempApplication = workingHoursTempApplication; _rollCallRepository = rollCallRepository; + _rollCallMandatoryRepository = rollCallMandatoryRepository; } /// @@ -60,7 +65,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos public (bool hasChekout, double FamilyAlloance, double OverTimePay) HasCheckout(long workshopId, long employeId, string year, string month) { var farisMonthName = Tools.ToFarsiMonthByNumber(month); - + var res = _context.CheckoutSet.FirstOrDefault(x => x.WorkshopId == workshopId && x.EmployeeId == employeId && x.Year == year && x.Month == farisMonthName && x.IsActiveString == "true"); @@ -73,46 +78,46 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos public EditCheckout GetDetails(long id) { return _context.CheckoutSet.Select(x => new EditCheckout() - { - Id = x.id, - 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, - BaseYearsPay = x.BaseYearsPay, - ConsumableItems = x.ConsumableItems.ToMoney(), - HousingAllowance = x.HousingAllowance.ToMoney(), - OvertimePay = x.OvertimePay, - NightworkPay = x.NightworkPay, - FridayPay = x.FridayPay, - MissionPay = x.MissionPay, - ShiftPay = x.ShiftPay, - FamilyAllowance = x.FamilyAllowance.ToMoney(), - BonusesPay = x.BonusesPay, - YearsPay = x.YearsPay, - LeavePay = x.LeavePay, - InsuranceDeduction = x.InsuranceDeduction, - TaxDeducation = x.TaxDeducation, - InstallmentDeduction = x.InstallmentDeduction, - SalaryAidDeduction = x.SalaryAidDeduction, - AbsenceDeduction = x.AbsenceDeduction, - TotalClaims = x.TotalClaims, - TotalDeductions = x.TotalDeductions, - TotalPayment = x.TotalPayment, - RewardPay = x.RewardPay, - HasRollCall = x.HasRollCall, - EmployeeId = x.EmployeeId, - WorkshopId = x.WorkshopId, - ContractId = x.ContractId, - ContractStartGr = x.ContractStart, - ContractEndGr = x.ContractEnd, - ContractStart = x.ContractStart.ToFarsi(), - ContractEnd = x.ContractEnd.ToFarsi() + { + Id = x.id, + 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, + BaseYearsPay = x.BaseYearsPay, + ConsumableItems = x.ConsumableItems.ToMoney(), + HousingAllowance = x.HousingAllowance.ToMoney(), + OvertimePay = x.OvertimePay, + NightworkPay = x.NightworkPay, + FridayPay = x.FridayPay, + MissionPay = x.MissionPay, + ShiftPay = x.ShiftPay, + FamilyAllowance = x.FamilyAllowance.ToMoney(), + BonusesPay = x.BonusesPay, + YearsPay = x.YearsPay, + LeavePay = x.LeavePay, + InsuranceDeduction = x.InsuranceDeduction, + TaxDeducation = x.TaxDeducation, + InstallmentDeduction = x.InstallmentDeduction, + SalaryAidDeduction = x.SalaryAidDeduction, + AbsenceDeduction = x.AbsenceDeduction, + TotalClaims = x.TotalClaims, + TotalDeductions = x.TotalDeductions, + TotalPayment = x.TotalPayment, + RewardPay = x.RewardPay, + HasRollCall = x.HasRollCall, + EmployeeId = x.EmployeeId, + WorkshopId = x.WorkshopId, + ContractId = x.ContractId, + ContractStartGr = x.ContractStart, + ContractEndGr = x.ContractEnd, + ContractStart = x.ContractStart.ToFarsi(), + ContractEnd = x.ContractEnd.ToFarsi() }) .FirstOrDefault(x => x.Id == id); @@ -124,7 +129,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos 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 + var result = (_context.Database .SqlQuery( $"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}") .AsEnumerable())// این قسمت مهمه! @@ -132,8 +137,8 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos var entity = await _context.CheckoutSet.FirstOrDefaultAsync(x => x.id == result); - entity.SetSalaryAid(command.SalaryAids,command.SalaryAidDeduction); - entity.SetLoanInstallment(command.LoanInstallments,command.InstallmentDeduction); + entity.SetSalaryAid(command.SalaryAids, command.SalaryAidDeduction); + entity.SetLoanInstallment(command.LoanInstallments, command.InstallmentDeduction); await _context.SaveChangesAsync(); } @@ -178,28 +183,28 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos { var item = new CheckoutViewModel(); - item.Id = (long) reader["Id"]; - item.EmployeeFullName = (string) reader?["EmployeeFullName"]; - var start = (DateTime) reader["ContractStart"]; + item.Id = (long)reader["Id"]; + item.EmployeeFullName = (string)reader?["EmployeeFullName"]; + var start = (DateTime)reader["ContractStart"]; item.ContractStart = start.ToFarsi(); - var end = (DateTime) reader["ContractEnd"]; + var end = (DateTime)reader["ContractEnd"]; item.ContractEnd = end.ToFarsi(); item.ContractStartGr = start; item.ContractEndGr = end; - item.PersonnelCode = (string) reader?["PersonnelCode"]; + item.PersonnelCode = (string)reader?["PersonnelCode"]; item.PersonnelCodeInt = item.PersonnelCode.ConvertToInt(); - item.ArchiveCode = (string) reader?["ArchiveCode"]; - item.SumOfWorkingDays = (string) reader?["SumOfWorkingDays"]; - item.WorkshopName = (string) reader?["WorkshopName"]; - item.Month = reader["Month"] != DBNull.Value ? (string) reader["Month"] : null; - item.Year = reader["Year"] != DBNull.Value ? (string) reader["Year"] : null; - item.ContractNo = (string) reader?["ContractNo"]; - item.ContractId = (long) reader["ContractId"]; - item.WorkshopId = (long) reader["WorkshopId"]; - item.EmployeeId = (long) reader["EmployeeId"]; - item.IsActiveString = (string) reader["IsActiveString"]; - item.Signature = (string) reader["Signature"]; - item.CreationDate = (DateTime) reader["CreationDate"]; + item.ArchiveCode = (string)reader?["ArchiveCode"]; + item.SumOfWorkingDays = (string)reader?["SumOfWorkingDays"]; + item.WorkshopName = (string)reader?["WorkshopName"]; + item.Month = reader["Month"] != DBNull.Value ? (string)reader["Month"] : null; + item.Year = reader["Year"] != DBNull.Value ? (string)reader["Year"] : null; + item.ContractNo = (string)reader?["ContractNo"]; + item.ContractId = (long)reader["ContractId"]; + item.WorkshopId = (long)reader["WorkshopId"]; + item.EmployeeId = (long)reader["EmployeeId"]; + item.IsActiveString = (string)reader["IsActiveString"]; + item.Signature = (string)reader["Signature"]; + item.CreationDate = (DateTime)reader["CreationDate"]; query.Add(item); @@ -414,12 +419,12 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos return query.OrderByDescending(x => x.ContractEndGr).ThenBy(x => x.PersonnelCodeInt).ToList(); } - + return query.OrderByDescending(x => x.Id) .ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(100).ToList(); - - - + + + @@ -490,194 +495,204 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos } - public List PrintAll(List id) - { - var query = new List(); - foreach (var item in id) - { - var ch = _context.CheckoutSet + public List PrintAll(List id) + { + var query = new List(); + foreach (var item in id) + { + var ch = _context.CheckoutSet .AsSplitQuery().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, - InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel() { - Amount = i.AmountForMonth, - AmountDouble = i.AmountForMonth.MoneyToDouble(), - Year = i.Year, - Month = i.Month, - IsActive = i.IsActive, - RemainingAmount = i.LoanRemaining, - LoanAmount = i.LoanAmount - }).ToList(), - SalaryAidViewModels = x.SalaryAids.Select(s => new SalaryAidViewModel() - { - Amount = s.Amount, - AmountDouble = s.Amount.MoneyToDouble(), - SalaryAidDateTimeFa = s.SalaryAidDateTimeFa, - SalaryAidDateTimeGe = s.SalaryAidDateTime - }).ToList(), + 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, + InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel() + { + Amount = i.AmountForMonth, + AmountDouble = i.AmountForMonth.MoneyToDouble(), + Year = i.Year, + Month = i.Month, + IsActive = i.IsActive, + RemainingAmount = i.LoanRemaining, + LoanAmount = i.LoanAmount + }).ToList(), + SalaryAidViewModels = x.SalaryAids.Select(s => new SalaryAidViewModel() + { + Amount = s.Amount, + AmountDouble = s.Amount.MoneyToDouble(), + SalaryAidDateTimeFa = s.SalaryAidDateTimeFa, + SalaryAidDateTimeGe = s.SalaryAidDateTime + }).ToList(), }).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(); + 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(); - foreach (var em in employerlist) - { - var employer = new EmprViewModel() - { - EmployerFullName = em.FName + " " + em.LName, - IsLegal = em.IsLegal, - }; - employers.Add(employer); - } + 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 TotalDeduction = AbsenceDeduction + InsuranceDeduction + InstallmentDeduction + SalaryAidDeduction + - TaxDeducation; - ch.TotalDeductions = TotalDeduction.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; + 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 (!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 (!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 (!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(); + // 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); - } + //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); + else + { + ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr; + ch.CreateWorkingHoursTemp.ContractEndGr = ch.ContractEndGr; + ch.CreateWorkingHoursTemp.ContarctStart = ch.ContractStartGr.ToFarsi(); + ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi(); + ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId; + ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId; + ch.MonthlyRollCall = ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking); + } + 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; - } + 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) + public CheckoutLeavePrintViewModel PrintLeave(long id) { var ch = _context.CheckoutSet.Select(x => new CheckoutLeavePrintViewModel() { @@ -780,181 +795,364 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos return ch; } - public CheckoutViewModel PrintOne(long id) - { - var ch = _context.CheckoutSet + public CheckoutViewModel PrintOne(long id) + { + var ch = _context.CheckoutSet .AsSplitQuery().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, - InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel() { - Amount = i.AmountForMonth, - AmountDouble = i.AmountForMonth.MoneyToDouble(), - Year = i.Year, - Month = i.Month, - IsActive = i.IsActive, - RemainingAmount = i.LoanRemaining, - LoanAmount = i.LoanAmount - }).ToList(), - SalaryAidViewModels = x.SalaryAids.Select(s => new SalaryAidViewModel() - { - Amount = s.Amount, - AmountDouble = s.Amount.MoneyToDouble(), - SalaryAidDateTimeFa = s.SalaryAidDateTimeFa, - SalaryAidDateTimeGe = s.SalaryAidDateTime - }).ToList(), + 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, + InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel() + { + Amount = i.AmountForMonth, + AmountDouble = i.AmountForMonth.MoneyToDouble(), + Year = i.Year, + Month = i.Month, + IsActive = i.IsActive, + RemainingAmount = i.LoanRemaining, + LoanAmount = i.LoanAmount + }).ToList(), + SalaryAidViewModels = x.SalaryAids.Select(s => new SalaryAidViewModel() + { + Amount = s.Amount, + AmountDouble = s.Amount.MoneyToDouble(), + SalaryAidDateTimeFa = s.SalaryAidDateTimeFa, + SalaryAidDateTimeGe = s.SalaryAidDateTime + }).ToList(), }).SingleOrDefault(x => x.Id == id); - 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(); + 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(); - 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(); + 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 TotalDeduction = AbsenceDeduction + InsuranceDeduction + InstallmentDeduction + SalaryAidDeduction + - TaxDeducation; - ch.TotalDeductions = TotalDeduction.ToMoney(); + 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 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; + //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 (!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 (!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 (!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(); + // 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); + //if (ch.WorkshopId == 40 || ch.WorkshopId == 68 || ch.WorkshopId == 44 || ch.WorkshopId == 45 || ch.WorkshopId == 280) + //{ + // ch.TotalClaims = ""; + // ch.TotalDeductions = ""; + // ch.TotalPayment = ""; + //} - return ch; - } + #region Leave - public OperationResult RemoveCheckout(long id) + var leavesQuery = _context.LeaveList + .Where(x => x.EmployeeId == ch.EmployeeId && x.WorkshopId == ch.WorkshopId && + x.StartLeave <= ch.ContractEndGr && x.EndLeave >= ch.ContractStartGr) + .AsNoTracking(); + + var paidLeave = leavesQuery.Where(x => x.LeaveType == "استحقاقی"); + var sickLeave = leavesQuery.Where(x => x.LeaveType == "استعلاجی").ToList(); + + + var dailyPaidLeave = paidLeave.Where(x => x.PaidLeaveType == "روزانه").ToList(); + var hourlyPaidLeave = paidLeave.Where(x => x.PaidLeaveType == "ساعتی").ToList(); + + var sickLeaveTimeSpans = sickLeave.Select(x => + { + var startLeave = ch.ContractStartGr > x.StartLeave ? ch.ContractStartGr : x.StartLeave; + var endLeave = ch.ContractEndGr < x.EndLeave ? ch.ContractEndGr : x.EndLeave; + + return (endLeave - startLeave).Add(TimeSpan.FromDays(1)); + }); + + ch.TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-"); + + var hourlyPaidLeaveTimeSpans = hourlyPaidLeave.Select(x => TimeOnly.Parse(x.LeaveHourses).ToTimeSpan()); + + var dailyPaidLeaveTimeSpans = dailyPaidLeave.Select(x => + { + var startLeave = ch.ContractStartGr > x.StartLeave ? ch.ContractStartGr : x.StartLeave; + var endLeave = ch.ContractEndGr < x.EndLeave ? ch.ContractEndGr : x.EndLeave; + return (endLeave - startLeave).Add(TimeSpan.FromDays(1)); + }); + + var totalPaidLeaveTimeSpans = hourlyPaidLeaveTimeSpans.Concat(dailyPaidLeaveTimeSpans); + + ch.TotalPaidLeave = new TimeSpan(totalPaidLeaveTimeSpans.Sum(x => x.Ticks)).ToFarsiDaysAndHoursAndMinutes("-"); + + + + #endregion + + + + 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); + else + { + ch.CreateWorkingHoursTemp.ContractStartGr = ch.ContractStartGr; + ch.CreateWorkingHoursTemp.ContractEndGr = ch.ContractEndGr; + ch.CreateWorkingHoursTemp.ContarctStart = ch.ContractStartGr.ToFarsi(); + ch.CreateWorkingHoursTemp.ContractEnd = ch.ContractEndGr.ToFarsi(); + ch.CreateWorkingHoursTemp.EmployeeId = ch.EmployeeId; + ch.CreateWorkingHoursTemp.WorkshopId = ch.WorkshopId; + ch.MonthlyRollCall = ConvertStaticToRollCall(ch.CreateWorkingHoursTemp, workshopName.WorkshopHolidayWorking); + } + return ch; + } + + private List ConvertStaticToRollCall(CreateWorkingHoursTemp workingHours, bool workshopHolidayWorking) + { + var rollCalls = _rollCallMandatoryRepository.ConvertStaticHoursToRollCall(workingHours, + workshopHolidayWorking); + var workshopId = workingHours.WorkshopId; + var employeeId = workingHours.EmployeeId; + var year = Convert.ToInt32(workingHours.ContarctStart.Substring(0, 4)); + var month = Convert.ToInt32(workingHours.ContarctStart.Substring(5, 2)); + var startMonthDay = $"{year:0000}/{month:00}/01".ToGeorgianDateTime(); + var endMonthDay = workingHours.ContractEndGr; + + var leaves = _context.LeaveList.Where(x => + x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.EndLeave.Date >= startMonthDay.Date && + x.StartLeave.Date <= endMonthDay.Date).ToList(); + + var firstDayOfCurrentMonth = new DateTime(year, month, 1, new PersianCalendar()); + + + if (month == 12) + { + year += 1; + month = 1; + } + else + month += 1; + + var nextMonthDate = new DateTime(year, month, 1, new PersianCalendar()); + + var lastDayOfCurrentMonth = nextMonthDate.AddDays(-1); + + int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1; + + + var holidays = _context.HolidayItems.Where(x => x.HolidayYear.Contains(year.ToString())).Select(x => new HolidayItemViewModel + { + Id = x.id, + Holidaydate = x.Holidaydate.ToFarsi(), + HolidayId = x.HolidayId, + HolidayYear = x.HolidayYear, + HolidaydateGr = x.Holidaydate + }).ToList(); + + if (workshopHolidayWorking) + holidays = []; + + //all the dates from start to end, to be compared with present days to get absent dates + var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => startMonthDay.AddDays(offset).Date).ToList(); + + var absentRecords = completeDaysList + .ExceptBy(rollCalls.Select(x => x.ShiftDate.Date), y => y.Date) + .Select(x => + { + var leave = leaves.FirstOrDefault(y => + y.EmployeeId == employeeId && y.EndLeave.Date >= x.Date && y.StartLeave.Date <= x.Date); + var isHoliday = false; + var isFriday = x.Date.DayOfWeek == DayOfWeek.Friday; + var isNormalWorkingDay = isHoliday == false && isFriday == false; + return new CheckoutDailyRollCallViewModel() + { + StartDate1 = null, + EndDate1 = null, + DateTimeGr = x.Date, + DayOfWeek = x.Date.DayOfWeek.DayOfWeeKToPersian(), + RollCallDateFa = x.Date.ToFarsi(), + LeaveType = leave != null ? leave.LeaveType : "", + IsAbsent = leave == null && isNormalWorkingDay + }; + }); + + + var presentDays = rollCalls.GroupBy(x => x.ShiftDate.Date).Select(x => + { + + var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList(); + + var rollCallTimeSpanPerDay = + new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => (y.EndDate - y.StartDate)!.Value.Ticks)); + var breakTimePerDay = new TimeSpan(x.Sum(r => r.BreakTimeSpan.Ticks)); + + var firstRollCall = orderedRollcalls.FirstOrDefault(); + var secondRollCall = orderedRollcalls.FirstOrDefault(); + + return new CheckoutDailyRollCallViewModel() + { + StartDate1 = firstRollCall?.StartDate?.ToString("HH:mm") ?? "", + EndDate1 = firstRollCall?.EndDate?.ToString("HH:mm") ?? "", + + StartDate2 = secondRollCall?.StartDate?.ToString("HH:mm") ?? "", + EndDate2 = secondRollCall?.EndDate?.ToString("HH:mm") ?? "", + + TotalhourseSpan = rollCallTimeSpanPerDay - breakTimePerDay, + + BreakTimeTimeSpan = breakTimePerDay, + + DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(), + RollCallDateFa = x.Key.Date.ToFarsi(), + DateTimeGr = x.Key.Date, + IsSliced = x.Count() > 2, + IsAbsent = false + }; + }); + + + presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel + { + StartDate1 = x.StartDate1, + EndDate1 = x.EndDate1, + EndDate2 = x.EndDate2, + StartDate2 = x.StartDate2, + TotalWorkingHours = $"{(int)(x.TotalhourseSpan.TotalHours)}:{x.TotalhourseSpan.Minutes:00}", + BreakTimeString = $"{(int)(x.BreakTimeTimeSpan.TotalHours)}:{x.BreakTimeTimeSpan.Minutes:00}", + TotalhourseSpan = x.TotalhourseSpan, + BreakTimeTimeSpan = x.BreakTimeTimeSpan, + DayOfWeek = x.DayOfWeek, + RollCallDateFa = x.RollCallDateFa, + DateTimeGr = x.DateTimeGr, + IsSliced = x.IsSliced, + IsAbsent = false + }); + + var result = presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList(); + result.ForEach(x => + { + x.IsHoliday = holidays.Any(y => x.DateTimeGr.Date == y.HolidaydateGr.Date); + x.IsFriday = x.DateTimeGr.DayOfWeek == DayOfWeek.Friday; + }); + + return result; + } + + public OperationResult RemoveCheckout(long id) { var op = new OperationResult(); var item = _context.CheckoutSet.FirstOrDefault(x => x.id == id); @@ -993,39 +1191,39 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos #endregion var query = _context.CheckoutSet .AsSplitQuery().Select(x => new CheckoutViewModel() - { - Id = x.id, - EmployeeId = x.EmployeeId, - WorkshopId = x.WorkshopId, - ContractStartGr = x.ContractStart, - ContractEndGr = x.ContractEnd, - ContractStart = x.ContractStart.ToFarsi(), - ContractEnd = x.ContractEnd.ToFarsi(), - Signature = x.Signature, - Year = x.Year, - Month = x.Month, - ContractNo = x.ContractNo, - ContractId = x.ContractId, - EmployeeFullName = x.EmployeeFullName, - PersonnelCode = x.PersonnelCode, - PersonnelCodeInt = Convert.ToInt32(x.PersonnelCode), - InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel() { - Amount = i.AmountForMonth, - AmountDouble = i.AmountForMonth.MoneyToDouble(), - Year = i.Year, - Month = i.Month, - IsActive = i.IsActive, - RemainingAmount = i.LoanRemaining, - LoanAmount = i.LoanAmount - }).ToList(), - SalaryAidViewModels = x.SalaryAids.Select(s => new SalaryAidViewModel() - { - Amount = s.Amount, - AmountDouble = s.Amount.MoneyToDouble(), - SalaryAidDateTimeFa = s.SalaryAidDateTimeFa, - SalaryAidDateTimeGe = s.SalaryAidDateTime - }).ToList(), + Id = x.id, + EmployeeId = x.EmployeeId, + WorkshopId = x.WorkshopId, + ContractStartGr = x.ContractStart, + ContractEndGr = x.ContractEnd, + ContractStart = x.ContractStart.ToFarsi(), + ContractEnd = x.ContractEnd.ToFarsi(), + Signature = x.Signature, + Year = x.Year, + Month = x.Month, + ContractNo = x.ContractNo, + ContractId = x.ContractId, + EmployeeFullName = x.EmployeeFullName, + PersonnelCode = x.PersonnelCode, + PersonnelCodeInt = Convert.ToInt32(x.PersonnelCode), + InstallmentViewModels = x.LoanInstallments.Select(i => new LoanInstallmentViewModel() + { + Amount = i.AmountForMonth, + AmountDouble = i.AmountForMonth.MoneyToDouble(), + Year = i.Year, + Month = i.Month, + IsActive = i.IsActive, + RemainingAmount = i.LoanRemaining, + LoanAmount = i.LoanAmount + }).ToList(), + SalaryAidViewModels = x.SalaryAids.Select(s => new SalaryAidViewModel() + { + Amount = s.Amount, + AmountDouble = s.Amount.MoneyToDouble(), + SalaryAidDateTimeFa = s.SalaryAidDateTimeFa, + SalaryAidDateTimeGe = s.SalaryAidDateTime + }).ToList(), }).Where(x => x.WorkshopId == searchModel.WorkshopId); if (searchModel.EmployeeId > 0) @@ -1033,7 +1231,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos query = query.Where(x => x.EmployeeId == searchModel.EmployeeId); searchModel.Sorting = "ContractStart-Max"; } - + if (!string.IsNullOrWhiteSpace(searchModel.ContractStart) && !string.IsNullOrWhiteSpace(searchModel.ContractEnd)) { @@ -1283,7 +1481,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos IsActiveString = x.IsActiveString, Signature = x.Signature, CreationDate = x.CreationDate, - + }); @@ -1494,14 +1692,14 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos if (hasSearch) return query.OrderByDescending(x => x.Id) .ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).ToList(); - else if(hasEmployeeOrWorkshpSearch && !hasSearch) + else if (hasEmployeeOrWorkshpSearch && !hasSearch) return query.OrderByDescending(x => x.ContractStartGr).ToList(); else return query.OrderByDescending(x => x.Id) .ThenByDescending(x => x.Year).ThenBy(x => x.PersonnelCodeInt).Take(50).ToList(); // Console.WriteLine("return" + watch.Elapsed); - + } diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index 3301287f..ad1cae73 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -2037,7 +2037,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll var starTimeSingel1 = Convert.ToDateTime(shift1Start); var endTimeSingel2 = Convert.ToDateTime(shift1End); - + bool hasRestTime = false; shift1StartGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, starTimeSingel1.Hour, starTimeSingel1.Minute,0); shift1EndGr = new DateTime(cuurentDate.Year, cuurentDate.Month, cuurentDate.Day, endTimeSingel2.Hour, endTimeSingel2.Minute, 0); @@ -2048,6 +2048,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll var shiftSpan = (shift1EndGr - shift1StartGr); if (restTime > TimeSpan.Zero && shiftSpan >= restTime) { + hasRestTime = true; shift1EndGr = shift1EndGr.Subtract(restTime); shiftSpan = (shift1EndGr - shift1StartGr); } @@ -2060,6 +2061,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll { result.Add(new RollCallViewModel() { + BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero, StartDate = shift1StartGr, EndDate = shift1EndGr, ShiftSpan = shiftSpan, @@ -2075,6 +2077,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll //shift <----------------------------------> result.Add(new RollCallViewModel() { + BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero, StartDate = hourseLeaveTypeResult.EndLeaveGr, EndDate = shift1EndGr, ShiftSpan = (shift1EndGr - hourseLeaveTypeResult.EndLeaveGr), @@ -2087,6 +2090,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll //shift <----------------------------------> result.Add(new RollCallViewModel() { + BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero, StartDate = shift1StartGr, EndDate = hourseLeaveTypeResult.StartLeaveGr, ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift1StartGr), @@ -2095,6 +2099,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll result.Add(new RollCallViewModel() { + BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero, StartDate = hourseLeaveTypeResult.EndLeaveGr, EndDate = shift1EndGr, ShiftSpan = (shift1EndGr - hourseLeaveTypeResult.EndLeaveGr), @@ -2108,6 +2113,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll result.Add(new RollCallViewModel() { + BreakTimeSpan = hasRestTime ? restTime : TimeSpan.Zero, StartDate = shift1StartGr, EndDate = hourseLeaveTypeResult.StartLeaveGr, ShiftSpan = (hourseLeaveTypeResult.StartLeaveGr - shift1StartGr), diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/CheckoutPrintAll.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/CheckoutPrintAll.cshtml index 7b6e5d7f..355fd8fb 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/CheckoutPrintAll.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/CheckoutPrintAll.cshtml @@ -314,6 +314,44 @@ width: 100%; justify-content: space-between; } + + .trTable:nth-child(even) { + background-color: #f1f1f1 !important; + } + + .shiftWorkContainerMsg { + position: relative; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border: 1px solid #D9D9D9 !important; + border-radius: 7px; + color: #1F1F1F !important; + font-size: 16px !important; + gap: 9px; + padding: 15px 21px; + max-width: 380px; + margin: auto; + } + + .shiftTitle { + position: absolute; + top: -10px; + right: 5px; + padding: 2px 4px; + color: #000000 !important; + font-size: 12px !important; + background-color: #F6F6F6 !important; + } + + .shiftTime { + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + } + var btnActive = "btn-active"; @@ -373,2838 +411,19 @@
- +
diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Details.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Details.cshtml index 8bafce71..2bb817b8 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Details.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Details.cshtml @@ -1,6 +1,15 @@ -@model CompanyManagment.App.Contracts.Checkout.CheckoutViewModel +@using System.Security.Cryptography.X509Certificates +@model CompanyManagment.App.Contracts.Checkout.CheckoutViewModel @{ - }
- - - - + - + + + + +
- + + \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml index eace4adc..da8cc149 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml @@ -3,1884 +3,219 @@ @model ServiceHost.Areas.Admin.Pages.Company.Checkouts.IndexModel @{ - - //int i = 1; - - + string adminVersion = _0_Framework.Application.Version.AdminVersion; + //int i = 1; } @{ - //Layout = "~/Pages/Shared/_Layout.cshtml"; - Layout = "Shared/_AdminLayout"; - ViewData["title"] = "تصفیه حساب"; - - @section Styles{ - - - - } - @*@section Script{ - - }*@ + //Layout = "~/Pages/Shared/_Layout.cshtml"; + Layout = "Shared/_AdminLayout"; + ViewData["title"] = "تصفیه حساب"; + + + @section Styles { + + + + } }
-
-
+
+
-

- ایجاد تصفیه حساب -@* ویرایش *@ +

+ ایجاد تصفیه حساب + @* ویرایش *@ -

- @*href="#showmodal=@Url.Page("./Index", "PrintAll", new {ids = idss})"*@ -
-
-
-
+

+ @*href="#showmodal=@Url.Page("./Index", "PrintAll", new {ids = idss})"*@ +
+
+
+
- - + + -
-
-

- -

+
+ -
-
- @*===================================================================================================================*@ -
-
-
-
-
-
-
- -
-
-
-
- -
-
-
- - - -
-
    -
-
-
-
-
- - -
-
-
-
-
-
-
- انتخاب تاریخ -
-
- -
-
- -
-
-
-
- @**@ - -
+
+
+
+ @*===================================================================================================================*@ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+ + + +
+
    +
+
+
+
+
+ + +
+
+
+
+
+
+
+ انتخاب تاریخ +
+
+ +
+
+ +
+
+
+
+ @**@ + +
-
-
-
- @**@ +
+
+
+ @**@ - -
-
+ +
+
-
-
- @**@ - @**@ -
-
-
-
-
- @* *@ - @* *@ -
+
+
+ @**@ + @**@ +
+
+
+
+
+ @* *@ + @* *@ +
-
- جستجو - - مشاهده همه -
-
-
- +
+ جستجو + + مشاهده همه +
+
+
+ -
-
- @*==================================================================personal=====*@ -
-
-
-
-
+
+
+ @*==================================================================personal=====*@ +
+
+
+
+
-
-
-
-

لیست تصفیه حساب ها

-
-
-
-
- -
-
-
-
-
+
+
+
+

لیست تصفیه حساب ها

+
+
+
+
+ +
+
+
+
+
@section Script { - - - - - - - - - - - @**@ - - - - + + + + + + } - - - - diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/PrintAll.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/PrintAll.cshtml index 0927888e..bfe0d7ee 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/PrintAll.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/PrintAll.cshtml @@ -294,6 +294,42 @@ -webkit-print-color-adjust: exact; } + + + + .shiftWorkContainerMsg { + position: relative; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + border: 1px solid #D9D9D9 !important; + border-radius: 7px; + color: #1F1F1F !important; + font-size: 16px !important; + gap: 9px; + padding: 15px 21px; + max-width: 380px; + margin: auto; + } + + .shiftTitle { + position: absolute; + top: -10px; + right: 5px; + padding: 2px 4px; + color: #000000 !important; + font-size: 12px !important; + background-color: #F6F6F6 !important; + } + + .shiftTime { + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + } + var btnActive = "btn-active"; @@ -301,2833 +337,20 @@ var inputDeactive = "input-deactive"; } - - \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailStaticRaw.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailStaticRaw.cshtml new file mode 100644 index 00000000..173a8268 --- /dev/null +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailStaticRaw.cshtml @@ -0,0 +1,642 @@ +@model CompanyManagment.App.Contracts.Checkout.CheckoutViewModel + +@{ + var totalDays = Model.MonthlyRollCall?.Count ?? 0; + var rightSideDays = totalDays / 2; + var leftSideDays = totalDays - rightSideDays; + var maxRows = rightSideDays; + var rawHeight = (int)Math.Floor(300.0 / maxRows); + var rowHeight = Math.Max(15, Math.Min(16, rawHeight)); + var calculateHeight = rowHeight + "px"; +} + +
+
+
+
+
+
+
@Model.ContractNo
+
+

بسمه تعالی

+

فیش حقوقی و رسید پرداخت حقوق

+
+
+
+ +
+
+
+
+
+
+ اینجانب + @Model.EmployeeFullName +
+
+
+ نام پدر: + @if (string.IsNullOrWhiteSpace(@Model.FathersName)) + { + "" + } + else + { + @Model.FathersName + + } +
+
+ به کد ملی: + @if (string.IsNullOrWhiteSpace(@Model.NationalCode)) + { + + } + else + { + + @Model.NationalCode + + } +
+
+ متولد: + @if (string.IsNullOrWhiteSpace(@Model.DateOfBirth)) + { + 1401/01/01 + } + else + { + @Model.DateOfBirth + } +
+
+
+ +
+
+ @{ + if (@Model.EmployerList.FirstOrDefault().IsLegal == "حقیقی") + { +
+
+ نام کارگاه: + @Model.WorkshopName +
+
+ +
+ نام کارفرما: + @if (Model.EmployerList.Count > 1) + { + + @Model.EmployerList[0].EmployerFullName ، +  @Model.EmployerList[1].EmployerFullName + @if (@Model.EmployerList.Count > 2) + { + و غیره + } + + } + else + { + + @Model.EmployerList.FirstOrDefault().EmployerFullName + + } +
+ + } + else if (@Model.EmployerList.FirstOrDefault().IsLegal == "حقوقی") + { +
+ پـرسنل شرکت/موسسه: + + @Model.WorkshopName + +
+ } + } +
+
+ @{ + var items = new List(); + + if (Model.MonthlySalary != "0") items.Add("حقوق و مزد"); + if (Model.ConsumableItems != "0") items.Add("کمک هزینه اقلام مصرفی خانوار"); + if (Model.HousingAllowance != "0") items.Add("کمک هزینه مسکن"); + if (!string.IsNullOrWhiteSpace(Model.OvertimePay) && Model.OvertimePay != "0") items.Add("فوق العاده اضافه کاری"); + if (!string.IsNullOrWhiteSpace(Model.NightworkPay) && Model.NightworkPay != "0") items.Add("فوق العاده شب کاری"); + if (!string.IsNullOrWhiteSpace(Model.FridayPay) && Model.FridayPay != "0") items.Add("فوق العاده جمعه کاری"); + if (Model.MissionPay != "0") items.Add("فوق العاده ماموریت"); + if (Model.ShiftPay != "0") items.Add("فوق العاده نوبت کاری"); + if (Model.FamilyAllowance != "0") items.Add("کمک هزینه عائله مندی"); + if (Model.MarriedAllowance != "0") items.Add("حق تاهل"); + if (Model.RewardPay != "0") items.Add("پاداش"); + if (Model.BonusesPay != "0") items.Add("عیدی و پاداش"); + if (Model.YearsPay != "0") items.Add("سنوات"); + if (Model.LeavePay != "0") items.Add("مزد مرخصی"); + + string finalText = ""; + if (items.Count == 1) + { + finalText = items[0]; + } + else if (items.Count > 1) + { + finalText = string.Join("، ", items.Take(items.Count - 1)) + " و " + items.Last(); + } + } + + + کلیه حق السعی خود اعم از @Html.Raw(finalText) @Model.Month ماه سال @Model.Year برابر با قرارداد به شماره فوق را از کارفرما بصورت وجه نقد و واریز به حساب دریافت نموده ام. + +
+
+
+
+ +
+
+ + + + @* *@ + + @* + *@ + + @* + *@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @{ + if (Model.IsLeft) + { + + } + else + { + + + + } + } + + + + + + + + + @{ + if (!Model.IsLeft) + { + + + + } + } + + + + + + + + @{ + if (!Model.IsLeft) + { + + + + } + } + + + + + + + + + + + + + + + + + + + + +
مطالبات کسورات
ردیف شرح ساعت/روز/تعداد مبلغ(ریال) شرح ساعت/روز/تعداد مبلغ(ریال)
1 حقوق و مزد @Model.SumOfWorkingDays @(Model.MonthlySalary == "0" ? "-" : Model.MonthlySalary) حق بیمه سهم کارگر - @(Model.InsuranceDeduction == "0" ? "-" : Model.InsuranceDeduction)
2 پایه سنوات @(Model.BaseYearsPay == "0" ? "-" : Model.SumOfWorkingDays) @(Model.BaseYearsPay == "0" ? "-" : Model.BaseYearsPay) مالیات بر حقوق - @(Model.TaxDeducation == "0" ? "-" : Model.TaxDeducation)
3 کمک هزینه اقلام مصرفی خانوار @(Model.ConsumableItems == "0" ? "-" : Model.SumOfWorkingDays) @(Model.ConsumableItems == "0" ? "-" : Model.ConsumableItems) قسط تسهیلات - @(Model.InstallmentDeduction == "0" ? "-" : Model.InstallmentDeduction)
4 کمک هزینه مسکن @(Model.HousingAllowance == "0" ? "-" : Model.SumOfWorkingDays) @(Model.HousingAllowance == "0" ? "-" : Model.HousingAllowance) مساعده - @(Model.SalaryAidDeduction == "0" ? "-" : Model.SalaryAidDeduction)
5 فوق العاده اضافه کاری @((Model.OverTimeWorkValue == "00:00" || string.IsNullOrWhiteSpace(Model.OverTimeWorkValue)) ? "-" : Model.OverTimeWorkValue) @((Model.OvertimePay == "0" || string.IsNullOrWhiteSpace(Model.OvertimePay)) ? "-" : Model.OvertimePay) غیبت - @(Model.AbsenceDeduction == "0" ? "-" : Model.AbsenceDeduction)
6 فوق العاده شب کاری @((Model.OverNightWorkValue == "00:00" || string.IsNullOrWhiteSpace(Model.OverNightWorkValue)) ? "-" : Model.OverNightWorkValue) @((Model.NightworkPay == "0" || string.IsNullOrWhiteSpace(Model.NightworkPay)) ? "-" : Model.NightworkPay)
7 فوق العاده جمعه کاری @((Model.FridayWorkValue == "0" || string.IsNullOrWhiteSpace(Model.FridayWorkValue)) ? "-" : Model.FridayWorkValue) @((Model.FridayPay == "0" || string.IsNullOrWhiteSpace(Model.FridayPay)) ? "-" : Model.FridayPay)
8 فوق العاده ماموریت - @(Model.MissionPay == "0" ? "-" : Model.MissionPay)
9 فوق العاده نوبت کاری @((Model.RotatingShiftValue == "0" || string.IsNullOrWhiteSpace(Model.RotatingShiftValue)) ? "-" : "%" + Model.RotatingShiftValue) @(Model.ShiftPay == "0" ? "-" : Model.ShiftPay)
10 کمک هزینه عائله مندی - @(Model.FamilyAllowance == "0" ? "-" : Model.FamilyAllowance)
11 حق تاهل @Model.MaritalStatus @(Model.MarriedAllowance == "0" ? "-" : Model.MarriedAllowance)
12 پاداش - @(Model.RewardPay == "0" ? "-" : Model.RewardPay)
13 عیدی و پاداش @(Model.BonusesPay == "0" ? "-" : Model.SumOfWorkingDays) @(Model.BonusesPay == "0" ? "-" : Model.BonusesPay) +
+
+ طبق تصفیه حساب نهایی تنظیمی فوق، آخرین روز اشتغال بکار اینجانب + @Model.LastDayOfWork + بوده و قطع همکاری با کارفرما و کارگاه از تاریخ + @Model.LeftWorkDate + می باشد +
+
+
14 سنوات @(Model.YearsPay == "0" ? "-" : Model.SumOfWorkingDays) @(Model.YearsPay == "0" ? "-" : Model.YearsPay)
15 مزد مرخصی @(Model.LeavePay == "0" ? "-" : Model.SumOfWorkingDays) @(Model.LeavePay == "0" ? "-" : Model.LeavePay)
جمع مطالبات - @(Model.TotalClaims == "0" ? "-" : Model.TotalClaims) جمع کسورات - @(Model.TotalDeductions == "0" ? "-" : Model.TotalDeductions)
مبلغ قابل پرداخت @(Model.TotalPayment == "0" ? "-" : Model.TotalPayment)
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + + + + + @if (Model.CreateWorkingHoursTemp.ShiftWork == "4") + { + + + + + + + + + + + + + + @for (int i = 0; i < 16; i++) + { + @* var dailyStatic = Model.MonthlyRollCall[i]; *@ + + @* var leftItem = i < leftSideDays ? Model.MonthlyRollCall[i] : null; *@ + var leftItem = i < 15 ? Model.MonthlyRollCall[i] : null; + @* var rightItem = i < rightSideDays ? Model.MonthlyRollCall[i + leftSideDays] : null; *@ + var rightIndex = 15 + i; + var rightItem = rightIndex < Model.MonthlyRollCall.Count ? Model.MonthlyRollCall[rightIndex] : null; + + + + + @* section one *@ + + @if (string.IsNullOrWhiteSpace(leftItem?.LeaveType)) + { + + + + } + else + { + + + } + + + + + @* section two *@ + + @if (string.IsNullOrWhiteSpace(rightItem?.LeaveType)) + { + + + + } + else + { + + } + + + + } + } + else + { + //[12-24 : 5] [24-24 : 6] [12-36 : 7] [24-48 : 8] + var shiftType = Model.CreateWorkingHoursTemp.ShiftWork switch + { + "5"=>"12 ساعت کار / 24 ساعت استراحت", + "6"=>"24 ساعت کار / 24 ساعت استراحت", + "7"=>"12 ساعت کار / 36 ساعت استراحت", + "8"=>"24 ساعت کار / 48 ساعت استراحت", + _=>"" + }; + + + + + } + + + + + + + + + + +
فیش حقوقی بدون سیستم هوشمند حضور غیاب
تاریخ مقطع اول کار مقطع دوم کار استراحت جمع تاریخ مقطع اول کار مقطع دوم کار استراحت جمع
+ @(leftItem?.RollCallDateFa ?? "") @(leftItem?.DayOfWeek ?? "") + + @(!String.IsNullOrWhiteSpace(leftItem?.StartDate1) ? leftItem?.StartDate1 + " الی " + leftItem?.EndDate1 : "") + + @(!String.IsNullOrWhiteSpace(leftItem?.StartDate2) ? leftItem?.StartDate2 + " الی " + leftItem?.EndDate2 : "") + + @(leftItem?.BreakTimeString ?? "") + + @leftItem?.LeaveType + + @(leftItem?.TotalWorkingHours ?? "") + + @(rightItem?.RollCallDateFa ?? "") @(rightItem?.DayOfWeek ?? "") + + @(!String.IsNullOrWhiteSpace(rightItem?.StartDate1) ? rightItem?.StartDate1 + " الی " + rightItem?.EndDate1 : "") + + @(!String.IsNullOrWhiteSpace(rightItem?.StartDate2) ? rightItem?.StartDate2 + " الی " + rightItem?.EndDate2 : "") + + @(rightItem?.BreakTimeString ?? "") + + @rightItem?.LeaveType + + @(rightItem?.TotalWorkingHours ?? "") +
+
+
شیفت کاری
+
+
ساعات ‌کاری این پرسنل در قالب
+
@shiftType
+
+
+ + + + @Model.CreateWorkingHoursTemp.StartComplex الی @Model.CreateWorkingHoursTemp.EndComplex +
+
+
مدت مرخصی استحقاقی : @Model.TotalPaidLeave مدت مرخصی استعلاجی : @Model.TotalSickLeave
+ + + + + + + +
موظفی @Model.Month @Model.Year : @Model.TotalMandatoryTimeStr ساعات حضور : @Model.TotalPresentTimeStr ساعات استراحت : @Model.TotalBreakTimeStr ساعات کارکرد واقعی : @Model.TotalWorkingTimeStr
+
+
+
+
+ +
+
+
+
+ +
+ + + + + + + + + + + + + + + + @for (int i = 0; i < 5; i++) + { + + + + + } + +
مساعده
تاریخمبلغ
+ @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count + ? Model.SalaryAidViewModels[i]?.SalaryAidDateTimeFa ?? "" + : "") + + @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count + ? Model.SalaryAidViewModels[i]?.Amount ?? "" + : "") +
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + @for (int i = 0; i < 5; i++) + { + + + + + + } + +
وام
مبلغ کلمبلغ هر قسطمبلغ باقیمانده
+ @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count + ? Model.InstallmentViewModels[i]?.LoanAmount ?? "" + : "") + + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count + ? Model.InstallmentViewModels[i]?.Amount ?? "" + : "") + + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count + ? Model.InstallmentViewModels[i]?.RemainingAmount ?? "" + : "") +
+
+ +
+
+
+
+
+
+ اثر انگشت +
+
+ امضاء +
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailsRollCallRaw.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailsRollCallRaw.cshtml index 4975695b..d8a3ccab 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailsRollCallRaw.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailsRollCallRaw.cshtml @@ -558,49 +558,57 @@ -
-
-
-
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + @for (int i = 0; i < 5; i++) + { + + + + + } + +
مساعده
تاریخمبلغ
+ @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count + ? Model.SalaryAidViewModels[i]?.SalaryAidDateTimeFa ?? "" + : "") + + @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count + ? Model.SalaryAidViewModels[i]?.Amount ?? "" + : "") +
+
+ +
+ +
- - - - - - - - - - - - - - - - @for (int i = 0; i < 5; i++) - { - - - - - } - -
مساعده
تاریخمبلغ
- @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count - ? Model.SalaryAidViewModels[i]?.SalaryAidDateTimeFa ?? "" - : "") - - @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count - ? Model.SalaryAidViewModels[i]?.Amount ?? "" - : "") -
- - + + + @@ -608,9 +616,10 @@ - - - + + + + @for (int i = 0; i < 5; i++) { @@ -620,6 +629,11 @@ ? Model.InstallmentViewModels[i]?.LoanAmount ?? "" : "") + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - @{ - int count_j = 0; + @{ + int count_j = 0; - // count_j = (i == 0 ? (((CountList < 12) || (i == (q - 1) && CountList!=12)) ? r : 12) : (((CountList < 12) || (i == (q - 1))) ? r : 12)); + // count_j = (i == 0 ? (((CountList < 12) || (i == (q - 1) && CountList!=12)) ? r : 12) : (((CountList < 12) || (i == (q - 1))) ? r : 12)); - if (i == 0 && ((CountList < 12) || (i == (q - 1) && CountList != 12))) - { - count_j = r; - } - else if (i == 0 && (CountList >= 12 || (i != (q - 1)))) - { - count_j = 12; - } - else if (i != 0 && ((CountList < 12) || ((i == (q - 1)) && r != 0))) - { - count_j = r; - } - else - count_j = 12; - - - if (i == (q - 1)) - count_j = (i * 12) + count_j; - else - { - count_j = ((i + 1) * count_j); - } - } - @for (int j = (i * 12); j < count_j; j++) + if (i == 0 && ((CountList < 12) || (i == (q - 1) && CountList != 12))) { + count_j = r; + } + else if (i == 0 && (CountList >= 12 || (i != (q - 1)))) + { + count_j = 12; + } + else if (i != 0 && ((CountList < 12) || ((i == (q - 1))&& r!=0))) + { + count_j = r; + } + else + count_j = 12; + + + if (i == (q - 1)) + count_j = (i * 12) + count_j; + else + { + count_j = ((i + 1) * count_j); + } + } + @for (int j = (i * 12); j < count_j; j++) + { @**@ - - @if (i == (q - 1)) - { - - } - else - { - - } - - - - - - - - - - - - - @**@ - @if (i == (q - 1)) - { - - } - else - { - - } + + @if (i == (q - 1)) + { + + } + else + { + + } + + + + + + + + + + + + + @**@ + @if (i == (q - 1)) + { + + } + else + { + + } - - index = index + 1; - } - @if (i == (q - 1) && (r > 0 && r <= 8)) - { - CountLastRow = 0; - hasLastRow = true; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } - else if (i == (q - 1) && (r > 0 && r <= 9)) - { - CountLastRow = 1; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } - else if (i == (q - 1) && (r > 0 && r <= 10)) - { - CountLastRow = 2; - - - - - - - - - - - - - - - - - } + + index = index + 1; + } + @if (i == (q - 1) && (r>0 && r <= 8 )) + { + CountLastRow = 0; + hasLastRow = true; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + else if (i == (q - 1) && (r>0 && r <= 9)) + { + CountLastRow=1; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + else if (i == (q - 1) && (r>0 && r <= 10)) + { + CountLastRow=2; + + + + + + + + + + + + + + + + + }
مبلغ کل واممبلغ باقیمانده وام
مبلغ کلمبلغ هر قسطمبلغ باقیمانده
+ @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count + ? Model.InstallmentViewModels[i]?.Amount ?? "" + : "") + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count ? Model.InstallmentViewModels[i]?.RemainingAmount ?? "" @@ -634,7 +648,7 @@ -
+
اثر انگشت diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailsRotatingShiftReport.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailsRotatingShiftReport.cshtml deleted file mode 100644 index e1dd794f..00000000 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/_Partials/PrintDetailsRotatingShiftReport.cshtml +++ /dev/null @@ -1,5 +0,0 @@ -@* - For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 -*@ -@{ -} diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/InsuranceConfirm.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/InsuranceConfirm.cshtml index f00ecb45..46b64a38 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/InsuranceConfirm.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/InsuranceConfirm.cshtml @@ -40,8 +40,7 @@ align-items: center; margin: 1rem 0; } - - .last-div { + .last-div{ width: 100%; /* height: 55px; */ } @@ -73,18 +72,20 @@ margin: 0 9rem; } - @@page { + @@page { size: A4 landscape; } .table-container-employee { - display: flex; - width: 100%; - justify-content: space-between; + display: flex; + width: 100%; + justify-content: space-between; } .trTable:nth-child(2n) { - background-color: #f1f1f1 !important; + background-color: #f1f1f1 !important; + -webkit-print-color-adjust: exact !important; + print-color-adjust: exact !important; } #printThis .table-bordered .has-left-work p, #printThis .table-bordered .has-start-work p { @@ -208,15 +209,15 @@ } #printThis .colgp-12 { - width: 44px; + width: 44px; } #printThis .colgp-13 { - width: 44px; + width: 44px; } #printThis .colgp-14 { - width: 40px; + width: 40px; } #printThis .table-bordered > tbody > tr:nth-child(12n) td:first-child { @@ -242,10 +243,10 @@ align-items: center; } - .titleSection p { - margin: 0; - text-align: right; - } + .titleSection p{ + margin: 0; + text-align: right; + } .titles { margin-left: auto; @@ -344,9 +345,9 @@ width: 18px; } - #printThis .colgp-7 { - width: 44px; - } + #printThis .colgp-7 { + width: 44px; + } #printThis .colgp-8 { width: 44px; @@ -356,13 +357,13 @@ width: 44px; } - #printThis .colgp-10 { - width: 44px; - } + #printThis .colgp-10 { + width: 44px; + } - #printThis .colgp-11 { - width: 44px; - } + #printThis .colgp-11 { + width: 44px; + } #printThis .colgp-12 { width: 44px; @@ -384,14 +385,14 @@ width: 60px; } - .col-md-9, .col-sm-9, .col-lg-9 { + .col-md-9, .col-sm-9, .col-lg-9 { width: 75%; - float: right; - } + float: right; + } - .asignment { - width: 25%; - } + .asignment { + width: 25%; + } } @@media screen { @@ -410,8 +411,8 @@ margin: 0 !important; padding: 0 !important; overflow: clip; - -webkit-print-color-adjust: exact !important; - print-color-adjust: exact !important; + -webkit-print-color-adjust:exact !important; + print-color-adjust:exact !important; } .modal-dialog { @@ -432,7 +433,7 @@ } .size-a4 { - width: 276mm; + width: 276mm; } #printThis .table-container { @@ -447,27 +448,26 @@ width: 100%; max-height: 15cm; border: hidden !important; - border-right: 0; + border-right :0; border-left: 0; } - #printThis .table-bordered > thead > tr > th { - font-size: 10px; - color: black; - text-align: center; - vertical-align: middle; - padding: 0; - border: 1px solid black; - } - - #printThis .table-bordered > tbody > tr > td { - padding: 8px 2px; - text-align: center; - font-size: 1rem; - border: 1px solid black; - } + #printThis .table-bordered > thead > tr > th { + font-size: 10px; + color: black; + text-align: center; + vertical-align: middle; + padding: 0; + border: 1px solid black; + } + #printThis .table-bordered > tbody > tr > td { + padding: 8px 2px; + text-align: center; + font-size: 1rem; + border: 1px solid black; + } .summary { display: flex; justify-content: flex-end; @@ -495,24 +495,33 @@ color: grey !important; } - .row-color2 .fa-square:before { - color: grey !important; - } + .row-color2 .fa-square:before { + color: grey !important; + } #printThis .table-bordered .has-left-work td { background: black !important; color: white !important; } - #printThis .table-bordered .has-left-work td p { - color: white !important; - } + #printThis .table-bordered .has-left-work td p{ + color: white !important; + } #printThis .table-bordered .has-start-work td { background: grey !important; } + + #printThis .trTable.new-leftwork td { + background-color: #333333 !important; + color: #ffffff !important; + -webkit-print-color-adjust: exact !important; + print-color-adjust: exact !important; + } } + + @@ -542,24 +551,24 @@
- @* *@ + @* *@
-

- * سطر به رنگ - به معنای ترک کار پرسنل می باشد. -

-

- * سطر به رنگ به معنای شروع بکار پرسنل می باشد. -

-
+

+ * سطر به رنگ + به معنای ترک کار پرسنل می باشد. +

+

+ * سطر به رنگ به معنای شروع بکار پرسنل می باشد. +

+
-

تایید کارفرما جهت تنظیم لیست بیمه پرسنل

-
+

تایید کارفرما جهت تنظیم لیست بیمه پرسنل

+
- -
+ +
@@ -587,307 +596,306 @@
توضیحات مجموع مزایای ماهانه غیرمشمول مجموع حقوق و مزایای ماهیانه مجموع مزایای ماهیانه حق تاهل دستمزد ماهانه پایه سنوات روزانه دستمزد روزانه روز کارکرد سمت کدملی نام و نام خانوادگی شماره بیمه ردیف
توضیحات مجموع مزایای ماهانه غیرمشمول مجموع حقوق و مزایای ماهیانه مجموع مزایای ماهیانه حق تاهل دستمزد ماهانه پایه سنوات روزانه دستمزد روزانه روز کارکرد سمت کدملی نام و نام خانوادگی شماره بیمه ردیف
- @if (!string.IsNullOrEmpty(Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate)) - { -

@Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate

- } - @if (Model.EmployeeDetailsForInsuranceList[j].HasStartWorkInMonth) - { -

@Model.EmployeeDetailsForInsuranceList[j].StartWorkDate

- } -
- @if (!string.IsNullOrEmpty(Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate)) - { -

@Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate

- } - @if (Model.EmployeeDetailsForInsuranceList[j].HasStartWorkInMonth) - { -

@Model.EmployeeDetailsForInsuranceList[j].StartWorkDate

- } -
@Model.EmployeeDetailsForInsuranceList[j].BenefitsIncludedNonContinuous.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].BenefitsIncludedContinuous.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].MonthlyBenefits.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].MarriedAllowance.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].MonthlySalary.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].BaseYears.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].DailyWage.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].WorkingDays@Model.EmployeeDetailsForInsuranceList[j].JobName@Model.EmployeeDetailsForInsuranceList[j].NationalCode@(Model.EmployeeDetailsForInsuranceList[j].FName + " " + Model.EmployeeDetailsForInsuranceList[j].LName)@Model.EmployeeDetailsForInsuranceList[j].InsuranceCode @index @index @index
+ @if (!string.IsNullOrEmpty(Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate)) + { +

@Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate

+ } + @if (Model.EmployeeDetailsForInsuranceList[j].HasStartWorkInMonth) + { +

@Model.EmployeeDetailsForInsuranceList[j].StartWorkDate

+ } +
+ @if (!string.IsNullOrEmpty(Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate)) + { +

@Model.EmployeeDetailsForInsuranceList[j].LeftWorkDate

+ } + @if (Model.EmployeeDetailsForInsuranceList[j].HasStartWorkInMonth) + { +

@Model.EmployeeDetailsForInsuranceList[j].StartWorkDate

+ } +
@Model.EmployeeDetailsForInsuranceList[j].BenefitsIncludedNonContinuous.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].BenefitsIncludedContinuous.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].MonthlyBenefits.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].MarriedAllowance.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].MonthlySalary.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].BaseYears.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].DailyWage.ToMoney()@Model.EmployeeDetailsForInsuranceList[j].WorkingDays@Model.EmployeeDetailsForInsuranceList[j].JobName@Model.EmployeeDetailsForInsuranceList[j].NationalCode@(Model.EmployeeDetailsForInsuranceList[j].FName + " " + Model.EmployeeDetailsForInsuranceList[j].LName)@Model.EmployeeDetailsForInsuranceList[j].InsuranceCode @index @index @index
@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedNonContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlyBenefits).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MarriedAllowance).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlySalary).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BaseYears).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.DailyWage).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.WorkingDays)
@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedNonContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlyBenefits).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MarriedAllowance).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlySalary).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BaseYears).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.DailyWage).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.WorkingDays)
-
+
-
- @{ - var pageStartIndex = i * 12; - var pageEndIndex = (i == q - 1) ? ((i * 12) + r) : ((i + 1) * 12); +
+ @{ + var pageStartIndex = i * 12; + var pageEndIndex = (i == q - 1) ? ((i * 12) + r) : ((i + 1) * 12); - var pageEmployees = Model.EmployeeDetailsForInsuranceList - .Skip(pageStartIndex) - .Take(pageEndIndex - pageStartIndex) - .ToList(); - var pageEmployeeIds = pageEmployees.Select(x => x.EmployeeId).ToHashSet(); + var pageEmployees = Model.EmployeeDetailsForInsuranceList + .Skip(pageStartIndex) + .Take(pageEndIndex - pageStartIndex) + .ToList(); + var pageEmployeeIds = pageEmployees.Select(x => x.EmployeeId).ToHashSet(); - var leftWorkList = Model.LeftWorkEmployees - .Where(x => pageEmployeeIds.Contains(x.EmployeeId)) - .Select(x => new LeftWorkViewModel - { - EmployeeFullName = x.EmployeeFullName ?? "-", - LeftWorkDate = x.LeftWorkDate ?? "-" - }) - .ToList(); + var leftWorkList = Model.LeftWorkEmployees + .Where(x => pageEmployeeIds.Contains(x.EmployeeId)) + .Select(x => new LeftWorkViewModel { + EmployeeFullName = x.EmployeeFullName ?? "-", + LeftWorkDate = x.LeftWorkDate ?? "-" + }) + .ToList(); - while (leftWorkList.Count < 12) - { + while (leftWorkList.Count < 12) + { leftWorkList.Add(new LeftWorkViewModel { EmployeeFullName = "-", LeftWorkDate = "-" }); - } + } var tables = new List>(); - for (int t = 0; t < 3; t++) - { - tables.Add(leftWorkList.Skip(t * 4).Take(4).ToList()); - } - } + for (int t = 0; t < 3; t++) + { + tables.Add(leftWorkList.Skip(t * 4).Take(4).ToList()); + } + } -

هشدار پرسنل ذیل با توجه به تاریخ مندرج با مجموعه شما هیچگونه قرارداد کاری ندارند.

-
-
+

هشدار پرسنل ذیل با توجه به تاریخ مندرج با مجموعه شما هیچگونه قرارداد کاری ندارند.

+
+
+ + @for (int t = 0; t < tables.Count; t++) + { + var table = tables[t]; + + + + + - @for (int t = 0; t < tables.Count; t++) - { - var table = tables[t]; -
- - - - + + + + - - - - - - @foreach (var item in table) - { - - + - - } -
تاریخنام پرسنل
تاریخنام پرسنل
+ @foreach (var item in table) + { +
@item.LeftWorkDate + @item.EmployeeFullName
- } + } + + } + + - - - - @* + + @*
@@ -907,11 +915,11 @@
*@ -
-
-
+
+
+
- @*

* سطر به رنگ @@ -921,8 +929,8 @@ * سطر به رنگ به معنای شروع بکار پرسنل می باشد.

*@ -

صفحه @(i + 1) از @((r > 0 && r <= 8) ? q : q + 1)

-
+

صفحه @(i + 1) از @((r > 0 && r <= 8) ? q : q + 1)

+
@*
*@
امضا و تایید کارفرما
@@ -936,7 +944,7 @@ if (!hasLastRow) { -
+
@* *@ @@ -957,42 +965,129 @@
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - @if (CountLastRow == 0) + @if (CountLastRow == 0) + { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + else if (CountLastRow == 2) + { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + + else if (CountLastRow == 1) { @@ -1009,113 +1104,26 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - } - else if (CountLastRow == 2) - { - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + } - else if (CountLastRow == 1) - { - - - - - - - - - - - - - - - - - } - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + +
توضیحات مجموع مزایای ماهانه غیرمشمول مجموع حقوق و مزایای ماهیانه مجموع مزایای ماهیانه حق تاهل دستمزد ماهانه پایه سنوات روزانه دستمزد روزانه روز کارکرد سمت کدملی نام و نام خانوادگی شماره بیمه ردیف
توضیحات مجموع مزایای ماهانه غیرمشمول مجموع حقوق و مزایای ماهیانه مجموع مزایای ماهیانه حق تاهل دستمزد ماهانه پایه سنوات روزانه دستمزد روزانه روز کارکرد سمت کدملی نام و نام خانوادگی شماره بیمه ردیف
@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedNonContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlyBenefits).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MarriedAllowance).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlySalary).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BaseYears).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.DailyWage).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.WorkingDays)
@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedNonContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BenefitsIncludedContinuous).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlyBenefits).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MarriedAllowance).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.MonthlySalary).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.BaseYears).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.DailyWage).ToMoney()@Model.EmployeeDetailsForInsuranceList.Sum(x => x.WorkingDays)
@@ -1130,7 +1138,7 @@ * سطر به رنگ به معنای شروع بکار پرسنل می باشد.

-

صفحه @(q + 1) از @(q + 1)

+

صفحه @(q+1) از @(q+1)

diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml index 4cd285ab..65aa5658 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsModal.cshtml @@ -273,8 +273,10 @@
- - @if (userId == Model.SenderId) + + @if (!Model.HasRequest) + { + @if (userId == Model.SenderId) { @@ -288,6 +290,7 @@ } + }
}
diff --git a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsScheduleModal.cshtml b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsScheduleModal.cshtml index 400dd8fc..8116cd74 100644 --- a/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsScheduleModal.cshtml +++ b/ServiceHost/Areas/AdminNew/Pages/Company/Task/DetailsScheduleModal.cshtml @@ -25,6 +25,10 @@ } @@ -48,78 +75,93 @@