From 9cd00a188624317be2ae4cda6b2835ef3c31f989 Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 7 Sep 2025 05:25:46 +0330 Subject: [PATCH 01/20] test --- CompanyManagment.App.Contracts/ContactUs/test1.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 CompanyManagment.App.Contracts/ContactUs/test1.cs diff --git a/CompanyManagment.App.Contracts/ContactUs/test1.cs b/CompanyManagment.App.Contracts/ContactUs/test1.cs new file mode 100644 index 00000000..69ed851c --- /dev/null +++ b/CompanyManagment.App.Contracts/ContactUs/test1.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CompanyManagment.App.Contracts.ContactUs +{ + class test1 + { + } +} From 1daaeff194b7f944d9f0477686e2a1b4ed35e96f Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 7 Sep 2025 05:29:07 +0330 Subject: [PATCH 02/20] test 2 --- CompanyManagment.App.Contracts/ContactUs/test2.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 CompanyManagment.App.Contracts/ContactUs/test2.cs diff --git a/CompanyManagment.App.Contracts/ContactUs/test2.cs b/CompanyManagment.App.Contracts/ContactUs/test2.cs new file mode 100644 index 00000000..f1bfb5e3 --- /dev/null +++ b/CompanyManagment.App.Contracts/ContactUs/test2.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace CompanyManagment.App.Contracts.ContactUs +{ + class test2 + { + } +} From 58c015b151737736f041451d444723022038bd3f Mon Sep 17 00:00:00 2001 From: MahanCh Date: Sun, 7 Sep 2025 17:22:01 +0330 Subject: [PATCH 03/20] fix: remove unnecessary whitespace in development environment check --- ServiceHost/Program.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/ServiceHost/Program.cs b/ServiceHost/Program.cs index bd2e195b..5df65d59 100644 --- a/ServiceHost/Program.cs +++ b/ServiceHost/Program.cs @@ -314,6 +314,7 @@ app.UseCors("AllowSpecificOrigins"); //the backend Tester if (builder.Environment.IsDevelopment()) + { using var scope = app.Services.CreateScope(); var tester = scope.ServiceProvider.GetRequiredService(); From ca350aa795bed83dfbac19732b5a7763cc365928 Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 8 Sep 2025 00:40:17 +0330 Subject: [PATCH 04/20] delete test files --- CompanyManagment.App.Contracts/ContactUs/test1.cs | 12 ------------ CompanyManagment.App.Contracts/ContactUs/test2.cs | 12 ------------ 2 files changed, 24 deletions(-) delete mode 100644 CompanyManagment.App.Contracts/ContactUs/test1.cs delete mode 100644 CompanyManagment.App.Contracts/ContactUs/test2.cs diff --git a/CompanyManagment.App.Contracts/ContactUs/test1.cs b/CompanyManagment.App.Contracts/ContactUs/test1.cs deleted file mode 100644 index 69ed851c..00000000 --- a/CompanyManagment.App.Contracts/ContactUs/test1.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CompanyManagment.App.Contracts.ContactUs -{ - class test1 - { - } -} diff --git a/CompanyManagment.App.Contracts/ContactUs/test2.cs b/CompanyManagment.App.Contracts/ContactUs/test2.cs deleted file mode 100644 index f1bfb5e3..00000000 --- a/CompanyManagment.App.Contracts/ContactUs/test2.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace CompanyManagment.App.Contracts.ContactUs -{ - class test2 - { - } -} From 1c6b0ac292a5992a455374a62fee216aab82519d Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 8 Sep 2025 01:04:02 +0330 Subject: [PATCH 05/20] test miror --- Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs index b9c58e62..1e67bc01 100644 --- a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs +++ b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs @@ -10,6 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg { public class ClassifiedSalary : EntityBase { + //test//test public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year) { Group1 = group1; From e80621280c4e60e330cf8d7d25194a852d7c2cc6 Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 8 Sep 2025 01:09:15 +0330 Subject: [PATCH 06/20] mirror test --- Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs index 1e67bc01..51beaf0b 100644 --- a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs +++ b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs @@ -10,7 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg { public class ClassifiedSalary : EntityBase { - //test//test + //test// public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year) { Group1 = group1; From 82d035b7e15aee9aaa04e45abecc89d1da2618be Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 8 Sep 2025 01:20:58 +0330 Subject: [PATCH 07/20] mirrorTest4 --- Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs index 51beaf0b..1e67bc01 100644 --- a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs +++ b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs @@ -10,7 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg { public class ClassifiedSalary : EntityBase { - //test// + //test//test public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year) { Group1 = group1; From 3b12be04b5352c0cf3ff5a5e134a6d649ba7ec99 Mon Sep 17 00:00:00 2001 From: SamSys Date: Tue, 9 Sep 2025 16:18:38 +0330 Subject: [PATCH 08/20] test defualt remote --- Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs index 1e67bc01..2de9ba33 100644 --- a/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs +++ b/Company.Domain/ClassifiedSalaryAgg/ClassifiedSalary.cs @@ -10,7 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg { public class ClassifiedSalary : EntityBase { - //test//test + //test public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year) { Group1 = group1; From f9947dc138bc93d1b10da01bceaf74e338b5a27e Mon Sep 17 00:00:00 2001 From: SamSys Date: Tue, 9 Sep 2025 18:41:16 +0330 Subject: [PATCH 09/20] change leaving time on checkout for EndOfyear or OnLeftWork Employees --- .../Contract/ComputingViewModel.cs | 4 ++++ .../Repository/CheckoutRepository.cs | 2 +- .../Repository/RollCallMandatoryRepository.cs | 14 +++++++++++++- .../Pages/Company/Checkouts/Index.cshtml.cs | 18 ++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs index 4c9478c8..ed64868b 100644 --- a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs +++ b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs @@ -61,5 +61,9 @@ public class ComputingViewModel /// public TimeSpan EmployeeMandatoryHours { get; set; } + /// + /// مجموع مرخصی های پرسنل در این فیش حقوقی + /// + public TimeSpan TotalLeaveOnThisCheckout { get; set; } //public List holidays; } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index 6b0f52d7..f05ae55b 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -1131,7 +1131,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos ch.TotalBreakTimeStr = ch.CheckoutRollCall.TotalBreakTimeSpan.ToFarsiHoursAndMinutes("-"); ch.TotalPresentTimeStr = ch.CheckoutRollCall.TotalPresentTimeSpan.ToFarsiHoursAndMinutes("-"); ch.TotalMandatoryTimeStr = ch.CheckoutRollCall.TotalMandatoryTimeSpan.ToFarsiHoursAndMinutes("-"); - ch.TotalPaidLeave = ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.ToFarsiDaysAndHoursAndMinutes("-"); + ch.TotalPaidLeave = Tools.ToFarsiHoursAndMinutes(Convert.ToInt32(ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.TotalHours), ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.Minutes, "-"); ch.MonthlyRollCall = ch.CheckoutRollCall.RollCallDaysCollection .Select(x => new CheckoutDailyRollCallViewModel { diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index 261dea2c..eb78e688 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -323,6 +323,9 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll TimeSpan totalLeaveSpan = TimeSpan.Zero; TimeSpan starndardHoursesPerTotalDaysSapn = new TimeSpan(hours, minutes, 0); + + //محموع تمام مرخصی های این ماه + TimeSpan totalLeaveOnThisCheckout = TimeSpan.Zero; if (leaveSearchResult.Count > 0 || hoursesleave.Count > 0) { if (leaveSearchResult.Any(x => x.HasShiftDuration)) @@ -342,6 +345,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll TimeSpan totalLeave = new TimeSpan(leaveSearchResult.Sum(x => x.ShiftDuration.Ticks)); totalLeave = totalLeave.Add(hoursesleaveTimeSpans); + totalLeaveOnThisCheckout = totalLeave; var totalLeaveDouble = (totalLeave.TotalMinutes) / 60; if (totalLeaveDouble > starndardHoursesPerTotalDays) { @@ -413,7 +417,11 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll totalLeaveSpan = sumLeave; } - + #region TotalLeaveOnThisCheckout + + totalLeaveOnThisCheckout = (leavingDayCout * workingPerDayAve).Add(hoursesleaveTimeSpans); + + #endregion } @@ -886,6 +894,10 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll // مرخصی استحقاقی TotalPaidLeave = totalLeaveSpan, + + // مجموع مرخصی های پرسنل در این فیش حقوقی + TotalLeaveOnThisCheckout = totalLeaveOnThisCheckout, + //مرخصی استعلاجی TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)), diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs index ff15a680..9910ae27 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs @@ -31,6 +31,7 @@ using PersianTools.Core; using ServiceHost.Hubs; using System.Diagnostics.Contracts; using WorkFlow.Application.Contracts.WorkFlow; +using System.Globalization; namespace ServiceHost.Areas.Admin.Pages.Company.Checkouts; @@ -949,6 +950,23 @@ public class IndexModel : PageModel contract.ContractEndGr, contract.WorkshopIds, contract.EmployeeId, fridayStartToEnd, officialHoliday, totalHoursH, totalHoursM, consumableItemDouble, housingAllowanceDouble, familyAllowanceDouble, marriedAllowanceDouble, workshop.IsOldContract); + + switch (computeOption) + { + case "OnEndOfYear": + var endOfYearCheckout = separation.ContractEnd.Substring(5, 2); + + mandatoryCompute.TotalPaidLeave = separation.HasLeft || endOfYearCheckout == "12" ? mandatoryCompute.TotalPaidLeave : mandatoryCompute.TotalLeaveOnThisCheckout; + break; + case "OnLeftWork": + mandatoryCompute.TotalPaidLeave = separation.HasLeft ? mandatoryCompute.TotalPaidLeave : mandatoryCompute.TotalLeaveOnThisCheckout; + break; + case "OnEndOfContract": + var startMonth = contract.ContarctStart.Substring(5, 2); + var endMonth = contract.ContractEnd.Substring(5, 2); + mandatoryCompute.TotalPaidLeave = startMonth != endMonth ? mandatoryCompute.TotalLeaveOnThisCheckout : mandatoryCompute.TotalPaidLeave; + break; + } var command = new CreateCheckout { EmployeeFullName = employee.EmployeeFullName, From c3cb3df3d3b2cca3edac6ea5e793c05e89008743 Mon Sep 17 00:00:00 2001 From: SamSys Date: Sat, 13 Sep 2025 06:29:25 +0330 Subject: [PATCH 10/20] change compute leaving model on checkout --- .../IRollCallMandatoryRepository.cs | 2 +- .../Contract/ComputingViewModel.cs | 2 +- .../RollCall/IRollCallMandatoryApplication.cs | 2 +- .../CheckoutApplication.cs | 3 +- .../RollCallMandatoryApplication.cs | 4 +- .../Repository/RollCallMandatoryRepository.cs | 22 ++--- .../Repository/YearlySalaryRepository.cs | 8 +- .../Pages/Company/Checkouts/Index.cshtml.cs | 84 +++++++++++-------- 8 files changed, 73 insertions(+), 54 deletions(-) diff --git a/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs b/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs index c1a8e006..9c77aa59 100644 --- a/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs +++ b/Company.Domain/RollCallAgg/IRollCallMandatoryRepository.cs @@ -15,7 +15,7 @@ namespace Company.Domain.RollCallAgg; public interface IRollCallMandatoryRepository : IRepository { - ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute); + ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute); /// /// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب diff --git a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs index ed64868b..3a2c0ddd 100644 --- a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs +++ b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs @@ -64,6 +64,6 @@ public class ComputingViewModel /// /// مجموع مرخصی های پرسنل در این فیش حقوقی /// - public TimeSpan TotalLeaveOnThisCheckout { get; set; } + //public TimeSpan TotalLeaveOnThisCheckout { get; set; } //public List holidays; } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs b/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs index ce101b2b..27bdb4c0 100644 --- a/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs +++ b/CompanyManagment.App.Contracts/RollCall/IRollCallMandatoryApplication.cs @@ -8,7 +8,7 @@ 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, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute); + ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute); /// /// گزارش نوبت کاری حضور غیاب diff --git a/CompanyManagment.Application/CheckoutApplication.cs b/CompanyManagment.Application/CheckoutApplication.cs index 4101295b..bd4fca43 100644 --- a/CompanyManagment.Application/CheckoutApplication.cs +++ b/CompanyManagment.Application/CheckoutApplication.cs @@ -184,7 +184,8 @@ public class CheckoutApplication : ICheckoutApplication { command.AbsenceDeduction = command.AbsenceDeduction - command.OvertimePay; command.OvertimePay = 0; - } + command.OverTimeWorkValue = "00:00"; + } else { command.OvertimePay = command.OvertimePay - command.AbsenceDeduction; diff --git a/CompanyManagment.Application/RollCallMandatoryApplication.cs b/CompanyManagment.Application/RollCallMandatoryApplication.cs index 617b906e..25e46b9f 100644 --- a/CompanyManagment.Application/RollCallMandatoryApplication.cs +++ b/CompanyManagment.Application/RollCallMandatoryApplication.cs @@ -21,9 +21,9 @@ 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, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute) + public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute,bool totalLeaveCompute) { - return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute); + return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, totalLeaveCompute); } public async Task RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd, diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index eb78e688..a4aaf37f 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -67,7 +67,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll #region OfficialChckout public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, - CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute) + CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute) { #region Entities @@ -325,7 +325,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll TimeSpan starndardHoursesPerTotalDaysSapn = new TimeSpan(hours, minutes, 0); //محموع تمام مرخصی های این ماه - TimeSpan totalLeaveOnThisCheckout = TimeSpan.Zero; + //TimeSpan totalLeaveOnThisCheckout = TimeSpan.Zero; if (leaveSearchResult.Count > 0 || hoursesleave.Count > 0) { if (leaveSearchResult.Any(x => x.HasShiftDuration)) @@ -345,9 +345,11 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll TimeSpan totalLeave = new TimeSpan(leaveSearchResult.Sum(x => x.ShiftDuration.Ticks)); totalLeave = totalLeave.Add(hoursesleaveTimeSpans); - totalLeaveOnThisCheckout = totalLeave; + //totalLeaveOnThisCheckout = totalLeave; var totalLeaveDouble = (totalLeave.TotalMinutes) / 60; - if (totalLeaveDouble > starndardHoursesPerTotalDays) + + //اگر مدت مرخصی از مجاز بیشتر بود و مدل محاسبه کامل نبود + if (totalLeaveDouble > starndardHoursesPerTotalDays && !totalLeaveCompute) { sumSpans = sumSpans.Add(starndardHoursesPerTotalDaysSapn); @@ -406,7 +408,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll } - if (sumLeave > starndardHoursesPerTotalDaysSapn) + if (sumLeave > starndardHoursesPerTotalDaysSapn && !totalLeaveCompute) { sumSpans = sumSpans.Add(starndardHoursesPerTotalDaysSapn); totalLeaveSpan = starndardHoursesPerTotalDaysSapn; @@ -417,11 +419,11 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll totalLeaveSpan = sumLeave; } - #region TotalLeaveOnThisCheckout + //#region TotalLeaveOnThisCheckout - totalLeaveOnThisCheckout = (leavingDayCout * workingPerDayAve).Add(hoursesleaveTimeSpans); + //totalLeaveOnThisCheckout = (leavingDayCout * workingPerDayAve).Add(hoursesleaveTimeSpans); - #endregion + //#endregion } @@ -895,8 +897,8 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll // مرخصی استحقاقی TotalPaidLeave = totalLeaveSpan, - // مجموع مرخصی های پرسنل در این فیش حقوقی - TotalLeaveOnThisCheckout = totalLeaveOnThisCheckout, + //// مجموع مرخصی های پرسنل در این فیش حقوقی + //TotalLeaveOnThisCheckout = totalLeaveOnThisCheckout, //مرخصی استعلاجی TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)), diff --git a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs index e148e46a..1f0278a5 100644 --- a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs +++ b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs @@ -2133,6 +2133,7 @@ public class YearlySalaryRepository : RepositoryBase, IYearl else if (isOldContract && contractEnd > start1403) { var startDate = startWorkDate >= start1403 ? startWorkDate : start1403; + var endOfYearRes = EndOfYearCantoleaveList(startDate, separationEndDate, workshopId, employeeId, hasleft, leftWorkDate, fridayStartToEnd, officialHoliday, totalHoursH, totalHorsM, separationStartDate) .FirstOrDefault(x => x.ContractStart == separationStartDate); @@ -2141,12 +2142,13 @@ public class YearlySalaryRepository : RepositoryBase, IYearl var end = EndOfYearCantoleaveList(startDate, separationEndDate, workshopId, employeeId, hasleft, leftWorkDate, fridayStartToEnd, officialHoliday, totalHoursH, totalHorsM, separationStartDate); + //وضعیت تصفیه مزد مرخصی result.LeaveCheckout = true; var canTolv = endOfYearRes.CanToLeave; - var absence = end.Sum(x => x.PeriodOfAbsence); + var absence = end.Where(x=>x.ContractStart >= startDayOfYearGr).Sum(x => x.PeriodOfAbsence); if (canTolv >= absence) { @@ -2208,8 +2210,8 @@ public class YearlySalaryRepository : RepositoryBase, IYearl separationStartDate); var canTolv = endOfYearRes.CanToLeave; - var absence = end.Sum(x => x.PeriodOfAbsence); - if (canTolv >= absence) + var absence = end.Where(x => x.ContractStart >= startDayOfYearGr).Sum(x => x.PeriodOfAbsence); + if (canTolv >= absence) { canTolv -= absence; absence = 0; diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs index 9910ae27..9dc85a10 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs @@ -767,9 +767,51 @@ public class IndexModel : PageModel var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(contract.Id); var separation = _contractApplication.contractSeparation(ConvertYear, ConvertMonth, contract.ContractStartGr, contract.ContractEndGr, contract.EmployeeId, contract.WorkshopIds); - + if (separation.checker) { + //workshopInfo + var workshop = _workshopApplication.GetDetails(contract.WorkshopIds); + + var employeeOptions = + _employeeComputeOptionsApplication.GetAllByWorkshopId(contract.WorkshopIds); + var getYearsOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId); + var yearsOption = getYearsOption == null ? workshop.YearsOptions : getYearsOption.YearsOptions; + var getBonusesOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId); + var bonusesOption = getBonusesOption == null + ? workshop.BonusesOptions + : getBonusesOption.BonusesOptions; + var getComputeOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId); + var computeOption = getComputeOption == null + ? workshop.ComputeOptions + : getComputeOption.ComputeOptions; + //آیا کل مرخصی به ساعت کاراضافه شود؟ + bool totalLeaveCompute = false; + //آیا غیبت محاسبه شود؟ + bool abcenseDeduction = false; + switch (computeOption) + { + case "OnEndOfYear": + var endOfYearCheckout = separation.ContractEnd.Substring(5, 2); + + + totalLeaveCompute = true; + abcenseDeduction = separation.HasLeft || endOfYearCheckout == "12"; + break; + case "OnLeftWork": + + totalLeaveCompute = true; + abcenseDeduction = separation.HasLeft; + break; + case "OnEndOfContract": + var startMonth = contract.ContarctStart.Substring(5, 2); + var endMonth = contract.ContractEnd.Substring(5, 2); + + totalLeaveCompute = startMonth == endMonth ? false : true; + abcenseDeduction = (startMonth != endMonth && separation.HasLeft) || (startMonth != endMonth && contract.ContractEndGr == separation.ContractEndGr); + break; + } + workingHours.ContractStartGr = separation.ContractStartGr; workingHours.ContractEndGr = separation.ContractEndGr; workingHours.ContarctStart = separation.ContarctStart; @@ -778,8 +820,7 @@ public class IndexModel : PageModel workingHours.GetWorkDateHide = contract.GetWorkDate; workingHours.WorkshopId = contract.WorkshopIds; workingHours.EmployeeId = contract.EmployeeId; - //workshopInfo - var workshop = _workshopApplication.GetDetails(contract.WorkshopIds); + var mandatoryCompute = new ComputingViewModel(); var hasRollCall = _rollCallEmployeeStatusApp.HasRollCallRecord(contract.EmployeeId, @@ -791,13 +832,13 @@ public class IndexModel : PageModel { mandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId, contract.WorkshopIds, - separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, false,workshop.RotatingShiftCompute); + separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, false,workshop.RotatingShiftCompute, totalLeaveCompute); } else { mandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId, contract.WorkshopIds, - separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, true,workshop.RotatingShiftCompute); + separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, true,workshop.RotatingShiftCompute, totalLeaveCompute); //var hasLeave = _leaveApplication.LeavOnChekout(separation.ContractStartGr, // separation.ContractEndGr, contract.EmployeeId, contract.WorkshopIds); //if (hasLeave != null) @@ -843,18 +884,6 @@ public class IndexModel : PageModel // workshop.ComputeOptions = "OnEndOfContract"; //} - var employeeOptions = - _employeeComputeOptionsApplication.GetAllByWorkshopId(contract.WorkshopIds); - var getYearsOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId); - var yearsOption = getYearsOption == null ? workshop.YearsOptions : getYearsOption.YearsOptions; - var getBonusesOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId); - var bonusesOption = getBonusesOption == null - ? workshop.BonusesOptions - : getBonusesOption.BonusesOptions; - var getComputeOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId); - var computeOption = getComputeOption == null - ? workshop.ComputeOptions - : getComputeOption.ComputeOptions; //سنوات var yearsPay = _yearlySalaryRepository.Years(separation.ContractStartGr, separation.LeftWorkDate, @@ -905,7 +934,7 @@ public class IndexModel : PageModel { foundMandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId, contract.WorkshopIds, - found.ContractStart, found.ContractEnd, foundWorkingHours, workshop.WorkshopHolidayWorking, false, workshop.RotatingShiftCompute); + found.ContractStart, found.ContractEnd, foundWorkingHours, workshop.WorkshopHolidayWorking, false, workshop.RotatingShiftCompute, totalLeaveCompute); } else @@ -951,22 +980,7 @@ public class IndexModel : PageModel officialHoliday, totalHoursH, totalHoursM, consumableItemDouble, housingAllowanceDouble, familyAllowanceDouble, marriedAllowanceDouble, workshop.IsOldContract); - switch (computeOption) - { - case "OnEndOfYear": - var endOfYearCheckout = separation.ContractEnd.Substring(5, 2); - - mandatoryCompute.TotalPaidLeave = separation.HasLeft || endOfYearCheckout == "12" ? mandatoryCompute.TotalPaidLeave : mandatoryCompute.TotalLeaveOnThisCheckout; - break; - case "OnLeftWork": - mandatoryCompute.TotalPaidLeave = separation.HasLeft ? mandatoryCompute.TotalPaidLeave : mandatoryCompute.TotalLeaveOnThisCheckout; - break; - case "OnEndOfContract": - var startMonth = contract.ContarctStart.Substring(5, 2); - var endMonth = contract.ContractEnd.Substring(5, 2); - mandatoryCompute.TotalPaidLeave = startMonth != endMonth ? mandatoryCompute.TotalLeaveOnThisCheckout : mandatoryCompute.TotalPaidLeave; - break; - } + var command = new CreateCheckout { EmployeeFullName = employee.EmployeeFullName, @@ -1015,7 +1029,7 @@ public class IndexModel : PageModel //مدت غیبت AbsencePeriod = leavePayNew.AbsencePeriod, //کسری غیبت - AbsenceDeduction = 0, + AbsenceDeduction = abcenseDeduction ? leavePayNew.AbsenceDeduction : 0, //وضعیت تصفیه مزد مرخصی LeaveCheckout = leavePayNew.LeaveCheckout, //میانگین ساعت کار در روز From 8eded713da045de4ab4f9e60ee233a51ea40dc2c Mon Sep 17 00:00:00 2001 From: mahan Date: Mon, 15 Sep 2025 16:12:17 +0330 Subject: [PATCH 11/20] fix: update gender handling in Create and CreateEmployee views --- 0_Framework/Application/UID/IUidService.cs | 2 +- .../Areas/Admin/Pages/Company/Employees/Create.cshtml | 6 ++++++ .../Admin/Pages/Company/Employees/CreateEmployee.cshtml | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/0_Framework/Application/UID/IUidService.cs b/0_Framework/Application/UID/IUidService.cs index 19dd0034..c2c26bd5 100644 --- a/0_Framework/Application/UID/IUidService.cs +++ b/0_Framework/Application/UID/IUidService.cs @@ -38,7 +38,7 @@ public class UidBasicInformation { "GENDER_MALE" => Application.Gender.Male, "GENDER_FEMALE" => Application.Gender.Female, - _ => throw new ArgumentOutOfRangeException() + _ => Application.Gender.None }; } public record IdentificationInformation(string NationalId, string BirthDate, string ShenasnameSeri, string ShenasnameSerial, string ShenasnamehNumber); diff --git a/ServiceHost/Areas/Admin/Pages/Company/Employees/Create.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Employees/Create.cshtml index 32b0cd0e..c0921767 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Employees/Create.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Employees/Create.cshtml @@ -571,6 +571,12 @@ } else if (response.data.gender === 1) { $('#GenderFemale').prop('checked', true); $('#soldier').prop('disabled', true); + } + else{ + $('#GenderMale').removeClass("disable"); + $('#GenderFemale').removeClass("disable"); + $('#divGender .radio-box').removeClass('disable'); + } currentStep++; showStep(currentStep); diff --git a/ServiceHost/Areas/Admin/Pages/Company/Employees/CreateEmployee.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Employees/CreateEmployee.cshtml index 4df980de..28543bbb 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Employees/CreateEmployee.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Employees/CreateEmployee.cshtml @@ -571,6 +571,11 @@ } else if (response.data.gender === 1) { $('#GenderFemale').prop('checked', true); $('#soldier').prop('disabled', true); + } + else{ + $('#GenderMale').removeClass("disable"); + $('#GenderFemale').removeClass("disable"); + $('#divGender .radio-box').removeClass('disable'); } currentStep++; showStep(currentStep); From b2c6ad25414de045d644d9f0dba106867687467e Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 15 Sep 2025 17:31:05 +0330 Subject: [PATCH 12/20] SickLeaving Bug on Static Checkout Fixed --- .../Repository/RollCallMandatoryRepository.cs | 37 +++++++++++-------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index a4aaf37f..196b4245 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -1801,6 +1801,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll var startDateAndTime = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute); var startContract = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute); var endContract = new PersianDateTime(eyear, emonth, eday, 23, 59); + var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList(); for (var da = startDateAndTime; da <= endContract; da = da.AddHours(addHours)) { @@ -1824,14 +1825,20 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll end.Second); Console.WriteLine($"{currentDateFa} - {currentDateGr.Date} - start : {startComplex} end : {endComplex}"); - rollCallList.Add(new RollCallViewModel() + + var hasLeave = countLeves.Any(x => x.StartLeaveGr <= startComplex && x.EndLeaveGr >= endComplex); + if (!hasLeave) { - StartDate = startComplex, - EndDate = endComplex, - ShiftSpan = (endComplex - startComplex), - ShiftDate = currentDateGr, - ShiftEndWithoutRest = endComplex - }); + rollCallList.Add(new RollCallViewModel() + { + StartDate = startComplex, + EndDate = endComplex, + ShiftSpan = (endComplex - startComplex), + ShiftDate = currentDateGr, + ShiftEndWithoutRest = endComplex + }); + } + var endCal = end - start; @@ -1840,16 +1847,16 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll } - var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList(); - if (countLeves.Count > 0) - { - int totalDays = countLeves.Sum(x => int.Parse(x.LeaveHourses)); + + //if (countLeves.Count > 0) + //{ + // int totalDays = countLeves.Sum(x => int.Parse(x.LeaveHourses)); - int countRollCall = rollCallList.Count(); - int takRollCall = totalDays < countRollCall ? (countRollCall - totalDays) : 0; - rollCallList = rollCallList.Take(takRollCall).ToList(); - } + // int countRollCall = rollCallList.Count(); + // int takRollCall = totalDays < countRollCall ? (countRollCall - totalDays) : 0; + // rollCallList = rollCallList.Take(takRollCall).ToList(); + //} } From 74c7b1ebbd6a9b8840783d0c75642b8bb8b4dc21 Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 15 Sep 2025 23:44:37 +0330 Subject: [PATCH 13/20] Optimized leaves affected on checkout --- .../Repository/RollCallMandatoryRepository.cs | 164 +++++++++++++----- 1 file changed, 122 insertions(+), 42 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index 196b4245..ae9a3c0f 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -39,6 +39,7 @@ using PersianTools.Core; + namespace CompanyManagment.EFCore.Repository; public class RollCallMandatoryRepository : RepositoryBase, IRollCallMandatoryRepository @@ -64,12 +65,12 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll } - #region OfficialChckout - public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, - DateTime contractEnd, - CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute) - { - #region Entities + #region OfficialChckout + public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, + DateTime contractEnd, + CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute) + { + #region Entities string SumWorkeTime = string.Empty; var weeklyTime = new TimeSpan(); @@ -144,7 +145,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll groupedRollCall = rollCallResult.GroupBy(x => x.ShiftDate.Date).Select(x => { - + DateTime friday = new DateTime(); @@ -197,19 +198,19 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll BreakTimeSpan = x.BreakTimeSpan }).ToList(); - groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => - { - TimeSpan breakTime; - if (contractStart > endOfFarvardin) - { - breakTime = CalculateBreakTime( - x.First().BreakTimeSpan, - new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))); - } - else - { - breakTime = CalculateBreakTime(breakTimeEntity, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))); - } + groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x => + { + TimeSpan breakTime; + if (contractStart > endOfFarvardin) + { + breakTime = CalculateBreakTime( + x.First().BreakTimeSpan, + new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))); + } + else + { + breakTime = CalculateBreakTime(breakTimeEntity, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks))); + } DateTime friday = new DateTime(); @@ -220,7 +221,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday)) .StartDate.Value; - + } if (x.Any(s => @@ -233,15 +234,15 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll } return new GroupedRollCalls() - { - CreationDate = x.Key, - ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value, EndWithOutResTime = s.EndDate!.Value }) - .ToList(), - //HasFriday = x.Any(s => - // s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || - // s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)), + { + CreationDate = x.Key, + ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value, EndWithOutResTime = s.EndDate!.Value }) + .ToList(), + //HasFriday = x.Any(s => + // s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday || + // s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)), - Fridays = friday, + Fridays = friday, SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - breakTime, @@ -265,7 +266,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll TimeSpan sumSpans = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks)); - TimeSpan sumSpansWhitOutleaves = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks)); + TimeSpan sumSpansWhitOutleaves = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks)); //بدست آوردن مرخصی ساعتی @@ -347,7 +348,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll totalLeave = totalLeave.Add(hoursesleaveTimeSpans); //totalLeaveOnThisCheckout = totalLeave; var totalLeaveDouble = (totalLeave.TotalMinutes) / 60; - + //اگر مدت مرخصی از مجاز بیشتر بود و مدل محاسبه کامل نبود if (totalLeaveDouble > starndardHoursesPerTotalDays && !totalLeaveCompute) { @@ -902,7 +903,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll //مرخصی استعلاجی TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)), - + //ساعت موظفی پرسنل در این ماه EmployeeMandatoryHours = mandatoryHoursTimeSpan, #endregion @@ -1802,6 +1803,68 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll var startContract = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute); var endContract = new PersianDateTime(eyear, emonth, eday, 23, 59); var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList(); + //int totalLeaveDays = countLeves.Sum(x => int.Parse(x.LeaveHourses)); + List affectedLeaves = new List(); + + DateTime contractStart = ($"{startContract}").ToGeorgianDateTime(); + DateTime contractEnd = ($"{endContract}").ToGeorgianDateTime(); + int leavingDayCout = 0; + List thisCheckoutLeaves = new List(); + + + if (leaveSearchResult.Count > 0) + { + foreach (var leave in leaveSearchResult) + { + //مرخصی های مابین + if (leave.StartLeaveGr >= contractStart && leave.EndLeaveGr <= contractEnd) + { + var modifyleave = new LeaveViewModel() + { + Id = leave.Id, + StartLeaveGr = leave.StartLeaveGr, + EndLeaveGr = leave.EndLeaveGr + }; + thisCheckoutLeaves.Add(leave); + } + + // مرخصی که شروعش قبل از شروع تصفیه حساب است + if (leave.StartLeaveGr < contractStart && leave.EndLeaveGr <= contractEnd) + { + var modifyleave = new LeaveViewModel() + { + Id = leave.Id, + StartLeaveGr = contractStart, + EndLeaveGr = leave.EndLeaveGr + }; + thisCheckoutLeaves.Add(modifyleave); + } + // مرخصی که پایانش بعد از پایان تصفیه حساب است + if (leave.EndLeaveGr > contractEnd && leave.StartLeaveGr >= contractStart) + { + var modifyleave = new LeaveViewModel() + { + Id = leave.Id, + StartLeaveGr = leave.StartLeaveGr, + EndLeaveGr = contractEnd, + }; + thisCheckoutLeaves.Add(modifyleave); + } + + //مرخصی استثنا که تمام بازه فیش را پوشش میدهد + if (leave.StartLeaveGr < contractStart && leave.EndLeaveGr > contractEnd) + { + var modifyleave = new LeaveViewModel() + { + Id = leave.Id, + StartLeaveGr = leave.StartLeaveGr, + EndLeaveGr = contractEnd, + }; + thisCheckoutLeaves.Add(modifyleave); + } + } + } + for (var da = startDateAndTime; da <= endContract; da = da.AddHours(addHours)) { @@ -1826,7 +1889,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll Console.WriteLine($"{currentDateFa} - {currentDateGr.Date} - start : {startComplex} end : {endComplex}"); - var hasLeave = countLeves.Any(x => x.StartLeaveGr <= startComplex && x.EndLeaveGr >= endComplex); + var hasLeave = thisCheckoutLeaves.Any(x => startComplex.Date <= x.EndLeaveGr.Date && endComplex.Date >= x.StartLeaveGr.Date); if (!hasLeave) { rollCallList.Add(new RollCallViewModel() @@ -1838,7 +1901,18 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll ShiftEndWithoutRest = endComplex }); } - + else + { + var affected = thisCheckoutLeaves.FirstOrDefault(x => startComplex.Date <= x.EndLeaveGr.Date && endComplex.Date >= x.StartLeaveGr.Date); + var modifyleave = new LeaveViewModel() + { + Id = affected.Id, + StartLeaveGr = affected.StartLeaveGr, + EndLeaveGr = affected.EndLeaveGr + }; + affectedLeaves.Add(modifyleave); + } + var endCal = end - start; @@ -1847,16 +1921,22 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll } - - //if (countLeves.Count > 0) - //{ - // int totalDays = countLeves.Sum(x => int.Parse(x.LeaveHourses)); - // int countRollCall = rollCallList.Count(); - // int takRollCall = totalDays < countRollCall ? (countRollCall - totalDays) : 0; - // rollCallList = rollCallList.Take(takRollCall).ToList(); - //} + affectedLeaves = affectedLeaves.DistinctBy(x => x.Id).ToList(); + + //مرخصی هایی که تاریخ آن ها بین رکورد های حضور پرسنل بوده و اعمال نشده + var exceptionLeaves = thisCheckoutLeaves + .Where(t => !affectedLeaves.Select(a => a.Id).Contains(t.Id)) + .ToList(); + + //حذف رکورد های حضور به تعداد مرخصی های اعمال نشده + if (exceptionLeaves.Count > 0) + { + int countRollCall = rollCallList.Count(); + int takRollCall = exceptionLeaves.Count < countRollCall ? (countRollCall - exceptionLeaves.Count) : 0; + rollCallList = rollCallList.Take(takRollCall).ToList(); + } } From 9474f3ff1a120426402e7a8be837bcfd9087199f Mon Sep 17 00:00:00 2001 From: mahan Date: Tue, 16 Sep 2025 11:51:20 +0330 Subject: [PATCH 14/20] Add transaction ID to financial statement mapping --- .../Repository/FinancialStatmentRepository.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs b/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs index 18cdbbcc..46e636a8 100644 --- a/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs +++ b/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs @@ -165,7 +165,8 @@ public class FinancialStatmentRepository : RepositoryBasex.DateTimeGr).ToList(), }; From eab0441f00498b427d1a5574f94cc9658b694176 Mon Sep 17 00:00:00 2001 From: Mahan Chamani <109232147+mahanch@users.noreply.github.com> Date: Thu, 18 Sep 2025 09:44:25 +0330 Subject: [PATCH 15/20] Update dotnet-developPublish.yml --- .github/workflows/dotnet-developPublish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-developPublish.yml b/.github/workflows/dotnet-developPublish.yml index a594b21a..4cc06918 100644 --- a/.github/workflows/dotnet-developPublish.yml +++ b/.github/workflows/dotnet-developPublish.yml @@ -37,7 +37,7 @@ jobs: & "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" ` -verb:sync ` -source:contentPath="$publishFolder" ` - -dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName=".\deployuser",password="R2rNpdnetP3j>q5b18",authType="Basic" ` + -dest:contentPath="C:\inetpub\wwwroot\dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName=".\deployuser",password="R2rNpdnetP3j>q5b18",authType="Basic" ` -allowUntrusted ` -enableRule:AppOffline From abe8774d6fefc1a28909b831d78a3245a0b5221b Mon Sep 17 00:00:00 2001 From: Mahan Chamani <109232147+mahanch@users.noreply.github.com> Date: Thu, 18 Sep 2025 10:04:15 +0330 Subject: [PATCH 16/20] Update dotnet-developPublish.yml --- .github/workflows/dotnet-developPublish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-developPublish.yml b/.github/workflows/dotnet-developPublish.yml index 4cc06918..77d8c826 100644 --- a/.github/workflows/dotnet-developPublish.yml +++ b/.github/workflows/dotnet-developPublish.yml @@ -37,7 +37,7 @@ jobs: & "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" ` -verb:sync ` -source:contentPath="$publishFolder" ` - -dest:contentPath="C:\inetpub\wwwroot\dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName=".\deployuser",password="R2rNpdnetP3j>q5b18",authType="Basic" ` + -dest:contentPath="C:\inetpub\wwwroot\dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" ` -allowUntrusted ` -enableRule:AppOffline From 21aa17d856357d6be70705326b3aa376d85b5f54 Mon Sep 17 00:00:00 2001 From: Mahan Chamani <109232147+mahanch@users.noreply.github.com> Date: Thu, 18 Sep 2025 10:42:41 +0330 Subject: [PATCH 17/20] Update dotnet-developPublish.yml --- .github/workflows/dotnet-developPublish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-developPublish.yml b/.github/workflows/dotnet-developPublish.yml index 77d8c826..aace164d 100644 --- a/.github/workflows/dotnet-developPublish.yml +++ b/.github/workflows/dotnet-developPublish.yml @@ -37,7 +37,7 @@ jobs: & "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" ` -verb:sync ` -source:contentPath="$publishFolder" ` - -dest:contentPath="C:\inetpub\wwwroot\dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" ` + -dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" ` -allowUntrusted ` -enableRule:AppOffline From 53eab1be67d6b04b274be992847ce13bcb5d97a9 Mon Sep 17 00:00:00 2001 From: mahan Date: Sun, 21 Sep 2025 11:03:06 +0330 Subject: [PATCH 18/20] feat: Add DashboardController for Admin --- .../Admin/Controllers/DashboardController.cs | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 ServiceHost/Areas/Admin/Controllers/DashboardController.cs diff --git a/ServiceHost/Areas/Admin/Controllers/DashboardController.cs b/ServiceHost/Areas/Admin/Controllers/DashboardController.cs new file mode 100644 index 00000000..4df39f0a --- /dev/null +++ b/ServiceHost/Areas/Admin/Controllers/DashboardController.cs @@ -0,0 +1,75 @@ +using _0_Framework.Application; +using _0_Framework.Application.Sms; +using AccountManagement.Application.Contracts.Task; +using AccountManagement.Application.Contracts.Ticket; +using CompanyManagment.App.Contracts.ClientDashboard; +using CompanyManagment.App.Contracts.HolidayItem; +using Microsoft.AspNetCore.Mvc; +using PersianTools.Core; +using ServiceHost.BaseControllers; + +namespace ServiceHost.Areas.Admin.Controllers; + +public class DashboardController : AdminBaseController +{ + private readonly ISmsService _smsService; + private readonly IHolidayItemApplication _holidayItemApplication; + private readonly ITaskApplication _taskApplication; + private readonly ITicketApplication _ticketApplication; + private long UserId; + + public DashboardController(ISmsService smsService, IHolidayItemApplication holidayItemApplication, ITaskApplication taskApplication,IAuthHelper authHelper, ITicketApplication ticketApplication) + { + _smsService = smsService; + _holidayItemApplication = holidayItemApplication; + _taskApplication = taskApplication; + _ticketApplication = ticketApplication; + UserId = authHelper.CurrentAccountId(); + } +[HttpGet] + public async Task> Index() + { + var calenderList = new List(); + + var todayGr = DateTime.Today; + var todayFa = todayGr.ToFarsi(); + + var todayPersian = new PersianDateTime( + int.Parse(todayFa.Substring(0, 4)), + int.Parse(todayFa.Substring(5, 2)), + int.Parse(todayFa.Substring(8, 2)) + ); + + var startDate =new PersianDateTime(todayGr.AddDays(-3)); + var endDate =new PersianDateTime(todayGr.AddDays(3)); + + + for (var day = startDate; day <= endDate; day = day.AddDays(1)) + { + var calenderNewItem = new CalenderViewModel + { + DayNumber = day.ToString("dd"), + IsToday = day.DateTime == todayGr, + DayOfWeek = day.DayOfWeek, + Holiday = _holidayItemApplication.IsHoliday(day.ToGregorianDateTime()) + }; + calenderList.Add(calenderNewItem); + } + var taskCount = await _taskApplication.RequestedAndOverdueTasksCount(UserId); + var ticketCount = _ticketApplication.GetAdminTicketsCount(); + + + return new AdminDashboardViewModel(calenderList, taskCount, ticketCount); + } + + [HttpGet("sms-remaining")] + public async Task> OnGetSmsRemaining() + { + var result = (int)await _smsService.GetCreditAmount(); + return new SmsRemainingResult(result); + } +} + +public record SmsRemainingResult(int Data); + +public record AdminDashboardViewModel(List Calender, int TaskCount, int TicketCount); \ No newline at end of file From 112369c2a554965cd5cf8bb66cc9c2d2d785d815 Mon Sep 17 00:00:00 2001 From: mahan Date: Sun, 21 Sep 2025 11:30:46 +0330 Subject: [PATCH 19/20] add fridays to holiday in DashboardController --- ServiceHost/Areas/Admin/Controllers/DashboardController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ServiceHost/Areas/Admin/Controllers/DashboardController.cs b/ServiceHost/Areas/Admin/Controllers/DashboardController.cs index 4df39f0a..d132095c 100644 --- a/ServiceHost/Areas/Admin/Controllers/DashboardController.cs +++ b/ServiceHost/Areas/Admin/Controllers/DashboardController.cs @@ -51,7 +51,7 @@ public class DashboardController : AdminBaseController DayNumber = day.ToString("dd"), IsToday = day.DateTime == todayGr, DayOfWeek = day.DayOfWeek, - Holiday = _holidayItemApplication.IsHoliday(day.ToGregorianDateTime()) + Holiday = _holidayItemApplication.IsHoliday(day.ToGregorianDateTime()) || day.DayOfWeek== "جمعه" }; calenderList.Add(calenderNewItem); } From e79dabbb2d036f6a8371735ac3f14b5b96d0536b Mon Sep 17 00:00:00 2001 From: mahan Date: Sun, 21 Sep 2025 11:57:48 +0330 Subject: [PATCH 20/20] add accounts by role --- .../Account/IAccountApplication.cs | 2 ++ .../AccountApplication.cs | 4 +++ .../Admin/Controllers/AccountController.cs | 27 ++++++++++++++++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs index 89f9693a..3c31d726 100644 --- a/AccountManagement.Application.Contracts/Account/IAccountApplication.cs +++ b/AccountManagement.Application.Contracts/Account/IAccountApplication.cs @@ -64,4 +64,6 @@ public interface IAccountApplication /// /// public bool CheckExistClientAccount(string userName); + List GetAdminAccountsNew(); + } \ No newline at end of file diff --git a/AccountManagement.Application/AccountApplication.cs b/AccountManagement.Application/AccountApplication.cs index ff4e5a25..4204be40 100644 --- a/AccountManagement.Application/AccountApplication.cs +++ b/AccountManagement.Application/AccountApplication.cs @@ -799,4 +799,8 @@ public class AccountApplication : IAccountApplication return _accountRepository.CheckExistClientAccount(userName); } + public List GetAdminAccountsNew() + { + return _accountRepository.GetAdminAccountsNew(); + } } \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Controllers/AccountController.cs b/ServiceHost/Areas/Admin/Controllers/AccountController.cs index 314b8de5..ddf16f83 100644 --- a/ServiceHost/Areas/Admin/Controllers/AccountController.cs +++ b/ServiceHost/Areas/Admin/Controllers/AccountController.cs @@ -8,6 +8,7 @@ public class AccountController:AdminBaseController { private readonly IAccountApplication _accountApplication; + public AccountController(IAccountApplication accountApplication) { _accountApplication = accountApplication; @@ -22,4 +23,28 @@ public class AccountController:AdminBaseController var res = await _accountApplication.GetAdminSelectList(); return res; } -} \ No newline at end of file + + [HttpGet("admins-by-role")] + public ActionResult GetAdminAccountsByRole() + { + var adminAccounts = _accountApplication.GetAdminAccountsNew().Select(x=> new AccountSelectListViewModel() + { + Id = x.Id, + Name = x.Fullname, + RoleId = x.RoleId + }).ToList(); + + var seniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 3).ToList(); + var juniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 5).ToList(); + var seniorInsuranceAccountList = adminAccounts.Where(x => x.RoleId == 7).ToList(); + var juniorInsuranceAccountsList = adminAccounts.Where(x => x.RoleId == 8).ToList(); + return new AdminAccountByRoleResponse(seniorContractAccountsList, juniorContractAccountsList, + seniorInsuranceAccountList, juniorInsuranceAccountsList); + } +} + +public record AdminAccountByRoleResponse( + List SeniorContractAccountsList, + List JuniorContractAccountsList, + List SeniorInsuranceAccountList, + List JuniorInsuranceAccountsList); \ No newline at end of file