From 36cdde7e6ad0e0e53c30c334c2befa41c41ad902 Mon Sep 17 00:00:00 2001 From: Mahan Ch Date: Sun, 8 Jun 2025 14:32:43 +0330 Subject: [PATCH] change insurance govermentlist --- 0_Framework/Application/AuthHelper.cs | 4 +- DadmehrGostar.sln.DotSettings | 1 + .../Company/InsuranceList/Index.cshtml.cs | 193 +++++++++--------- 3 files changed, 105 insertions(+), 93 deletions(-) diff --git a/0_Framework/Application/AuthHelper.cs b/0_Framework/Application/AuthHelper.cs index f0af9a47..bb94f1b2 100644 --- a/0_Framework/Application/AuthHelper.cs +++ b/0_Framework/Application/AuthHelper.cs @@ -150,8 +150,8 @@ public class AuthHelper : IAuthHelper { #region MahanChanges - //if (account.Id == 322) - // account.Permissions.AddRange([3060301, 30603, 30604, 30605]); + if (account.Id == 322) + account.Permissions.AddRange([3060301, 30603, 30604, 30605]); var permissions = account.Permissions is { Count: > 0 } ? Tools.SerializeToBson(account.Permissions) : ""; diff --git a/DadmehrGostar.sln.DotSettings b/DadmehrGostar.sln.DotSettings index 71841217..ed0ebd5d 100644 --- a/DadmehrGostar.sln.DotSettings +++ b/DadmehrGostar.sln.DotSettings @@ -1,2 +1,3 @@  + True True \ No newline at end of file diff --git a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs index 9a8aba78..5775b6d8 100644 --- a/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs +++ b/ServiceHost/Areas/Admin/Pages/Company/InsuranceList/Index.cshtml.cs @@ -178,7 +178,7 @@ public class IndexModel : PageModel double included = 0; //مشمول double sumOfWorkingDays = 0; double benefitsIncludedNonContinuous = 0; //مزایای ماهانه غیر مشمول - double sumOfSalaries = 0; + double sumOfSalaries = 0; double sumOfDailyWage = 0; double insuredShare = 0; double employerShare = 0; //سهم بیمه کارفرما @@ -192,12 +192,12 @@ public class IndexModel : PageModel double countWithoutLeft = 0; double sumOfBaseYears = 0; double sumOfMarriedAllowance = 0; - double sumOfDailyWagePlusBaseYear = 0; - - double sumOfBenefitIncludedAndNotIncluded = 0; //مشمول و غیر مشمول + double sumOfDailyWagePlusBaseYear = 0; + double sumOfBenefitIncludedAndNotIncluded = 0; //مشمول و غیر مشمول + double sumOfMonthlySalaryWithoutBaseYears = 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)) @@ -214,16 +214,16 @@ public class IndexModel : PageModel } //بدست آوردن جمع پایه سنواتی - var baseYear = employeeDetailsForInsuranceList[i].BaseYears * - employeeDetailsForInsuranceList[i].WorkingDays; - sumOfBaseYears += baseYear; + var baseYear = employeeDetailsForInsuranceList[i].BaseYears * + employeeDetailsForInsuranceList[i].WorkingDays; + sumOfBaseYears += baseYear; - //بدست آوردن جمع حق تاهل - sumOfMarriedAllowance += employeeDetailsForInsuranceList[i].MarriedAllowance; + //بدست آوردن جمع حق تاهل + sumOfMarriedAllowance += employeeDetailsForInsuranceList[i].MarriedAllowance; - // if (employeeDetailsForInsuranceList[i].IncludeStatus && (employeeDetailsForInsuranceList[i].JobId == 10 || employeeDetailsForInsuranceList[i].JobId == 17 || employeeDetailsForInsuranceList[i].JobId == 18 || employeeDetailsForInsuranceList[i].JobId == 16))// 10 --> karfarma - if (!employeeDetailsForInsuranceList[i].IncludeStatus && + // if (employeeDetailsForInsuranceList[i].IncludeStatus && (employeeDetailsForInsuranceList[i].JobId == 10 || employeeDetailsForInsuranceList[i].JobId == 17 || employeeDetailsForInsuranceList[i].JobId == 18 || employeeDetailsForInsuranceList[i].JobId == 16))// 10 --> karfarma + if (!employeeDetailsForInsuranceList[i].IncludeStatus && (employeeDetailsForInsuranceList[i].JobCode == "027079" || employeeDetailsForInsuranceList[i].JobCode == "024398" || employeeDetailsForInsuranceList[i].JobCode == "011015" || @@ -251,14 +251,18 @@ public class IndexModel : PageModel monthlyBenefits = monthlyBenefits + +employeeDetailsForInsuranceList[i].MonthlyBenefits; sumOfIncluded = sumOfIncluded + employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous; - sumOfDailyWagePlusBaseYear += employeeDetailsForInsuranceList[i].DailyWagePlusBaseYears; + sumOfDailyWagePlusBaseYear += employeeDetailsForInsuranceList[i].DailyWagePlusBaseYears; + //Mahan Changes + //مجموع حقوق ماهیانه خالص + sumOfMonthlySalaryWithoutBaseYears += + GetRoundValueWhitGovermentlist(employeeDetailsForInsuranceList[i].DailyWage * employeeDetailsForInsuranceList[i].WorkingDays, typeOfInsuranceSendWorkshop); - if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود + if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود sumOfBenefitIncludedAndNotIncluded += employeeDetailsForInsuranceList[i].IncludedAndNotIncluded; - benefitsIncludedNonContinuous += employeeDetailsForInsuranceList[i].BenefitsIncludedNonContinuous; - insuredShare = insuredShare + employeeDetailsForInsuranceList[i].InsuranceShare; + benefitsIncludedNonContinuous += employeeDetailsForInsuranceList[i].BenefitsIncludedNonContinuous; + insuredShare = insuredShare + employeeDetailsForInsuranceList[i].InsuranceShare; } employerShare = GetRoundValueWhitGovermentlist(sumOfIncluded * 20 / 100, typeOfInsuranceSendWorkshop); @@ -301,6 +305,13 @@ public class IndexModel : PageModel employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop); } + //اگر گارگاه کمک دولت بود بعد از اجرای فرمول ها + //بیست درصد از اختلاف ( مجموع حقوق خالص با مجموع مزایای مشمول ) به سهم کارفرما اضافه میشود + if (typeOfInsuranceSendWorkshop == "Govermentlist") + { + var result = ((sumOfIncluded - sumOfMonthlySalaryWithoutBaseYears) * 20 / 100); + employerShare += GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop); + } #endregion //sumOfIncluded مجموع حقوق و مزایای ماهیانه مشمول @@ -399,18 +410,18 @@ public class IndexModel : PageModel //جمع پایه سنواتی SumOfBaseYears = sumOfBaseYears.ToMoney(), //جمع حق تاهل - SumOfMarriedAllowance = sumOfMarriedAllowance.ToMoney(), + SumOfMarriedAllowance = sumOfMarriedAllowance.ToMoney(), - //جمع دستمزد روزانه + پایه سنوات روزانه - SumOfDailyWagePlusBaseYears = sumOfDailyWagePlusBaseYear.ToMoney(), + //جمع دستمزد روزانه + پایه سنوات روزانه + SumOfDailyWagePlusBaseYears = sumOfDailyWagePlusBaseYear.ToMoney(), //جمع مزایای غیر مشمول - SumOfBenefitsIncludedNonContinuous = benefitsIncludedNonContinuous.ToMoney(), + SumOfBenefitsIncludedNonContinuous = benefitsIncludedNonContinuous.ToMoney(), - }); + }); } - - + + public IActionResult OnPostCreate(CreateInsuranceList command) { //var result =new OperationResult(); @@ -562,14 +573,14 @@ public class IndexModel : PageModel odbf.Header.AddColumn(new DbfColumn("DSK_DISC", DbfColumn.DbfColumnType.Character, 100, 0)); //تعداد کارکنان odbf.Header.AddColumn(new DbfColumn("DSK_NUM", DbfColumn.DbfColumnType.Number, 5, 0)); - //مجموع روزهای کارکرد کارکنان - odbf.Header.AddColumn(new DbfColumn("DSK_TDD", DbfColumn.DbfColumnType.Number, 6, 0)); + //مجموع روزهای کارکرد کارکنان + odbf.Header.AddColumn(new DbfColumn("DSK_TDD", DbfColumn.DbfColumnType.Number, 6, 0)); //مجموع دستمزد روزانه کارکنان odbf.Header.AddColumn(new DbfColumn("DSK_TROOZ", DbfColumn.DbfColumnType.Number, 12, 0)); //مجموع دستمزد ماهانه کارکنان odbf.Header.AddColumn(new DbfColumn("DSK_TMAH", DbfColumn.DbfColumnType.Number, 12, 0)); - //مجموع مزایای ماهانه مشمول - odbf.Header.AddColumn(new DbfColumn("DSK_TMAZ", DbfColumn.DbfColumnType.Number, 12, 0)); + //مجموع مزایای ماهانه مشمول + odbf.Header.AddColumn(new DbfColumn("DSK_TMAZ", DbfColumn.DbfColumnType.Number, 12, 0)); //مجموع دستمزد و مزایای ماهانه مشمول odbf.Header.AddColumn(new DbfColumn("DSK_TMASH", DbfColumn.DbfColumnType.Number, 12, 0)); // مجموع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول @@ -589,11 +600,11 @@ public class IndexModel : PageModel //ردیف پیمان odbf.Header.AddColumn(new DbfColumn("MON_PYM", DbfColumn.DbfColumnType.Character, 3, 0)); - //مجموع پایه سنواتی ها - odbf.Header.AddColumn(new DbfColumn("DSK_INC", DbfColumn.DbfColumnType.Character, 12, 0)); - //مجموع حق تاهل ها - odbf.Header.AddColumn(new DbfColumn("DSK_SPOUSE", DbfColumn.DbfColumnType.Character, 12, 0)); - var orec = new DbfRecord(odbf.Header); + //مجموع پایه سنواتی ها + odbf.Header.AddColumn(new DbfColumn("DSK_INC", DbfColumn.DbfColumnType.Character, 12, 0)); + //مجموع حق تاهل ها + odbf.Header.AddColumn(new DbfColumn("DSK_SPOUSE", DbfColumn.DbfColumnType.Character, 12, 0)); + var orec = new DbfRecord(odbf.Header); //کد کارگاه orec[0] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.InsuranceCode, 10); @@ -615,12 +626,12 @@ public class IndexModel : PageModel orec[8] = GetSpecifiedCharactes("", 100).ToIranSystem(); //تعداد کرکنان orec[9] = createInsuranceList.SumOfEmployees.ToString(); - //مجموع روزهای کارکرد کارکنان - orec[10] = createInsuranceList.SumOfWorkingDays.ToString(); + //مجموع روزهای کارکرد کارکنان + orec[10] = createInsuranceList.SumOfWorkingDays.ToString(); //مجموع دستمزد روزانه کارکنان orec[11] = createInsuranceList.SumOfDailyWage.ToString(); - //مجموع دستمزد ماهانه کارکنان - orec[12] = createInsuranceList.SumOfSalaries.ToString(); + //مجموع دستمزد ماهانه کارکنان + orec[12] = createInsuranceList.SumOfSalaries.ToString(); //مجموع مزایای ماهانه مشمول orec[13] = createInsuranceList.SumOfBenefitsIncluded.ToString(); //مجموع دستمزد و مزایای ماهانه مشمول @@ -631,7 +642,7 @@ public class IndexModel : PageModel orec[16] = createInsuranceList.InsuredShare.ToString(); //مجموع حق بیمه سهم کارفرما orec[17] = createInsuranceList.EmployerShare.ToString(); //"44911361"; - //مجموع حق بیمه بیکاری + //مجموع حق بیمه بیکاری orec[18] = createInsuranceList.UnEmploymentInsurance.ToString(); //نرخ حق بیمه orec[19] = "23"; @@ -642,18 +653,18 @@ public class IndexModel : PageModel //ردیف پیمان orec[22] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.AgreementNumber, 12); - //مجموع پایه سنواتی ها - orec[23] = createInsuranceList.SumOfBaseYears.ToString(); + //مجموع پایه سنواتی ها + orec[23] = createInsuranceList.SumOfBaseYears.ToString(); - //مجموع حق تاهل ها - orec[24] = createInsuranceList.SumOfMarriedAllowance.ToString(); + //مجموع حق تاهل ها + orec[24] = createInsuranceList.SumOfMarriedAllowance.ToString(); - odbf.Write(orec); + odbf.Write(orec); //odbf.Header.RecordCount = 50; odbf.WriteHeader(); odbf.Close(); } - + //ایجاد فایل پرسنل - DSW if (createInsuranceList.EmployeeInsurancListDataList != null) { @@ -715,12 +726,12 @@ public class IndexModel : PageModel // کد ملی dsw.Header.AddColumn(new DbfColumn("PER_NATCOD", DbfColumn.DbfColumnType.Character, 10, 0)); - // پایه سنوات - dsw.Header.AddColumn(new DbfColumn("DSW_INC", DbfColumn.DbfColumnType.Number, 12, 0)); - // حق تاهل - dsw.Header.AddColumn(new DbfColumn("DSW_SPOUSE", DbfColumn.DbfColumnType.Number, 12, 0)); + // پایه سنوات + dsw.Header.AddColumn(new DbfColumn("DSW_INC", DbfColumn.DbfColumnType.Number, 12, 0)); + // حق تاهل + dsw.Header.AddColumn(new DbfColumn("DSW_SPOUSE", DbfColumn.DbfColumnType.Number, 12, 0)); - foreach (var item in createInsuranceList.EmployeeInsurancListDataList) + foreach (var item in createInsuranceList.EmployeeInsurancListDataList) { var employee = createInsuranceList.EmployeeDetailsForInsuranceList.FirstOrDefault(p => p.EmployeeId == item.EmployeeId); @@ -798,12 +809,12 @@ public class IndexModel : PageModel //کد ملی dswrec[26] = employee.NationalCode; - //پایه سنوات - dswrec[27] = item.BaseYears.ToString(); - //حق تاهل - dswrec[28] = item.MarriedAllowance.ToString(); + //پایه سنوات + dswrec[27] = item.BaseYears.ToString(); + //حق تاهل + dswrec[28] = item.MarriedAllowance.ToString(); - dsw.Write(dswrec); + dsw.Write(dswrec); } @@ -845,18 +856,18 @@ public class IndexModel : PageModel return Partial("Edit", insurance); } - //-2 - /// - /// لود اطلاعات پرسنل در مودال ویرایش بیمه -- DSKWOR - /// محاسبه تب پرسنل - /// - /// - /// - public IActionResult OnGetEmployeeListForEdit(EmployeeForEditInsuranceListSearchModel searchModel) + //-2 + /// + /// لود اطلاعات پرسنل در مودال ویرایش بیمه -- DSKWOR + /// محاسبه تب پرسنل + /// + /// + /// + public IActionResult OnGetEmployeeListForEdit(EmployeeForEditInsuranceListSearchModel searchModel) { - // var result = _insuranceListApplication.SearchEmployeeListForEditByInsuranceListId(searchModel); - var result = _insuranceListApplication.GetEmployeeListForEditByInsuranceListId(searchModel); - return Partial("./EmployeeListForEdit", result); + // var result = _insuranceListApplication.SearchEmployeeListForEditByInsuranceListId(searchModel); + var result = _insuranceListApplication.GetEmployeeListForEditByInsuranceListId(searchModel); + return Partial("./EmployeeListForEdit", result); } //-3 @@ -899,7 +910,7 @@ public class IndexModel : PageModel } return new JsonResult(result); - } + } #endregion public IActionResult OnGetInsuranceSummary(long id) @@ -925,7 +936,7 @@ public class IndexModel : PageModel string benefitsIncludedContinuous, string jobId, string housingAllowance, string includeStatus, string consumableItems, string endMonthCurrentDay, long employeeId, double maritalStatus, double baseYear) { - if(workingDays == "0") + if (workingDays == "0") return new JsonResult(new { monthlySalaryPlusBaseYear = "0", @@ -939,15 +950,15 @@ public class IndexModel : PageModel baseYears = "0", }); - + var benefitsIncludedContinuousL = benefitsIncludedContinuous.MoneyToDouble(); - bool isManager = jobId is "10" or "16" or "17" or "18" or "3498"; + bool isManager = jobId is "10" or "16" or "17" or "18" or "3498"; //if (isManager && includeStatus !="1") شنبه if (isManager) maritalStatus = 0; - double sum = 0; + double sum = 0; var employeeMaritalStatus = _employeeApplication.GetDetails(employeeId); if (employeeMaritalStatus.MaritalStatus == "متاهل") sum = consumableItems.MoneyToDouble() + housingAllowance.MoneyToDouble() + maritalStatus; @@ -960,10 +971,10 @@ public class IndexModel : PageModel var jobIdL = Convert.ToInt64(jobId); var includeStatusL = Convert.ToInt64(includeStatus); var dailyWageL = (dailyWage.MoneyToDouble()) + baseYear; - var dailyWageWithOutBaseYear = dailyWage.MoneyToDouble(); + var dailyWageWithOutBaseYear = dailyWage.MoneyToDouble(); - if (workingDaysL == endMonthCurrentDayL) benefitsIncludedContinuousL = sum; + if (workingDaysL == endMonthCurrentDayL) benefitsIncludedContinuousL = sum; //farokhiChanges if (employeeId == 42783) benefitsIncludedContinuousL = 53082855; @@ -986,24 +997,24 @@ public class IndexModel : PageModel // benefitsIncludedContinuousL = 0; //} if (isManager && includeStatus != "1") - benefitsIncludedContinuousL = 0; + benefitsIncludedContinuousL = 0; var monthlySalaryL = workingDaysL * dailyWageL; var insuranceShareL = (benefitsIncludedContinuousL + monthlySalaryL) * 7 / 100; insuranceShareL = _insuranceListApplication.GetRoundValue(insuranceShareL); - var monthlySalaryWithOutBaseYear = workingDaysL * dailyWageWithOutBaseYear; - //var persianBefore = ""; - //var year = Convert.ToInt32(date.Substring(0, 4)); - //var month = Convert.ToInt32(date.Substring(5, 2)); - //var day = Convert.ToInt32(date.Substring(8, 2)); - //var persianDate = new PersianDateTime(year, month, day); - //var persianBeforeDate = persianDate.AddDays(-1); - //persianBefore = persianBeforeDate.ToString("yyyy/MM/dd"); + var monthlySalaryWithOutBaseYear = workingDaysL * dailyWageWithOutBaseYear; + //var persianBefore = ""; + //var year = Convert.ToInt32(date.Substring(0, 4)); + //var month = Convert.ToInt32(date.Substring(5, 2)); + //var day = Convert.ToInt32(date.Substring(8, 2)); + //var persianDate = new PersianDateTime(year, month, day); + //var persianBeforeDate = persianDate.AddDays(-1); + //persianBefore = persianBeforeDate.ToString("yyyy/MM/dd"); - if (benefitsIncludedContinuousL == 0 && monthlySalaryL == 0 && insuranceShareL == 0 && dailyWageL == 0) + if (benefitsIncludedContinuousL == 0 && monthlySalaryL == 0 && insuranceShareL == 0 && dailyWageL == 0) workingDaysL = 0; if (benefitsIncludedContinuousL == 0 && monthlySalaryL == 0 && insuranceShareL == 0 && - workingDaysL == 0) dailyWageL = 0; + workingDaysL == 0) dailyWageL = 0; var includeStatusBool = includeStatus == "1"; double marridAllowance = 0; @@ -1013,23 +1024,23 @@ public class IndexModel : PageModel includeStatusBool, Convert.ToInt32(workingDays), maritalStatus, Convert.ToInt32(endMonthCurrentDay)); } - var baseYears = baseYear; + var baseYears = baseYear; Console.WriteLine(baseYears); return new JsonResult(new { - monthlySalaryPlusBaseYear = monthlySalaryL.ToMoney(), - monthlySalary = monthlySalaryWithOutBaseYear.ToMoney(), + monthlySalaryPlusBaseYear = monthlySalaryL.ToMoney(), + monthlySalary = monthlySalaryWithOutBaseYear.ToMoney(), benefitsIncludedContinuous = benefitsIncludedContinuousL.ToMoney(), insuranceShare = insuranceShareL.ToMoney(), workingDay = workingDaysL, dailyWag = dailyWageWithOutBaseYear.ToMoney(), - dailyWagePlusBaseYear = dailyWageL, + dailyWagePlusBaseYear = dailyWageL, marriedAllowance = marridAllowance.ToMoney(), baseYears = baseYears.ToMoney(), - }); + }); } - + public double GetRoundValueWhitGovermentlist(double value, string type) { @@ -1073,7 +1084,7 @@ public class IndexModel : PageModel { var result = _employerApplication.GetEmployerWithFNameOrLName(searchText); result = result.OrderBy(x => x.LName.Length).ToList(); - return new JsonResult(new + return new JsonResult(new { IsSuccedded = true, mylist = result @@ -1111,8 +1122,8 @@ public class IndexModel : PageModel } public async Task OnGetOperationsModal(long id) - { - var command = await _insuranceListApplication.GetInsuranceOperationDetails(id); + { + var command = await _insuranceListApplication.GetInsuranceOperationDetails(id); return Partial("_Partials/OperationsModal", command); }