From 60252ab03211efc7b67c872c35bd61ce6ebf3378 Mon Sep 17 00:00:00 2001 From: SamSys Date: Sat, 19 Jul 2025 18:43:05 +0400 Subject: [PATCH 01/15] Insurance bug fix - CreateTransction for rolllCall --- .../IInstitutionContractRepository.cs | 10 ++ .../IInstitutionContractApplication.cs | 8 + .../InstitutionContractApplication.cs | 8 + .../InsuranceListApplication.cs | 5 +- .../InstitutionContractRepository.cs | 145 ++++++++++++++++++ 5 files changed, 174 insertions(+), 2 deletions(-) diff --git a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs index c46dea77..9aa53393 100644 --- a/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs +++ b/Company.Domain/InstitutionContractAgg/IInstitutionContractRepository.cs @@ -33,4 +33,14 @@ public interface IInstitutionContractRepository : IRepository workshopViewModels); InstitutionContract InstitutionContractByEmployerId(long employerId); + + + /// + /// ایجاد سند مالی حضور غیاب + /// + /// + /// + /// + /// + void RollcallServiceCreateTransaction(); } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs index 342ad846..57ac69f0 100644 --- a/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs +++ b/CompanyManagment.App.Contracts/InstitutionContract/IInstitutionContractApplication.cs @@ -15,6 +15,14 @@ public interface IInstitutionContractApplication List Search(InstitutionContractSearchModel searchModel); List NewSearch(InstitutionContractSearchModel searchModel); + + /// + /// دریافت اطلاعات قزداد های مالی فعال + ///دارای کارگاه + /// جهت ست کردن سرویس ها از طریق اکسل + /// + /// + List GetInstitutionContractToSetServicesExcelImport(); List PrintAll(List id); InstitutionContractViewModel PrintOne(long id); OperationResult Active(long id); diff --git a/CompanyManagment.Application/InstitutionContractApplication.cs b/CompanyManagment.Application/InstitutionContractApplication.cs index b228581a..fd87513b 100644 --- a/CompanyManagment.Application/InstitutionContractApplication.cs +++ b/CompanyManagment.Application/InstitutionContractApplication.cs @@ -579,6 +579,14 @@ public class InstitutionContractApplication : IInstitutionContractApplication return _institutionContractRepository.NewSearch(searchModel); } + + public List GetInstitutionContractToSetServicesExcelImport() + { + var result = _institutionContractRepository.NewSearch(new InstitutionContractSearchModel()); + + return result.Where(x => x.IsActiveString == "true" && x.IsContractingPartyBlock !="true" && x.WorkshopCount != "0" && x.ContractStartGr <= DateTime.Now && x.ContractEndGr >= DateTime.Now).ToList(); + } + public string ExpCheckColor(DateTime now, DateTime ContractEndGr, DateTime endThisMontGr, string ContractAmount, string isActiveString) { string result = ""; diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 251be235..08f07cf2 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -537,8 +537,9 @@ public class InsuranceListApplication : IInsuranceListApplication var employeeListData = employeeInsurancDataPreviusList .FirstOrDefault(e => e.EmployeeId == employee.EmployeeId); //مزیای عیر مشمول لیست قبل - var benefitsIncludedNonContinuous = - employeeListData != null ? employeeListData.BenefitsIncludedNonContinuous : 0; + //var benefitsIncludedNonContinuous = + // employeeListData != null ? employeeListData.BenefitsIncludedNonContinuous : 0; + double benefitsIncludedNonContinuous = 0; if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && !isManager) { diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index 7bce4b2f..e2fc888c 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -13,6 +13,7 @@ using CompanyManagment.App.Contracts.Employer; using CompanyManagment.App.Contracts.InstitutionContract; using CompanyManagment.App.Contracts.Workshop; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using PersianTools.Core; @@ -759,6 +760,150 @@ public class InstitutionContractRepository : RepositoryBase + /// ایجاد سند مالی حضور غیاب + /// + /// + /// + /// + /// + + #region RollcallServicCreateTransaction + + public void RollcallServiceCreateTransaction() + { + DateTime now = DateTime.Now; + var nowFa = now.ToFarsi(); + var endOfMonth = nowFa.FindeEndOfMonth(); + + DateTime endOfMonthGr = endOfMonth.ToGeorgianDateTime(); + + + #region FindeNextMonth 1th + var year = Convert.ToInt32(endOfMonth.Substring(0, 4)); + var month = Convert.ToInt32(endOfMonth.Substring(5, 2)); + var nextM = new PersianDateTime(year, month, 1).AddMonths(1); + var nextMonthGr = ($"{nextM}").ToGeorgianDateTime(); + var endOfCurrentMonth = (($"{endOfMonth.Substring(0, 8)}/01").FindeEndOfMonth()).ToGeorgianDateTime(); + #endregion + #region GetAvtiveContracts + var institutionContracts = _context.InstitutionContractSet.Where(x => x.IsActiveString == "true").Select(x => new InstitutionContractViewModel + { + Id = x.id, + ContractingPartyId = x.ContractingPartyId, + ContractingPartyName = x.ContractingPartyName, + ContractStartGr = x.ContractStartGr, + ContractStartFa = x.ContractStartFa, + ContractEndGr = x.ContractEndGr, + ContractEndFa = x.ContractEndFa, + IsActiveString = x.IsActiveString, + SearchAmount = x.ContractAmount, + TypeOfContract = x.TypeOfContract + }).Where(x => + x.ContractStartGr < endOfMonthGr && x.ContractEndGr >= endOfMonthGr && x.SearchAmount > 0) + .ToList(); + #endregion + + #region GetFutureContracts + + List futureContracts = _context.InstitutionContractSet + .Where(x => x.IsActiveString == "true" && + x.ContractStartGr == nextMonthGr && x.ContractAmount > 0) + .Select(x => new InstitutionContractViewModel + { + Id = x.id, + ContractingPartyId = x.ContractingPartyId, + ContractingPartyName = x.ContractingPartyName, + ContractStartGr = x.ContractStartGr, + ContractStartFa = x.ContractStartFa, + ContractEndGr = x.ContractEndGr, + ContractEndFa = x.ContractEndFa, + IsActiveString = x.IsActiveString, + TypeOfContract = x.TypeOfContract, + ExtensionNo = x.ExtensionNo, + }).ToList(); + + #endregion + + #region GetDectivedContractOnCurrentMonth + + if (futureContracts.Any()) + { + List futureContractIds = futureContracts.Select(x => x.ContractingPartyId).ToList(); + List deatcivedContract = _context.InstitutionContractSet + .Where(x => x.IsActiveString == "false" && futureContractIds.Contains(x.ContractingPartyId) && + x.ContractEndGr == endOfCurrentMonth && x.ContractAmount > 0) + .Select(x => new InstitutionContractViewModel + { + Id = x.id, + ContractingPartyId = x.ContractingPartyId, + ContractingPartyName = x.ContractingPartyName, + ContractStartGr = x.ContractStartGr, + ContractStartFa = x.ContractStartFa, + ContractEndGr = x.ContractEndGr, + ContractEndFa = x.ContractEndFa, + IsActiveString = x.IsActiveString, + SearchAmount = x.ContractAmount, + TypeOfContract = x.TypeOfContract + }).ToList(); + + if (deatcivedContract.Any()) + institutionContracts.AddRange(deatcivedContract); + } + + List exceptionContractingPartyIds = [30520, 30739]; + institutionContracts = institutionContracts + .Where(x => !exceptionContractingPartyIds.Contains(x.ContractingPartyId)).ToList(); + int counter = 0; + var rollcallServiceList = + _context.RollCallServices.Where(x => x.IsActiveString == "true").ToList(); + var activeStatusDate = new DateTime(2121, 03, 21); + + foreach (var item in institutionContracts) + { + + //var isblock = contractingParty.IsBlock == "true" ? true : false; + + var employers = _context.Employers.Where(x => x.ContractingPartyId == item.ContractingPartyId).Select(x => x.id); + var workshops = _context.WorkshopEmployers.Where(x => employers.Contains(x.EmployerId)).Select(x => x.WorkshopId).Distinct().ToList(); + + + var srvices = + rollcallServiceList.Where(x => workshops.Contains(x.WorkshopId)).ToList(); + if (rollcallServiceList.Count > 0) + { + foreach (var rollCallService in srvices) + { + var spaning = (int)(endOfMonthGr - rollCallService.StartService).TotalDays + 1; + int monthCounter = spaning > 31 ? 2 : 1; + + + + var employees = + _context.RollCallEmployees.Where(x => x.WorkshopId == rollCallService.WorkshopId).Select(x=>x.id); + + var employeeCount = _context.RollCallEmployeesStatus.Where(x => employees.Contains(x.RollCallEmployeeId)) + .Count(x => x.EndDate.Date == activeStatusDate.Date); + + if (employeeCount > 0) + { + counter++; + Console.WriteLine(" number : " + counter + " - " + rollCallService.StartService.ToFarsi() + " WorkshopId : " + rollCallService.WorkshopId + " monthCount : " + monthCounter + " employeeCount : " + employeeCount); + } + + } + } + + } + + #endregion + } + + #endregion + + #region CustomViewModels From 0806b55dfb98cf652a67b8a52010eea1889f242f Mon Sep 17 00:00:00 2001 From: syntax24 Date: Sat, 19 Jul 2025 18:27:42 +0330 Subject: [PATCH 02/15] add client cors --- ServiceHost/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ServiceHost/Program.cs b/ServiceHost/Program.cs index 0f5f7853..3dc3b092 100644 --- a/ServiceHost/Program.cs +++ b/ServiceHost/Program.cs @@ -269,7 +269,9 @@ builder.Services.AddCors(options => "https://gozareshgir.ir", "https://dad-mehr.ir", "https://admin.dad-mehr.ir", - "https://admin.gozareshgir.ir" + "https://client.dad-mehr.ir", + "https://admin.gozareshgir.ir", + "https://client.gozareshgir.ir" ) .AllowAnyHeader() .AllowAnyMethod() From fe20c63baf87f352701fb3816d8b8eac8598c9ce Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 20 Jul 2025 11:27:41 +0400 Subject: [PATCH 03/15] change RollcallServiceCreateTransaction --- .../InstitutionContractRepository.cs | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index e2fc888c..ec919b0a 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -886,11 +886,38 @@ public class InstitutionContractRepository : RepositoryBase employees.Contains(x.RollCallEmployeeId)) .Count(x => x.EndDate.Date == activeStatusDate.Date); - + if (employeeCount > 0) { + var workshop = _context.Workshops.FirstOrDefault(x => x.id == rollCallService.WorkshopId); counter++; - Console.WriteLine(" number : " + counter + " - " + rollCallService.StartService.ToFarsi() + " WorkshopId : " + rollCallService.WorkshopId + " monthCount : " + monthCounter + " employeeCount : " + employeeCount); + + + var dailyWageYearlySalery = _context.YearlySalaries.Include(i => i.YearlySalaryItemsList).FirstOrDefault(x => + x.StartDate.Date <= DateTime.Now.Date && x.EndDate >= DateTime.Now.Date); + + var dailyWage = dailyWageYearlySalery.YearlySalaryItemsList.Where(x => x.ItemName == "مزد روزانه") + .Select(x => x.ItemValue).FirstOrDefault(); + + var planPercentage = _context.PlanPercentages.FirstOrDefault(); + + var countPersonnel = employeeCount; + var planByCountPerson = _context.InstitutionPlans + .FirstOrDefault(x => x.CountPerson == countPersonnel); + + var amountForOneMonth =(((dailyWage * planPercentage.RollCallPercent) / 100) * planByCountPerson.CountPerson * + planByCountPerson.IncreasePercentage); + + + var amountWithoutTax = amountForOneMonth * monthCounter; + + + var tenPercent = amountWithoutTax * 10 / 100; + var totalAmonut = amountWithoutTax + tenPercent; + + Console.WriteLine( counter + " - " + rollCallService.StartService.ToFarsi() + " - " + rollCallService.WorkshopId + " - " + monthCounter + " - " + employeeCount + $" - {amountWithoutTax}"); + + //Console.WriteLine(" number : " + counter + " - " + rollCallService.StartService.ToFarsi() + " - WorkshopId : " + rollCallService.WorkshopId + " - monthCount : " + monthCounter + " - employeeCount : " + employeeCount + $" - Amount : {amountWithoutTax.ToMoney()}" + $" - ten : {tenPercent.ToMoney()} total : {totalAmonut.ToMoney()}"); } } From c7b9f2ae2085e435fe18aade296b0339bba8d27e Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 20 Jul 2025 13:14:12 +0400 Subject: [PATCH 04/15] add RollCall service transaction --- .../AssetsAdmin/page/InstitutionContract/js/EditTransaction.js | 2 ++ .../page/InstitutionContract/js/FinancialStatment.js | 1 + 2 files changed, 3 insertions(+) diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/EditTransaction.js b/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/EditTransaction.js index 1b6b1b5f..641f44cb 100644 --- a/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/EditTransaction.js +++ b/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/EditTransaction.js @@ -14,6 +14,7 @@ $(document).ready(function () { + ` @@ -81,6 +82,7 @@ let debtorOptions = $( + ` ); diff --git a/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/FinancialStatment.js b/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/FinancialStatment.js index 6e427c60..10682bea 100644 --- a/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/FinancialStatment.js +++ b/ServiceHost/wwwroot/AssetsAdmin/page/InstitutionContract/js/FinancialStatment.js @@ -172,6 +172,7 @@ let debtorOptions = $( + ` ); From 29875f487084f9f0555d57b226a6b19ab4076f5a Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 20 Jul 2025 14:48:51 +0400 Subject: [PATCH 05/15] Create RollCall Transaction Completed --- .../InstitutionContractRepository.cs | 58 +++++++++++++++++-- 1 file changed, 54 insertions(+), 4 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index ec919b0a..34b2f3df 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -7,6 +7,8 @@ using _0_Framework.Application; using _0_Framework.InfraStructure; using Company.Domain.ContractingPartyAccountAgg; using Company.Domain.empolyerAgg; +using Company.Domain.FinancialStatmentAgg; +using Company.Domain.FinancialTransactionAgg; using Company.Domain.InstitutionContractAgg; using Company.Domain.WorkshopAgg; using CompanyManagment.App.Contracts.Employer; @@ -16,6 +18,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using PersianTools.Core; +using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; namespace CompanyManagment.EFCore.Repository; @@ -876,10 +879,34 @@ public class InstitutionContractRepository : RepositoryBase 31 ? 2 : 1; - + //var spaning = (int)(endOfMonthGr - rollCallService.StartService).TotalDays + 1; + int monthCounter = 0; + var currentMonthStart = ($"{(endOfMonthGr.ToFarsi()).Substring(0, 8)}01").ToGeorgianDateTime(); + var prevMonthEnd = currentMonthStart.AddDays(-1); + var prevMonthStart = ($"{(prevMonthEnd.ToFarsi()).Substring(0, 8)}01").ToGeorgianDateTime(); + + var monthCurrent = endOfMonth.Substring(5, 2); + var yearCurrent = endOfMonth.Substring(0, 4); + var currentMonthName = monthCurrent.ToFarsiMonthByNumber(); + + 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} {yearPrev} و {currentMonthName} {yearCurrent}"; + monthCounter = 2; + }else if (rollCallService.StartService <= currentMonthStart && + rollCallService.StartService > prevMonthStart) + { + monthCounter = 1; + + description = $"{currentMonthName} {yearCurrent}"; + } + + var employees = _context.RollCallEmployees.Where(x => x.WorkshopId == rollCallService.WorkshopId).Select(x=>x.id); @@ -887,7 +914,7 @@ public class InstitutionContractRepository : RepositoryBase employees.Contains(x.RollCallEmployeeId)) .Count(x => x.EndDate.Date == activeStatusDate.Date); - if (employeeCount > 0) + if (employeeCount > 0 && monthCounter > 0) { var workshop = _context.Workshops.FirstOrDefault(x => x.id == rollCallService.WorkshopId); counter++; @@ -917,6 +944,29 @@ public class InstitutionContractRepository : RepositoryBase + x.ContractingPartyId == item.ContractingPartyId); + long financialStatementId = 0; + if (financialStatment != null) + { + financialStatementId = financialStatment.id; + } + else + { + var statement = new FinancialStatment(item.ContractingPartyId, item.ContractingPartyName); + _context.FinancialStatments.Add(statement); + _context.SaveChanges(); + + financialStatementId = statement.id; + } + + var transaction = new FinancialTransaction(financialStatementId, endOfMonthGr, endOfMonth, + description, + "debt", "بابت سرویس حضور غیاب", totalAmonut, 0, 0); + _context.FinancialTransactions.Add(transaction); + _context.SaveChanges(); + //Console.WriteLine(" number : " + counter + " - " + rollCallService.StartService.ToFarsi() + " - WorkshopId : " + rollCallService.WorkshopId + " - monthCount : " + monthCounter + " - employeeCount : " + employeeCount + $" - Amount : {amountWithoutTax.ToMoney()}" + $" - ten : {tenPercent.ToMoney()} total : {totalAmonut.ToMoney()}"); } From 39a91c269dfde906ac3d6f2314c35612ae7abf3f Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 20 Jul 2025 14:50:51 +0400 Subject: [PATCH 06/15] change --- .../Repository/InstitutionContractRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index 34b2f3df..6b70f65b 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -896,7 +896,7 @@ public class InstitutionContractRepository : RepositoryBase prevMonthStart) From aab65e07dc2f34d6627b0eb5146d2bec8181882a Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 20 Jul 2025 16:42:29 +0400 Subject: [PATCH 07/15] create rollcall transction add workshop name --- .../Repository/InstitutionContractRepository.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs index 6b70f65b..64653737 100644 --- a/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/InstitutionContractRepository.cs @@ -877,6 +877,7 @@ public class InstitutionContractRepository : RepositoryBase workshops.Contains(x.WorkshopId)).ToList(); if (rollcallServiceList.Count > 0) { + foreach (var rollCallService in srvices) { //var spaning = (int)(endOfMonthGr - rollCallService.StartService).TotalDays + 1; @@ -889,21 +890,22 @@ 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}"; + description = $"{prevMonthName} و {currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}"; monthCounter = 2; }else if (rollCallService.StartService <= currentMonthStart && rollCallService.StartService > prevMonthStart) { monthCounter = 1; - description = $"{currentMonthName} {yearCurrent}"; + description = $"{currentMonthName} {yearCurrent} - {workshop.WorkshopFullName}"; } @@ -916,7 +918,7 @@ public class InstitutionContractRepository : RepositoryBase 0 && monthCounter > 0) { - var workshop = _context.Workshops.FirstOrDefault(x => x.id == rollCallService.WorkshopId); + counter++; From 6e7199cf6d602a38fe7f2cfdc9b9a1f473d298ce Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 21 Jul 2025 19:43:22 +0400 Subject: [PATCH 08/15] add new option to insurance --- .../CheckoutAgg/ICheckoutRepository.cs | 2 +- .../InsuranceListApplication.cs | 23 +++++++++++++++++-- .../Repository/CheckoutRepository.cs | 6 ++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs index 90d2f576..3a71ea7c 100644 --- a/Company.Domain/CheckoutAgg/ICheckoutRepository.cs +++ b/Company.Domain/CheckoutAgg/ICheckoutRepository.cs @@ -18,7 +18,7 @@ public interface ICheckoutRepository : IRepository /// /// /// - (bool hasChekout, double FamilyAlloance, double OverTimePay) HasCheckout(long workshopId, long employeId, + (bool hasChekout, double FamilyAlloance, double OverTimePay, double RotatingShift, double Nightwork, double Fridaywork, double YraesPay) HasCheckout(long workshopId, long employeId, string year, string month); EditCheckout GetDetails(long id); diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 08f07cf2..c9f83c64 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -440,6 +440,12 @@ public class InsuranceListApplication : IInsuranceListApplication bool employeeHasCheckout = true; double familyAllowance = 0; double overTimePay = 0; + + double rotatingShift = 0; + double nightWork = 0; + double fridayWork = 0; + double yearsPay = 0; + if (hasWorkshopOverTimeOrFamilyAllowance && (leftDate >= startDateGr || employee.LeftWorkDateGr == null)) { var checkout = _checkoutRepository.HasCheckout(workshopId, employee.EmployeeId, @@ -450,6 +456,11 @@ public class InsuranceListApplication : IInsuranceListApplication familyAllowance = checkout.FamilyAlloance; overTimePay = checkout.OverTimePay; + rotatingShift = checkout.RotatingShift; + nightWork = checkout.Nightwork; + fridayWork = checkout.Fridaywork; + yearsPay = checkout.YraesPay; + } else { @@ -541,9 +552,17 @@ public class InsuranceListApplication : IInsuranceListApplication // employeeListData != null ? employeeListData.BenefitsIncludedNonContinuous : 0; double benefitsIncludedNonContinuous = 0; if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && !isManager) - { + { + double addOptionsfromCheckout = familyAllowance; - benefitsIncludedNonContinuous = GetRoundValue(benefitsIncludedNonContinuous + familyAllowance); + //استثنا کارگته پایا تجارت مهراکو + if (workshopId == 652) + { + addOptionsfromCheckout = familyAllowance + rotatingShift + nightWork + fridayWork + yearsPay; + } + + + benefitsIncludedNonContinuous = GetRoundValue(benefitsIncludedNonContinuous + addOptionsfromCheckout); } diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index 478b00fb..665291da 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -71,7 +71,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos /// /// /// - public (bool hasChekout, double FamilyAlloance, double OverTimePay) HasCheckout(long workshopId, long employeId, string year, string month) + public (bool hasChekout, double FamilyAlloance, double OverTimePay, double RotatingShift, double Nightwork, double Fridaywork, double YraesPay) HasCheckout(long workshopId, long employeId, string year, string month) { var farisMonthName = Tools.ToFarsiMonthByNumber(month); @@ -79,9 +79,9 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos x.WorkshopId == workshopId && x.EmployeeId == employeId && x.Year == year && x.Month == farisMonthName && x.IsActiveString == "true"); if (res == null) - return (false, 0, 0); + return (false, 0, 0,0,0,0,0); - return (true, res.FamilyAllowance, res.OvertimePay); + return (true, res.FamilyAllowance, res.OvertimePay, res.ShiftPay, res.NightworkPay, res.FridayPay,res.YearsPay); } public EditCheckout GetDetails(long id) From ad2612b60cc05aea5686f8d12d7ed6f5b37af7ad Mon Sep 17 00:00:00 2001 From: syntax24 Date: Tue, 22 Jul 2025 13:25:29 +0330 Subject: [PATCH 09/15] change insurance exception workshop --- CompanyManagment.Application/InsuranceListApplication.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index c9f83c64..0c87b3e1 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -555,8 +555,8 @@ public class InsuranceListApplication : IInsuranceListApplication { double addOptionsfromCheckout = familyAllowance; - //استثنا کارگته پایا تجارت مهراکو - if (workshopId == 652) + //استثنا کارگته بازرگانی سیم آهن مهراکو + if (workshopId == 666) { addOptionsfromCheckout = familyAllowance + rotatingShift + nightWork + fridayWork + yearsPay; } From 1ebc93a1f8afc183e42c2176d21bef572874d5e2 Mon Sep 17 00:00:00 2001 From: syntax24 Date: Wed, 23 Jul 2025 03:25:23 +0330 Subject: [PATCH 10/15] insurance change [workshopId = 666} commented --- CompanyManagment.Application/InsuranceListApplication.cs | 8 ++++---- ServiceHost/appsettings.Development.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 0c87b3e1..3e5b1d16 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -556,10 +556,10 @@ public class InsuranceListApplication : IInsuranceListApplication double addOptionsfromCheckout = familyAllowance; //استثنا کارگته بازرگانی سیم آهن مهراکو - if (workshopId == 666) - { - addOptionsfromCheckout = familyAllowance + rotatingShift + nightWork + fridayWork + yearsPay; - } + //if (workshopId == 666) + //{ + // addOptionsfromCheckout = familyAllowance + rotatingShift + nightWork + fridayWork + yearsPay; + //} benefitsIncludedNonContinuous = GetRoundValue(benefitsIncludedNonContinuous + addOptionsfromCheckout); diff --git a/ServiceHost/appsettings.Development.json b/ServiceHost/appsettings.Development.json index 663f601a..4ebfc856 100644 --- a/ServiceHost/appsettings.Development.json +++ b/ServiceHost/appsettings.Development.json @@ -32,7 +32,7 @@ "ApiKey": "Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa", "SecretKey": "dadmehr" }, - "Domain": ".dad-mehr.ir" + "Domain": ".gozareshgir.ir" } From 91365f5aebd8065a9bf7d13ba0fed2e46999605b Mon Sep 17 00:00:00 2001 From: SamSys Date: Wed, 23 Jul 2025 16:46:16 +0400 Subject: [PATCH 11/15] bug : Load rollCall Contract to Create checkout - Fixed --- .../Repository/CheckoutRepository.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index 665291da..cef202ba 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -240,6 +240,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos var now = DateTime.Now; DateTime currentStart = ($"{DateTime.Now.ToFarsi().Substring(0, 8)}01").ToGeorgianDateTime(); DateTime currentEnd = ($"{DateTime.Now.ToFarsi().FindeEndOfMonth()}").ToGeorgianDateTime(); + var chekoutCreated = result.checkout.FirstOrDefault(x => x.ContractStart < endSearch && x.ContractEnd > startSreach && x.IsActiveString == "true"); if (chekoutCreated != null) @@ -265,13 +266,20 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos } var employeeJoin = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork .contractWorkshopEmployee.employee.id; - - bool hasRollCall = - _rollCallEmployeeRepository.HasRollCallRecord(employeeJoin, workshopId, startSreach, endSearch); + var leftWork = result.contractWorkshopEmployeeleftWorkPersonnelCode.contractWorkshopEmployeeleftWork .leftwork; + var startStatusSearch = leftWork.StartWorkDate > startSreach && leftWork.StartWorkDate <= endSearch + ? leftWork.StartWorkDate + : startSreach; + var endStatusSearch = leftWork.HasLeft && leftWork.LeftWorkDate > startSreach && leftWork.LeftWorkDate <= endSearch + ? leftWork.LeftWorkDate.AddDays(-1) + : startSreach; + bool hasRollCall = + _rollCallEmployeeRepository.HasRollCallRecord(employeeJoin, workshopId, startStatusSearch, endStatusSearch); + bool extension = true; bool laterThanEnd = false; string description = ""; From e924ca7049f7f02fa833a86072b57a14722d192a Mon Sep 17 00:00:00 2001 From: syntax24 Date: Wed, 23 Jul 2025 16:56:40 +0330 Subject: [PATCH 12/15] change menu --- ServiceHost/Areas/Admin/Pages/Shared/_Menu.cshtml | 2 +- ServiceHost/Areas/AdminNew/Pages/Shared/_Menu.cshtml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ServiceHost/Areas/Admin/Pages/Shared/_Menu.cshtml b/ServiceHost/Areas/Admin/Pages/Shared/_Menu.cshtml index c045b6e3..9cdcacd7 100644 --- a/ServiceHost/Areas/Admin/Pages/Shared/_Menu.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Shared/_Menu.cshtml @@ -465,7 +465,7 @@
  • - +