insurance changes - chekout - workshopShiftStatus bug fixed

This commit is contained in:
SamSys
2025-02-08 21:46:02 +03:30
parent 141ae59939
commit c4f4762ac4
15 changed files with 81 additions and 48 deletions

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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();

View File

@@ -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);

View File

@@ -690,7 +690,12 @@ public class ContractRepository : RepositoryBase<long, Contract>, 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);

View File

@@ -1236,18 +1236,20 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, 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);
}

View File

@@ -750,7 +750,6 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
IsMaritalStatusSet = !string.IsNullOrWhiteSpace(result.x.left.Employee.MaritalStatus)
}).ToList();
return query;
}

View File

@@ -1867,7 +1867,7 @@ CreateWorkingHoursTemp command, long leavId)
#region SalaryAidDeduction
var salaryAidViewModel = _context.SalaryAids
.Where(x => 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,

View File

@@ -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);
}

View File

@@ -83,7 +83,7 @@
</div>
<div class="second-col-content">
<label> شماره پرسنلی </label>
<input type="text" class="position-code" value="@item.PersonnelCode" data-haspersonelcode="@(item.HasPersonelCode ? true : false)" disabled="disabled">
<input type="text" class="position-code" value="@item.PersonnelCode" checked="checked" data-haspersonelcode="@(item.HasPersonelCode ? true : false)" disabled="disabled">
</div>
<div class="third-col-content">
<div class="d-flex position-check">
@@ -91,7 +91,7 @@
<div class="checkbox-wrapper">
@if (item.LeftworkInsuranceViewModels != null && item.LeftworkInsuranceViewModels.Count > 0)
{
<input checked="@item.LeftworkInsuranceViewModels[0].IncludeStatus" type="checkbox" class="setContract">
<input @(item.LeftworkInsuranceViewModels[0].IncludeStatus ? "checked" : "") type="checkbox" class="setContract">
}
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() {

View File

@@ -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());

View File

@@ -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());

View File

@@ -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());

View File

@@ -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);