From ac1bb05515bb40e1a1750830249356a6c1330c8d Mon Sep 17 00:00:00 2001 From: SamSys Date: Mon, 12 May 2025 15:41:35 +0330 Subject: [PATCH] Insuranc IsManager condition set for new props --- .../InsuranceListApplication.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 9c9ab55b..7d05e2d3 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -391,6 +391,7 @@ public class InsuranceListApplication: IInsuranceListApplication x.Year == searchModel.Year && x.Month == searchModel.Month && searchModel.WorkshopIds.Contains(x.WorkshopId))) { + var startMonthFa = $"{searchModel.Year}/{searchModel.Month.PadLeft(2, '0')}/01"; DateTime startDateGr = startMonthFa.ToGeorgianDateTime(); DateTime endDateGr = startMonthFa.FindeEndOfMonth() @@ -416,6 +417,7 @@ public class InsuranceListApplication: IInsuranceListApplication var dateOfIssue = employee.DateOfIssueGr.ToFarsi(); var leftDate = employee.LeftWorkDateGr != null ? employee.LeftWorkDateGr.Value.AddDays(-1) : new DateTime(); + bool isManager = employee.JobId is 10 or 16 or 17 or 18 or 3498; //آیا در کارگاه تیک محاسبه اضافه کار یا حق اولاد زده شده است؟ bool hasWorkshopOverTimeOrFamilyAllowance = @@ -440,7 +442,7 @@ public class InsuranceListApplication: IInsuranceListApplication } else { - employeeHasCheckout = false; + employeeHasCheckout = isManager == false ? false : true; } } @@ -457,7 +459,7 @@ public class InsuranceListApplication: IInsuranceListApplication var baseYears = _insuranceListRepositpry.GetEmployeeInsuranceBaseYear(employee.EmployeeId, workshopId, workingDays.countWorkingDays, startDateGr, endDateGr,workingDays.startWork, workingDays.endWork, workingDays.hasLeftWorkInMonth); //آیا کارفرما یا مدیر عامل است؟ - bool isManager = employee.JobId is 10 or 16 or 17 or 18 or 3498; + baseYears.baseYear = isManager ? 0 : baseYears.baseYear; Console.WriteLine(employee.JobId + " - "+ baseYears.baseYear); //جمع مزد روزانه و پایه سنوات @@ -477,7 +479,7 @@ public class InsuranceListApplication: IInsuranceListApplication // monthlyBenefits = 80869389; //if (employee.EmployeeId is 43787)// شهرام براهیمی سیقلان // monthlyBenefits = 54748472; - if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout) + if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout && !isManager) { monthlyBenefits = GetRoundValue(monthlyBenefits += overTimePay); @@ -504,7 +506,7 @@ public class InsuranceListApplication: IInsuranceListApplication //مزیای عیر مشمول لیست قبل var benefitsIncludedNonContinuous = employeeListData != null ? employeeListData.BenefitsIncludedNonContinuous : 0; - if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout) + if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && !isManager) { benefitsIncludedNonContinuous = GetRoundValue(benefitsIncludedNonContinuous + familyAllowance); @@ -1507,19 +1509,19 @@ public class InsuranceListApplication: IInsuranceListApplication } else { - employeeHasCheckout = false; + employeeHasCheckout = isManager == false ? false : true; } } bool familyAllowanceIsSet = true; bool overTimePayIsSet = true; - if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && employeeData.FamilyAllowance == 0 && hasFamilyAllowance) + if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout && employeeData.FamilyAllowance == 0 && hasFamilyAllowance && !isManager) { familyAllowanceIsSet = false; } - if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout && employeeData.OverTimePay == 0 && hasOverTimePay) + if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout && employeeData.OverTimePay == 0 && hasOverTimePay && !isManager) { overTimePayIsSet = false;