From e67aca37f92cdb84bc33a71c705ae2b23555e2c8 Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 15 Dec 2025 12:15:00 +0330 Subject: [PATCH] Insurance HasCheckout change --- .../Repository/CheckoutRepository.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs index cb843e5a..a78ff18e 100644 --- a/CompanyManagment.EFCore/Repository/CheckoutRepository.cs +++ b/CompanyManagment.EFCore/Repository/CheckoutRepository.cs @@ -64,7 +64,7 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos } /// - /// چیک میکند که آیا پرسنل در سال و ماه درخواستی در این کارگاه فیش حقوقی دارد یا خیر + /// چک میکند که آیا پرسنل در سال و ماه درخواستی در این کارگاه فیش حقوقی دارد یا خیر /// /// /// @@ -74,12 +74,21 @@ public class CheckoutRepository : RepositoryBase, ICheckoutRepos 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); - + var res = _context.CheckoutSet.FirstOrDefault(x => x.WorkshopId == workshopId && x.EmployeeId == employeId && x.Year == year && x.Month == farisMonthName && x.IsActiveString == "true"); if (res == null) - return (false, 0, 0,0,0,0,0); + { + var checkLeftDate = ($"{year}/{month}/01").ToGeorgianDateTime(); + var hasLeftwork = _context.LeftWorkList.Any(x => + x.EmployeeId == employeId && x.WorkshopId == workshopId && x.LeftWorkDate == checkLeftDate); + if(hasLeftwork) + return (true, 0, 0, 0, 0, 0, 0); + + return (false, 0, 0, 0, 0, 0, 0); + } + return (true, res.FamilyAllowance, res.OvertimePay, res.ShiftPay, res.NightworkPay, res.FridayPay,res.YearsPay); }