From fe20c63baf87f352701fb3816d8b8eac8598c9ce Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 20 Jul 2025 11:27:41 +0400 Subject: [PATCH] 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()}"); } }