From c9183fb57e5ef898e052e9421f027bab74c429c2 Mon Sep 17 00:00:00 2001 From: Mahan Ch Date: Mon, 9 Jun 2025 13:51:31 +0330 Subject: [PATCH] add goverment list calculation --- ...mployeeDetailsForInsuranceListViewModel.cs | 2 + .../YearlySalary/IYearlySalaryApplication.cs | 1 + .../InsuranceListApplication.cs | 1 - .../YearlySalaryApplication.cs | 2 +- .../Repository/YearlySalaryRepository.cs | 1 - .../Pages/Company/InsuranceList/Create.cshtml | 157 +++++++++--------- .../Pages/Company/InsuranceList/Edit.cshtml | 3 +- .../Company/InsuranceList/Index.cshtml.cs | 16 +- 8 files changed, 100 insertions(+), 83 deletions(-) diff --git a/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs b/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs index 3dcb1c29..66d08800 100644 --- a/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs +++ b/CompanyManagment.App.Contracts/InsuranceList/EmployeeDetailsForInsuranceListViewModel.cs @@ -298,4 +298,6 @@ public class EmployeeDetailsForInsuranceListViewModel ///// DSK_SPOUSE ///// //public double SumOfMarriedAllowance { get; set; } + public string Month { get; set; } + public string Year { get; set; } } \ No newline at end of file diff --git a/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs b/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs index d068375a..42e5b33e 100644 --- a/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs +++ b/CompanyManagment.App.Contracts/YearlySalary/IYearlySalaryApplication.cs @@ -25,4 +25,5 @@ public interface IYearlySalaryApplication InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year); #endregion + } \ No newline at end of file diff --git a/CompanyManagment.Application/InsuranceListApplication.cs b/CompanyManagment.Application/InsuranceListApplication.cs index 8e921e6e..19d833b1 100644 --- a/CompanyManagment.Application/InsuranceListApplication.cs +++ b/CompanyManagment.Application/InsuranceListApplication.cs @@ -414,7 +414,6 @@ public class InsuranceListApplication : IInsuranceListApplication //مقادیر سالانه این تاریخ var yearlysaleries = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, searchModel.Year); - // دریافت اطلاعات هویتی و شروع و ترک کار کارکنان var employeesInfoAndLeftWorks = _leftWorkInsuranceApplication.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDateGr, diff --git a/CompanyManagment.Application/YearlySalaryApplication.cs b/CompanyManagment.Application/YearlySalaryApplication.cs index 82afe137..f5535933 100644 --- a/CompanyManagment.Application/YearlySalaryApplication.cs +++ b/CompanyManagment.Application/YearlySalaryApplication.cs @@ -160,7 +160,7 @@ public class YearlySalaryApplication : IYearlySalaryApplication public InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year) { return _yearlySalaryRepository.GetInsuranceItems(startDate, endDate, year); - } + } #endregion } \ No newline at end of file diff --git a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs index ac6a0777..5b9d52aa 100644 --- a/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs +++ b/CompanyManagment.EFCore/Repository/YearlySalaryRepository.cs @@ -3876,7 +3876,6 @@ public class YearlySalaryRepository : RepositoryBase, IYearl return query; } - #endregion diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml index ab521c27..67e4a8d2 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Create.cshtml @@ -98,7 +98,7 @@
- @*
+ @*
کپی از آخرین لیست ارسالی
*@ @@ -148,87 +148,87 @@
-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
- - + +
- - + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +
+
- +
@@ -738,12 +738,12 @@ var employeeId = $(this).attr("data-employeeid"); if (employeeId == id) { - + $(this).find('td:eq(1)').text($('#LeftWorkDate').val()); $(this).find('td:eq(2)').text($('#StartWorkDate').val()); $(this).find('td:eq(3)').text(jobName); $(this).find('td:eq(4)').text($('#InsuranceShare').val()); - + var monthlySalaryPlusBaseyear = getNumberValue($('#hiddenMonthlySalaryPlusBaseYear').val()); var benefitsIncludedContinuous = getNumberValue($('#BenefitsIncludedContinuous').val()); var benefitsIncluded = Number(monthlySalaryPlusBaseyear) + Number(benefitsIncludedContinuous); @@ -768,10 +768,10 @@ $(this).find('td:eq(7)').attr('data-monthlybenefits', benefitsIncludedContinuous); $(this).find('td:eq(8)').text($('#hiddenMonthlySalaryPlusBaseYear').val()); - $(this).find('td:eq(8)').attr("data-monthlysalary", monthlySalaryPlusBaseyear); + $(this).find('td:eq(8)').attr("data-monthlysalary", monthlySalaryPlusBaseyear); $(this).find('td:eq(8)').attr("data-MonthlySalaryPlusBaseyear", monthlySalaryPlusBaseyear); - $(this).find('td:eq(11)').text($('#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(11)').attr("data-DailyWagePlusBaseYears", getNumberValue($('#hiddendaailyWagePlusBaseYear').val())); @@ -792,7 +792,7 @@ var marriedAllowance = getNumberValue($('#hiddenMarriedAllowance').val()); $(this).find('td:eq(9)').text($('#hiddenMarriedAllowance').val()); $(this).find('td:eq(9)').attr("data-MarriedAllowance", marriedAllowance); - + var baseYears = getNumberValue($('#hiddenBaseYearToEditModal').val()); $(this).find('td:eq(10)').text($('#hiddenBaseYearToEditModal').val()); $(this).find('td:eq(10)').attr("data-BaseYears", baseYears); @@ -1052,12 +1052,15 @@ employeeDetails.IncludedAndNotIncluded = Number($(this).find('td:eq(5)').attr('data-includedandnotincluded')); employeeDetails.InsuranceShare = Number($(this).find('td:eq(4)').attr('data-insuranceshare')); employeeDetails.WorkingDays = Number($(this).find('td:eq(12)').text()); - + employeeDetails.MarriedAllowance = Number($(this).find('td:eq(9)').attr('data-MarriedAllowance')); employeeDetails.BaseYears = Number($(this).find('td:eq(10)').attr('data-BaseYears')); employeeDetails.DailyWagePlusBaseYears = Number($(this).find('td:eq(11)').attr('data-DailyWagePlusBaseYears')); employeeDetails.BenefitsIncludedNonContinuous = Number($(this).find('td:eq(5)').attr('data-BenefitsIncludedNonContinuous')); - + employeeDetails.Year = $("#Year").val(); + employeeDetails.Month = $("#ddlMonth").val(); + + employeeDetailsForInsuranceList.push(employeeDetails); }); @@ -1099,7 +1102,7 @@ $('#txtSumOfMarriedAllowance').val(response.sumOfMarriedAllowance); $('#txtSumOfDailyWagePlusBaseYears').val(response.sumOfDailyWagePlusBaseYears); $('#txtSumOfBenefitsIncludedNonContinuous').val(response.sumOfBenefitsIncludedNonContinuous); - + console.log(response.sumOfBenefitsIncludedNonContinuous); }, failure: function (response) { @@ -1251,7 +1254,7 @@ $("#divEmployeeInsurancListData").append(``); $("#divEmployeeInsurancListData").append(``); - + //$("#divEmployeeInsurancListData").append(''); //$("#divEmployeeInsurancListData").append(''); @@ -1381,7 +1384,7 @@ $.Notification.autoHideNotify('success', 'top right', response.message); $("#MainModal").modal('hide'); // $('.btn-search1').click(); - + // Reload Function pageIndexJs = 0; hasMoreData = true; diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml index c2400e0e..68b8e88c 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Edit.cshtml @@ -776,7 +776,8 @@ employeeDetails.BaseYears = Number($(this).find('td:eq(10)').attr('data-BaseYears')); employeeDetails.DailyWagePlusBaseYears = Number($(this).find('td:eq(11)').attr('data-DailyWagePlusBaseYears')); employeeDetails.BenefitsIncludedNonContinuous = Number($(this).find('td:eq(5)').attr('data-BenefitsIncludedNonContinuous')); - + employeeDetails.Year = $("#Year").val(); + employeeDetails.Month = $("#ddlMonth").val(); employeeDetailsForInsuranceList.push(employeeDetails); }); //console.log(employeeDetailsForInsuranceList); diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs index 5775b6d8..6a78ab70 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs @@ -192,6 +192,18 @@ public class IndexModel : PageModel double countWithoutLeft = 0; double sumOfBaseYears = 0; double sumOfMarriedAllowance = 0; + double yearlySalaryDailyWage = 0; + if (employeeDetailsForInsuranceList.Count > 0) + { + var employeeDetail = employeeDetailsForInsuranceList.First(); + var startMonthFa = $"{employeeDetail.Year}/{employeeDetail.Month.PadLeft(2, '0')}/01"; + DateTime startDateGr = startMonthFa.ToGeorgianDateTime(); + DateTime endDateGr = startMonthFa.FindeEndOfMonth() + .ToGeorgianDateTime(); + int endOfMonth = Convert.ToInt32((startMonthFa.FindeEndOfMonth()).Substring(8, 2)); + yearlySalaryDailyWage = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, employeeDetail.Year).DayliWage; + } + double sumOfDailyWagePlusBaseYear = 0; double sumOfBenefitIncludedAndNotIncluded = 0; //مشمول و غیر مشمول @@ -255,8 +267,8 @@ public class IndexModel : PageModel //Mahan Changes //مجموع حقوق ماهیانه خالص - sumOfMonthlySalaryWithoutBaseYears += - GetRoundValueWhitGovermentlist(employeeDetailsForInsuranceList[i].DailyWage * employeeDetailsForInsuranceList[i].WorkingDays, typeOfInsuranceSendWorkshop); + sumOfMonthlySalaryWithoutBaseYears += + GetRoundValueWhitGovermentlist(yearlySalaryDailyWage * employeeDetailsForInsuranceList[i].WorkingDays, typeOfInsuranceSendWorkshop); if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود sumOfBenefitIncludedAndNotIncluded += employeeDetailsForInsuranceList[i].IncludedAndNotIncluded;