diff --git a/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs b/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs index e99d7a11..900e40fb 100644 --- a/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs +++ b/Company.Domain/InsuranceListAgg/IInsuranceListRepository.cs @@ -5,6 +5,7 @@ using System.Text; using System.Threading.Tasks; using _0_Framework.Application; using _0_Framework.Domain; +using CompanyManagment.App.Contracts.EmployeeInsurancListData; using CompanyManagment.App.Contracts.InsuranceList; using CompanyManagment.App.Contracts.InsuranceWorkshopInfo; @@ -40,6 +41,14 @@ public interface IInsuranceListRepository:IRepository /// /// (int insuranceHistoryYearsCount, double baseYear) GetEmployeeInsuranceBaseYear(long employeeId, long workshopId, int countWorkingDay, DateTime listStartDate, DateTime listEndDate, DateTime startWorkDate, DateTime leftDate, bool hasLeft); + + /// + /// بدست آوردن اطلاعات محاسباتی ماه قبل پرسنل + /// + /// + /// + /// + List GetEmployeeInsuranceDataAmonthAgo(DateTime currentMonthStartDate, long workshopId); #endregion #region client diff --git a/CompanyManagment.App.Contracts/EmployeeInsurancListData/CreateEmployeeInsurancListData.cs b/CompanyManagment.App.Contracts/EmployeeInsurancListData/CreateEmployeeInsurancListData.cs index 088c90c1..f3bf245e 100644 --- a/CompanyManagment.App.Contracts/EmployeeInsurancListData/CreateEmployeeInsurancListData.cs +++ b/CompanyManagment.App.Contracts/EmployeeInsurancListData/CreateEmployeeInsurancListData.cs @@ -42,9 +42,13 @@ public class CreateEmployeeInsurancListData /// DSW_MASH /// public double MonthlyBenefitsIncluded { get; set; } - // مزایای مشمول مستمر + /// + /// مزایای ماهانه مشمول + /// public double BenefitsIncludedContinuous { get; set; } - //مزایای مشمول غیر مستمر + /// + /// مزایای ماهانه غیرمشمول + /// public double BenefitsIncludedNonContinuous { get; set; } /// diff --git a/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataSearchModel.cs b/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataSearchModel.cs index cfe2d96a..b927f7f0 100644 --- a/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataSearchModel.cs +++ b/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataSearchModel.cs @@ -23,9 +23,13 @@ public class EmployeeInsurancListDataSearchModel public double MonthlyBenefits { get; set; } //دستمزد و مزایای ماهانه مشمول public double MonthlyBenefitsIncluded { get; set; } - // مزایای مشمول مستمر + /// + /// مزایای ماهانه مشمول + /// public double BenefitsIncludedContinuous { get; set; } - //مزایای مشمول غیر مستمر + /// + /// مزایای ماهانه غیرمشمول + /// public double BenefitsIncludedNonContinuous { get; set; } //سهم بیمه حق کارگر public double InsuranceShare { get; set; } diff --git a/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataViewModel.cs b/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataViewModel.cs index 52c694e9..6fe5ba6d 100644 --- a/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataViewModel.cs +++ b/CompanyManagment.App.Contracts/EmployeeInsurancListData/EmployeeInsurancListDataViewModel.cs @@ -41,9 +41,13 @@ public class EmployeeInsurancListDataViewModel /// DSW_MASH /// public double MonthlyBenefitsIncluded { get; set; } - // مزایای مشمول مستمر + /// + /// مزایای ماهانه مشمول + /// public double BenefitsIncludedContinuous { get; set; } - //مزایای مشمول غیر مستمر + /// + /// مزایای ماهیانه غیرمشمول + /// public double BenefitsIncludedNonContinuous { get; set; } /// /// جمع کل دستمزد و مزایای ماهانه diff --git a/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs b/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs index 415d893e..52e56b27 100644 --- a/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs +++ b/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs @@ -135,11 +135,11 @@ public class EmployeeDetailsForInsuranceListViewModel /// public double MonthlyBenefitsIncluded { get; set; } /// - /// مزایای مشمول مستمر + /// مزایای ماهیانه مشمول /// public double BenefitsIncludedContinuous { get; set; } /// - /// مزایای مشمول غیر مستمر + /// مزایای ماهیانه غیرمشمول /// public double BenefitsIncludedNonContinuous { get; set; } diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index cd9bf530..48b1227e 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -400,6 +400,9 @@ public class InsuranceListApplication: IInsuranceListApplication var employeesInfoAndLeftWorks = _leftWorkInsuranceApplication.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDateGr, endDateGr); + + var employeeInsurancDataPreviusList = + _insuranceListRepositpry.GetEmployeeInsuranceDataAmonthAgo(startDateGr, workshopId); watch.Start(); var computeResult = employeesInfoAndLeftWorks.Select(employee => { @@ -445,6 +448,15 @@ public class InsuranceListApplication: IInsuranceListApplication // محاسبه بیمه بیکاری var unEmploymentInsurance = (benefitsIncludedContinuous * 3) / 100; + + + var employeeListData = employeeInsurancDataPreviusList + .FirstOrDefault(e => e.EmployeeId == employee.EmployeeId); + //مزیای عیر مشمول لیست قبل + var benefitsIncludedNonContinuous = + employeeListData != null ? employeeListData.BenefitsIncludedNonContinuous : 0; + + var includedAndNotIncluded = benefitsIncludedContinuous + benefitsIncludedNonContinuous; return new EmployeeDetailsForInsuranceListViewModel { #region EmployeeInfo @@ -508,14 +520,14 @@ public class InsuranceListApplication: IInsuranceListApplication //مزایای ماهانه MonthlyBenefits = monthlyBenefits, - //مزایای مشمول مستمر + //مزایای مشمول BenefitsIncludedContinuous = benefitsIncludedContinuous, - //مزیایی مشمول غیر مستمر - BenefitsIncludedNonContinuous = 0, + //مزایای غیر مشمول + BenefitsIncludedNonContinuous = benefitsIncludedNonContinuous, - // جمع کل دستمزد و مزایای ماهانه - IncludedAndNotIncluded = benefitsIncludedContinuous, + // جمع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول + IncludedAndNotIncluded = includedAndNotIncluded, //حق بیمه سهم بیمه شده InsuranceShare = GetRoundValue(insuranceShare), diff --git a/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs b/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs index c124cb24..51b0f918 100644 --- a/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs +++ b/CompanyManagment.EFCore/Repository/InsuranceListRepository.cs @@ -1232,4 +1232,25 @@ public class InsuranceListRepository : RepositoryBase, IIns return (yearsCount, baseYear); } + + public List GetEmployeeInsuranceDataAmonthAgo(DateTime currentMonthStartDate, long workshopId) + { + var previusMonthListdate = currentMonthStartDate.AddDays(-1); + var res = _context.InsuranceListSet + .Where(x => x.StartDate < previusMonthListdate && x.EndDate >= previusMonthListdate && x.WorkshopId == workshopId) + .Join(_context.EmployeeInsurancListDataSet, + insuranceList => insuranceList.id, + employeeInsurancListData => employeeInsurancListData.InsuranceListId, + (insuranceList, employeeInsurancListData) => new EmployeeInsurancListDataViewModel + { + InsuranceListId = insuranceList.id, + EmployeeId = employeeInsurancListData.EmployeeId, + WorkingDays = employeeInsurancListData.WorkingDays, + BenefitsIncludedNonContinuous = employeeInsurancListData.BenefitsIncludedNonContinuous + + + }); + + return res.ToList(); + } } \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml index c0b1f9f6..f745bfdd 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml @@ -729,22 +729,22 @@ $(this).find('td:eq(8)').text($('#MonthlySalary').val()); $(this).find('td:eq(8)').attr("data-monthlysalary", monthlySalary); - $(this).find('td:eq(9)').text($('#DailyWage').val()); - $(this).find('td:eq(9)').attr("data-dailywage", getNumberValue($('#DailyWage').val())); + $(this).find('td:eq(11)').text($('#DailyWage').val()); + $(this).find('td:eq(11)').attr("data-dailywage", getNumberValue($('#DailyWage').val())); - $(this).find('td:eq(10)').text($('#WorkingDays').val()); + $(this).find('td:eq(12)').text($('#WorkingDays').val()); $(this).find('td:eq(4)').attr('data-insuranceshare', insuranceshare); $(this).find('td:eq(4)').attr('data-employershare', employershare); $(this).find('td:eq(4)').attr('data-unemploymentinsurance', unemploymentinsurance); - $(this).find('td:eq(11)').text($('#IdNumber').val()); - $(this).find('td:eq(12)').text($('#DateOfBirth').val()); - $(this).find('td:eq(13)').text($('#PlaceOfIssue').val()); - $(this).find('td:eq(14)').text($('#NationalCode').val()); - $(this).find('td:eq(15)').text($('#FatherName').val()); - $(this).find('td:eq(16)').text($('#Gender').val()); - $(this).find('td:eq(17)').text($('#LName').val()); - $(this).find('td:eq(18)').text($('#FName').val()); - $(this).find('td:eq(19)').text($('#InsuranceCode').val()); + $(this).find('td:eq(13)').text($('#IdNumber').val()); + $(this).find('td:eq(14)').text($('#DateOfBirth').val()); + $(this).find('td:eq(15)').text($('#PlaceOfIssue').val()); + $(this).find('td:eq(16)').text($('#NationalCode').val()); + $(this).find('td:eq(17)').text($('#FatherName').val()); + $(this).find('td:eq(18)').text($('#Gender').val()); + $(this).find('td:eq(19)').text($('#LName').val()); + $(this).find('td:eq(20)').text($('#FName').val()); + $(this).find('td:eq(21)').text($('#InsuranceCode').val()); return false; } }); diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml index 2c02ea15..8da42de1 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/EmployeeDatatable.cshtml @@ -408,26 +408,26 @@ $('#BenefitsIncludedNonContinuous').val(commafy(row.find('td:eq(5)').attr("data-benefitsincludednoncontinuous"))); $('#BenefitsIncludedContinuous').val(row.find('td:eq(7)').text()); $('#MonthlySalary').val(row.find('td:eq(8)').text()); - $('#DailyWage').val(row.find('td:eq(9)').text()); - $('#WorkingDays').val(row.find('td:eq(10)').text()); + $('#DailyWage').val(row.find('td:eq(11)').text()); + $('#WorkingDays').val(row.find('td:eq(12)').text()); $('#WorkingDays').attr('max',oldWorkingDays); $('#OldWorkingDays').val(oldWorkingDays); - $('#IdNumber').val(row.find('td:eq(11)').text()); - $('#DateOfBirth').val(row.find('td:eq(12)').text()); - $('#PlaceOfIssue').val(row.find('td:eq(13)').text()); - $('#NationalCode').val(row.find('td:eq(14)').text()); - $('#FatherName').val(row.find('td:eq(15)').text()); - $('#Gender').val(row.find('td:eq(16)').text()); - $('#LName').val(row.find('td:eq(17)').text()); - $('#FName').val(row.find('td:eq(18)').text()); - $('#InsuranceCode').val(row.find('td:eq(19)').text()); + $('#IdNumber').val(row.find('td:eq(13)').text()); + $('#DateOfBirth').val(row.find('td:eq(14)').text()); + $('#PlaceOfIssue').val(row.find('td:eq(15)').text()); + $('#NationalCode').val(row.find('td:eq(16)').text()); + $('#FatherName').val(row.find('td:eq(17)').text()); + $('#Gender').val(row.find('td:eq(18)').text()); + $('#LName').val(row.find('td:eq(19)').text()); + $('#FName').val(row.find('td:eq(20)').text()); + $('#InsuranceCode').val(row.find('td:eq(21)').text()); // $('#column18').val(row.find('td:eq(0)').text()); $('#EmployeeId').val(rowId); $('#InsuranceEmployeeInformationId').val(insuranceEmployeeInformationId); $('#DateOfIssue').val(dateOfIssue); - $('#HousingAllowance').val(row.find('td:eq(10)').attr("data-housingallowance")); - $('#ConsumableItems').val(row.find('td:eq(10)').attr("data-consumableitems")); - $('#EndMonthCurrentDay').val(row.find('td:eq(10)').attr("data-endmonthcurrentday")); + $('#HousingAllowance').val(row.find('td:eq(12)').attr("data-housingallowance")); + $('#ConsumableItems').val(row.find('td:eq(12)').attr("data-consumableitems")); + $('#EndMonthCurrentDay').val(row.find('td:eq(12)').attr("data-endmonthcurrentday")); $('#IncludeStatus').val(row.attr("data-includeStatus")); $('#yearlySalaryItem').val(row.attr("data-yearlySalaryItem")); $('#hasconfilictjobs').val(row.attr("data-hasconfilictjobs")); diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs index 3bf589a5..de3d9e00 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs @@ -172,8 +172,8 @@ public class IndexModel : PageModel double sumOfEmployees = employeeDetailsForInsuranceList.Count(); double included = 0; //مشمول double sumOfWorkingDays = 0; - double benefitsIncludedNonContinuous = 0; //مشمول غیر مستمر - double sumOfSalaries = 0; + double benefitsIncludedNonContinuous = 0; //مزایای ماهانه غیر مشمول + double sumOfSalaries = 0; double sumOfDailyWage = 0; double insuredShare = 0; double employerShare = 0; //سهم بیمه کارفرما @@ -187,9 +187,12 @@ public class IndexModel : PageModel double countWithoutLeft = 0; double sumOfBaseYears = 0; double sumOfMarriedAllowance = 0; + double sumOfDailyWagePlusBaseYear = 0; + + double sumOfBenefitIncludedAndNotIncluded = 0; //مشمول و غیر مشمول - for (var i = 0; i < employeeDetailsForInsuranceList.Count; i++) + for (var i = 0; i < employeeDetailsForInsuranceList.Count; i++) { var leftWorkDay = ""; if (!string.IsNullOrWhiteSpace(employeeDetailsForInsuranceList[i].LeftWorkDate)) @@ -243,12 +246,14 @@ public class IndexModel : PageModel monthlyBenefits = monthlyBenefits + +employeeDetailsForInsuranceList[i].MonthlyBenefits; sumOfIncluded = sumOfIncluded + employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous; - if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود - benefitsIncludedNonContinuous = benefitsIncludedNonContinuous + - employeeDetailsForInsuranceList[i].IncludedAndNotIncluded; + sumOfDailyWagePlusBaseYear += employeeDetailsForInsuranceList[i].DailyWagePlusBaseYears; - insuredShare = insuredShare + employeeDetailsForInsuranceList[i].InsuranceShare; + if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود + sumOfBenefitIncludedAndNotIncluded += (employeeDetailsForInsuranceList[i].IncludedAndNotIncluded + employeeDetailsForInsuranceList[i].BenefitsIncludedNonContinuous); + + benefitsIncludedNonContinuous += employeeDetailsForInsuranceList[i].BenefitsIncludedNonContinuous; + insuredShare = insuredShare + employeeDetailsForInsuranceList[i].InsuranceShare; } employerShare = GetRoundValueWhitGovermentlist(sumOfIncluded * 20 / 100, typeOfInsuranceSendWorkshop); @@ -378,7 +383,7 @@ public class IndexModel : PageModel //مشمول Included = sumOfIncluded.ToMoney(), ////مشمول و غیر مشمول - IncludedAndNotIncluded = benefitsIncludedNonContinuous.ToMoney(), + IncludedAndNotIncluded = sumOfBenefitIncludedAndNotIncluded.ToMoney(), ////IncludedAndNotIncluded = (sumOfIncluded + benefitsIncludedNonContinuous).ToMoney(), //سهم حق بیمه شده InsuredShare = insuredShare.ToMoney(), @@ -390,6 +395,13 @@ public class IndexModel : PageModel SumOfBaseYears = sumOfBaseYears.ToMoney(), //جمع حق تاهل SumOfMarriedAllowance = sumOfMarriedAllowance.ToMoney(), + + //جمع دستمزد روزانه + پایه سنوات روزانه + SumOfDailyWagePlusBaseyear = sumOfDailyWagePlusBaseYear.ToMoney(), + + //جمع مزایای غیر مشمول + SumOFbenefitsIncludedNonContinuous = benefitsIncludedNonContinuous, + }); } diff --git a/ServiceHost/InsuranceList/11/1403_09/DSKKAR00.dbf b/ServiceHost/InsuranceList/11/1403_09/DSKKAR00.dbf new file mode 100644 index 00000000..9f3c7db6 Binary files /dev/null and b/ServiceHost/InsuranceList/11/1403_09/DSKKAR00.dbf differ diff --git a/ServiceHost/InsuranceList/11/1403_09/DSKWOR00.dbf b/ServiceHost/InsuranceList/11/1403_09/DSKWOR00.dbf new file mode 100644 index 00000000..347e4987 Binary files /dev/null and b/ServiceHost/InsuranceList/11/1403_09/DSKWOR00.dbf differ diff --git a/ServiceHost/InsuranceList/11/1403_11/DSKKAR00.dbf b/ServiceHost/InsuranceList/11/1403_11/DSKKAR00.dbf new file mode 100644 index 00000000..ea252456 Binary files /dev/null and b/ServiceHost/InsuranceList/11/1403_11/DSKKAR00.dbf differ diff --git a/ServiceHost/InsuranceList/11/1403_11/DSKWOR00.dbf b/ServiceHost/InsuranceList/11/1403_11/DSKWOR00.dbf new file mode 100644 index 00000000..7de6a1cd Binary files /dev/null and b/ServiceHost/InsuranceList/11/1403_11/DSKWOR00.dbf differ