diff --git a/0_Framework/Application/Tools.cs b/0_Framework/Application/Tools.cs index fbe8b825..c983cb61 100644 --- a/0_Framework/Application/Tools.cs +++ b/0_Framework/Application/Tools.cs @@ -60,7 +60,7 @@ public static class Tools if(leftWork == null) leftWork = DateTime.MinValue; //اگر ترک کار پرسنل در ماه مشخص شده لیست بیمه بود - if (leftWork != DateTime.MinValue && leftWork.Value <= endDate) + if (leftWork != DateTime.MinValue && leftWork.Value < endDate) { end = leftWork.Value; endWorkInMonth = true; diff --git a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs index 26f5063e..964f70d9 100644 --- a/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs +++ b/Company.Domain/CustomizeWorkshopEmployeeSettingsAgg/Entities/CustomizeWorkshopEmployeeSettings.cs @@ -91,8 +91,7 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity NightWorkPay nightWorkPay, MarriedAllowance marriedAllowance, ShiftPay shiftPay, FamilyAllowance familyAllowance, LeavePay leavePay, InsuranceDeduction insuranceDeduction, FineAbsenceDeduction fineAbsenceDeduction, LateToWork lateToWork, EarlyExit earlyExit, - FridayWork fridayWork, HolidayWork holidayWork, IrregularShift irregularShift, - WorkshopShiftStatus workshopShiftStatus, bool isSettingChange, int leavePermittedDays) + FridayWork fridayWork, HolidayWork holidayWork, IrregularShift irregularShift, bool isSettingChange, int leavePermittedDays) { SetValueObjects(fridayPay, overTimePay, baseYearsPay, bonusesPay , nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, insuranceDeduction, fineAbsenceDeduction, @@ -102,10 +101,6 @@ public class CustomizeWorkshopEmployeeSettings : BaseCustomizeEntity IsSettingChanged = isSettingChange; FridayWork = fridayWork; HolidayWork = holidayWork; - IrregularShift = workshopShiftStatus == WorkshopShiftStatus.Regular ? - new IrregularShift(new TimeOnly(), new TimeOnly(), WorkshopIrregularShifts.None) - : new IrregularShift(irregularShift.StartTime, irregularShift.EndTime, irregularShift.WorkshopIrregularShifts); - WorkshopShiftStatus = workshopShiftStatus; LeavePermittedDays = leavePermittedDays; } diff --git a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs index bd48840c..48bd4fd7 100644 --- a/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs +++ b/Company.Domain/CustomizeWorkshopGroupSettingsAgg/Entities/CustomizeWorkshopGroupSettings.cs @@ -154,7 +154,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity { item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, - LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false, leavePermittedDays); + LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays); } } public void EditAndOverwriteOnAllEmployees(string groupName, double salary, @@ -182,7 +182,7 @@ public class CustomizeWorkshopGroupSettings : BaseCustomizeEntity { item.EditEmployees(Salary, FridayPay, OverTimePay, BaseYearsPay, BonusesPay , NightWorkPay, MarriedAllowance, ShiftPay, FamilyAllowance, LeavePay, InsuranceDeduction, FineAbsenceDeduction, - LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, WorkshopShiftStatus, false, leavePermittedDays); + LateToWork, EarlyExit, FridayWork, HolidayWork, IrregularShift, false, leavePermittedDays); } } diff --git a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs index c6a712c6..66a1590b 100644 --- a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs +++ b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs @@ -1311,7 +1311,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo && shiftPay == entity.ShiftPay && nightWorkPay == entity.NightWorkPay && marriedAllowance == entity.MarriedAllowance && familyAllowance == entity.FamilyAllowance && leavePay == entity.LeavePay && insuranceDeduction == entity.InsuranceDeduction && fineAbsenceDeduction == entity.FineAbsenceDeduction && lateToWork == entity.LateToWork && earlyExit == entity.EarlyExit && command.FridayWork == entity.FridayWork - && command.HolidayWork == entity.HolidayWork && command.IrregularShift == entity.IrregularShift && command.WorkshopShiftStatus == entity.WorkshopShiftStatus) + && command.HolidayWork == entity.HolidayWork ) { isChanged = false; } @@ -1323,8 +1323,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo //change employee data manually. It changes the 'IsChanged' property to true. entity.EditEmployees(salary, fridayPay, overTimePay, baseYearsPay, bonusesPay, nightWorkPay, marriedAllowance, shiftPay, familyAllowance, leavePay, - insuranceDeduction, fineAbsenceDeduction, lateToWork, earlyExit, command.FridayWork, command.HolidayWork, command.IrregularShift, - command.WorkshopShiftStatus, isChanged, command.LeavePermittedDays); + insuranceDeduction, fineAbsenceDeduction, lateToWork, earlyExit, command.FridayWork, command.HolidayWork, command.IrregularShift, isChanged, command.LeavePermittedDays); _customizeWorkshopEmployeeSettingsRepository.SaveChanges(); diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 007bb879..7807dd69 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -441,8 +441,10 @@ public class InsuranceListApplication: IInsuranceListApplication var monthlyBenefits = GetMonthlyBenefits(endOfMonth, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marriedAllowance, workingDays.countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, employee.JobId, employee.EmployeeId,employee.IncludeStatus); - //محاسبه جمع مزایای مشمول و دستمزد ماهانه - var benefitsIncludedContinuous = monthlyBenefits + monthlySalary; + var marriedAllowanceCompute = MarriedAllowance(employee.MaritalStatus, employee.JobId, employee.IncludeStatus, + workingDays.countWorkingDays, yearlysaleries.MarriedAllowance, endOfMonth); + //محاسبه جمع مزایای مشمول و دستمزد ماهانه + var benefitsIncludedContinuous = monthlyBenefits + monthlySalary; //benefitsIncludedContinuous = employee.JobId != 16 ? benefitsIncludedContinuous : 0; //محاسبه حق بیمه سهم بیمه شده @@ -516,7 +518,7 @@ public class InsuranceListApplication: IInsuranceListApplication DailyWagePlusBaseYears = dailyWagePlusBaseYears, //حق تاهل - MarriedAllowance = marriedAllowance, + MarriedAllowance = marriedAllowanceCompute, //دستمزد ماهانه MonthlySalary = monthlySalary, @@ -875,7 +877,26 @@ public class InsuranceListApplication: IInsuranceListApplication return result; } - + private double MarriedAllowance(string maritalStatus,long jobId, bool includedStatus, + int countWorkingDays, double marriedAlowance,int endMonthCurrentDay) + { + bool isManager = jobId is 10 or 16 or 17 or 18; + if (isManager)//اگر مدیر عامل بود + return 0; + if (maritalStatus != "متاهل")//اگر مجرد بود + return 0; + + if(countWorkingDays == endMonthCurrentDay) + return (marriedAlowance); + + return endMonthCurrentDay switch + { + 29 => GetRoundValue((marriedAlowance / 29) * countWorkingDays), + 30 => GetRoundValue((marriedAlowance / 30) * countWorkingDays), + 31 => GetRoundValue((marriedAlowance / 31) * countWorkingDays), + _ => marriedAlowance + }; + } public OperationResult CreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command) { @@ -1461,7 +1482,7 @@ public class InsuranceListApplication: IInsuranceListApplication DailyWagePlusBaseYears = employeeData.DailyWagePlusBaseYears, //حق تاهل - MarriedAllowance = isManager ? 0 : employeeData.MarriedAllowance, + MarriedAllowance = employeeData.MarriedAllowance, //دستمزد ماهانه MonthlySalary = employeeData.MonthlySalary, @@ -1640,18 +1661,21 @@ public class InsuranceListApplication: IInsuranceListApplication //اگر پرسنل کارفرما بود و نوع لیست کارگاه کمک دولت بود مزایا محاسبه نشود //اگر تیک مشمول مزایا در ترک کار خاموش بود مزایا نگیرد - if (jobId is 10 or 16 or 17 or 18 && !includeStatus) + + bool isManager = jobId is 10 or 16 or 17 or 18; + if (isManager && !includeStatus) return 0; //پرسنل استثناء if (employeeId == 42783) return 53082855; - + //if(employeeId == 8859) + // return GetRoundValue(((consumableItemsItemValue + housingAllowanceItemValue + maritalStatus) / 31) * countWorkingDays); - //مزایای ماهانه با توجه به پایان ماه که 30 یا 31 روزه است، متفاوت می باشد - //برای ماه 29 روزه هم تقسیم بر 30 می شود. - if (countWorkingDays == endMonthCurrentDay) + //مزایای ماهانه با توجه به پایان ماه که 30 یا 31 روزه است، متفاوت می باشد + //برای ماه 29 روزه هم تقسیم بر 30 می شود. + if (countWorkingDays == endMonthCurrentDay) return (consumableItemsItemValue + housingAllowanceItemValue + maritalStatus); else if (endMonthCurrentDay == 29)//farokhiChanges در خط پایین عدد 30 رو به 29 تغییر دادم return GetRoundValue(((consumableItemsItemValue + housingAllowanceItemValue + maritalStatus) / 29) * countWorkingDays); diff --git a/CompanyManagment.EFCore/Repository/ContractRepository.cs b/CompanyManagment.EFCore/Repository/ContractRepository.cs index fa0b47ad..d4809b95 100644 --- a/CompanyManagment.EFCore/Repository/ContractRepository.cs +++ b/CompanyManagment.EFCore/Repository/ContractRepository.cs @@ -690,7 +690,12 @@ public class ContractRepository : RepositoryBase, IContractRepos }; var leftworkList = _leftWorkRepository.search(searchModel); - var lastLeftWork = leftworkList.FirstOrDefault(x=>contractStart <= x.LeftWorkDateGr && ContractEnd >= x.StartWorkDateGr); + if(leftworkList.Count == 0) + return new ContractSeparationViewModel() + { + checker = false + }; + var lastLeftWork = leftworkList.FirstOrDefault(x=>contractStart <= x.LeftWorkDateGr && ContractEnd >= x.StartWorkDateGr); //if (lastLeftWork.StartWorkDateGr > contractStart) // lastLeftWork = leftworkList.FirstOrDefault(x => // x.StartWorkDateGr <= contractStart && x.LeftWorkDateGr > contractStart); diff --git a/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs b/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs index f9603c8d..c4df88a4 100644 --- a/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs +++ b/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs @@ -1236,18 +1236,20 @@ public class InsuranceListRepository : RepositoryBase, IIns //اگر ترک کار کرده بود //یا //شروع به کارش بعد از یکم ماه بود - if (hasLeft || listStartDate < startWorkDate) - { - //تعداد روزهای ماه در این لیست بیمه - var monthDayCont = (int)(listEndDate - listStartDate).TotalDays + 1; - //پایه سنوات به ازای هر روز - var baseyarPerDay = baseYear / monthDayCont; - // پایه سنوات یک روز ضرب در روزهای کارکرد در ماه - baseYear = baseyarPerDay * countWorkingDay; + //if (hasLeft || listStartDate < startWorkDate) + //{ + // //تعداد روزهای ماه در این لیست بیمه + // var monthDayCont = (int)(listEndDate - listStartDate).TotalDays + 1; + // //پایه سنوات به ازای هر روز + // var baseyarPerDay = baseYear / monthDayCont; + // // پایه سنوات یک روز ضرب در روزهای کارکرد در ماه + // baseYear = baseyarPerDay * countWorkingDay; - } + //} + + return (yearsCount, baseYear); } diff --git a/CompanyManagment.EFCore/Repository/LeftWorkInsuranceRepository.cs b/CompanyManagment.EFCore/Repository/LeftWorkInsuranceRepository.cs index 992ede00..9cbe1fc6 100644 --- a/CompanyManagment.EFCore/Repository/LeftWorkInsuranceRepository.cs +++ b/CompanyManagment.EFCore/Repository/LeftWorkInsuranceRepository.cs @@ -750,7 +750,6 @@ public class LeftWorkInsuranceRepository : RepositoryBase x.SalaryAidDateTime >= contractStart && x.SalaryAidDateTime <= contractEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel() + .Where(x => x.SalaryAidDateTime.Date >= contractStart && x.SalaryAidDateTime.Date <= contractEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel() { Amount = x.Amount.ToMoney(), AmountDouble = x.Amount, diff --git a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs index c3371057..132eb778 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/Checkouts/Index.cshtml.cs @@ -773,6 +773,7 @@ public class IndexModel : PageModel // separation.ContarctStart = item.ContarctStart; // separation.ContractEnd = item.ContractEnd; //} + var search = new CheckoutSearchModel { ContractNo = item.ContractNo, @@ -808,6 +809,13 @@ public class IndexModel : PageModel } + if (!separation.checker) + { + item.RedColor = true; + item.Extension = false; + + } + ContractListNew.Add(item); } diff --git a/ServiceHost/Areas/Admin/Pages/Company/Employees/LeftWorkInsurance.cshtml b/ServiceHost/Areas/Admin/Pages/Company/Employees/LeftWorkInsurance.cshtml index 0931e791..082c2416 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/Employees/LeftWorkInsurance.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/Employees/LeftWorkInsurance.cshtml @@ -83,7 +83,7 @@
- +
@@ -91,7 +91,7 @@
@if (item.LeftworkInsuranceViewModels != null && item.LeftworkInsuranceViewModels.Count > 0) { - + } else { @@ -1191,11 +1191,11 @@ function employerDiagnose() { const positionTitle = $('.value').data('value'); const setContract = $(".setContract"); - if (positionTitle == '10' || positionTitle == '16' || positionTitle == '17' || positionTitle == '18') { - setContract.prop("checked", false); - } else { - setContract.prop("checked", true); - } + // if (positionTitle == '10' || positionTitle == '16' || positionTitle == '17' || positionTitle == '18') { + // setContract.prop("checked", false); + // } else { + // setContract.prop("checked", true); + // } } function disappearIcon() { diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml index fb2b36c9..a021332f 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml @@ -1284,6 +1284,7 @@ function showEditModal(row, rowId, insuranceEmployeeInformationId, dateOfIssue) { var jobId = row.find('td:eq(3)').attr("data-id"); + var oldWorkingDays = row.find('td:eq(12)').attr("data-oldWorkingDays"); //showJobList(jobId); $('#edit-modal').modal('show'); $('#LeftWorkDate').val(row.find('td:eq(1)').text()); diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml index f41193c7..9795c8f9 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml @@ -395,7 +395,7 @@ function showEditModal(row,rowId,insuranceEmployeeInformationId,dateOfIssue){ var jobId=row.find('td:eq(3)').attr("data-id"); - var oldWorkingDays= row.find('td:eq(10)').attr("data-oldWorkingDays"); + var oldWorkingDays= row.find('td:eq(12)').attr("data-oldWorkingDays"); //showJobList(jobId); $('#edit-modal').modal('show'); $('#LeftWorkDate').val(row.find('td:eq(1)').text()); diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeListForEdit.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeListForEdit.cshtml index d41c793b..7413d2e0 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeListForEdit.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeListForEdit.cshtml @@ -354,7 +354,7 @@ function showEditModal(row,rowId,insuranceEmployeeInformationId,dateOfIssue){ var jobId=row.find('td:eq(3)').attr("data-id"); - var oldWorkingDays= row.find('td:eq(10)').attr("data-oldWorkingDays"); + var oldWorkingDays= row.find('td:eq(12)').attr("data-oldWorkingDays"); //showJobList(jobId); $('#edit-modal').modal('show'); $('#LeftWorkDate').val(row.find('td:eq(1)').text()); diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs index ad29eed6..ebf3f42a 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs @@ -925,8 +925,9 @@ public class IndexModel : PageModel var benefitsIncludedContinuousL = benefitsIncludedContinuous.MoneyToDouble(); bool isManager = jobId is "10" or "16" or "17" or "18"; - if (isManager) - maritalStatus = 0; + //if (isManager && includeStatus !="1") شنبه + if (isManager) + maritalStatus = 0; double sum = 0; var employeeMaritalStatus = _employeeApplication.GetDetails(employeeId); @@ -966,9 +967,8 @@ public class IndexModel : PageModel //{ // benefitsIncludedContinuousL = 0; //} - if ((includeStatusL == 0 && (jobIdL == 10 || jobIdL == 17 || jobIdL == 18 || jobIdL == 16)) || - (includeStatusL == 1 && jobIdL == 10)) // 10 --> karfarma - benefitsIncludedContinuousL = 0; + if (isManager && includeStatus != "1") + benefitsIncludedContinuousL = 0; var monthlySalaryL = workingDaysL * dailyWageL; var insuranceShareL = (benefitsIncludedContinuousL + monthlySalaryL) * 7 / 100; insuranceShareL = _insuranceListApplication.GetRoundValue(insuranceShareL);