From ffd9abd8d24f55b4a822717298285207f9dc9bff Mon Sep 17 00:00:00 2001 From: SamSys Date: Sat, 22 Feb 2025 05:28:35 +0330 Subject: [PATCH] Checkout bug fixed --- .../IRollCallMandatoryRepository.cs | 2 +- .../RollCallAgg/IRollCallRepository.cs | 8 + .../IYearlySalaryRepository.cs | 2 +- .../Checkout/CreateCheckout.cs | 3 + .../CheckoutDailyRollCallViewModel.cs | 10 + .../RollCall/IRollCallMandatoryApplication.cs | 2 +- .../CheckoutApplication.cs | 2 +- .../RollCallEmployeeStatusApplication.cs | 10 +- .../RollCallMandatoryApplication.cs | 4 +- .../Repository/CustomizeCheckoutRepository.cs | 26 +- .../CustomizeCheckoutTempRepository.cs | 59 +- .../Repository/RollCallMandatoryRepository.cs | 95 ++- .../Repository/RollCallRepository.cs | 339 +++++++++- .../Repository/YearlySalaryRepository.cs | 8 +- .../Pages/Company/Checkouts/Create.cshtml | 2 +- .../Pages/Company/Checkouts/Index.cshtml.cs | 24 +- .../PrintOneCheckoutTemporary.cshtml | 585 ++++++++++-------- .../PrintOneCheckoutUnofficial.cshtml | 138 ++++- .../PrintDetailsCheckoutTemporaryRaw.cshtml | 162 ++++- .../PrintDetailsCheckoutUnofficialRaw.cshtml | 293 ++++++--- .../js/ModalCheckoutUnofficialCreate.js | 4 +- 21 files changed, 1278 insertions(+), 500 deletions(-) diff --git a/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs b/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs index 046482ef..66d91bd1 100644 --- a/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs +++ b/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs @@ -12,7 +12,7 @@ namespace Company.Domain.RollCallAgg; public interface IRollCallMandatoryRepository : IRepository { - ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, long leavId); + ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking); TimeSpan AfterSubtract(CreateWorkingHoursTemp command, TimeSpan sumOneDaySpan, DateTime creationDate); List RotatingShiftCheck(List rollCallList); diff --git a/Company.Domain/RollCallAgg/IRollCallRepository.cs b/Company.Domain/RollCallAgg/IRollCallRepository.cs index 6b234a9c..83849eeb 100644 --- a/Company.Domain/RollCallAgg/IRollCallRepository.cs +++ b/Company.Domain/RollCallAgg/IRollCallRepository.cs @@ -80,5 +80,13 @@ namespace Company.Domain.RollCallAgg List GetWorkshopEmployeeRollCallsWithUndefinedForDate(long workshopId, long employeeId, DateTime georgianDateTime); void RemoveEmployeeRollCallsWithUndefinedInDate(long workshopId, long employeeId, DateTime date); + + #region Mahan + + List GetEmployeeRollCallsForCustomizeCheckoutTemp(IEnumerable customizeCheckoutIds, + long workshopId); + + + #endregion } } diff --git a/Company.Domain/YearlySalaryAgg/IYearlySalaryRepository.cs b/Company.Domain/YearlySalaryAgg/IYearlySalaryRepository.cs index 25c5c6f7..f7e28c28 100644 --- a/Company.Domain/YearlySalaryAgg/IYearlySalaryRepository.cs +++ b/Company.Domain/YearlySalaryAgg/IYearlySalaryRepository.cs @@ -13,7 +13,7 @@ public interface IYearlySalaryRepository : IRepository { List GetYears(); List GetYearlySalary(); - MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete); + MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart,DateTime contractEnd, double daylyWage, string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking); double GetLeavePay(DateTime contractStart, DateTime contractEnd, double daylyWage, double consumableItem, double housingAllowance, double familyAllowance , string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM); double GetOverTimeWorking(double dayliWage, string overTimeWorkH, string overTimeWorkM); double GetOverNightWorking(double dayliWage, string overNightWorkH, string overNightWorkM, string weeklyWorkingTime, int officialholiday, int friday, DateTime contractStart, DateTime contractEnd, string totalHoursH, string totalHorsM); diff --git a/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs b/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs index a6ac682e..0af8d207 100644 --- a/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs +++ b/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs @@ -133,4 +133,7 @@ public class CreateCheckout /// تعداد روزهای محاسبه شده برای عیدی و پاداش /// public string TotalDayOfBunosesCompute { get; set; } + + public bool HolidayWorking { get; set; } + } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/RollCall/CheckoutDailyRollCallViewModel.cs b/CompanyManagment.App.Contracts/RollCall/CheckoutDailyRollCallViewModel.cs index ee7c9baa..6547b2de 100644 --- a/CompanyManagment.App.Contracts/RollCall/CheckoutDailyRollCallViewModel.cs +++ b/CompanyManagment.App.Contracts/RollCall/CheckoutDailyRollCallViewModel.cs @@ -22,6 +22,16 @@ namespace CompanyManagment.App.Contracts.RollCall public TimeSpan BreakTimeTimeSpan { get; set; } public string BreakTimeString { get; set; } + /// + /// اگر مرخصی نداشته باشد خالی خواهد بود، اگر داشته باشد نوع مرخصی جانشانی می شود + /// + public string LeaveType { get; set; } + + public bool IsAbsent { get; set; } + public bool IsFriday { get; set; } + public bool IsHoliday { get; set; } + public bool IsBirthDay { get; set; } + } #endregion diff --git a/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs b/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs index 69f681e3..4744d8d1 100644 --- a/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs +++ b/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs @@ -7,5 +7,5 @@ namespace CompanyManagment.App.Contracts.RollCall; public interface IRollCallMandatoryApplication { bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart); - ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, long leavId); + ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking); } \ No newline at end of file diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs index 2b8108a4..ba7b8029 100644 --- a/CompanyManagment.Application/CheckoutApplication.cs +++ b/CompanyManagment.Application/CheckoutApplication.cs @@ -121,7 +121,7 @@ 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); + _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); //دستمزد ماهانه var monthlyWage = MontlyYearsBunos.MontlyWage; //سنوات diff --git a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs index c2251333..236ded26 100644 --- a/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs +++ b/CompanyManagment.Application/RollCallEmployeeStatusApplication.cs @@ -68,8 +68,16 @@ namespace CompanyManagment.Application //کاریابی ملل 605 //368 پیتزا امیر آماده سازی //367 پیتزا امیر رستوران - if(workshopId == 11 || workshopId == 585 || workshopId == 604 || workshopId == 605 || workshopId == 368 || workshopId == 367) + //286 مرکز توان بخشی رسالت + bool skipRollCall = workshopId is 11 or 585 or 604 or 605 or 368 or 367 or 286; + +#if DEBUG + skipRollCall = workshopId is 11 or 585 or 604 or 605 or 368 or 367; +#endif + if (skipRollCall) return false; + + var service = _rollCallServiceRepository.GetAllServiceByWorkshopId(workshopId); if (!service.Any(x => x.StartService.Date <= contractStart.Date && x.EndService.Date >= contractEnd.Date)) diff --git a/CompanyManagment.Application/RollCallMandatoryApplication.cs b/CompanyManagment.Application/RollCallMandatoryApplication.cs index 73cd5199..8850e139 100644 --- a/CompanyManagment.Application/RollCallMandatoryApplication.cs +++ b/CompanyManagment.Application/RollCallMandatoryApplication.cs @@ -20,8 +20,8 @@ public class RollCallMandatoryApplication : IRollCallMandatoryApplication return _rollCallMandatoryRepository.Exists(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date); } - public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, long leavId) + public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking) { - return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, leavId); + return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking); } } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/CustomizeCheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CustomizeCheckoutRepository.cs index 9f58d444..2d14b1df 100644 --- a/CompanyManagment.EFCore/Repository/CustomizeCheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CustomizeCheckoutRepository.cs @@ -73,7 +73,8 @@ namespace CompanyManagment.EFCore.Repository //var year = pc.GetYear(monthStart); //var month = pc.GetMonth(monthStart); - IQueryable customizeCheckoutsQuery = _companyContext.CustomizeCheckouts.Where(x => customizeCheckoutIds.Contains(x.id)).Include(x=>x.CheckoutFines); + IQueryable customizeCheckoutsQuery = _companyContext.CustomizeCheckouts + .Where(x => customizeCheckoutIds.Contains(x.id)).Include(x => x.CheckoutFines); IQueryable workshopsQuery = _companyContext.Workshops.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.id)); @@ -133,16 +134,15 @@ namespace CompanyManagment.EFCore.Repository EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(), LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(), FineDeduction = x.FineDeduction.ToMoney(), - FineViewModelList = x.CheckoutFines.Select(y=> new FineViewModel() + FineViewModelList = x.CheckoutFines.Select(y => new FineViewModel() { Amount = y.Amount, FineDate = y.FineDateFa, Title = y.Title }).ToList(), - InstallmentViewModels = x.CustomizeCheckoutLoanInstallments.Select(i=>new LoanInstallmentViewModel() + InstallmentViewModels = x.CustomizeCheckoutLoanInstallments.Select(i => new LoanInstallmentViewModel() { - //موقتا مبلغ کل وام بجای قسط ارسال شده است - Amount = i.LoanAmount, + Amount = i.AmountForMonth, AmountDouble = i.AmountForMonth.MoneyToDouble(), Year = i.Year, Month = i.Month, @@ -150,26 +150,26 @@ namespace CompanyManagment.EFCore.Repository RemainingAmount = i.LoanRemaining, LoanAmount = i.LoanAmount }).ToList(), - RewardViewModels = x.CustomizeCheckoutRewards.Select(r=>new RewardViewModel() + RewardViewModels = x.CustomizeCheckoutRewards.Select(r => new RewardViewModel() { IsActive = r.IsActive, Title = r.Title, Amount = r.Amount, - AmountDouble =r.Amount.MoneyToDouble(), + AmountDouble = r.Amount.MoneyToDouble(), Description = r.Description, GrantDateFa = r.GrantDateFa, GrantDateGr = r.GrantDate }).ToList(), - SalaryAidViewModels = x.CustomizeCheckoutSalaryAids.Select(s=> new SalaryAidViewModel() + SalaryAidViewModels = x.CustomizeCheckoutSalaryAids.Select(s => new SalaryAidViewModel() { Amount = s.Amount, AmountDouble = s.Amount.MoneyToDouble(), SalaryAidDateTimeFa = s.SalaryAidDateTimeFa, SalaryAidDateTimeGe = s.SalaryAidDateTime }).ToList(), - - - + + + }).ToList(); List workshopsList = workshopsQuery.Select(x => new WorkshopViewModel { @@ -215,9 +215,10 @@ namespace CompanyManagment.EFCore.Repository List personnelRollCalls = _rollCallRepository - .GetEmployeeRollCallsForMonth(customizeCheckoutsList.Select(x => x.EmployeeId).ToList(), workshopId, startDate, endDate); + .GetEmployeeRollCallsForMonth(customizeCheckoutsList.Select(x => x.EmployeeId), workshopId, startDate, endDate); int counter = 1; + foreach (var checkout in customizeCheckoutsList) { checkout.PrintCounter = counter++; @@ -230,6 +231,7 @@ namespace CompanyManagment.EFCore.Repository checkout.EmployerList = workshopEmployersList; checkout.EmployerName = workshopEmployersList.FirstOrDefault()?.FullName ?? "-"; + checkout.MonthlyRollCall = personnelRollCalls.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId); checkout.PersonnelCode = personnelCodeList.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId)?.PersonnelCode ?? 0; diff --git a/CompanyManagment.EFCore/Repository/CustomizeCheckoutTempRepository.cs b/CompanyManagment.EFCore/Repository/CustomizeCheckoutTempRepository.cs index b70fc314..4acf5ab2 100644 --- a/CompanyManagment.EFCore/Repository/CustomizeCheckoutTempRepository.cs +++ b/CompanyManagment.EFCore/Repository/CustomizeCheckoutTempRepository.cs @@ -267,7 +267,7 @@ namespace CompanyManagment.EFCore.Repository EmployeeLName = x.EmployeeLName, EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(), LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(), - FineDeduction = x.FineDeduction.ToMoney(), + FineDeduction = x.FineDeduction.ToMoney(), FineViewModelList = x.CheckoutFines.Select(y => new FineViewModel() { Amount = y.Amount, @@ -276,17 +276,14 @@ namespace CompanyManagment.EFCore.Repository }).ToList(), InstallmentViewModels = x.CustomizeCheckoutLoanInstallments.Select(i => new LoanInstallmentViewModel() { - //موقتا مبلغ کل وام بجای قسط ارسال شده است - Amount = i.LoanAmount, + Amount = i.AmountForMonth, AmountDouble = i.AmountForMonth.MoneyToDouble(), Year = i.Year, Month = i.Month, IsActive = i.IsActive, RemainingAmount = i.LoanRemaining, LoanAmount = i.LoanAmount - - - }).ToList(), + }).ToList(), RewardViewModels = x.CustomizeCheckoutRewards.Select(r => new RewardViewModel() { IsActive = r.IsActive, @@ -345,42 +342,46 @@ namespace CompanyManagment.EFCore.Repository if (date == null) return new(); - var startDate = date.ContractStartGr.AddMonthsFa(0, out _).ToGeorgianDateTime().Date; - var endDate = startDate.AddMonthsFa(1, out _).ToGeorgianDateTime().Date.AddTicks(-1); + var startDate = date.ContractStartGr.Date; + var endDate = date.ContractEndGr.AddDays(1).Date.AddTicks(-1); List personnelRollCalls = _rollCallRepository - .GetEmployeeRollCallsInDates(customizeCheckoutsList.Select(x => x.EmployeeId).ToList(), workshopId, startDate, endDate); + .GetEmployeeRollCallsForCustomizeCheckoutTemp(customizeCheckoutsList.Select(x => x.Id).ToList(), workshopId); int counter = 1; foreach (var checkout in customizeCheckoutsList) { checkout.PrintCounter = counter++; - //var leftwork = leftWorksList.FirstOrDefault(x => checkout.WorkshopId == x.WorkshopId && x.EmployeeId == checkout.EmployeeId); - //checkout.LeftWorkDateGr = leftwork.LeftWorkDateGr; + //var leftwork = leftWorksList.FirstOrDefault(x => checkout.WorkshopId == x.WorkshopId && x.EmployeeId == checkout.EmployeeId); + //checkout.LeftWorkDateGr = leftwork.LeftWorkDateGr; - //var employee = employees.FirstOrDefault(x => x.Id == checkout.EmployeeId); - var rollCalls = personnelRollCalls.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId); - - checkout.EmployerList = workshopEmployersList; + //var employee = employees.FirstOrDefault(x => x.Id == checkout.EmployeeId); + var rollCalls = personnelRollCalls.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId); + + checkout.EmployerList = workshopEmployersList; checkout.EmployerName = workshopEmployersList.FirstOrDefault()?.FullName ?? "-"; - checkout.MonthlyRollCall =rollCalls; + checkout.MonthlyRollCall = rollCalls; checkout.MonthlyRollCall.DailyRollCalls = rollCalls.DailyRollCalls.Select(x => { - var isInRange = x.DateTimeGr >= checkout.ContractStartGr && x.DateTimeGr <= checkout.ContractEndGr; - return new CheckoutDailyRollCallViewModel() - { - StartDate1 = isInRange ? x.StartDate1 : "", - EndDate1 = isInRange ? x.EndDate1 : "", - EndDate2 = isInRange ? x.EndDate2 : "", - StartDate2 = isInRange ? x.StartDate2 : "", - TotalWorkingHours = isInRange?x.TotalWorkingHours : "", - DayOfWeek = x.DayOfWeek, - RollCallDateFa = x.RollCallDateFa, - DateTimeGr = x.DateTimeGr, - IsSliced = isInRange && x.IsSliced - }; + var isInRange = x.DateTimeGr >= checkout.ContractStartGr && x.DateTimeGr <= checkout.ContractEndGr; + return new CheckoutDailyRollCallViewModel() + { + StartDate1 = isInRange ? x.StartDate1 : "", + EndDate1 = isInRange ? x.EndDate1 : "", + EndDate2 = isInRange ? x.EndDate2 : "", + StartDate2 = isInRange ? x.StartDate2 : "", + TotalWorkingHours = isInRange ? x.TotalWorkingHours : "", + DayOfWeek = x.DayOfWeek, + RollCallDateFa = x.RollCallDateFa, + DateTimeGr = x.DateTimeGr, + IsSliced = isInRange && x.IsSliced, + LeaveType = x.LeaveType, + IsBirthDay = x.IsBirthDay, + IsAbsent = x.IsAbsent, + IsFriday = x.IsFriday + }; }).ToList(); checkout.PersonnelCode = personnelCodeList.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId)?.PersonnelCode ?? 0; diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index 2e50865d..5fb0c3a8 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -50,7 +50,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll #region OfficialChckout public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, -CreateWorkingHoursTemp command, long leavId) +CreateWorkingHoursTemp command, bool holidayWorking) { #region Entities @@ -65,6 +65,7 @@ CreateWorkingHoursTemp command, long leavId) int numberOfFridays = 0; #endregion + //گرفتن ساعت استراحت پرسنل از تنظیمات #region breakTime @@ -81,18 +82,18 @@ CreateWorkingHoursTemp command, long leavId) StartDate = x.StartDate, EndDate = x.EndDate, ShiftSpan = (x.EndDate.Value - x.StartDate.Value), - CreationDate = x.CreationDate, + CreationDate = x.ShiftDate, }).ToList(); - List groupedRollCall = rollCallResult.GroupBy(x => x.StartDate!.Value.Date).Select(x => new GroupedRollCalls() + List groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => new GroupedRollCalls() { CreationDate = x.Key, ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value }).ToList(), - HasFriday = x.Any(s => s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value.DayOfWeek == DayOfWeek.Friday), + HasFriday = x.Any(s => s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)), SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - CalculateBreakTime(breakTime, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))), - }).ToList(); + }).OrderBy(x=>x.CreationDate).ToList(); numberOfFridays = groupedRollCall.Count(x => x.HasFriday); @@ -185,9 +186,11 @@ CreateWorkingHoursTemp command, long leavId) } int TotalDaysNoFriday = TotalContractDays - fridays; int mandatorDays = TotalContractDays - (fridays + holiday); - //***********************************// - //This Time Mandatory Hourse - double mandatoryHours = Math.Round((mandatorDays * 7.33), 2); + //if (holidayWorking) + // mandatorDays = TotalContractDays - fridays; + //***********************************// + //This Time Mandatory Hourse + double mandatoryHours = Math.Round((mandatorDays * 7.33), 2); //***********************************// var dailyFix = TimeSpan.Parse("07:20"); TimeSpan mandatoryHoursTimeSpan = new TimeSpan(7, 20, 0).Multiply(mandatorDays); @@ -246,7 +249,7 @@ CreateWorkingHoursTemp command, long leavId) int TotalContractdaysUnder30 = TotalContractDays > 30 ? 30 : TotalContractDays; if (totalHourses < mandatoryHours) { - if (command.ShiftWork == "1" || command.ShiftWork == "2" || command.ShiftWork == "4") + if (!string.IsNullOrWhiteSpace(command.ShiftWork)) { var workedHoursePerDay = totalHourses / mandatorDays; var result = (dayliFeeDouble / 7.33) * workedHoursePerDay; @@ -652,29 +655,69 @@ CreateWorkingHoursTemp command, long leavId) { #region Entityes - var midNight24 = new DateTime(item.CreationDate.Year, item.CreationDate.Month, item.CreationDate.Day, 0, 0, 0).AddDays(1); var morningWorkingTime = new TimeSpan(); var eveningWorkingTime = new TimeSpan(); var nightWorkingTime = new TimeSpan(); - DateTime morningStart = new DateTime(item.CreationDate.Year, item.CreationDate.Month, item.CreationDate.Day, 6, 0, 0); - DateTime morningEnd = new DateTime(item.CreationDate.Year, item.CreationDate.Month, item.CreationDate.Day, 14, 0, 0); - DateTime eveningStart = morningEnd; - DateTime eveningEnd = new DateTime(item.CreationDate.Year, item.CreationDate.Month, item.CreationDate.Day, 22, 0, 0); - DateTime nightStart = eveningEnd; - DateTime nightEnd = morningStart; - DateTime nightEndNextday = nightEnd.AddDays(1); - DateTime morningEndNextday = morningEnd.AddDays(1); - DateTime eveningEndNextday = eveningEnd.AddDays(1); - - #endregion foreach (var shift in item.ShiftList) { + #region DatePeriod - #region morning enter 14 <- 6 - if (shift.Start >= morningStart // 14<---<6 + var shiftDate = item.CreationDate; + if (shift.Start.Date < shiftDate.Date) + shiftDate = shiftDate.AddDays(-1); + + DateTime midNight24 = new DateTime(shiftDate.Year, shiftDate.Month, shiftDate.Day, 0, 0, 0); + DateTime morningStart = new DateTime(shiftDate.Year, shiftDate.Month, shiftDate.Day, 6, 0, 0); + DateTime morningEnd = new DateTime(shiftDate.Year, shiftDate.Month, shiftDate.Day, 14, 0, 0); + DateTime eveningStart = morningEnd; + DateTime eveningEnd = new DateTime(shiftDate.Year, shiftDate.Month, shiftDate.Day, 22, 0, 0); + DateTime nightStart = eveningEnd; + DateTime nightEnd = morningStart; + DateTime nightEndNextday = nightEnd.AddDays(1); + DateTime morningEndNextday = morningEnd.AddDays(1); + DateTime eveningEndNextday = eveningEnd.AddDays(1); + + #endregion + + #region MidNight Enter 00:00 ---> 6 + + if (shift.Start >= midNight24 // 00:00 >---> 6 + && shift.End <= morningStart) + { + nightWorkingTime = nightWorkingTime.Add(shift.End - shift.Start); + } + else if (shift.Start >= midNight24 && shift.Start < morningStart // 00:00---6--->14 + && shift.End > morningStart && shift.End <= morningEnd) + { + nightWorkingTime = nightWorkingTime.Add(morningStart - shift.Start); + morningWorkingTime = morningWorkingTime.Add(shift.End - morningStart); + } + else if (shift.Start >= midNight24 && shift.Start < morningStart// 00:00---6---14--->22 + && shift.End > morningEnd && shift.End <= eveningEnd) + { + nightWorkingTime = nightWorkingTime.Add(morningStart - shift.Start); + morningWorkingTime = morningWorkingTime.Add(new TimeSpan(8, 0, 0)); + eveningWorkingTime = eveningWorkingTime.Add(shift.End - eveningStart); + + } + else if (shift.Start >= midNight24 // 00:00---6---14----22---->6 + && shift.Start < morningStart + && shift.End > eveningEnd && shift.End <= nightEndNextday) + { + nightWorkingTime = nightWorkingTime.Add(morningStart - shift.Start); + morningWorkingTime = morningWorkingTime.Add(new TimeSpan(8, 0, 0)); + eveningWorkingTime = eveningWorkingTime.Add(new TimeSpan(8, 0, 0)); + nightWorkingTime = nightWorkingTime.Add(shift.End - eveningEnd); + + } + + #endregion + + #region morning enter 14 <- 6 + if (shift.Start >= morningStart // 14<---<6 && shift.End <= morningEnd) { morningWorkingTime = morningWorkingTime.Add(shift.End - shift.Start); @@ -784,11 +827,11 @@ CreateWorkingHoursTemp command, long leavId) TimeSpan nextDayNightSpan = (shift.End - eveningEndNextday); nightWorkingTime = nightWorkingTime.Add(nextDayNightSpan); } - #endregion + #endregion + - - } + } #region Result var result = new RotatingShiftViewModel(); diff --git a/CompanyManagment.EFCore/Repository/RollCallRepository.cs b/CompanyManagment.EFCore/Repository/RollCallRepository.cs index f8eb9e36..84f5d33a 100644 --- a/CompanyManagment.EFCore/Repository/RollCallRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallRepository.cs @@ -262,17 +262,21 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos } - //حضور غیاب گروهی از پرسنل برای پرینت گروهی فیش حقوقی غیر رسمی نهایی - public List GetEmployeeRollCallsForMonth(IEnumerable employeeIds, long workshopId, DateTime start, DateTime end) + //حضور غیاب گروهی از پرسنل برای پرینت گروهی فیش حقوقی غیر رسمی نهایی + public List GetEmployeeRollCallsForMonth(IEnumerable employeeIds, long workshopId, DateTime start, DateTime end) { - + if (workshopId == 170) + return GetEmployeeRollCallsForMonthForKababMahdi(employeeIds, workshopId, start, end); var rollCalls = _context.RollCalls.Where(x => employeeIds.Contains(x.EmployeeId) && workshopId == x.WorkshopId && x.StartDate != null && x.EndDate != null && x.RollCallModifyType != RollCallModifyType.Undefined && x.ShiftDate.Date >= start && x.ShiftDate.Date <= end).ToList(); + var leaves = _context.LeaveList.Where(x => + x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId) && x.EndLeave.Date >= start.Date && + x.StartLeave.Date <= end.Date).ToList(); var year = Convert.ToInt32(start.ToFarsi().Substring(0, 4)); var month = Convert.ToInt32(start.ToFarsi().Substring(5, 2)); @@ -292,31 +296,51 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos var lastDayOfCurrentMonth = nextMonthDate.AddDays(-1); int dateRange = (int)(lastDayOfCurrentMonth - firstDayOfCurrentMonth).TotalDays + 1; - + var employeeSettingsList = + _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId).ToList(); + var holidays = _holidayItemApplication.Search(new HolidayItemSearchModel() + { + HolidayYear = start.ToFarsiYear() + }); //all the dates from start to end, to be compared with present days to get absent dates - var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => start.AddDays(offset).Date); + var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => start.AddDays(offset).Date).ToList(); List result = new(); foreach (var employeeId in employeeIds) { - - var absentRecords = completeDaysList.Where(x => !rollCalls.Any(y => y.EmployeeId == employeeId && x.Date.Date == y.ShiftDate.Date)) - .Select(x => new CheckoutDailyRollCallViewModel() + var settings = employeeSettingsList.FirstOrDefault(x => x.EmployeeId == employeeId); + var worksInFriday = settings.FridayWork != FridayWork.Default; + var worksInHolidays = settings.HolidayWork != HolidayWork.Default; + var absentRecords = completeDaysList.Where(x => + !rollCalls.Any(y => y.EmployeeId == employeeId && x.Date.Date == y.ShiftDate.Date)) + .Select(x => { - StartDate1 = null, - EndDate1 = null, - DateTimeGr = x.Date, - DayOfWeek = x.Date.DayOfWeek.ToString(), - RollCallDateFa = x.Date.ToFarsi() + var leave = leaves.FirstOrDefault(y => + y.EmployeeId == employeeId && y.EndLeave.Date >= x.Date && y.StartLeave.Date <= x.Date); + var isHoliday = holidays.Any(y => y.HolidaydateGr == x.Date); + 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.ToString(), + RollCallDateFa = x.Date.ToFarsi(), + LeaveType = leave != null ? leave.LeaveType : "", + IsAbsent = leave == null && (isNormalWorkingDay || + (worksInFriday && x.Date.DayOfWeek == DayOfWeek.Friday) || + (worksInHolidays && isHoliday)) + }; }); var presentDays = rollCalls.Where(x => x.EmployeeId == employeeId).GroupBy(x => x.ShiftDate.Date).Select(x => { - var orderedRollcalls = x.OrderBy(y => y.StartDate!.Value); + var orderedRollcalls = x.OrderBy(y => y.StartDate!.Value).ToList(); return new CheckoutDailyRollCallViewModel() { - StartDate1 = orderedRollcalls.FirstOrDefault().StartDate.Value.ToString("HH:mm"), - EndDate1 = orderedRollcalls.FirstOrDefault().EndDate.Value.ToString("HH:mm"), + StartDate1 = orderedRollcalls.FirstOrDefault()?.StartDate?.ToString("HH:mm"), + EndDate1 = orderedRollcalls.FirstOrDefault()?.EndDate?.ToString("HH:mm"), StartDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.StartDate?.ToString("HH:mm") ?? "", EndDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.EndDate?.ToString("HH:mm") ?? "", @@ -326,7 +350,8 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(), RollCallDateFa = x.Key.Date.ToFarsi(), DateTimeGr = x.Key.Date, - IsSliced = x.Count() > 2 + IsSliced = x.Count() > 2, + IsAbsent = false }; }); presentDays = presentDays.Select(x => new CheckoutDailyRollCallViewModel @@ -340,12 +365,17 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos RollCallDateFa = x.RollCallDateFa, DateTimeGr = x.DateTimeGr, IsSliced = x.IsSliced, + IsAbsent = false }); List checkoutDailyRollCalls = presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList(); - + checkoutDailyRollCalls.ForEach(x => + { + x.IsFriday = x.DateTimeGr.DayOfWeek == DayOfWeek.Friday; + x.IsHoliday = holidays.Any(y => y.HolidaydateGr == x.DateTimeGr); + }); var resultItem = new PersonnelCheckoutDailyRollCallViewModel() { EmployeeId = employeeId, @@ -1392,5 +1422,278 @@ public class RollCallRepository : RepositoryBase, IRollCallRepos return; _context.RollCalls.RemoveRange(rollCalls); } + + public List GetEmployeeRollCallsForCustomizeCheckoutTemp(IEnumerable customizeCheckoutIds, long workshopId) + { + //if (workshopId == 170) + // return GetEmployeeRollCallsInDatesForKababMahdi(employeeIds, workshopId, start, end); + + + var checkoutJoinEmployee = _context.CustomizeCheckoutTemps.Where(x => customizeCheckoutIds.Contains(x.id)) + .Join(_context.Employees, + (customizeCheckout) => customizeCheckout.EmployeeId, + (employee) => employee.id, + ((customizeCheckout, employee) => new { customizeCheckout, employee })).Select(x => new + { + CustomizeCheckoutId = x.customizeCheckout.id, + CheckoutStart = x.customizeCheckout.ContractStart, + CheckoutEnd = x.customizeCheckout.ContractEnd, + EmployeeId = x.employee.id, + + }).ToList(); + + List result = new(); + PersianCalendar pc = new(); + foreach (var join in checkoutJoinEmployee) + { + var start = join.CheckoutStart; + var end = join.CheckoutEnd; + var employeeId = join.EmployeeId; + + var rollCalls = _context.RollCalls.Where(x => + employeeId == x.EmployeeId && workshopId == x.WorkshopId && x.StartDate != null && + x.EndDate != null && x.ShiftDate.Date >= start && x.ShiftDate.Date <= end).ToList(); + + var leaves = _context.LeaveList.Where(x => + x.WorkshopId == workshopId && employeeId == x.EmployeeId && x.EndLeave.Date >= start.Date && + x.StartLeave.Date <= end.Date && x.PaidLeaveType == "روزانه").ToList(); + + + var employeeSettingsList = + _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId) + .ToList(); + + var endOfMonth = start.AddMonthsFa(1, out _).ToGeorgianDateTime().Date.AddTicks(-1); + int dateRange = (int)(endOfMonth.Date - start).TotalDays + 1; + + var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => start.AddDays(offset).Date).ToList(); + var holidays = _holidayItemApplication.Search(new HolidayItemSearchModel() + { + HolidayYear = start.ToFarsiYear() + }); + + var settings = employeeSettingsList.FirstOrDefault(x => x.EmployeeId == employeeId); + var birthDay = _context.Employees.Where(x => x.id == employeeId).Select(x => x.DateOfBirth).First(); + var worksInFriday = settings.FridayWork != FridayWork.Default; + var worksInHolidays = settings.HolidayWork != HolidayWork.Default; + var absentRecords = completeDaysList.Where(x => + !rollCalls.Any(y => y.EmployeeId == employeeId && x.Date.Date == y.ShiftDate.Date)) + .Select(x => + { + var leave = leaves.FirstOrDefault(y => + y.EmployeeId == employeeId && y.EndLeave.Date >= x.Date && y.StartLeave.Date <= x.Date); + var isHoliday = holidays.Any(y => y.HolidaydateGr == x.Date); + var isFriday = x.Date.DayOfWeek == DayOfWeek.Friday; + var isNormalWorkingDay = isHoliday == false && isFriday == false; + var isInContractRange = x <= end && x >= start; + return new CheckoutDailyRollCallViewModel() + { + StartDate1 = null, + EndDate1 = null, + DateTimeGr = x.Date.Date, + DayOfWeek = x.Date.DayOfWeek.ToString(), + RollCallDateFa = x.Date.ToFarsi(), + LeaveType = leave != null ? leave.LeaveType : "", + IsAbsent = leave == null && isInContractRange && (isNormalWorkingDay || + (worksInFriday && x.Date.DayOfWeek == + DayOfWeek.Friday) || + (worksInHolidays && isHoliday)) + }; + }); + + var presentDays = rollCalls.Where(x => x.EmployeeId == employeeId).GroupBy(x => x.ShiftDate.Date).Select( + x => + { + var orderedRollcalls = x.OrderBy(y => y.ShiftDate).ToList(); + return new CheckoutDailyRollCallViewModel() + { + StartDate1 = orderedRollcalls.FirstOrDefault()?.StartDate?.ToString("HH:mm"), + EndDate1 = orderedRollcalls.FirstOrDefault()?.EndDate?.ToString("HH:mm"), + + StartDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.StartDate?.ToString("HH:mm") ?? "", + EndDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.EndDate?.ToString("HH:mm") ?? "", + + TotalhourseSpan = + new TimeSpan(x.Where(y => y.EndDate != null) + .Sum(y => (y.EndDate - y.StartDate)!.Value.Ticks)), + 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.ToString("00")}", + DayOfWeek = x.DayOfWeek, + RollCallDateFa = x.RollCallDateFa, + DateTimeGr = x.DateTimeGr, + IsSliced = x.IsSliced, + IsAbsent = false + + + }); + + List checkoutDailyRollCalls = + presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList(); + + checkoutDailyRollCalls.ForEach(x => + { + x.IsFriday = x.DateTimeGr.DayOfWeek == DayOfWeek.Friday; + x.IsHoliday = holidays.Any(y => y.HolidaydateGr == x.DateTimeGr); + x.IsBirthDay = workshopId == 170 && pc.GetMonth(x.DateTimeGr) == pc.GetMonth(birthDay) && pc.GetDayOfMonth(x.DateTimeGr) == pc.GetDayOfMonth(birthDay); + }); + + var resultItem = new PersonnelCheckoutDailyRollCallViewModel() + { + EmployeeId = employeeId, + WorkshopId = workshopId, + DailyRollCalls = checkoutDailyRollCalls + }; + result.Add(resultItem); + + } + + return result; + + } + + //حضور غیاب گروهی از پرسنل برای پرینت گروهی فیش حقوقی غیر رسمی نهایی + public List GetEmployeeRollCallsForMonthForKababMahdi(IEnumerable employeeIds, long workshopId, DateTime start, DateTime end) + { + + + + var rollCalls = _context.RollCalls.Where(x => + employeeIds.Contains(x.EmployeeId) && workshopId == x.WorkshopId && x.StartDate != null && + x.EndDate != null && x.RollCallModifyType != RollCallModifyType.Undefined && + x.ShiftDate.Date >= start && x.ShiftDate.Date <= end).ToList(); + + var leaves = _context.LeaveList.Where(x => + x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId) && x.EndLeave.Date >= start.Date && + x.StartLeave.Date <= end.Date).ToList(); + + var employees = _context.Employees.Where(x => employeeIds.Contains(x.id)).Select(x => new { Id = x.id, x.DateOfBirth }).ToList(); + var year = Convert.ToInt32(start.ToFarsi().Substring(0, 4)); + var month = Convert.ToInt32(start.ToFarsi().Substring(5, 2)); + 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 employeeSettingsList = + _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery().Where(x => x.WorkshopId == workshopId).ToList(); + var holidays = _holidayItemApplication.Search(new HolidayItemSearchModel() + { + HolidayYear = start.ToFarsiYear() + }); + //all the dates from start to end, to be compared with present days to get absent dates + var completeDaysList = Enumerable.Range(0, dateRange).Select(offset => start.AddDays(offset).Date).ToList(); + PersianCalendar pc = new(); + + List result = new(); + foreach (var employeeId in employeeIds) + { + var settings = employeeSettingsList.FirstOrDefault(x => x.EmployeeId == employeeId); + var worksInFriday = settings.FridayWork != FridayWork.Default; + var worksInHolidays = settings.HolidayWork != HolidayWork.Default; + var birthDay = employees.First(x => x.Id == employeeId).DateOfBirth; + var absentRecords = completeDaysList.Where(x => + !rollCalls.Any(y => y.EmployeeId == employeeId && x.Date.Date == y.ShiftDate.Date)) + .Select(x => + { + var leave = leaves.FirstOrDefault(y => + y.EmployeeId == employeeId && y.EndLeave.Date >= x.Date && y.StartLeave.Date <= x.Date); + var isHoliday = holidays.Any(y => y.HolidaydateGr == x.Date); + var isFriday = x.Date.DayOfWeek == DayOfWeek.Friday; + var isBirthday = pc.GetMonth(x) == pc.GetMonth(birthDay) && pc.GetDayOfMonth(x) == pc.GetDayOfMonth(birthDay); + var isNormalWorkingDay = isHoliday == false && isFriday == false; + return new CheckoutDailyRollCallViewModel() + { + StartDate1 = null, + EndDate1 = null, + DateTimeGr = x.Date, + DayOfWeek = x.Date.DayOfWeek.ToString(), + RollCallDateFa = x.Date.ToFarsi(), + LeaveType = leave != null ? leave.LeaveType : "", + IsAbsent = leave == null && (isNormalWorkingDay || + (worksInFriday && x.Date.DayOfWeek == DayOfWeek.Friday) || + (worksInHolidays && isHoliday)), + IsBirthDay = isBirthday + }; + }); + var presentDays = rollCalls.Where(x => x.EmployeeId == employeeId).GroupBy(x => x.ShiftDate.Date).Select(x => + { + var orderedRollcalls = x.OrderBy(y => y.StartDate!.Value).ToList(); + return new CheckoutDailyRollCallViewModel() + { + StartDate1 = orderedRollcalls.FirstOrDefault()?.StartDate?.ToString("HH:mm"), + EndDate1 = orderedRollcalls.FirstOrDefault()?.EndDate?.ToString("HH:mm"), + + StartDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.StartDate?.ToString("HH:mm") ?? "", + EndDate2 = orderedRollcalls.Skip(1).FirstOrDefault()?.EndDate?.ToString("HH:mm") ?? "", + + TotalhourseSpan = + new TimeSpan(x.Where(y => y.EndDate != null).Sum(y => (y.EndDate - y.StartDate)!.Value.Ticks)), + DayOfWeek = x.Key.DayOfWeek.DayOfWeeKToPersian(), + RollCallDateFa = x.Key.Date.ToFarsi(), + DateTimeGr = x.Key.Date, + IsSliced = x.Count() > 2, + IsAbsent = false, + IsBirthDay = pc.GetMonth(x.Key) == pc.GetMonth(birthDay) && pc.GetDayOfMonth(x.Key) == pc.GetDayOfMonth(birthDay) + }; + }); + 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.ToString("00")}", + DayOfWeek = x.DayOfWeek, + RollCallDateFa = x.RollCallDateFa, + DateTimeGr = x.DateTimeGr, + IsSliced = x.IsSliced, + IsAbsent = false, + IsBirthDay = x.IsBirthDay + }); + + List checkoutDailyRollCalls = presentDays.Concat(absentRecords).OrderBy(x => x.DateTimeGr).ToList(); + + checkoutDailyRollCalls.ForEach(x => + { + x.IsFriday = x.DateTimeGr.DayOfWeek == DayOfWeek.Friday; + x.IsHoliday = holidays.Any(y => y.HolidaydateGr == x.DateTimeGr); + }); + var resultItem = new PersonnelCheckoutDailyRollCallViewModel() + { + EmployeeId = employeeId, + WorkshopId = workshopId, + DailyRollCalls = checkoutDailyRollCalls + }; + result.Add(resultItem); + } + + + return result; + + + } } diff --git a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs index 55877021..e71cfade 100644 --- a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs +++ b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs @@ -80,7 +80,7 @@ public class YearlySalaryRepository : RepositoryBase, IYearl //محاسبه حقوق ماهیانه عیدی و پاداش ، سنوات #region GetMontlyBunosYears public MontlywageBunosYearsViewModel GetMontlyBunosYears(TimeSpan weeklyTime, DateTime contractStart, DateTime contractEnd, double daylyWage, - string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete) + string weeklyWorkingTime, int officialholiday, int friday, string totalHoursH, string totalHorsM, string basic, int fridayStartToEnd, double dayliFeeComplete, bool hasRollCall, bool holidaysWorking) { double basicDouble = basic.MoneyToDouble(); double sub = 0; @@ -117,6 +117,9 @@ public class YearlySalaryRepository : RepositoryBase, IYearl //var MandatoryDays = TotalDays - friday - officialholiday; var MandatoryDays = TotalDays - fridayStartToEnd; + //اگر حضورغیاب داشت + if(hasRollCall) + MandatoryDays = TotalDays - fridayStartToEnd - officialholiday; //بدست آوردن ساعت موظفی این ماه var TotalMandatoryHours = MandatoryDays * 7.33;//ساعت موظفی این ماه @@ -479,7 +482,7 @@ public class YearlySalaryRepository : RepositoryBase, IYearl double computeResult = 0; //تعداد روزهای قرارداد - + if (weeklyWorkingTime == "24 - 12" || weeklyWorkingTime == "24 - 24" || weeklyWorkingTime == "36 - 12" || weeklyWorkingTime == "48 - 24") @@ -553,6 +556,7 @@ public class YearlySalaryRepository : RepositoryBase, IYearl double weeklyTime = 0; try { + weeklyTime = double.Parse(weeklyWorkingTime, CultureInfo.InvariantCulture); } catch (Exception e) diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Create.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Create.cshtml index 2db2a457..6c77c1e6 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Create.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Create.cshtml @@ -699,7 +699,7 @@ e.preventDefault(); e.stopImmediatePropagation(); $.ajax({ - async: false, + //async: false, type: "POST", url: $(this).attr('action'), data: $(this).serialize(), diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs index 132eb778..1fd81766 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs @@ -272,8 +272,11 @@ public class IndexModel : PageModel var mandatoryCompute = MandatoryHours(workingHours,false, 0); + if (contract.EmployeeId == 9659) + mandatoryCompute.SumTime44 = "48 - 24"; - var employee = _employeeApplication.GetDetails(contract.EmployeeId); + + var employee = _employeeApplication.GetDetails(contract.EmployeeId); var workshop = _workshopApplication.GetDetails(contract.WorkshopIds); var officialHoliday = mandatoryCompute.OfficialHoliday; var Friday = int.Parse(mandatoryCompute.NumberOfFriday); @@ -286,7 +289,9 @@ public class IndexModel : PageModel var familyAllowanceDouble = mandatoryCompute.FamilyAllowance.MoneyToDouble(); var overTimeWorking = _yearlySalaryRepository.GetOverTimeWorking(dayliWage, mandatoryCompute.OverTimeWorkH, mandatoryCompute.OverTimeWorkM); - var overNightWorking = _yearlySalaryRepository.GetOverNightWorking(dayliWage, + + + var overNightWorking = _yearlySalaryRepository.GetOverNightWorking(dayliWage, mandatoryCompute.OverNightWorkH, mandatoryCompute.OverNightWorkM, mandatoryCompute.SumTime44, officialHoliday, Friday, separation.ContractStartGr, separation.ContractEndGr, totalHoursH, totalHoursM); @@ -441,7 +446,7 @@ public class IndexModel : PageModel { mandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId, contract.WorkshopIds, - separation.ContractStartGr, separation.ContractEndGr, workingHours, 0); + separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking); } else { @@ -456,7 +461,9 @@ public class IndexModel : PageModel var employee = _employeeApplication.GetDetails(contract.EmployeeId); - + if (contract.EmployeeId == 9659) + mandatoryCompute.SumTime44 = "48 - 24"; + var officialHoliday = mandatoryCompute.OfficialHoliday; var Friday = int.Parse(mandatoryCompute.NumberOfFriday); var fridayStartToEnd = mandatoryCompute.FridayStartToEnd; @@ -470,7 +477,9 @@ public class IndexModel : PageModel var marriedAllowanceDouble = mandatoryCompute.MarriedAllowance.MoneyToDouble(); var overTimeWorking = _yearlySalaryRepository.GetOverTimeWorking(dayliWage, mandatoryCompute.OverTimeWorkH, mandatoryCompute.OverTimeWorkM); - var overNightWorking = _yearlySalaryRepository.GetOverNightWorking(dayliWage, + + + var overNightWorking = _yearlySalaryRepository.GetOverNightWorking(dayliWage, mandatoryCompute.OverNightWorkH, mandatoryCompute.OverNightWorkM, mandatoryCompute.SumTime44, officialHoliday, Friday, separation.ContractStartGr, separation.ContractEndGr, totalHoursH, totalHoursM); @@ -548,7 +557,7 @@ public class IndexModel : PageModel { foundMandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId, contract.WorkshopIds, - found.ContractStart, found.ContractEnd, foundWorkingHours, 0); + found.ContractStart, found.ContractEnd, foundWorkingHours, workshop.WorkshopHolidayWorking); } else @@ -561,7 +570,7 @@ public class IndexModel : PageModel _yearlySalaryRepository.GetMontlyBunosYears(foundMandatoryCompute.weeklyTime, found.ContractStart, found.ContractEnd, foundMandatoryCompute.SalaryCompute.MoneyToDouble(), foundMandatoryCompute.SumTime44, foundMandatoryCompute.OfficialHoliday, int.Parse(foundMandatoryCompute.NumberOfFriday), foundMandatoryCompute.TotalHolidayAndNotH, foundMandatoryCompute.TotalHolidayAndNotM, - foundMandatoryCompute.Basic, foundMandatoryCompute.FridayStartToEnd, foundMandatoryCompute.DayliFeeComplete); + foundMandatoryCompute.Basic, foundMandatoryCompute.FridayStartToEnd, foundMandatoryCompute.DayliFeeComplete, hasRollCall, workshop.WorkshopHolidayWorking); double foundMontlySalary = MontlyYearsBunos.MontlyWage; int foundTotaldays = Convert.ToInt32(MontlyYearsBunos.SumOfWorkingDay); double foundDayliWage = foundMontlySalary / foundTotaldays; @@ -670,6 +679,7 @@ public class IndexModel : PageModel TotalDayOfLeaveCompute = leavePayNew.TotalDayOfLeaveCompute, TotalDayOfYearsCompute = yearsPay.YearsPay > 0 ? $"{yearsPay.TotalDayCompute}" : "0", TotalDayOfBunosesCompute = bunosesPay.Bunoses > 0 ? $"{bunosesPay.TotalDayCompute}" : "0", + HolidayWorking = workshop.WorkshopHolidayWorking, }; _checkoutApplication.Create(command); diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutTemporary.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutTemporary.cshtml index 596de840..c3022456 100644 --- a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutTemporary.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutTemporary.cshtml @@ -238,277 +238,370 @@ -
-
-
- - - - - - - - - - - - - - - @for (int i = 0; i < 15; i++) - { - - - - - - - - - - - } - -
تاریخورودخروجورودخروجاستراحتمنقطعساعت کارکرد
@Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.ToFarsi() - @Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.DayOfWeek.DayOfWeeKToPersian()@Model.MonthlyRollCall.DailyRollCalls[i].StartDate1@Model.MonthlyRollCall.DailyRollCalls[i].EndDate1@Model.MonthlyRollCall.DailyRollCalls[i].StartDate2@Model.MonthlyRollCall.DailyRollCalls[i].EndDate2@Model.MonthlyRollCall.DailyRollCalls[i].BreakTimeString - @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsSliced) - { - - - - - } - else - { - - - } - @Model.MonthlyRollCall.DailyRollCalls[i].TotalWorkingHours
-
-
- - - - - - - - - - - - - - - @{ - Model.MonthlyRollCall.DailyRollCalls = Model.MonthlyRollCall.DailyRollCalls.Skip(15).ToList(); - } - @foreach (var day in Model.MonthlyRollCall.DailyRollCalls) - { - - - - - - - - - - - } - -
تاریخورودخروجورودخروجاستراحتمنقطعساعت کارکرد
@day.DateTimeGr.ToFarsi() - @day.DateTimeGr.DayOfWeek.DayOfWeeKToPersian()@day.StartDate1@day.EndDate1@day.StartDate2@day.EndDate2@day.BreakTimeString - @if (day.IsSliced) - { - - - - - } - else - { - - - } - @day.TotalWorkingHours
+
+
+
+ + + + + + + + + + + + + + + @for (int i = 0; i < 15; i++) + { + + + @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsAbsent) + { + + + } + else + { + @if (string.IsNullOrWhiteSpace(Model.MonthlyRollCall.DailyRollCalls[i].LeaveType)) + { + + + + + } + else + { + + + } + } + + + + + + } + +
تاریخورودخروجورودخروجاستراحتمنقطعساعت کارکرد
@Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.ToFarsi() - @Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.DayOfWeek.DayOfWeeKToPersian() +
+
+ + غیبت + +
+
+
+
+
+@* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+
+
@Model.MonthlyRollCall.DailyRollCalls[i].StartDate1@Model.MonthlyRollCall.DailyRollCalls[i].EndDate1@Model.MonthlyRollCall.DailyRollCalls[i].StartDate2@Model.MonthlyRollCall.DailyRollCalls[i].EndDate2 +
+ + @Model.MonthlyRollCall.DailyRollCalls[i].LeaveType + +
+
+
+ @* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+
@Model.MonthlyRollCall.DailyRollCalls[i].BreakTimeString + @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsSliced) + { + + + + + } + else + { + - + } + @Model.MonthlyRollCall.DailyRollCalls[i].TotalWorkingHours
+
+
+ + + + + + + + + + + + + + + @{ + Model.MonthlyRollCall.DailyRollCalls = Model.MonthlyRollCall.DailyRollCalls.Skip(15).ToList(); + } + @foreach (var day in Model.MonthlyRollCall.DailyRollCalls) + { + + + @if (day.IsAbsent) + { + + + } + else + { + @if (string.IsNullOrWhiteSpace(day.LeaveType)) + { + + + + + } + else + { + + + } + } + + + + + + } + +
تاریخورودخروجورودخروجاستراحتمنقطعساعت کارکرد
@day.DateTimeGr.ToFarsi() - @day.DateTimeGr.DayOfWeek.DayOfWeeKToPersian() +
+
+ + غیبت + +
+
+
+
+
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+
+
@day.StartDate1@day.EndDate1@day.StartDate2@day.EndDate2 +
+ + @day.LeaveType + +
+
+
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+
@day.BreakTimeString + @if (day.IsSliced) + { + + + + + } + else + { + - + } + @day.TotalWorkingHours
+
-
-
-
- @* +
+
+ @*
- - - + + + - - - - @for (int i = 0; i < 5; i++) - { - - - - } -
ردیف
- @(indexTable = indexTable + 1) -
*@ - -
- - - - - - + + + + @for (int i = 0; i < 5; i++) + { + + + + } +
ردیف
+ @(indexTable = indexTable + 1) +
*@ - - جریمه ها - +
+ + + + + + - - - - - + + + - @for (int i = 0; i < 7; i++) - { - - - - - - } + + + + + -
تاریخعنوانمبلغ
جریمه ها
- @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count - ? Model.FineViewModelList[i]?.FineDate ?? "" - : "") - -
- @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count - ? Model.FineViewModelList[i]?.Title ?? "" - : "") -
-
- @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count - ? Model.FineViewModelList[i]?.Amount ?? "" - : "") -
تاریخعنوانمبلغ
+ @for (int i = 0; i < 7; i++) + { + + + @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count + ? Model.FineViewModelList[i]?.FineDate ?? "" + : "") + + +
+ @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count + ? Model.FineViewModelList[i]?.Title ?? "" + : "") +
+ + + @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count + ? Model.FineViewModelList[i]?.Amount ?? "" + : "") + + + } - - - - - +
- - مساعده - + + + + + - - - - + + + - @for (int i = 0; i < 7; 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 < 7; 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 < 7; i++) - { - - - - - } + + + + -
مبلغ کل واممبلغ باقیمانده وام
وام
- @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count - ? Model.InstallmentViewModels[i]?.Amount ?? "" - : "") - - @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count - ? Model.InstallmentViewModels[i]?.RemainingAmount ?? "" - : "") -
مبلغ کل واممبلغ باقیمانده وام
+ @for (int i = 0; i < 7; i++) + { + + + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count + ? Model.InstallmentViewModels[i]?.LoanAmount ?? "" + : "") + + + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count + ? Model.InstallmentViewModels[i]?.RemainingAmount ?? "" + : "") + + + } - - - - - - +
- - پاداش - + + + + + + - - - - - + + + - @for (int i = 0; i < 7; i++) - { - - - - - - } + + + + + -
تاریخعنوانمبلغ
پاداش
- @(Model.RewardViewModels != null && i < Model.RewardViewModels.Count - ? Model.RewardViewModels[i]?.GrantDateFa ?? "" - : "") - -
- @(Model.RewardViewModels != null && i < Model.RewardViewModels.Count - ? Model.RewardViewModels[i]?.Title ?? "-" - : "") -
-
- @(Model.RewardViewModels != null && i < Model.RewardViewModels.Count - ? Model.RewardViewModels[i]?.Amount ?? "" - : "") -
تاریخعنوانمبلغ
- -
-
-
- + @for (int i = 0; i < 7; i++) + { + + + @(Model.RewardViewModels != null && i < Model.RewardViewModels.Count + ? Model.RewardViewModels[i]?.GrantDateFa ?? "" + : "") + + +
+ @(Model.RewardViewModels != null && i < Model.RewardViewModels.Count + ? Model.RewardViewModels[i]?.Title ?? "-" + : "") +
+ + + @(Model.RewardViewModels != null && i < Model.RewardViewModels.Count + ? Model.RewardViewModels[i]?.Amount ?? "" + : "") + + + } + + + +
+ +
diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutUnofficial.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutUnofficial.cshtml index 278237b9..f0ba8026 100644 --- a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutUnofficial.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/PrintOneCheckoutUnofficial.cshtml @@ -240,7 +240,7 @@ -
+
@@ -259,12 +259,59 @@ @for (int i = 0; i < 15; i++) { - + - - - - + @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsAbsent) + { + + + } + else + { + @if (string.IsNullOrWhiteSpace(Model.MonthlyRollCall.DailyRollCalls[i].LeaveType)) + { + + + + + } + else + { + + + } + } + + - - - - + @if (day.IsAbsent) + { + + + } + else + { + @if (string.IsNullOrWhiteSpace(day.LeaveType)) + { + + + + + } + else + { + + + } + } +
@Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.ToFarsi() - @Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.DayOfWeek.DayOfWeeKToPersian()@Model.MonthlyRollCall.DailyRollCalls[i].StartDate1@Model.MonthlyRollCall.DailyRollCalls[i].EndDate1@Model.MonthlyRollCall.DailyRollCalls[i].StartDate2@Model.MonthlyRollCall.DailyRollCalls[i].EndDate2 +
+
+ + غیبت + +
+
+
+
+
+ @* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+
+
@Model.MonthlyRollCall.DailyRollCalls[i].StartDate1@Model.MonthlyRollCall.DailyRollCalls[i].EndDate1@Model.MonthlyRollCall.DailyRollCalls[i].StartDate2@Model.MonthlyRollCall.DailyRollCalls[i].EndDate2 +
+ + @Model.MonthlyRollCall.DailyRollCalls[i].LeaveType + +
+
+
+ @* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+
@Model.MonthlyRollCall.DailyRollCalls[i].BreakTimeString @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsSliced) @@ -305,12 +352,59 @@ } @foreach (var day in Model.MonthlyRollCall.DailyRollCalls) { -
@day.DateTimeGr.ToFarsi() - @day.DateTimeGr.DayOfWeek.DayOfWeeKToPersian()@day.StartDate1@day.EndDate1@day.StartDate2@day.EndDate2 +
+
+ + غیبت + +
+
+
+
+
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+
+
@day.StartDate1@day.EndDate1@day.StartDate2@day.EndDate2 +
+ + @day.LeaveType + +
+
+
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+
@day.BreakTimeString @if (day.IsSliced) @@ -332,7 +426,7 @@
-
+
@@ -364,19 +458,19 @@ - + جریمه ها تاریخ عنوان - مبلغ + مبلغ @for (int i = 0; i < 7; i++) { - + @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count ? Model.FineViewModelList[i]?.FineDate ?? "" @@ -405,13 +499,13 @@ - + مساعده تاریخ - مبلغ + مبلغ @for (int i = 0; i < 7; i++) @@ -422,7 +516,7 @@ ? Model.SalaryAidViewModels[i]?.SalaryAidDateTimeFa ?? "" : "") - + @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count ? Model.SalaryAidViewModels[i]?.Amount ?? "" : "") @@ -438,21 +532,21 @@ - + وام مبلغ کل وام - مبلغ باقیمانده وام + مبلغ باقیمانده وام @for (int i = 0; i < 7; i++) { - + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count - ? Model.InstallmentViewModels[i]?.Amount ?? "" + ? Model.InstallmentViewModels[i]?.LoanAmount ?? "" : "") diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutTemporaryRaw.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutTemporaryRaw.cshtml index f55a49f3..ab838fb5 100644 --- a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutTemporaryRaw.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutTemporaryRaw.cshtml @@ -220,23 +220,72 @@ تاریخ - ورود - خروج - ورود - خروج - منقطع - ساعت کارکرد + ورود + خروج + ورود + خروج + استراحت + منقطع + ساعت کارکرد @for (int i = 0; i < 15; i++) { - + @Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.ToFarsi() - @Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.DayOfWeek.DayOfWeeKToPersian() - @Model.MonthlyRollCall.DailyRollCalls[i].StartDate1 - @Model.MonthlyRollCall.DailyRollCalls[i].EndDate1 - @Model.MonthlyRollCall.DailyRollCalls[i].StartDate2 - @Model.MonthlyRollCall.DailyRollCalls[i].EndDate2 + @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsAbsent) + { + +
+
+ + غیبت + +
+
+ + +
+
+ @* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+
+ + } + else + { + @if (string.IsNullOrWhiteSpace(Model.MonthlyRollCall.DailyRollCalls[i].LeaveType)) + { + @Model.MonthlyRollCall.DailyRollCalls[i].StartDate1 + @Model.MonthlyRollCall.DailyRollCalls[i].EndDate1 + @Model.MonthlyRollCall.DailyRollCalls[i].StartDate2 + @Model.MonthlyRollCall.DailyRollCalls[i].EndDate2 + } + else + { + +
+ + @Model.MonthlyRollCall.DailyRollCalls[i].LeaveType + +
+ + +
+ @* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+ + } + } + + @Model.MonthlyRollCall.DailyRollCalls[i].BreakTimeString @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsSliced) { @@ -261,12 +310,13 @@ تاریخ - ورود - خروج - ورود - خروج - منقطع - ساعت کارکرد + ورود + خروج + ورود + خروج + استراحت + منقطع + ساعت کارکرد @@ -275,12 +325,60 @@ } @foreach (var day in Model.MonthlyRollCall.DailyRollCalls) { - + @day.DateTimeGr.ToFarsi() - @day.DateTimeGr.DayOfWeek.DayOfWeeKToPersian() - @day.StartDate1 - @day.EndDate1 - @day.StartDate2 - @day.EndDate2 + @if (day.IsAbsent) + { + +
+
+ + غیبت + +
+
+ + +
+
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+
+ + } + else + { + @if (string.IsNullOrWhiteSpace(day.LeaveType)) + { + @day.StartDate1 + @day.EndDate1 + @day.StartDate2 + @day.EndDate2 + } + else + { + +
+ + @day.LeaveType + +
+ + +
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+ + } + } + + @day.BreakTimeString @if (day.IsSliced) { @@ -332,19 +430,19 @@ - + جریمه ها تاریخ عنوان - مبلغ + مبلغ @for (int i = 0; i < 7; i++) { - + @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count ? Model.FineViewModelList[i]?.FineDate ?? "" @@ -373,13 +471,13 @@ - + مساعده تاریخ - مبلغ + مبلغ @for (int i = 0; i < 7; i++) @@ -390,7 +488,7 @@ ? Model.SalaryAidViewModels[i]?.SalaryAidDateTimeFa ?? "" : "") - + @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count ? Model.SalaryAidViewModels[i]?.Amount ?? "" : "") @@ -406,21 +504,21 @@ - + وام مبلغ کل وام - مبلغ باقیمانده وام + مبلغ باقیمانده وام @for (int i = 0; i < 7; i++) { - + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count - ? Model.InstallmentViewModels[i]?.Amount ?? "" + ? Model.InstallmentViewModels[i]?.LoanAmount ?? "" : "") diff --git a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutUnofficialRaw.cshtml b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutUnofficialRaw.cshtml index 8d8c6d1c..958ab4a1 100644 --- a/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutUnofficialRaw.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/CustomizeCheckout/_Partials/PrintDetailsCheckoutUnofficialRaw.cshtml @@ -212,95 +212,194 @@
-
-
-
- - - - - - - - - - - - - - @for (int i = 0; i < 15; i++) - { - - - - - - - - - - } - -
تاریخورودخروجورودخروجمنقطعساعت کارکرد
@Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.ToFarsi() - @Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.DayOfWeek.DayOfWeeKToPersian()@Model.MonthlyRollCall.DailyRollCalls[i].StartDate1@Model.MonthlyRollCall.DailyRollCalls[i].EndDate1@Model.MonthlyRollCall.DailyRollCalls[i].StartDate2@Model.MonthlyRollCall.DailyRollCalls[i].EndDate2 - @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsSliced) - { - - - - - } - else - { - - - } - @Model.MonthlyRollCall.DailyRollCalls[i].TotalWorkingHours
-
-
- - - - - - - - - - - - - - @{ - Model.MonthlyRollCall.DailyRollCalls = Model.MonthlyRollCall.DailyRollCalls.Skip(15).ToList(); - } - @foreach (var day in Model.MonthlyRollCall.DailyRollCalls) - { - - - - - - - - - - } - -
تاریخورودخروجورودخروجمنقطعساعت کارکرد
@day.DateTimeGr.ToFarsi() - @day.DateTimeGr.DayOfWeek.DayOfWeeKToPersian()@day.StartDate1@day.EndDate1@day.StartDate2@day.EndDate2 - @if (day.IsSliced) - { - - - - - } - else - { - - - } - @day.TotalWorkingHours
+
+
+
+ + + + + + + + + + + + + + + @for (int i = 0; i < 15; i++) + { + + + @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsAbsent) + { + + + } + else + { + @if (string.IsNullOrWhiteSpace(Model.MonthlyRollCall.DailyRollCalls[i].LeaveType)) + { + + + + + } + else + { + + + } + } + + + + + + } + +
تاریخورودخروجورودخروجاستراحتمنقطعساعت کارکرد
@Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.ToFarsi() - @Model.MonthlyRollCall.DailyRollCalls[i].DateTimeGr.DayOfWeek.DayOfWeeKToPersian() +
+
+ + غیبت + +
+ +
+
+
+
+ @* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+
+
@Model.MonthlyRollCall.DailyRollCalls[i].StartDate1@Model.MonthlyRollCall.DailyRollCalls[i].EndDate1@Model.MonthlyRollCall.DailyRollCalls[i].StartDate2@Model.MonthlyRollCall.DailyRollCalls[i].EndDate2 +
+ + @Model.MonthlyRollCall.DailyRollCalls[i].LeaveType + +
+
+
+ @* @if (Model.MonthlyRollCall.DailyRollCalls[i].IsBirthDay) + { + تولد + } *@ +
+
@Model.MonthlyRollCall.DailyRollCalls[i].BreakTimeString + @if (@Model.MonthlyRollCall.DailyRollCalls[i].IsSliced) + { + + + + + } + else + { + - + } + @Model.MonthlyRollCall.DailyRollCalls[i].TotalWorkingHours
+
+
+ + + + + + + + + + + + + + + @{ + Model.MonthlyRollCall.DailyRollCalls = Model.MonthlyRollCall.DailyRollCalls.Skip(15).ToList(); + } + @foreach (var day in Model.MonthlyRollCall.DailyRollCalls) + { + + + @if (day.IsAbsent) + { + + + } + else + { + @if (string.IsNullOrWhiteSpace(day.LeaveType)) + { + + + + + } + else + { + + + } + } + + + + + + } + +
تاریخورودخروجورودخروجاستراحتمنقطعساعت کارکرد
@day.DateTimeGr.ToFarsi() - @day.DateTimeGr.DayOfWeek.DayOfWeeKToPersian() +
+
+ + غیبت + +
+
+
+
+
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+
+
@day.StartDate1@day.EndDate1@day.StartDate2@day.EndDate2 +
+ + @day.LeaveType + +
+
+
+ @* @if (day.IsBirthDay) + { + تولد + } *@ +
+
@day.BreakTimeString + @if (day.IsSliced) + { + + + + + } + else + { + - + } + @day.TotalWorkingHours
+
-
@@ -331,19 +430,19 @@ - + جریمه ها تاریخ عنوان - مبلغ + مبلغ @for (int i = 0; i < 7; i++) { - + @(Model.FineViewModelList != null && i < Model.FineViewModelList.Count ? Model.FineViewModelList[i]?.FineDate ?? "" @@ -372,13 +471,13 @@ - + مساعده تاریخ - مبلغ + مبلغ @for (int i = 0; i < 7; i++) @@ -389,7 +488,7 @@ ? Model.SalaryAidViewModels[i]?.SalaryAidDateTimeFa ?? "" : "") - + @(Model.SalaryAidViewModels != null && i < Model.SalaryAidViewModels.Count ? Model.SalaryAidViewModels[i]?.Amount ?? "" : "") @@ -405,21 +504,21 @@ - + وام مبلغ کل وام - مبلغ باقیمانده وام + مبلغ باقیمانده وام @for (int i = 0; i < 7; i++) { - + @(Model.InstallmentViewModels != null && i < Model.InstallmentViewModels.Count - ? Model.InstallmentViewModels[i]?.Amount ?? "" + ? Model.InstallmentViewModels[i]?.LoanAmount ?? "" : "") diff --git a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js index 2f3f7b55..28f655ca 100644 --- a/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js +++ b/ServiceHost/wwwroot/AssetsClient/pages/CustomizeCheckout/js/ModalCheckoutUnofficialCreate.js @@ -61,9 +61,11 @@ /* سلکت شدن ماه جاری */ const today = new Date(); - const jalaaliDate = jalaali.toJalaali(today.getFullYear(), today.getMonth() + 1, today.getDate()); + const jalaaliDate = jalaali.toJalaali(today.getFullYear(), today.getMonth(), today.getDate()); const currentMonth = String(jalaaliDate.jm).padStart(2, '0'); + /* const lastMonth = */ + const monthSelect = document.getElementById('month-select'); monthSelect.value = currentMonth; /* سلکت شدن ماه جاری */