From 54fbbc964fa50e2925f2ae01553dacd2d31b5222 Mon Sep 17 00:00:00 2001 From: SamSys Date: Wed, 20 Aug 2025 03:27:54 +0330 Subject: [PATCH 1/6] change OvertTimeWOrking Compute - Send EmployeeMandatoryHours To Save --- .../Checkout/CreateCheckout.cs | 5 +++++ .../Contract/ComputingViewModel.cs | 5 +++++ .../Repository/RollCallMandatoryRepository.cs | 12 +++++++++++- .../Admin/Pages/Company/Checkouts/Index.cshtml.cs | 3 +++ ServiceHost/Properties/launchSettings.json | 2 +- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs b/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs index 423d087c..8baee048 100644 --- a/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs +++ b/CompanyManagment.App.Contracts/Checkout/CreateCheckout.cs @@ -135,6 +135,11 @@ public class CreateCheckout /// public string TotalDayOfBunosesCompute { get; set; } + /// + /// ساعت موظفی پرسنل برای این ماه + /// + public TimeSpan EmployeeMandatoryHours { get; set; } + public bool HolidayWorking { get; set; } public string ShiftWork { get; set; } diff --git a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs index 0e8ce49c..4c9478c8 100644 --- a/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs +++ b/CompanyManagment.App.Contracts/Contract/ComputingViewModel.cs @@ -56,5 +56,10 @@ public class ComputingViewModel public TimeSpan TotalPaidLeave { get; set; } public TimeSpan TotalSickLeave { get; set; } + /// + /// ساعت موظفی پرسنل برای این ماه + /// + public TimeSpan EmployeeMandatoryHours { get; set; } + //public List holidays; } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs index 0d1bb5f6..261dea2c 100644 --- a/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs +++ b/CompanyManagment.EFCore/Repository/RollCallMandatoryRepository.cs @@ -103,6 +103,13 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll //This Time Mandatory Hourse double mandatoryHours = Math.Round((mandatorDays * 7.33), 2); + //تبدیل عدد زیاضی موظفی به تایم اسپن + int hoursConverted = (int)mandatoryHours; + double minutesDecimalConverted = (mandatoryHours - hoursConverted) * 60; + int minutesConverted = (int)minutesDecimalConverted; + TimeSpan mandatoryHoursTimeSpan = new TimeSpan(hoursConverted, minutesConverted, 0); + + //گرفتن ساعت استراحت پرسنل از تنظیمات #region breakTime BaseCustomizeEntity settings = _context.CustomizeWorkshopEmployeeSettings.AsSplitQuery() @@ -443,7 +450,7 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll //TimeSpan mandatoryHoursTimeSpan = new TimeSpan(7, 20, 0).Multiply(mandatorDays); //TimeSpan Mandatory = sumSpansWhitOutleaves.Subtract(mandatoryHoursTimeSpan); - double mandatoryWorkWithOutleaves = (sumSpansWhitOutleaves.TotalMinutes) / 60; + double mandatoryWorkWithOutleaves = (sumSpans.TotalMinutes) / 60; double overTimeWork = 0; if (mandatoryWorkWithOutleaves > mandatoryHours) { @@ -881,6 +888,9 @@ public class RollCallMandatoryRepository : RepositoryBase, IRoll TotalPaidLeave = totalLeaveSpan, //مرخصی استعلاجی TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)), + + //ساعت موظفی پرسنل در این ماه + EmployeeMandatoryHours = mandatoryHoursTimeSpan, #endregion }; diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs index 7f1e49a2..ff15a680 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs @@ -1041,6 +1041,9 @@ public class IndexModel : PageModel //لیست حضورغیاب جهت ذخیره سازی GroupedRollCalls = mandatoryCompute.GroupedRollCalls, + // ساعت موظفی پرسنل برای این ماه + EmployeeMandatoryHours = mandatoryCompute.EmployeeMandatoryHours, + HasInsuranceChekoutOverTime = workshop.InsuranceCheckoutOvertime }; diff --git a/ServiceHost/Properties/launchSettings.json b/ServiceHost/Properties/launchSettings.json index 69be5550..788962e4 100644 --- a/ServiceHost/Properties/launchSettings.json +++ b/ServiceHost/Properties/launchSettings.json @@ -11,7 +11,7 @@ }, "ServiceHost": { "commandName": "Project", - "launchBrowser": false, + "launchBrowser": true, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" From 3aa56686960819b97acf821ec4da2b06d941588b Mon Sep 17 00:00:00 2001 From: SamSys Date: Thu, 21 Aug 2025 16:44:51 +0330 Subject: [PATCH 2/6] CustomizeCheckout enable or disable on client menu bug fixed --- ServiceHost/Areas/Client/Pages/Index.cshtml.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ServiceHost/Areas/Client/Pages/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Index.cshtml.cs index e61508cc..18436670 100644 --- a/ServiceHost/Areas/Client/Pages/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Index.cshtml.cs @@ -687,9 +687,16 @@ namespace ServiceHost.Areas.Client.Pages var allServices = _rollCallServiceApplication.GetAllServiceByWorkshopId(workshopId); var hasPreviousService = allServices.Any(); + + var activeService = _rollCallServiceApplication.GetActiveServiceByWorkshopId(workshopId); var hasRollCallService = activeService != null; + bool hasCustomizeCheckout = false; + + if (hasRollCallService) + hasCustomizeCheckout = activeService.HasCustomizeCheckoutService == "true" ? true : false; + bool hasCameraAccount; if (hasRollCallService) { @@ -707,7 +714,8 @@ namespace ServiceHost.Areas.Client.Pages { hasRollCallWorkshopSetting, hasCameraAccount, - hasRollCallService + hasRollCallService, + hasCustomizeCheckout }); } From 7afa112e630b3e97798d53e09db8b61ffce94247 Mon Sep 17 00:00:00 2001 From: syntax24 Date: Thu, 21 Aug 2025 16:46:40 +0330 Subject: [PATCH 3/6] appsettings.dev changes --- ServiceHost/appsettings.Development.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ServiceHost/appsettings.Development.json b/ServiceHost/appsettings.Development.json index ef2d0a22..b99bd4af 100644 --- a/ServiceHost/appsettings.Development.json +++ b/ServiceHost/appsettings.Development.json @@ -12,7 +12,7 @@ //"MesbahDb": "Data Source=DESKTOP-NUE119G\\MSNEW;Initial Catalog=Mesbah_db;Integrated Security=True" //server - "MesbahDbServer": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;", + //"MesbahDbServer": "Data Source=171.22.24.15;Initial Catalog=mesbah_db;Persist Security Info=False;User ID=ir_db;Password=R2rNp[170]18[3019]#@ATt;TrustServerCertificate=true;", //local @@ -35,7 +35,7 @@ "ApiKey": "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa", "SecretKey": "dadmehr" }, - "Domain": ".dadmehrg.ir" + "Domain": ".gozareshgir.ir" } From 41503101b61b717084682220d1ec9fd59428ec54 Mon Sep 17 00:00:00 2001 From: SamSys Date: Fri, 22 Aug 2025 00:58:42 +0330 Subject: [PATCH 4/6] create rollcallservice transaction chnages --- .../InstitutionContractRepository.cs | 41 ++++++++++++------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index 2a89c94a..9049c2f3 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -909,24 +909,30 @@ public class InstitutionContractRepository : RepositoryBase x.id == rollCallService.WorkshopId); string description = ""; - if (rollCallService.StartService <= prevMonthStart) - { - var monthPrev = prevMonthEnd.ToFarsi().Substring(5, 2); - var yearPrev = prevMonthEnd.ToFarsi().Substring(0, 4); - var prevMonthName = monthPrev.ToFarsiMonthByNumber(); - description = - $"{prevMonthName} و {currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}"; - monthCounter = 2; - } - else if (rollCallService.StartService <= currentMonthStart && - rollCallService.StartService > prevMonthStart) + //if (rollCallService.StartService <= prevMonthStart) + //{ + // var monthPrev = prevMonthEnd.ToFarsi().Substring(5, 2); + // var yearPrev = prevMonthEnd.ToFarsi().Substring(0, 4); + // var prevMonthName = monthPrev.ToFarsiMonthByNumber(); + // description = + // $"{prevMonthName} و {currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}"; + // monthCounter = 2; + //} + //else if (rollCallService.StartService <= currentMonthStart && + // rollCallService.StartService > prevMonthStart) + //{ + // monthCounter = 1; + + // description = $"{currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}"; + //} + + if (rollCallService.StartService <= currentMonthStart) { monthCounter = 1; description = $"{currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}"; } - var employees = _context.RollCallEmployees.Where(x => x.WorkshopId == rollCallService.WorkshopId) .Select(x => x.id); @@ -965,9 +971,14 @@ public class InstitutionContractRepository : RepositoryBase @@ -988,7 +999,7 @@ public class InstitutionContractRepository : RepositoryBase Date: Sat, 23 Aug 2025 11:51:46 +0330 Subject: [PATCH 5/6] fix: calculate balance correctly in financial transaction details --- .../Repository/FinancialStatmentRepository.cs | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs b/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs index c4ed3cc8..b54f6b1c 100644 --- a/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs +++ b/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs @@ -171,7 +171,9 @@ public class FinancialStatmentRepository : RepositoryBase> GetDetailsByPublicId(string publicId) { var op = new OperationResult(); @@ -194,17 +196,30 @@ public class FinancialStatmentRepository : RepositoryBase x.Creditor), TotalDebt = financialStatement.FinancialTransactionList.Sum(x => x.Deptor), ContractingPartyName = financialStatement.ContractingPartyName, - Transactions = financialStatement.FinancialTransactionList.Select(t => new FinancialTransactionDetailViewModel() + Transactions = financialStatement.FinancialTransactionList.Select(t => { - DateTimeGr = t.TdateGr, - DateFa = t.TdateGr.ToFarsi(), - TimeFa = $"{t.TdateGr:HH:mm}", - Description = t.DescriptionOption + " " + t.Description, - Debtor = t.Deptor, - Creditor = t.Creditor, - Balance = t.Balance, - Type = t.TypeOfTransaction == "debt" ? FinancialTransactionType.Debt : FinancialTransactionType.Credit, - TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد" + if (t.TypeOfTransaction == "debt") + { + balance += t.Deptor; + } + else + { + balance -= t.Creditor; + } + return new FinancialTransactionDetailViewModel() + { + DateTimeGr = t.TdateGr, + DateFa = t.TdateGr.ToFarsi(), + TimeFa = $"{t.TdateGr:HH:mm}", + Description = t.DescriptionOption + " " + t.Description, + Debtor = t.Deptor, + Creditor = t.Creditor, + Balance = balance, + Type = t.TypeOfTransaction == "debt" + ? FinancialTransactionType.Debt + : FinancialTransactionType.Credit, + TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد" + }; }).OrderByDescending(t => t.DateTimeGr).ToList(), }; return op.Succcedded(res); From 98146b4aa70970382e8fbb9cfe4e88aa197ef098 Mon Sep 17 00:00:00 2001 From: MahanCh Date: Sat, 23 Aug 2025 11:51:46 +0330 Subject: [PATCH 6/6] fix: calculate balance correctly in financial transaction details --- .../Repository/FinancialStatmentRepository.cs | 39 +++++++++++++------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs b/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs index c4ed3cc8..18cdbbcc 100644 --- a/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs +++ b/CompanyManagment.EFCore/Repository/FinancialStatmentRepository.cs @@ -171,7 +171,8 @@ public class FinancialStatmentRepository : RepositoryBase> GetDetailsByPublicId(string publicId) { var op = new OperationResult(); @@ -186,7 +187,8 @@ public class FinancialStatmentRepository : RepositoryBase x.Creditor), TotalDebt = financialStatement.FinancialTransactionList.Sum(x => x.Deptor), ContractingPartyName = financialStatement.ContractingPartyName, - Transactions = financialStatement.FinancialTransactionList.Select(t => new FinancialTransactionDetailViewModel() + Transactions = financialStatement.FinancialTransactionList.Select(t => { - DateTimeGr = t.TdateGr, - DateFa = t.TdateGr.ToFarsi(), - TimeFa = $"{t.TdateGr:HH:mm}", - Description = t.DescriptionOption + " " + t.Description, - Debtor = t.Deptor, - Creditor = t.Creditor, - Balance = t.Balance, - Type = t.TypeOfTransaction == "debt" ? FinancialTransactionType.Debt : FinancialTransactionType.Credit, - TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد" + if (t.TypeOfTransaction == "debt") + { + balance += t.Deptor; + } + else + { + balance -= t.Creditor; + } + return new FinancialTransactionDetailViewModel() + { + DateTimeGr = t.TdateGr, + DateFa = t.TdateGr.ToFarsi(), + TimeFa = $"{t.TdateGr:HH:mm}", + Description = t.DescriptionOption + " " + t.Description, + Debtor = t.Deptor, + Creditor = t.Creditor, + Balance = balance, + Type = t.TypeOfTransaction == "debt" + ? FinancialTransactionType.Debt + : FinancialTransactionType.Credit, + TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد" + }; }).OrderByDescending(t => t.DateTimeGr).ToList(), }; return op.Succcedded(res);