Insurance New Change

This commit is contained in:
SamSys
2025-05-10 13:06:16 +03:30
parent 62502fcede
commit 9e60c12212
3 changed files with 42 additions and 5 deletions

View File

@@ -18,7 +18,8 @@ public interface ICheckoutRepository : IRepository<long, Checkout>
/// <param name="سال به صورت رشته عددی"></param>
/// <param name="ماه بصورت رشته عددی"></param>
/// <returns></returns>
bool HasCheckout(long workshopId, long employeId, string year, string month);
(bool hasChekout, double FamilyAlloance, double OverTimePay) HasCheckout(long workshopId, long employeId,
string year, string month);
EditCheckout GetDetails(long id);
void CreateCkeckout(Checkout command);

View File

@@ -425,10 +425,23 @@ public class InsuranceListApplication: IInsuranceListApplication
//این مورد زمانی چک می شود که تیک محاسبه در کارگاه زده شده باشد
// در غیر اینصورت بصورت پیشفرض دارای فیش حقوق در نظر گرفته می شود
bool employeeHasCheckout = true;
double familyAllowance = 0;
double overTimePay = 0;
if (hasWorkshopOverTimeOrFamilyAllowance && (leftDate >= startDateGr || employee.LeftWorkDateGr == null))
{
employeeHasCheckout = _checkoutRepository.HasCheckout(workshopId, employee.EmployeeId,
var checkout = _checkoutRepository.HasCheckout(workshopId, employee.EmployeeId,
searchModel.Year, searchModel.Month);
if (checkout.hasChekout)
{
familyAllowance = checkout.FamilyAlloance;
overTimePay = checkout.OverTimePay;
}
else
{
employeeHasCheckout = false;
}
}
@@ -487,6 +500,17 @@ public class InsuranceListApplication: IInsuranceListApplication
//مزیای عیر مشمول لیست قبل
var benefitsIncludedNonContinuous =
employeeListData != null ? employeeListData.BenefitsIncludedNonContinuous : 0;
if (workshop.InsuranceCheckoutFamilyAllowance && employeeHasCheckout)
{
benefitsIncludedNonContinuous = benefitsIncludedNonContinuous + familyAllowance;
}
if (workshop.InsuranceCheckoutOvertime && employeeHasCheckout)
{
benefitsIncludedContinuous = benefitsIncludedContinuous + overTimePay;
}
var includedAndNotIncluded = benefitsIncludedContinuous + benefitsIncludedNonContinuous;
return new EmployeeDetailsForInsuranceListViewModel
@@ -1462,8 +1486,16 @@ public class InsuranceListApplication: IInsuranceListApplication
bool employeeHasCheckout = true;
if (hasWorkshopOverTimeOrFamilyAllowance && (leftDate >= startDateGr || employeeData.LeftWorkDateGr == null))
{
employeeHasCheckout = _checkoutRepository.HasCheckout(workshopId, employeeData.EmployeeId,
var checkout = _checkoutRepository.HasCheckout(workshopId, employeeData.EmployeeId,
searchModel.Year, searchModel.Month);
if (checkout.hasChekout)
{
}
else
{
employeeHasCheckout = false;
}
}
return new EmployeeDetailsForInsuranceListViewModel
{

View File

@@ -55,13 +55,17 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
/// <param name="سال به صورت رشته عددی"></param>
/// <param name="ماه بصورت رشته عددی"></param>
/// <returns></returns>
public bool HasCheckout(long workshopId, long employeId, string year, string month)
public (bool hasChekout, double FamilyAlloance, double OverTimePay) HasCheckout(long workshopId, long employeId, string year, string month)
{
var farisMonthName = Tools.ToFarsiMonthByNumber(month);
return _context.CheckoutSet.Any(x =>
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);
return (true, res.FamilyAllowance, res.OvertimePay);
}
public EditCheckout GetDetails(long id)