marge from Insurance

This commit is contained in:
SamSys
2025-02-01 19:36:09 +03:30
42 changed files with 12233 additions and 2458 deletions

View File

@@ -33,11 +33,80 @@ public static class Tools
public static string[] DayNamesG = { "یکشنبه", "دو شنبه", "سه شنبه", "چهار شنبه", "پنج شنبه", "جمعه", "شنبه" };
/// <summary>
/// محاسبه سن
/// دریافت روزهای کارکرد پرسنل در لیست بیمه ماه مشخص شده
/// با کمک شروع بکار و ترک کار
/// </summary>
/// <param name="startWork"></param>
/// <param name="leftWork"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="employeeId"></param>
/// <returns></returns>
public static (int countWorkingDays,DateTime startWork,DateTime endWork,bool hasStartWorkInMonth,bool hasLeftWorkInMonth) GetEmployeeInsuranceWorkingDays(DateTime startWork,DateTime? leftWork,DateTime startDate,
DateTime endDate,long employeeId)
{
DateTime start = startDate;
DateTime end = endDate;
bool startWorkInMonth = false;
bool endWorkInMonth = false;
//اگر شروع بکار پرسنل در ماه مشخص شده لیست بیمه بود
if (startWork >= startDate)
{
start = startWork;
startWorkInMonth = true;
}
if(leftWork == null)
leftWork = DateTime.MinValue;
//اگر ترک کار پرسنل در ماه مشخص شده لیست بیمه بود
if (leftWork != DateTime.MinValue && leftWork.Value <= endDate)
{
end = leftWork.Value;
endWorkInMonth = true;
}
int countDays = (int)(end - start).TotalDays +1;
//روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
switch (employeeId)
{
//case 3812://ثابت- کسری حاجی پور
// countWorkingDays = 15;
// break;
case 40463://ثابت
countDays = 10;
break;
case 40469://ثابت
countDays = 7;
break;
case 9950://ثابت
countDays = 15;
break;
case 9640://ثابت
countDays = 15;
break;
case 40998://ثابت
countDays = 15;
break;
case 6219://ثابت
countDays = 15;
break;
//case 7897://ثابت
// countWorkingDays = 15;
}
return (countDays,start,end,startWorkInMonth,endWorkInMonth);
}
/// <summary>
/// محاسبه سن
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <returns></returns>
public static (int yearCount, int monthCount, int dayCount) GetAge(DateTime startDate, DateTime endDate)
{

View File

@@ -36,6 +36,12 @@ public interface IPersonalContractingPartyRepository :IRepository<long, Personal
#endregion
#region Insurance
bool IsBlockCheckByWorkshopId(long workshopId);
#endregion
}

View File

@@ -4,12 +4,15 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using _0_Framework.Domain;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
namespace Company.Domain.EmployeeInsurancListDataAgg;
public class EmployeeInsurancListData : EntityBase
{
public EmployeeInsurancListData(long insuranceListId, long employeeId, int workingDays, double dailyWage, double monthlySalary, double monthlyBenefits, double monthlyBenefitsIncluded, double benefitsIncludedContinuous, double benefitsIncludedNonContinuous, double insuranceShare, DateTime startWorkDate, DateTime? leftWorkDate, long jobId,bool includeStatus)
public EmployeeInsurancListData(long insuranceListId, long employeeId, int workingDays, double dailyWage, double monthlySalary,
double monthlyBenefits, double monthlyBenefitsIncluded, double benefitsIncludedContinuous, double benefitsIncludedNonContinuous,
double insuranceShare, DateTime startWorkDate, DateTime? leftWorkDate, long jobId,bool includeStatus, double baseYears, double marriedAllowance)
{
InsuranceListId = insuranceListId;
EmployeeId = employeeId;
@@ -25,38 +28,92 @@ public class EmployeeInsurancListData : EntityBase
LeftWorkDate = leftWorkDate;
JobId = jobId;
IncludeStatus = includeStatus;
BaseYears = baseYears;
MarriedAllowance = marriedAllowance;
DailyWagePlusBaseYears = dailyWage + baseYears;
}
public long InsuranceListId { get; private set; }
public long EmployeeId { get; private set; }
//روزهای کارکرد پرسنل
/// <summary>
/// تعداد روز های کارکرد پرسنل
/// DSW_DD
/// </summary>
public int WorkingDays { get; private set; }
// دستمزد روزانه
/// <summary>
/// دستمزد روزانه پرسنل double
/// DSW_ROOZ
/// </summary>
public double DailyWage { get; private set; }
//دستمزد ماهانه
/// <summary>
/// دستمزد ماهانه پرسنل double
/// DSW_MAH
/// </summary>
public double MonthlySalary{ get; private set; }
//مزایای ماهانه
/// <summary>
/// مزایای ماهانه
/// DSW_MAZ
/// </summary>
public double MonthlyBenefits { get; private set; }
//دستمزد و مزایای ماهانه مشمول
/// <summary>
/// جمع دستمزد و مزایای ماهانه مشمول
/// DSW_MASH
/// </summary>
public double MonthlyBenefitsIncluded { get; private set; }
// مزایای مشمول مستمر
public double BenefitsIncludedContinuous { get; private set; }
//مزایای مشمول غیر مستمر
public double BenefitsIncludedNonContinuous { get; private set; }
//سهم بیمه حق کارگر
/// <summary>
/// حق بیمه سهم بیمه شده
/// DSW_BIME
/// </summary>
public double InsuranceShare { get; private set; }
// تاریخ شروع به کار
/// <summary>
/// تایخ شروع بکار میلادی
/// DSW_SDATE
/// </summary>
public DateTime StartWorkDate { get; private set; }
//تاریخ ترک کار
/// <summary>
/// تاریخ ترک کار میلادی
/// DSW_EDATE
/// </summary>
public DateTime? LeftWorkDate { get; private set; }
// آی دی شغل
public long JobId { get; private set; }
public bool IncludeStatus { get; private set; }
/// <summary>
/// پایه سنواتی
/// DSW_INC
/// </summary>
public double BaseYears { get; private set; }
public void Edit(int workingDays, double dailyWage, double monthlySalary, double monthlyBenefits, double monthlyBenefitsIncluded, double benefitsIncludedContinuous, double benefitsIncludedNonContinuous, double insuranceShare, DateTime startWorkDate, DateTime? leftWorkDate, long jobId, bool includeStatus)
/// <summary>
/// جمع پایه سنوات و دستمزد روزانه
/// DSW_INC
/// </summary>
public double DailyWagePlusBaseYears { get; private set; }
/// <summary>
/// حق تاهل
/// DSW_SPOUSE
/// </summary>
public double MarriedAllowance { get; private set; }
public void Edit(int workingDays, double dailyWage, double monthlySalary, double monthlyBenefits, double monthlyBenefitsIncluded,
double benefitsIncludedContinuous, double benefitsIncludedNonContinuous, double insuranceShare, DateTime startWorkDate,
DateTime? leftWorkDate, long jobId, bool includeStatus, double baseYears, double marriedAllowance)
{
WorkingDays = workingDays;
@@ -71,7 +128,11 @@ public class EmployeeInsurancListData : EntityBase
LeftWorkDate = leftWorkDate;
JobId = jobId;
IncludeStatus= includeStatus;
BaseYears = baseYears;
MarriedAllowance = marriedAllowance;
DailyWagePlusBaseYears = dailyWage + baseYears;
}
}

View File

@@ -27,6 +27,20 @@ public interface IInsuranceListRepository:IRepository<long, InsuranceList>
InsuranceListViewModel GetInsuranceListByWorkshopIdAndYear(long workshopId, string year);
#region farokhi
/// <summary>
/// جستجوی لیست بیمه بهینه شده
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
public List<InsuranceListViewModel> OptimizedSearch(InsuranceListSearchModel searchModel);
/// <summary>
/// محاسبه پایه سنوات بیمه برای پرسنل
/// </summary>
/// <returns></returns>
(int insuranceHistoryYearsCount, double baseYear) GetEmployeeInsuranceBaseYear(long employeeId, long workshopId, int countWorkingDay, DateTime listStartDate, DateTime listEndDate, DateTime startWorkDate, DateTime leftDate, bool hasLeft);
#endregion
#region client
List<InsuranceListViewModel> SearchForClient(InsuranceListSearchModel searchModel);

View File

@@ -13,7 +13,8 @@ public class InsuranceList : EntityBase
public InsuranceList(long workshopId, string year, string month, int sumOfEmployees, int sumOfWorkingDays,
double sumOfSalaries, double sumOfBenefitsIncluded, double included, double includedAndNotIncluded, double insuredShare,
double employerShare, double unEmploymentInsurance, double difficultJobsInsuranc, DateTime startDate, DateTime endDate, double sumOfDailyWage, bool confirmSentlist=false)
double employerShare, double unEmploymentInsurance, double difficultJobsInsuranc, DateTime startDate, DateTime endDate,
double sumOfDailyWage, double sumOfBaseYears, double sumOfMarriedAllowance, bool confirmSentlist=false)
{
WorkshopId = workshopId;
Year = year;
@@ -31,46 +32,130 @@ public class InsuranceList : EntityBase
StartDate = startDate;
EndDate = endDate;
SumOfDailyWage = sumOfDailyWage;
SumOfBaseYears = sumOfBaseYears;
SumOfMarriedAllowance = sumOfMarriedAllowance;
ConfirmSentlist = confirmSentlist;
SumOfDailyWagePlusBaseYears = sumOfDailyWage + sumOfBaseYears;
}
//آی دی کارگاه
public long WorkshopId { get; private set; }
//سال
/// <summary>
/// سال ارسال لیست
/// DSK_YY
/// </summary>
public string Year { get; private set; }
//ماه
/// <summary>
/// ماه ارسال لیست
/// DSK_MM
/// </summary>
public string Month { get; private set; }
//مجموع تعداد پرسنل
/// <summary>
/// تعداد کارکنان
/// DSK_NUM
/// </summary>
public int SumOfEmployees { get; private set; }
//مجموع روزهای کارکرد پرسنل
/// <summary>
/// مجموع روزهای کارکرد کارکنان
/// DSK_TDD
/// </summary>
public int SumOfWorkingDays { get; private set; }
// مجموع دستمزد پرسنل
/// <summary>
/// مجموع دستمزد ماهانه کارکنان
/// DSK_TMAH
/// </summary>
public double SumOfSalaries { get; private set; }
/// <summary>
/// مجموع دستمزد روزانه کارکنان
/// DSK_TROOZ
/// </summary>
public double SumOfDailyWage { get; set; }
//مجموع مزایای مشمول
/// <summary>
/// مجموع مزایای ماهانه مشمول
/// DSK_TMAZ
/// </summary>
public double SumOfBenefitsIncluded { get; private set; }
//مشمول
/// <summary>
/// مجموع دستمزد و مزایای ماهانه مشمول
/// DSK_TMASH
/// </summary>
public double Included { get; private set; }
//غیرمشمول
/// <summary>
/// مجموع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول
/// DSK_TTOTL
/// </summary>
public double IncludedAndNotIncluded { get; private set; }
//سهم بیمه شده
/// <summary>
/// مجموع حق بیمه سهم بیمه شده
/// DSK_TBIME
/// </summary>
public double InsuredShare { get; private set; }
//سهم کارفرما
/// <summary>
/// مجموع حق بیمه سهم کارفرما
/// DSK_TKOSO
/// </summary>
public double EmployerShare { get; private set; }
//حق بیمه بیکاری
/// <summary>
/// مجموع حق بیمه بیکاری
/// DSK_BIC
/// </summary>
public double UnEmploymentInsurance { get; private set; }
//مزایای مشاغل سخت
/// <summary>
/// نرخ مشاغل سخت زیان آور
/// DSK_BIMH
/// </summary>
public double DifficultJobsInsuranc { get; private set; }
//تاریخ شروع لیست
/// <summary>
/// تاریخ شروع لیست
/// میلادی
/// </summary>
public DateTime StartDate { get; private set; }
// تاریخ پایان لیست
/// <summary>
/// تاریخ پایان لیست
/// میلادی
/// </summary>
public DateTime EndDate { get; private set; }
public bool ConfirmSentlist { get; private set; }
/// <summary>
/// مجموع پایه سنواتی کارکنان
/// DSK_INC
/// </summary>
public double SumOfBaseYears { get; private set; }
/// <summary>
/// جمع پایه سنوات و دستمزد روزانه کارکنان
/// DSW_INC
/// </summary>
public double SumOfDailyWagePlusBaseYears { get; private set; }
/// <summary>
/// مجموع حق تاهل کارکنان
/// DSK_SPOUSE
/// </summary>
public double SumOfMarriedAllowance { get; private set; }
public List<InsuranceListWorkshop> InsuranceListWorkshops { get; set; }
public void Edit(int sumOfEmployees, int sumOfWorkingDays, double sumOfSalaries, double sumOfBenefitsIncluded, double included,
double includedAndNotIncluded, double insuredShare, double employerShare, double unEmploymentInsurance, double difficultJobsInsuranc,
DateTime startDate, double sumOfDailyWage,bool confirmSentlist)
DateTime startDate, double sumOfDailyWage, double sumOfBaseYears, double sumOfMarriedAllowance, bool confirmSentlist)
{
SumOfEmployees = sumOfEmployees;
SumOfWorkingDays = sumOfWorkingDays;
@@ -83,7 +168,10 @@ public class InsuranceList : EntityBase
UnEmploymentInsurance = unEmploymentInsurance;
DifficultJobsInsuranc = difficultJobsInsuranc;
SumOfDailyWage = sumOfDailyWage;
SumOfBaseYears = sumOfBaseYears;
SumOfMarriedAllowance = sumOfMarriedAllowance;
ConfirmSentlist = confirmSentlist;
SumOfDailyWagePlusBaseYears = sumOfDailyWage + sumOfBaseYears;
}
}

View File

@@ -31,4 +31,14 @@ public interface ILeftWorkInsuranceRepository : IRepository<long, LeftWorkInsura
OperationResult CheckEditLeftWorkInsurance(long workshopId, long employeeId, DateTime date, int type);
OperationResult CheckBeforeSaveLeftWorkInsurance(long workshopId, long employeeId, DateTime toGeorgianDateTime, int type);
int TotalWorkingYears(long employeeId, long workshopId, DateTime startDate);
#region Insurance
/// <summary>
/// دریافت شروع و ترک کار بیمه پرسنل و اطلاعات هویتی آن
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceLeftWorksAndInformation(long workshopId, DateTime startDate, DateTime endDate);
#endregion
}

View File

@@ -63,5 +63,15 @@ public interface IWorkshopRepository : IRepository<long, Workshop>
PersonalContractingPartyViewModel GetPersonalContractingPartyByWorkshopId(long workshopId);
List<WorkshopViewModel> GetWorkshopsByClientAccountId(long clientAccountId);
#endregion
#endregion
#region Insurance
/// <summary>
/// لیست انتخاب کارگاه در مودال ایجاد بیمه
/// </summary>
/// <returns></returns>
List<WorkshopViewModel> GetWorkshopSelectListInsuransce();
#endregion
}

View File

@@ -51,7 +51,14 @@ public interface IYearlySalaryRepository : IRepository<long, YearlySalary>
Task<HolidayApiVewModel> HolidayGregorian(DateTime gregorianDate);
Task<HolidayApiVewModel> HolidayShamsi(string shamsiDate);
#endregion
#endregion
#region Insurance
InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year);
#endregion
}

View File

@@ -44,7 +44,13 @@ public interface IEmployerRepository : IRepository<long, Employer>
OperationResult ActiveAll(long id);
List<EmployerViewModel> GetAllEmployers();
#endregion
#endregion
#region Insurance
(string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId);
#endregion

View File

@@ -12,29 +12,78 @@ public class CreateEmployeeInsurancListData
{ //آی دی کارگاه
public long InsuranceListId { get; set; }
public long EmployeeId { get; set; }
//روزهای کارکرد پرسنل
/// <summary>
/// تعداد روز های کارکرد پرسنل
/// DSW_DD
/// </summary>
public int WorkingDays { get; set; }
// دستمزد روزانه
public double DailyWage { get; set; }
//دستمزد ماهانه
public double MonthlySalary { get; set; }
//مزایای ماهانه
public double MonthlyBenefits { get; set; }
//دستمزد و مزایای ماهانه مشمول
/// <summary>
/// دستمزد روزانه پرسنل double
/// DSW_ROOZ
/// </summary>
public double DailyWage { get; set; }
/// <summary>
/// دستمزد ماهانه پرسنل double
/// DSW_MAH
/// </summary>
public double MonthlySalary { get; set; }
/// <summary>
/// مزایای ماهانه
/// DSW_MAZ
/// </summary>
public double MonthlyBenefits { get; set; }
/// <summary>
/// جمع دستمزد و مزایای ماهانه مشمول
/// DSW_MASH
/// </summary>
public double MonthlyBenefitsIncluded { get; set; }
// مزایای مشمول مستمر
public double BenefitsIncludedContinuous { get; set; }
//مزایای مشمول غیر مستمر
public double BenefitsIncludedNonContinuous { get; set; }
//سهم بیمه حق کارگر
/// <summary>
/// حق بیمه سهم بیمه شده
/// DSW_BIME
/// </summary>
public double InsuranceShare { get; set; }
// تاریخ شروع به کار
/// <summary>
/// تایخ شروع بکار میلادی
/// DSW_SDATE
/// </summary>
public DateTime StartWorkDate { get; set; }
//تاریخ ترک کار
/// <summary>
/// تاریخ ترک کار میلادی
/// DSW_EDATE
/// </summary>
public DateTime? LeftWorkDate { get; set; }
// آی دی شغل
public long JobId { get; set; }
public bool IncludeStatus { get; set; }
/// <summary>
/// پایه سنواتی
/// DSW_INC
/// </summary>
public double BaseYears { get; set; }
/// <summary>
/// جمع پایه سنوات و دستمزد روزانه
/// DSW_INC
/// </summary>
public double DailyWagePlusBaseYears { get; set; }
/// <summary>
/// حق تاهل
/// DSW_SPOUSE
/// </summary>
public double MarriedAllowance { get; set; }
}

View File

@@ -35,4 +35,22 @@ public class EmployeeInsurancListDataSearchModel
public DateTime LeftWorkDate { get; set; }
// آی دی شغل
public long JobId { get; set; }
/// <summary>
/// پایه سنواتی
/// DSW_INC
/// </summary>
public double BaseYears { get; set; }
/// <summary>
/// جمع پایه سنوات و دستمزد روزانه
/// DSW_INC
/// </summary>
public double DailyWagePlusBaseYears { get; set; }
/// <summary>
/// حق تاهل
/// DSW_SPOUSE
/// </summary>
public double MarriedAllowance { get; set; }
}

View File

@@ -11,32 +11,76 @@ public class EmployeeInsurancListDataViewModel
public long InsuranceListId { get; set; }
public long EmployeeId { get; set; }
//روزهای کارکرد پرسنل
/// <summary>
/// تعداد روز های کارکرد پرسنل
/// DSW_DD
/// </summary>
public int WorkingDays { get; set; }
// دستمزد روزانه
/// <summary>
/// دستمزد روزانه پرسنل double
/// DSW_ROOZ
/// </summary>
public double DailyWage { get; set; }
//دستمزد ماهانه
/// <summary>
/// دستمزد ماهانه پرسنل double
/// DSW_MAH
/// </summary>
public double MonthlySalary { get; set; }
//مزایای ماهانه
/// <summary>
/// مزایای ماهانه
/// DSW_MAZ
/// </summary>
public double MonthlyBenefits { get; set; }
//دستمزد و مزایای ماهانه مشمول
/// <summary>
/// جمع دستمزد و مزایای ماهانه مشمول
/// DSW_MASH
/// </summary>
public double MonthlyBenefitsIncluded { get; set; }
// مزایای مشمول مستمر
public double BenefitsIncludedContinuous { get; set; }
//مزایای مشمول غیر مستمر
public double BenefitsIncludedNonContinuous { get; set; }
//مشمول و غیر مشمول
/// <summary>
/// جمع کل دستمزد و مزایای ماهانه
/// DSW_TOTL
/// </summary>
public double IncludedAndNotIncluded { get; set; }
//سهم بیمه حق کارگر
/// <summary>
/// حق بیمه سهم بیمه شده
/// DSW_BIME
/// </summary>
public double InsuranceShare { get; set; }
// تاریخ شروع به کار
/// <summary>
/// تایخ شروع بکار میلادی
/// DSW_SDATE
/// </summary>
public DateTime StartWorkDate { get; set; }
//تاریخ ترک کار
/// <summary>
/// تاریخ ترک کار میلادی
/// DSW_EDATE
/// </summary>
public DateTime? LeftWorkDate { get; set; }
// آی دی شغل
public long JobId { get; set; }
/// <summary>
/// نام شغل
/// DSW_OCP
/// </summary>
public string JobName { get; set; }
/// <summary>
/// کد شغل
/// DSW_JOB
/// </summary>
public string JobCode { get; set; }
public string StrStartWorkDate { get; set; }
public string StrLeftWorkDate { get; set; }
@@ -53,5 +97,23 @@ public class EmployeeInsurancListDataViewModel
public bool IncludeStatus { get; set; }
public bool HasConfilictLeftWork { get; set; }
/// <summary>
/// پایه سنواتی
/// DSW_INC
/// </summary>
public double BaseYears { get; set; }
/// <summary>
/// جمع پایه سنوات و دستمزد روزانه
/// DSW_INC
/// </summary>
public double DailyWagePlusBaseYears { get; set; }
/// <summary>
/// حق تاهل
/// DSW_SPOUSE
/// </summary>
public double MarriedAllowance { get; set; }
}

View File

@@ -44,8 +44,12 @@ public interface IEmployerApplication
OperationResult ActiveAll(long id);
List<EmployerViewModel> GetAllEmployers();
#endregion
#endregion
#region Insurance
(string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId);
#endregion
}

View File

@@ -14,48 +14,141 @@ public class CreateInsuranceList
{ //آی دی کارگاه
public long WorkshopId { get; set; }
public string WorkshopName { get; set; }
//سال
/// <summary>
/// سال ارسال لیست
/// DSK_YY
/// </summary>
public string Year { get; set; }
//ماه
/// <summary>
/// ماه ارسال لیست
/// DSK_MM
/// </summary>
public string Month { get; set; }
//مجموع تعداد پرسنل
/// <summary>
/// تعداد کارکنان
/// DSK_NUM
/// </summary>
public int SumOfEmployees { get; set; }
//مجموع روزهای کارکرد پرسنل
/// <summary>
/// مجموع روزهای کارکرد کارکنان
/// DSK_TDD
/// </summary>
public int SumOfWorkingDays { get; set; }
// مجموع دستمزد پرسنل
/// <summary>
/// مجموع دستمزد ماهانه کارکنان
/// DSK_TMAH
/// </summary>
public double SumOfSalaries { get; set; }
//مجموع مزایای مشمول
/// <summary>
/// مجموع مزایای ماهانه مشمول
/// DSK_TMAZ
/// </summary>
public double SumOfBenefitsIncluded { get; set; }
//مشمول
/// <summary>
/// مجموع دستمزد و مزایای ماهانه مشمول
/// DSK_TMASH
/// </summary>
public double Included { get; set; }
//غیرمشمول و مشمول
/// <summary>
/// مجموع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول
/// DSK_TTOTL
/// </summary>
public double IncludedAndNotIncluded { get; set; }
//سهم بیمه شده
/// <summary>
/// مجموع حق بیمه سهم بیمه شده
/// DSK_TBIME
/// </summary>
public double InsuredShare { get; set; }
//سهم کارفرما
/// <summary>
/// مجموع حق بیمه سهم کارفرما
/// DSK_TKOSO
/// </summary>
public double EmployerShare { get; set; }
//حق بیمه بیکاری
/// <summary>
/// مجموع حق بیمه بیکاری
/// DSK_BIC
/// </summary>
public double UnEmploymentInsurance { get; set; }
//مزایای مشاغل سخت
/// <summary>
/// نرخ مشاغل سخت زیان آور
/// DSK_BIMH
/// </summary>
public double DifficultJobsInsuranc { get; set; }
//تاریخ شروع لیست
/// <summary>
/// تاریخ شروع لیست
/// میلادی
/// </summary>
public DateTime StartDate { get; set; }
// تاریخ پایان لیست
/// <summary>
/// تاریخ پایان لیست
/// میلادی
/// </summary>
public DateTime EndDate { get; set; }
public List<WorkshopViewModel> WorkShopList { get; set; }
public SelectList WorkShopSelectList { get; set; }
public List<string> YearList { get; set; }
public string BeforCurrentMonth { get; set; }
public string CurrentYear { get; set; }
/// <summary>
/// اطلاعات ذخیره شده کارگاه برای بیمه
/// </summary>
public InsuranceWorkshopInfoViewModel InsuranceWorkshopInfo { get; set; }
/// <summary>
/// لیست اطلاعات هویتی کارکنان
/// </summary>
public List<EmployeeDetailsForInsuranceListViewModel> EmployeeDetailsForInsuranceList { get; set; }
/// <summary>
/// لیست اطلاعات محاسباتی کارکنان
/// </summary>
public List<EmployeeInsurancListDataViewModel> EmployeeInsurancListDataList { get; set; }
public List<long> WorkshopIds { get; set; }
/// <summary>
/// کمک هزینه مسکن
/// </summary>
public double HousingAllowance { get; set; }
/// <summary>
/// کمک هزینه اقلام مصرفی
/// </summary>
public double ConsumableItems { get; set; }
/// <summary>
/// مجموع دستمزد روزانه کارکنان
/// DSK_TROOZ
/// </summary>
public double SumOfDailyWage { get; set; }
public double AllInsuredShare { get; set; }
/// <summary>
/// مجموع پایه سنواتی کارکنان
/// DSK_INC
/// </summary>
public double SumOfBaseYears { get; set; }
/// <summary>
/// جمع پایه سنوات و دستمزد روزانه کارکنان
/// DSW_INC
/// </summary>
public double SumOfDailyWagePlusBaseYears { get; set; }
/// <summary>
/// مجموع حق تاهل کارکنان
/// DSK_SPOUSE
/// </summary>
public double SumOfMarriedAllowance { get; set; }
public bool ConfirmSentlist { get; set; }

View File

@@ -6,84 +6,225 @@ using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.InsuranceList;
/// <summary>
/// اطلاعات ذخریه شده پرسنل برای بیمه
/// </summary>
public class EmployeeDetailsForInsuranceListViewModel
{
public long EmployeeId { get; set; }
public long InsuranceEmployeeInformationId { get; set; }
/// <summary>
/// نام
/// DSW_FNAME
/// </summary>
public string FName { get; set; }
/// <summary>
/// نام خانوادگی
/// DSW_LNAME
/// </summary>
public string LName { get; set; }
/// <summary>
/// نام پدر
/// DSW_DNAME
/// </summary>
public string FatherName { get; set; }
/// <summary>
/// تاریخ تولد میلادی
/// DSW_BDATE
/// </summary>
public DateTime DateOfBirthGr { get; set; }
/// <summary>
/// تاریخ صدور میلادی
/// DSW_IDATE
/// </summary>
public DateTime DateOfIssueGr { get; set; }
/// <summary>
/// تاریخ تولد شمسی
/// DSW_BDATE
/// </summary>
public string DateOfBirth { get; set; }
/// <summary>
/// تاریخ صدور شمسی
/// DSW_IDATE
/// </summary>
public string DateOfIssue { get; set; }
/// <summary>
/// محل صدور
/// DSW_IDPLC
/// </summary>
public string PlaceOfIssue { get; set; }
/// <summary>
/// کد ملی پرسنل
/// PER_NATCOD
/// </summary>
public string NationalCode { get; set; }
/// <summary>
/// ملیت
/// DSW_NAT
/// </summary>
public string Nationality { get; set; }
/// <summary>
/// شماره شناسنامه
/// DSW_IDNO
/// </summary>
public string IdNumber { get; set; }
/// <summary>
/// جنسیت
/// DSW_SEX
/// </summary>
public string Gender { get; set; }
/// <summary>
/// شماره بیمه
/// DSW_ID1
/// </summary>
public string InsuranceCode { get; set; }
// public long EmployeeInsurancListDataId { get; set; }
public long InsuranceListId { get; set; }
//روزهای کارکرد پرسنل
/// <summary>
/// تعداد روز های کارکرد پرسنل
/// DSW_DD
/// </summary>
public int WorkingDays { get; set; }
// دستمزد روزانه
/// <summary>
/// دستمزد روزانه پرسنل double
/// DSW_ROOZ
/// </summary>
public double DailyWage { get; set; }
/// <summary>
/// دستمزد روزانه پرسنل str
/// DSW_ROOZ
/// </summary>
public string DailyWageStr { get; set; }
//دستمزد ماهانه
/// <summary>
/// دستمزد ماهانه پرسنل double
/// DSW_MAH
/// </summary>
public double MonthlySalary { get; set; }
public double MonthlyBaseYears { get; set; }
public string MonthlyBaseYearsStr { get; set; }
//مزایای ماهانه
/// <summary>
/// مزایای ماهانه
/// DSW_MAZ
/// </summary>
public double MonthlyBenefits { get; set; }
//دستمزد و مزایای ماهانه مشمول
/// <summary>
/// جمع دستمزد و مزایای ماهانه مشمول
/// DSW_MASH
/// </summary>
public double MonthlyBenefitsIncluded { get; set; }
// مزایای مشمول مستمر
/// <summary>
/// مزایای مشمول مستمر
/// </summary>
public double BenefitsIncludedContinuous { get; set; }
//مزایای مشمول غیر مستمر
/// <summary>
/// مزایای مشمول غیر مستمر
/// </summary>
public double BenefitsIncludedNonContinuous { get; set; }
/// <summary>
/// جمع کل دستمزد و مزایای ماهانه
/// DSW_TOTL
/// </summary>
public double IncludedAndNotIncluded { get; set; }
//سهم بیمه حق کارگر
/// <summary>
/// حق بیمه سهم بیمه شده
/// DSW_BIME
/// </summary>
public double InsuranceShare { get; set; }
// تاریخ شروع به کار
public string StartWorkDate { get; set; }
//تاریخ ترک کار
public string LeftWorkDate { get; set; }
// تاریخ شروع به کار
/// <summary>
/// تایخ شروع بکار میلادی
/// DSW_SDATE
/// </summary>
public DateTime StartWorkDateGr { get; set; }
//تاریخ ترک کار
/// <summary>
/// تاریخ ترک کار میلادی
/// DSW_EDATE
/// </summary>
public DateTime? LeftWorkDateGr { get; set; }
// آی دی شغل
public long JobId { get; set; }
/// <summary>
/// نام شغل
/// DSW_OCP
/// </summary>
public string JobName { get; set; }
/// <summary>
/// کد شغل
/// DSW_JOB
/// </summary>
public string JobCode { get; set; }
public double HousingAllowance { get; set; }
public double ConsumableItems { get; set; }
public double MaritalStatus { get; set; }
/// <summary>
/// وضعیت تاهل
/// </summary>
public string MaritalStatus { get; set; }
public bool IsMaritalStatusSet { get; set; }
public int EndMonthCurrentDay { get; set; }
public double SumOfDailyWage { get; set; }
//بیمه سهم کارفرما
/// <summary>
/// حق بیمه سهم کارفرما
/// </summary>
public double EmployerShare { get; set; }
//بیمه بیکاری
/// <summary>
/// بیمه بیکاری
/// </summary>
public double UnEmploymentInsurance { get; set; }
public string StartMonthCurrent { get; set; }
public bool HasLeftWorkInMonth { get; set; }
public bool HasStartWorkInMonth { get; set; }
public long EmployeeInsurancListDataId { get; set; }
/// <summary>
/// مشمول مزیا - عدم مشمول مزایا
/// </summary>
public bool IncludeStatus { get; set; }
/// <summary>
/// تایخ شروع بکار میلادی جدید
/// DSW_SDATE
/// </summary>
public DateTime StartWorkDateNew { get; set; }
/// <summary>
/// تاریخ ترک کار میلادی جدید
/// DSW_EDATE
/// </summary>
public DateTime? LeftWorkDateNew { get; set; }
public string StrLeftWorkDateNew { get; set; }
public string StrStartWorkDateNew { get; set; }
public long JobIdNew { get; set; }
@@ -93,4 +234,40 @@ public class EmployeeDetailsForInsuranceListViewModel
public bool HasConfilictLeftWork { get; set; }
public double YearlySalaryItem { get; set; }
public bool HasConfilictJobs { get; set; }
/// <summary>
/// پایه سنواتی
/// DSW_INC
/// </summary>
public double BaseYears { get; set; }
/// <summary>
/// جمع پایه سنوات و دستمزد روزانه
/// DSW_INC
/// </summary>
public double DailyWagePlusBaseYears { get; set; }
/// <summary>
/// حق تاهل
/// DSW_SPOUSE
/// </summary>
public double MarriedAllowance { get; set; }
///// <summary>
///// مجموع پایه سنواتی کارکنان
///// DSK_INC
///// </summary>
//public double SumOfBaseYears { get; set; }
///// <summary>
///// جمع پایه سنوات و دستمزد روزانه کارکنان
///// DSW_INC
///// </summary>
//public double SumOfDailyWagePlusBaseYears { get; set; }
///// <summary>
///// مجموع حق تاهل کارکنان
///// DSK_SPOUSE
///// </summary>
//public double SumOfMarriedAllowance { get; set; }
}

View File

@@ -12,4 +12,5 @@ public class MainEmployeeDetailsViewModel
public bool IsExist { get; set; }
public bool IsBlock { get; set; }
public double MaritalStatus { get; set; }
}

View File

@@ -10,16 +10,37 @@ public class InsuranceWorkshopInfoViewModel
{
public long InsuranceWorkshopInfoId { get; set; }
public long WorkshopId { get; set; }
//نام کارگاه
/// <summary>
/// نام کارگاه
/// DSK_NAME
/// </summary>
public string WorkshopName { get; set; }
//کد کارگاهی بیمه
/// <summary>
/// کد کارگاهی بیمه
/// DSK_ID
/// </summary>
public string InsuranceCode { get; set; }
//ردیف پیمان
/// <summary>
/// ردیف پیمان
/// </summary>
public string AgreementNumber { get; set; }
// نام کارفرما
/// <summary>
/// نام کارفرما
/// DSK_FARM
/// </summary>
public string EmployerName { get; set; }
//آدرس کارگاه
/// <summary>
/// آدرس کارگاه
/// DSK_ADRS
/// </summary>
public string Address { get; set; }
/// <summary>
/// شماره لیست
/// DSK_LISTNO
/// </summary>
public string ListNumber { get; set; }
//public bool FixedSalary { get; set; }
//public string Population { get; set; }

View File

@@ -31,4 +31,14 @@ public interface ILeftWorkInsuranceApplication
OperationResult CheckEditLeftWorkInsurance(long workshopId, long employeeId, string date, int type);
OperationResult CheckBeforeSaveLeftWorkInsurance(long workshopId, long employeeId, string date, int type);
#region Insurance
/// <summary>
/// دریافت شروع و ترک کار بیمه پرسنل و اطلاعات هویتی آن
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceLeftWorksAndInformation(long workshopId, DateTime startDate, DateTime endDate);
#endregion
}

View File

@@ -42,6 +42,16 @@ public interface IPersonalContractingPartyApp
OperationResult DisableBlock(long id);
#endregion
#region Insurance
/// <summary>
/// چک میکند که آیا طرف حساب بلاک است یا خیر
/// با دریافت آی دی کارگاه
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
bool IsBlockCheckByWorkshopId(long workshopId);
#endregion
}

View File

@@ -61,4 +61,14 @@ public interface IWorkshopApplication
#endregion
AccountViewModel GetClientAccountByWorkshopId(long workshopId);
#region Insurance
/// <summary>
/// لیست انتخاب کارگاه در مودال ایجاد بیمه
/// </summary>
/// <returns></returns>
List<WorkshopViewModel> GetWorkshopSelectListInsuransce();
#endregion
}

View File

@@ -19,4 +19,10 @@ public interface IYearlySalaryApplication
Task<HolidayApiVewModel> HolidayGregorian(DateTime gregorianDate);
Task<HolidayApiVewModel> HolidayShamsi(string shamsiDate);
#region Insurance
InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year);
#endregion
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CompanyManagment.App.Contracts.YearlySalary;
public class InsuranceYearlySalaryModel
{
public double DayliWage { get; set; }
public double HousingAllowance { get; set; }
public double ConsumableItems { get; set; }
public double MarriedAllowance { get; set; }
}

View File

@@ -26,7 +26,9 @@ public class EmployeeInsurancListDataApplication : IEmployeeInsurancListDataAppl
if (command == null)
return operation.Failed("لطفا اطلاعات ورودی را تکمیل نمایید!");
var employeeInsurancListData = new EmployeeInsurancListData(command.InsuranceListId, command.EmployeeId, command.WorkingDays, command.DailyWage, command.MonthlySalary, command.MonthlyBenefits, command.MonthlyBenefitsIncluded, command.BenefitsIncludedContinuous, command.BenefitsIncludedNonContinuous, command.InsuranceShare, command.StartWorkDate,command.LeftWorkDate,command.JobId,command.IncludeStatus);
var employeeInsurancListData = new EmployeeInsurancListData(command.InsuranceListId, command.EmployeeId, command.WorkingDays, command.DailyWage, command.MonthlySalary, command.MonthlyBenefits,
command.MonthlyBenefitsIncluded, command.BenefitsIncludedContinuous, command.BenefitsIncludedNonContinuous, command.InsuranceShare,
command.StartWorkDate,command.LeftWorkDate,command.JobId,command.IncludeStatus, command.BaseYears,command.MarriedAllowance);
_employeeInsurancListDataRepository.Create(employeeInsurancListData);
_employeeInsurancListDataRepository.SaveChanges();
return operation.Succcedded();

View File

@@ -939,5 +939,16 @@ public class EmployerApplication : IEmployerApplication
return _EmployerRepository.GetAllEmployers();
}
#endregion
#endregion
#region Insurance
public (string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId)
{
return _EmployerRepository.InsuranceEmployerByWorkshopId(workshopId);
}
#endregion
}

View File

@@ -1,12 +1,15 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using _0_Framework.Application;
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
using Company.Domain.DateSalaryAgg;
using Company.Domain.DateSalaryItemAgg;
using Company.Domain.EmployeeAgg;
using Company.Domain.EmployeeChildrenAgg;
using Company.Domain.empolyerAgg;
using Company.Domain.InsuranceEmployeeInfoAgg;
using Company.Domain.InsuranceJobItemAgg;
using Company.Domain.InsuranceListAgg;
@@ -337,352 +340,521 @@ public class InsuranceListApplication: IInsuranceListApplication
public List<InsuranceListViewModel> Search(InsuranceListSearchModel searchModel)
{
var result = _insuranceListRepositpry.Search(searchModel);
result = result.Select(x => new InsuranceListViewModel()
{
Id = x.Id,
Year = x.Year,
Month = x.Month.GetMonthByNumber(),
MonthNumber = x.MonthNumber,
WorkShopCode = x.WorkShopCode,
WorkShopName = x.WorkShopName,
WorkShopId = x.WorkShopId,
TypeOfInsuranceSend = x.TypeOfInsuranceSend,
FixedSalary = x.FixedSalary,
StrFixedSalary = x.StrFixedSalary,
EmployerName = x.EmployerName,
Branch = x.Branch,
City = x.City,
ConfirmSentlist = x.ConfirmSentlist,
EmployerId = x.EmployerId,
IsBlockCantracingParty = _contractingPartyApp.IsBlockByEmployerId(x.EmployerId),
return _insuranceListRepositpry.OptimizedSearch(searchModel);
//var result = _insuranceListRepositpry.Search(searchModel);
//result = result.Select(x => new InsuranceListViewModel()
//{
// Id = x.Id,
// Year = x.Year,
// Month = x.Month.GetMonthByNumber(),
// MonthNumber = x.MonthNumber,
// WorkShopCode = x.WorkShopCode,
// WorkShopName = x.WorkShopName,
// WorkShopId = x.WorkShopId,
// TypeOfInsuranceSend = x.TypeOfInsuranceSend,
// FixedSalary = x.FixedSalary,
// StrFixedSalary = x.StrFixedSalary,
// EmployerName = x.EmployerName,
// Branch = x.Branch,
// City = x.City,
// ConfirmSentlist = x.ConfirmSentlist,
// EmployerId = x.EmployerId,
// IsBlockCantracingParty = _contractingPartyApp.IsBlockByEmployerId(x.EmployerId),
}).ToList();
return result;
//}).ToList();
//return result;
}
// محاسبه جدول پرسنل در - DSKWOR 1 create
/// <summary>
/// محاسبه جدول پرسنل در مودال ایجاد لیست بیمه
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
public MainEmployeeDetailsViewModel SearchEmployeeForCreateInsuranceList( EmployeeForCreateInsuranceListSearchModel searchModel)
{
var watch = new Stopwatch();
var result = new MainEmployeeDetailsViewModel();
var workshopId = searchModel.WorkshopIds.FirstOrDefault();
var employerId = _workShopRepository.GetDetails(workshopId).EmployerIdList.FirstOrDefault();
var isBolock = _contractingPartyApp.IsBlockByEmployerId(employerId);
//var employerId = _workShopRepository.GetDetails(workshopId).EmployerIdList.FirstOrDefault();
//var isBolock = _contractingPartyApp.IsBlockByEmployerId(employerId);
var isBolock = _contractingPartyApp.IsBlockCheckByWorkshopId(workshopId);
double monthlybaseYear = 0;
// اگر لیست بیمه تکراری نبود
if (!_insuranceListRepositpry.Exists(x =>x.Year == searchModel.Year && x.Month == searchModel.Month && searchModel.WorkshopIds.Contains(x.WorkshopId)))
// اگر در این سال و ماه برای این کارگاه لیست بیمه ایجاد نشده بود
if (!_insuranceListRepositpry.Exists(x =>
x.Year == searchModel.Year && x.Month == searchModel.Month &&
searchModel.WorkshopIds.Contains(x.WorkshopId)))
{
List<EmployeeDetailsForInsuranceListViewModel> list = new List<EmployeeDetailsForInsuranceListViewModel>();
// شروع بکار و ترک کار بیمه
var leftWorkInsuranceViewModelList =_leftWorkInsuranceApplication.SearchForCreateInsuranceList(searchModel);
var startMonthFa = $"{searchModel.Year}/{searchModel.Month}/01";
DateTime startDateGr = startMonthFa.ToGeorgianDateTime();
DateTime endDateGr = startMonthFa.FindeEndOfMonth()
.ToGeorgianDateTime();
int endOfMonth = Convert.ToInt32((startMonthFa.FindeEndOfMonth()).Substring(8, 2));
int leftWorkInsuranceCount= leftWorkInsuranceViewModelList.Count();
//مقادیر سالانه این تاریخ
var yearlysaleries = _yearlySalaryApplication.GetInsuranceItems(startDateGr, endDateGr, searchModel.Year);
string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
var model = new YearlySalarySearchModel();
var startDate = startMonthCurrent.ToGeorgianDateTime();
model.StartDateGr = startDate;
model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
model.year = searchModel.Year;
//مقادیر سالانه این تاریخ
var yearSalaryObj = _yearlySalaryApplication.GetDetailsBySearchModel(model);
var yearlysalaryItem = new YearlysalaryItemViewModel();
var housingAllowance = new YearlysalaryItemViewModel();
var consumableItems = new YearlysalaryItemViewModel();
var maritalStatus = new YearlysalaryItemViewModel();
if (yearSalaryObj != null)
{
yearlysalaryItem = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
.Where(x => x.ItemName == "مزد روزانه").FirstOrDefault();
housingAllowance = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
.Where(x => x.ItemName == "کمک هزینه مسکن").FirstOrDefault();
consumableItems = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
.Where(x => x.ItemName == "کمک هزینه اقلام").FirstOrDefault();
maritalStatus = _yearlySalaryItemApplication.GetItemsByYearlySalaryId(yearSalaryObj.Id)
.Where(x => x.ItemName == "حق تاهل").FirstOrDefault();
}
foreach (var item in leftWorkInsuranceViewModelList)
{
var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
var employeeDetailsForInsuranceObj = new EmployeeDetailsForInsuranceListViewModel();
employeeDetailsForInsuranceObj.HasConfilictJobs = false;
// دریافت اطلاعات هویتی و شروع و ترک کار کارکنان
var employeesInfoAndLeftWorks =
_leftWorkInsuranceApplication.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDateGr,
endDateGr);
watch.Start();
var computeResult = employeesInfoAndLeftWorks.Select(employee =>
{
var dateOfBirth = employee.DateOfBirthGr.ToFarsi();
var dateOfIssue = employee.DateOfIssueGr.ToFarsi();
var leftDate = employee.LeftWorkDateGr != null ? employee.LeftWorkDateGr.Value.AddDays(-1) : new DateTime();
employeeDetailsForInsuranceObj.IsMaritalStatusSet = // آیا وضعیت تاهل پرسنل ست شده است
!string.IsNullOrWhiteSpace(employeeObject.MaritalStatus);
if (_insuranceEmployeeInfoRepository.Exists(x => x.EmployeeId == item.EmployeeId))
{
var employeeInfoObject = _insuranceEmployeeInfoApplication.GetDetailsByEmployeeId(item.EmployeeId);
employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = employeeInfoObject.Id;
employeeDetailsForInsuranceObj.EmployeeId = employeeInfoObject.EmployeeId;
employeeDetailsForInsuranceObj.FName = employeeInfoObject.FName;
employeeDetailsForInsuranceObj.LName = employeeInfoObject.LName;
employeeDetailsForInsuranceObj.FatherName = employeeInfoObject.FatherName;
employeeDetailsForInsuranceObj.DateOfBirth = employeeInfoObject.DateOfBirth;
employeeDetailsForInsuranceObj.DateOfIssue = employeeInfoObject.DateOfIssue;
employeeDetailsForInsuranceObj.DateOfBirthGr = employeeInfoObject.DateOfBirthGr;
employeeDetailsForInsuranceObj.DateOfIssueGr = employeeInfoObject.DateOfIssueGr;
employeeDetailsForInsuranceObj.PlaceOfIssue = employeeInfoObject.PlaceOfIssue;
employeeDetailsForInsuranceObj.IdNumber = employeeInfoObject.IdNumber;
employeeDetailsForInsuranceObj.Gender = employeeInfoObject.Gender;
var workingDays = Tools.GetEmployeeInsuranceWorkingDays(employee.StartWorkDateGr, leftDate, startDateGr,endDateGr, employee.EmployeeId);
var leftWorkFa = workingDays.hasLeftWorkInMonth ? employee.LeftWorkDateGr.ToFarsi(): "";
var startWorkFa = workingDays.startWork.ToFarsi();
//به دست آوردن دستمزد روزانه با توجه به اینکه کارگاه مشاغل مقطوع است یا خیر
var dailyWage = searchModel.FixedSalary ?
Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, workshopId, employee.EmployeeId, startDateGr, endDateGr, employee.JobId, searchModel.Population, searchModel.InsuranceJobId))
: ComputeDailyWage(yearlysaleries.DayliWage, employee.EmployeeId, workshopId, searchModel.Year);
//بدست آوردن پایه سنوات
var baseYears = _insuranceListRepositpry.GetEmployeeInsuranceBaseYear(employee.EmployeeId, workshopId,
workingDays.countWorkingDays, startDateGr, endDateGr,workingDays.startWork, workingDays.endWork, workingDays.hasLeftWorkInMonth);
//از جدول پرسنل پر می شود
employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode; //employeeInfoObject.NationalCode;
employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode; //employeeInfoObject.InsuranceCode;
}
else
{
// var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = 0;
//employeeDetailsForInsuranceObj.EmployeeInsurancListDataId = 0;
employeeDetailsForInsuranceObj.EmployeeId = employeeObject.Id;
employeeDetailsForInsuranceObj.FName = employeeObject.FName;
employeeDetailsForInsuranceObj.LName = employeeObject.LName;
employeeDetailsForInsuranceObj.FatherName = employeeObject.FatherName;
employeeDetailsForInsuranceObj.DateOfBirth = (employeeObject.DateOfBirth=="1300/10/11"?"" : employeeObject.DateOfBirth);
employeeDetailsForInsuranceObj.DateOfIssue = employeeObject.DateOfIssue;
employeeDetailsForInsuranceObj.PlaceOfIssue = employeeObject.PlaceOfIssue;
employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode;
employeeDetailsForInsuranceObj.IdNumber = employeeObject.IdNumber;
employeeDetailsForInsuranceObj.Gender = employeeObject.Gender;
employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode;
employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
}
//جمع مزد روزانه و پایه سنوات
var dailyWagePlusBaseYears = dailyWage + baseYears.baseYear;
#region ComputingWorkingDays
int startWork = 0;
int endWork = 0;
//دستمزد ماهانه با محاسبه پایه سنوات
var monthlySalary = GetRoundValue(dailyWagePlusBaseYears * workingDays.countWorkingDays);
var year = Convert.ToInt32(searchModel.Year);
var month = Convert.ToInt32(searchModel.Month);
var day = 1;
var persianCurrentStartDate = new PersianDateTime(year, month, day);
var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
//آخرین روز ماه جاری
var endMonthCurrentDay = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
//حق تاهل
var marriedAllowance = employee.MaritalStatus == "متاهل" ? yearlysaleries.MarriedAllowance : 0;
var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
//محاسبه مزایای ماهانه
var monthlyBenefits = GetMonthlyBenefits(endOfMonth, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marriedAllowance, workingDays.countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, employee.JobId, employee.EmployeeId);
if (persianStartDateUser < persianCurrentStartDate)
employeeDetailsForInsuranceObj.HasStartWorkInMonth = false;
else
employeeDetailsForInsuranceObj.HasStartWorkInMonth = true;
//محاسبه مزایای مشمول مستمر
var benefitsIncludedContinuous = monthlyBenefits + monthlySalary;
//اگر شروع به کار کاربر از ابتدای ماه جاری کمتر باشد
if (persianStartDateUser <= persianCurrentStartDate)
{
startWork = 1;
}
else
{
startWork = dayStartDateUser;
}
//محاسبه حق بیمه سهم بیمه شده
var insuranceShare = (benefitsIncludedContinuous * 7) / 100;
if (!string.IsNullOrEmpty(item.LeftWorkDate))
{
var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
var persianEndDateUser = persianLeftDateUser.AddDays(-1);
var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
//محاسبه حق بیمه سهم کارفرما
var employerShare = (benefitsIncludedContinuous * 20) / 100;
//if (persianLeftDateUser <= persianCurrentEndDate)
// employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
//else
// employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
// محاسبه بیمه بیکاری
var unEmploymentInsurance = (benefitsIncludedContinuous * 3) / 100;
return new EmployeeDetailsForInsuranceListViewModel
{
#region EmployeeInfo
//ترک کارش در ماه و سال جاری بود نمایش داده شود
if (!item.LeftWorkDate.Contains(searchModel.Year + "/" + searchModel.Month))
{
employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
item.LeftWorkDate = string.Empty;
item.LeftWorkDateGr = null;
}
else
{
employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
}
InsuranceEmployeeInformationId = employee.InsuranceEmployeeInformationId,
EmployeeId = employee.EmployeeId,
FName = employee.FName,
LName = employee.LName,
FatherName = employee.FatherName,
DateOfBirth = dateOfBirth == "1300/10/11" ? "" : dateOfBirth,
DateOfIssue = dateOfIssue,
DateOfBirthGr = employee.DateOfBirthGr,
DateOfIssueGr = employee.DateOfIssueGr,
PlaceOfIssue = employee.PlaceOfIssue,
IdNumber = employee.IdNumber,
Gender = employee.Gender,
NationalCode = employee.NationalCode,
Nationality = employee.Nationality,
InsuranceCode = employee.InsuranceCode,
// آیا وضعیت تاهل پرسنل ست شده است
IsMaritalStatusSet = !string.IsNullOrWhiteSpace(employee.MaritalStatus),
MaritalStatus = employee.MaritalStatus,
//اگر پایان به کار کاربر از پایان ماه جاری بیشتر باشد
if (persianEndDateUser >= persianCurrentEndDate)
{
endWork = endMonthCurrentDay;
}
else
{
endWork = Convert.ToInt32(persianEndDateUserStr.Substring(8, 2));
}
}
else
{
employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
endWork = endMonthCurrentDay;
}
StartMonthCurrent = startMonthFa,
WorkingDays = workingDays.countWorkingDays,
StartWorkDate = startWorkFa,
StartWorkDateGr = workingDays.startWork,
LeftWorkDate = leftWorkFa,
LeftWorkDateGr = workingDays.hasLeftWorkInMonth ? employee.LeftWorkDateGr : null,
JobId = employee.JobId,
JobName = employee.JobName,
JobCode = employee.JobCode,
int countWorkingDays = 0;
for (int i = startWork; i <= endWork; i++)
{
countWorkingDays = countWorkingDays + 1;
}
//farokhiChanges
//روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
switch (item.EmployeeId)
{
HasStartWorkInMonth = workingDays.hasStartWorkInMonth,
HasLeftWorkInMonth = workingDays.hasLeftWorkInMonth,
#endregion
#region Compute
//مشمول مزایا بودن
IncludeStatus = employee.IncludeStatus,
//دستمزد روزانه
DailyWage = GetRoundValue(dailyWage),
DailyWageStr = dailyWage.ToMoney(),
HasConfilictJobs = dailyWage == 0,
//پایه سنوات
BaseYears = baseYears.baseYear,
//مجموع مزد روزانه و پایه سنوات
DailyWagePlusBaseYears = dailyWagePlusBaseYears,
//حق تاهل
MarriedAllowance = employee.MaritalStatus == "متاهل" ? yearlysaleries.MarriedAllowance : 0,
//دستمزد ماهانه
MonthlySalary = monthlySalary,
//case 3812://ثابت- کسری حاجی پور
// countWorkingDays = 15;
// break;
case 40463://ثابت
countWorkingDays = 10;
break;
case 40469://ثابت
countWorkingDays = 7;
break;
case 9950://ثابت
countWorkingDays = 15;
break;
case 9640://ثابت
countWorkingDays = 15;
break;
case 40998://ثابت
countWorkingDays = 15;
break;
case 6219://ثابت
countWorkingDays = 15;
break;
//case 7897://ثابت
// countWorkingDays = 15;
break;
}
#endregion
//مزایای ماهانه
MonthlyBenefits = monthlyBenefits,
employeeDetailsForInsuranceObj.IncludeStatus = item.IncludeStatus;
//مزایای مشمول مستمر
BenefitsIncludedContinuous = benefitsIncludedContinuous,
//مزیایی مشمول غیر مستمر
BenefitsIncludedNonContinuous = 0,
// جمع کل دستمزد و مزایای ماهانه
IncludedAndNotIncluded = benefitsIncludedContinuous,
//حق بیمه سهم بیمه شده
InsuranceShare = GetRoundValue(insuranceShare),
//حق بیمه سهم کارفرما
EmployerShare = GetRoundValue(employerShare),
//بیمه بیکاری
UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance),
//کمک هزینه مسکن
HousingAllowance = yearlysaleries.HousingAllowance,
//کمک هزینه اقلام
ConsumableItems = yearlysaleries.ConsumableItems,
EndMonthCurrentDay = endOfMonth,
YearlySalaryItem = yearlysaleries.DayliWage,
MonthlyBaseYearsStr = "0",
MonthlyBaseYears = 0,
#endregion
#region InsuranceJob
double dailyWage = employeeDetailsForInsuranceObj.DailyWage;
if (searchModel.FixedSalary)
{
dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, item.WorkshopId,item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
employeeDetailsForInsuranceObj.HasConfilictJobs = (dailyWage == 0 ? true : false);
}
#endregion
};
});
Console.WriteLine("New Compute : " + watch.Elapsed);
watch.Stop();
if (yearlysalaryItem != null)
{
if(!searchModel.FixedSalary )
{
//dailyWage= yearlysalaryItem.ItemValue;
dailyWage = ComputeDailyWage(yearlysalaryItem.ItemValue, item.EmployeeId,item.WorkshopId, searchModel.Year) ;
//(double basic, int totalYears) basicResult = BasicYear(item.EmployeeId, workshopId, startDate);
//var basic = basicResult.basic;
//if (basicResult.totalYears > 0)
//{
// monthlybaseYear = GetMonthlyBaseYear(basicResult.basic, countWorkingDays);
//}
}
employeeDetailsForInsuranceObj.DailyWage = GetRoundValue(dailyWage);
employeeDetailsForInsuranceObj.DailyWageStr = employeeDetailsForInsuranceObj.DailyWage.ToMoney();
employeeDetailsForInsuranceObj.MonthlySalary = GetRoundValue(dailyWage * countWorkingDays);
employeeDetailsForInsuranceObj.HousingAllowance = housingAllowance.ItemValue;
employeeDetailsForInsuranceObj.ConsumableItems = consumableItems.ItemValue;
employeeDetailsForInsuranceObj.EndMonthCurrentDay = endMonthCurrentDay;
employeeDetailsForInsuranceObj.YearlySalaryItem = yearlysalaryItem.ItemValue;
employeeDetailsForInsuranceObj.MonthlyBaseYearsStr = monthlybaseYear.ToMoney();
if (item.IncludeStatus)
{
var marital = employeeObject.MaritalStatus == "متاهل" ? maritalStatus.ItemValue : 0;
employeeDetailsForInsuranceObj.MonthlyBenefits = GetMonthlyBenefits(endMonthCurrentDay, consumableItems.ItemValue, housingAllowance.ItemValue, marital, countWorkingDays);
}
else
{
employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
}
watch.Start();
if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
{
employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
}
//farokhiChanges
if (item.EmployeeId == 42783)
employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
#region Old_heydari
//List<EmployeeDetailsForInsuranceListViewModel> list = new List<EmployeeDetailsForInsuranceListViewModel>();
//var leftWorkInsuranceViewModel = _leftWorkInsuranceApplication.SearchForCreateInsuranceList(searchModel);
////int leftWorkInsuranceCount= leftWorkInsuranceViewModelList.Count();
employeeDetailsForInsuranceObj.BenefitsIncludedContinuous =employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary;
//if ((!item.IncludeStatus &&(item.JobId == 10 || item.JobId == 17 || item.JobId == 18 || item.JobId == 16)) ||(item.IncludeStatus && item.JobId == 10)) // 10 --> karfarma
//{
// var insuranceShare2 =(employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 27) / 100;
// employeeDetailsForInsuranceObj.InsuranceShare =GetRoundValue(insuranceShare2);
//}
//else
//{
var insuranceShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 7) / 100;
employeeDetailsForInsuranceObj.InsuranceShare = GetRoundValue(insuranceShare); //Math.Round(insuranceShare, MidpointRounding.ToPositiveInfinity);
//}
//string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
//string endMonthCurrent = startMonthCurrent.FindeEndOfMonth();
var employerShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 20) / 100;
employeeDetailsForInsuranceObj.EmployerShare = GetRoundValue(employerShare); //Math.Round(employerShare, MidpointRounding.ToPositiveInfinity);
//var model = new YearlySalarySearchModel();
//var startDate = startMonthCurrent.ToGeorgianDateTime();
//var endDate = endMonthCurrent.ToGeorgianDateTime();
//model.StartDateGr = startDate;
//model.EndDateGr = endMonthCurrent.ToGeorgianDateTime();
//model.year = searchModel.Year;
//if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId==10)//کمک دولت
//{employeeDetailsForInsuranceObj.InsuranceShare = 0;}
var unEmploymentInsurance =(employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 3) / 100;
employeeDetailsForInsuranceObj.UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance);
employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous;
employeeDetailsForInsuranceObj.IncludedAndNotIncluded = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous + employeeDetailsForInsuranceObj.BenefitsIncludedContinuous;
//foreach (var item in leftWorkInsuranceViewModel)
//{
// var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
}
// var employeeDetailsForInsuranceObj = new EmployeeDetailsForInsuranceListViewModel();
// employeeDetailsForInsuranceObj.HasConfilictJobs = false;
employeeDetailsForInsuranceObj.StartMonthCurrent = startMonthCurrent;
employeeDetailsForInsuranceObj.WorkingDays = countWorkingDays;
employeeDetailsForInsuranceObj.StartWorkDate = item.StartWorkDate;
employeeDetailsForInsuranceObj.LeftWorkDate = item.LeftWorkDate;
employeeDetailsForInsuranceObj.JobId = item.JobId;
employeeDetailsForInsuranceObj.JobName = item.JobName;
employeeDetailsForInsuranceObj.JobCode = item.JobCode;
if (!string.IsNullOrWhiteSpace(item.LeftWorkDate))
employeeDetailsForInsuranceObj.LeftWorkDateGr = item.LeftWorkDateGr;
// // آیا وضعیت تاهل پرسنل ست شده است
// employeeDetailsForInsuranceObj.IsMaritalStatusSet =
// !string.IsNullOrWhiteSpace(employeeObject.MaritalStatus);
// //دزیافت اطلاعات هویتی پرسنل
// //در صورت نداشن دیتا از جدول پرسنل پر می شود
// #region PersonnelInfo
employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr;
//farokhiChanges
if (item.EmployeeId == 42783)
employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
// if (_insuranceEmployeeInfoRepository.Exists(x => x.EmployeeId == item.EmployeeId))
// {
// var employeeInfoObject = _insuranceEmployeeInfoApplication.GetDetailsByEmployeeId(item.EmployeeId);
// employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = employeeInfoObject.Id;
// employeeDetailsForInsuranceObj.EmployeeId = employeeInfoObject.EmployeeId;
// employeeDetailsForInsuranceObj.FName = employeeInfoObject.FName;
// employeeDetailsForInsuranceObj.LName = employeeInfoObject.LName;
// employeeDetailsForInsuranceObj.FatherName = employeeInfoObject.FatherName;
// employeeDetailsForInsuranceObj.DateOfBirth = employeeInfoObject.DateOfBirth;
// employeeDetailsForInsuranceObj.DateOfIssue = employeeInfoObject.DateOfIssue;
// employeeDetailsForInsuranceObj.DateOfBirthGr = employeeInfoObject.DateOfBirthGr;
// employeeDetailsForInsuranceObj.DateOfIssueGr = employeeInfoObject.DateOfIssueGr;
// employeeDetailsForInsuranceObj.PlaceOfIssue = employeeInfoObject.PlaceOfIssue;
// employeeDetailsForInsuranceObj.IdNumber = employeeInfoObject.IdNumber;
// employeeDetailsForInsuranceObj.Gender = employeeInfoObject.Gender;
list.Add(employeeDetailsForInsuranceObj);
}
// //از جدول پرسنل پر می شود
// employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode; //employeeInfoObject.NationalCode;
// employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
// employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode; //employeeInfoObject.InsuranceCode;
// }
// else
// {
// // var employeeObject = _employeeRepository.GetDetailsByADDate(item.EmployeeId);
// employeeDetailsForInsuranceObj.InsuranceEmployeeInformationId = 0;
// //employeeDetailsForInsuranceObj.EmployeeInsurancListDataId = 0;
// employeeDetailsForInsuranceObj.EmployeeId = employeeObject.Id;
// employeeDetailsForInsuranceObj.FName = employeeObject.FName;
// employeeDetailsForInsuranceObj.LName = employeeObject.LName;
// employeeDetailsForInsuranceObj.FatherName = employeeObject.FatherName;
// employeeDetailsForInsuranceObj.DateOfBirth = (employeeObject.DateOfBirth == "1300/10/11" ? "" : employeeObject.DateOfBirth);
// employeeDetailsForInsuranceObj.DateOfIssue = employeeObject.DateOfIssue;
// employeeDetailsForInsuranceObj.PlaceOfIssue = employeeObject.PlaceOfIssue;
// employeeDetailsForInsuranceObj.NationalCode = employeeObject.NationalCode;
// employeeDetailsForInsuranceObj.IdNumber = employeeObject.IdNumber;
// employeeDetailsForInsuranceObj.Gender = employeeObject.Gender;
// employeeDetailsForInsuranceObj.InsuranceCode = employeeObject.InsuranceCode;
// employeeDetailsForInsuranceObj.Nationality = employeeObject.Nationality;
// }
// #endregion
list = list.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
// //روزهای کارکرد پرسنل
// #region ComputingWorkingDays
// int startWork = 0;
// int endWork = 0;
// var year = Convert.ToInt32(searchModel.Year);
// var month = Convert.ToInt32(searchModel.Month);
// var day = 1;
// var persianCurrentStartDate = new PersianDateTime(year, month, day);
// var dayMonthCurrent = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
// var persianCurrentEndDate = new PersianDateTime(year, month, dayMonthCurrent);
// //آخرین روز ماه جاری
// var endMonthCurrentDay = Convert.ToInt32(endMonthCurrent.Substring(8, 2));
// var yearStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(0, 4));
// var monthStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(5, 2));
// var dayStartDateUser = Convert.ToInt32(item.StartWorkDate.Substring(8, 2));
// var persianStartDateUser = new PersianDateTime(yearStartDateUser, monthStartDateUser, dayStartDateUser);
// if (persianStartDateUser < persianCurrentStartDate)
// employeeDetailsForInsuranceObj.HasStartWorkInMonth = false;
// else
// employeeDetailsForInsuranceObj.HasStartWorkInMonth = true;
// //اگر شروع به کار کاربر از ابتدای ماه جاری کمتر باشد
// if (persianStartDateUser <= persianCurrentStartDate)
// {
// startWork = 1;
// }
// else
// {
// startWork = dayStartDateUser;
// }
// if (!string.IsNullOrEmpty(item.LeftWorkDate))
// {
// var yearEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(0, 4));
// var monthEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(5, 2));
// var dayEndDateUser = Convert.ToInt32(item.LeftWorkDate.Substring(8, 2));
// var persianLeftDateUser = new PersianDateTime(yearEndDateUser, monthEndDateUser, dayEndDateUser);
// var persianEndDateUser = persianLeftDateUser.AddDays(-1);
// var persianEndDateUserStr = persianLeftDateUser.AddDays(-1).ToString("yyyy/MM/dd");
// //if (persianLeftDateUser <= persianCurrentEndDate)
// // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
// //else
// // employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
// //ترک کارش در ماه و سال جاری بود نمایش داده شود
// if (!item.LeftWorkDate.Contains(searchModel.Year + "/" + searchModel.Month))
// {
// employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
// item.LeftWorkDate = string.Empty;
// item.LeftWorkDateGr = null;
// }
// else
// {
// employeeDetailsForInsuranceObj.HasLeftWorkInMonth = true;
// }
// //اگر پایان به کار کاربر از پایان ماه جاری بیشتر باشد
// if (persianEndDateUser >= persianCurrentEndDate)
// {
// endWork = endMonthCurrentDay;
// }
// else
// {
// endWork = Convert.ToInt32(persianEndDateUserStr.Substring(8, 2));
// }
// }
// else
// {
// employeeDetailsForInsuranceObj.HasLeftWorkInMonth = false;
// endWork = endMonthCurrentDay;
// }
// int countWorkingDays = 0;
// for (int i = startWork; i <= endWork; i++)
// {
// countWorkingDays = countWorkingDays + 1;
// }
// //farokhiChanges
// //روزهای کارکرد پرسنل با آی دی های زیر دستی تعریف شد
// switch (item.EmployeeId)
// {
// //case 3812://ثابت- کسری حاجی پور
// // countWorkingDays = 15;
// // break;
// case 40463://ثابت
// countWorkingDays = 10;
// break;
// case 40469://ثابت
// countWorkingDays = 7;
// break;
// case 9950://ثابت
// countWorkingDays = 15;
// break;
// case 9640://ثابت
// countWorkingDays = 15;
// break;
// case 40998://ثابت
// countWorkingDays = 15;
// break;
// case 6219://ثابت
// countWorkingDays = 15;
// break;
// //case 7897://ثابت
// // countWorkingDays = 15;
// break;
// }
// #endregion
// employeeDetailsForInsuranceObj.IncludeStatus = item.IncludeStatus;
// #region InsuranceJob
// double dailyWage = employeeDetailsForInsuranceObj.DailyWage;
// if (searchModel.FixedSalary)
// {
// dailyWage = Convert.ToDouble(GetDailyWageFixedSalary(searchModel.Year, workshopId, item.EmployeeId, model.StartDateGr, model.EndDateGr, item.JobId, searchModel.Population, searchModel.InsuranceJobId));
// employeeDetailsForInsuranceObj.HasConfilictJobs = (dailyWage == 0 ? true : false);
// }
// #endregion
// if (yearlysaleries != null)
// {
// if (!searchModel.FixedSalary)
// {
// //dailyWage= yearlysalaryItem.ItemValue;
// dailyWage = ComputeDailyWage(yearlysaleries.DayliWage, item.EmployeeId, workshopId, searchModel.Year);
// //(double basic, int totalYears) basicResult = BasicYear(item.EmployeeId, workshopId, startDate);
// //var basic = basicResult.basic;
// //if (basicResult.totalYears > 0)
// //{
// // monthlybaseYear = GetMonthlyBaseYear(basicResult.basic, countWorkingDays);
// //}
// }
// employeeDetailsForInsuranceObj.DailyWage = GetRoundValue(dailyWage);
// employeeDetailsForInsuranceObj.BaseYears = 0;
// employeeDetailsForInsuranceObj.DailyWageStr = employeeDetailsForInsuranceObj.DailyWage.ToMoney();
// employeeDetailsForInsuranceObj.DailyWagePlusBaseYears = 0;
// employeeDetailsForInsuranceObj.MonthlySalary = GetRoundValue(dailyWage * countWorkingDays);
// employeeDetailsForInsuranceObj.HousingAllowance = yearlysaleries.HousingAllowance;
// employeeDetailsForInsuranceObj.ConsumableItems = yearlysaleries.ConsumableItems;
// employeeDetailsForInsuranceObj.EndMonthCurrentDay = endMonthCurrentDay;
// employeeDetailsForInsuranceObj.YearlySalaryItem = yearlysaleries.DayliWage;
// employeeDetailsForInsuranceObj.MonthlyBaseYearsStr = monthlybaseYear.ToMoney();
// employeeDetailsForInsuranceObj.MarriedAllowance = 0;
// if (item.IncludeStatus)
// {
// var marital = employeeObject.MaritalStatus == "متاهل" ? yearlysaleries.MarriedAllowance : 0;
// employeeDetailsForInsuranceObj.MonthlyBenefits = GetMonthlyBenefits(endMonthCurrentDay, yearlysaleries.ConsumableItems, yearlysaleries.HousingAllowance, marital, countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, item.JobId, item.EmployeeId);
// }
// else
// {
// employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
// }
// if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId == 10) //کمک دولت
// {
// employeeDetailsForInsuranceObj.MonthlyBenefits = 0;
// }
// //farokhiChanges
// if (item.EmployeeId == 42783)
// employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
// employeeDetailsForInsuranceObj.BenefitsIncludedContinuous = employeeDetailsForInsuranceObj.MonthlyBenefits + employeeDetailsForInsuranceObj.MonthlySalary;
// //حق بیمه سهم بیمه شده
// var insuranceShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 7) / 100;
// employeeDetailsForInsuranceObj.InsuranceShare = GetRoundValue(insuranceShare); //Math.Round(insuranceShare, MidpointRounding.ToPositiveInfinity);
// //حق بیمه سهم کارفرما
// var employerShare = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 20) / 100;
// employeeDetailsForInsuranceObj.EmployerShare = GetRoundValue(employerShare); //Math.Round(employerShare, MidpointRounding.ToPositiveInfinity);
// //if (searchModel.TypeOfInsuranceSendWorkshop == "Govermentlist" && item.JobId==10)//کمک دولت
// //{employeeDetailsForInsuranceObj.InsuranceShare = 0;}
// var unEmploymentInsurance = (employeeDetailsForInsuranceObj.BenefitsIncludedContinuous * 3) / 100;
// employeeDetailsForInsuranceObj.UnEmploymentInsurance = GetRoundValue(unEmploymentInsurance);
// employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous;
// employeeDetailsForInsuranceObj.IncludedAndNotIncluded = employeeDetailsForInsuranceObj.BenefitsIncludedNonContinuous + employeeDetailsForInsuranceObj.BenefitsIncludedContinuous;
// }
// employeeDetailsForInsuranceObj.StartMonthCurrent = startMonthCurrent;
// employeeDetailsForInsuranceObj.WorkingDays = countWorkingDays;
// employeeDetailsForInsuranceObj.StartWorkDate = item.StartWorkDate;
// employeeDetailsForInsuranceObj.LeftWorkDate = item.LeftWorkDate;
// employeeDetailsForInsuranceObj.JobId = item.JobId;
// employeeDetailsForInsuranceObj.JobName = item.JobName;
// employeeDetailsForInsuranceObj.JobCode = item.JobCode;
// if (!string.IsNullOrWhiteSpace(item.LeftWorkDate))
// employeeDetailsForInsuranceObj.LeftWorkDateGr = item.LeftWorkDateGr;
// employeeDetailsForInsuranceObj.StartWorkDateGr = item.StartWorkDateGr;
// //farokhiChanges
// if (item.EmployeeId == 42783)
// employeeDetailsForInsuranceObj.MonthlyBenefits = 53082855;
// list.Add(employeeDetailsForInsuranceObj);
//}
//result.EmployeeDetailsForInsuranceList = list.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
// .ThenBy(x => x.LName).ToList();
#endregion
result.EmployeeDetailsForInsuranceList = computeResult.OrderByDescending(x => x.HasLeftWorkInMonth).ThenByDescending(x => x.HasStartWorkInMonth)
.ThenBy(x => x.LName).ToList();
result.EmployeeDetailsForInsuranceList = list;
Console.WriteLine("ToList compute : " + watch.Elapsed);
result.IsExist = false;
result.IsBlock = isBolock == "true"?true:false;
result.MaritalStatus = maritalStatus.ItemValue;
result.IsBlock = isBolock;
result.MaritalStatus = yearlysaleries.MarriedAllowance;
}
else
{
result.IsExist = true;
result.IsBlock = isBolock == "true" ? true : false;
result.IsBlock = isBolock;
}
return result;
}
@@ -1031,7 +1203,7 @@ public class InsuranceListApplication: IInsuranceListApplication
.Where(x => x.ItemName == "حق تاهل").FirstOrDefault();
item.HousingAllowance = housingAllowance.ItemValue;
item.ConsumableItems = consumableItems.ItemValue;
item.MaritalStatus = maritalStatus.ItemValue;
item.MarriedAllowance = maritalStatus.ItemValue;
item.YearlySalaryItem = yearlysalaryItem.ItemValue;
}
@@ -1132,7 +1304,7 @@ public class InsuranceListApplication: IInsuranceListApplication
if (item.IncludeStatus)
{
var marital = employeeObject.MaritalStatus == "متاهل" ? maritalStatus.ItemValue : 0;
item.MonthlyBenefits = GetMonthlyBenefits(dayMonthCurrent, consumableItems.ItemValue, housingAllowance.ItemValue, marital, countWorkingDays);
item.MonthlyBenefits = GetMonthlyBenefits(dayMonthCurrent, consumableItems.ItemValue, housingAllowance.ItemValue, marital, countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, item.JobId, item.EmployeeId);
}
else
{
@@ -1286,8 +1458,27 @@ public class InsuranceListApplication: IInsuranceListApplication
return result;
}
private double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue,double maritalStatus, int countWorkingDays)
/// <summary>
/// محاسبه مزایای ماهانه
/// </summary>
/// <param name="endMonthCurrentDay"></param>
/// <param name="consumableItemsItemValue"></param>
/// <param name="housingAllowanceItemValue"></param>
/// <param name="maritalStatus"></param>
/// <param name="countWorkingDays"></param>
/// <param name="typeOfInsuranceSendWorkshop"></param>
/// <param name="jobId"></param>
/// <param name="employeeId"></param>
/// <returns></returns>
private double GetMonthlyBenefits(int endMonthCurrentDay, double consumableItemsItemValue, double housingAllowanceItemValue,double maritalStatus, int countWorkingDays, string typeOfInsuranceSendWorkshop, long jobId,long employeeId)
{
//اگر پرسنل کارفرما بود و نوع لیست کارگاه کمک دولت بود مزایا محاسبه نشود
if (typeOfInsuranceSendWorkshop == "Govermentlist" && jobId == 10)
return 0;
//پرسنل استثناء
if (employeeId == 42783)
return 53082855;
//مزایای ماهانه با توجه به پایان ماه که 30 یا 31 روزه است، متفاوت می باشد
//برای ماه 29 روزه هم تقسیم بر 30 می شود.
if (countWorkingDays == endMonthCurrentDay)
@@ -1315,6 +1506,8 @@ public class InsuranceListApplication: IInsuranceListApplication
dailyWage=employeeInsurancListData.DailyWage;
}
}
dailyWage = employeeId == 6536 ? 9399512 : dailyWage;
return dailyWage;
}
public MainEmployeeDetailsViewModel GetEmployeeForInsuranceList(List<LeftWorkInsuranceViewModel> leftWorkInsuranceViewModelList, EmployeeForEditInsuranceListSearchModel searchModel)
@@ -1545,7 +1738,7 @@ public class InsuranceListApplication: IInsuranceListApplication
if (item.IncludeStatus)
{
var marital = employeeObject.MaritalStatus == "متاهل" ? maritalStatus.ItemValue : 0;
employeeDetailsForInsuranceObj.MonthlyBenefits = GetMonthlyBenefits(endMonthCurrentDay, consumableItems.ItemValue, housingAllowance.ItemValue, marital, countWorkingDays);
employeeDetailsForInsuranceObj.MonthlyBenefits = GetMonthlyBenefits(endMonthCurrentDay, consumableItems.ItemValue, housingAllowance.ItemValue, marital, countWorkingDays, searchModel.TypeOfInsuranceSendWorkshop, item.JobId, item.EmployeeId);
}
else
{

View File

@@ -447,30 +447,17 @@ public class LeftWorkInsuranceApplication : ILeftWorkInsuranceApplication
public List<LeftWorkInsuranceViewModel> SearchForCreateInsuranceList(
EmployeeForCreateInsuranceListSearchModel searchModel)
{
var resultList = new List<LeftWorkInsuranceViewModel>();
string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
var resultList = new List<LeftWorkInsuranceViewModel>();
var leftWorkInsuranceList = _leftWorkInsuranceRepository.SearchForCreateInsuranceList(searchModel);
//foreach (var item in leftWorkInsuranceList)
//{
// item.StartWorkDate = item.StartWorkDateGr.ToFarsi();
// if (item.LeftWorkDateGr != null)
// {
// item.LeftWorkDate = item.LeftWorkDateGr.ToFarsi();
// item.EndWorkDate = GetBeforeDate(item.LeftWorkDate);
// item.IsActiveWorkshop = false;
// }
// else
// {
// item.IsActiveWorkshop = true;
// }
//}
//انتخاب ماه و سال برای ثبت بیمه اجباری است
if (!string.IsNullOrWhiteSpace(searchModel.Year) && !string.IsNullOrWhiteSpace(searchModel.Month))
{
string yearAndMonth = searchModel.Year + "/" + searchModel.Month;
string startMonthCurrent = searchModel.Year + "/" + searchModel.Month + "/01";
// string endMonthCurrent = searchModel.Year + "/" + searchModel.Month + startMonthCurrent.FindeEndOfMonth();
var year = Convert.ToInt32(searchModel.Year);
@@ -619,4 +606,15 @@ public class LeftWorkInsuranceApplication : ILeftWorkInsuranceApplication
return _leftWorkInsuranceRepository.CheckBeforeSaveLeftWorkInsurance(workshopId, employeeId, date.ToGeorgianDateTime(), type);
}
#region Insurance
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceLeftWorksAndInformation(long workshopId, DateTime startDate, DateTime endDate)
{
return _leftWorkInsuranceRepository.GetEmployeeInsuranceLeftWorksAndInformation(workshopId, startDate, endDate);
}
#endregion
}

View File

@@ -491,7 +491,16 @@ public class PersonalContractingPartyApplication : IPersonalContractingPartyApp
return opration.Succcedded();
}
#endregion
#region Insurance
public bool IsBlockCheckByWorkshopId(long workshopId)
{
return _personalContractingPartyRepository2.IsBlockCheckByWorkshopId(workshopId);
}
#endregion
}

View File

@@ -16,6 +16,7 @@ using CompanyManagment.App.Contracts.RollCallService;
using CompanyManagment.App.Contracts.Workshop;
using CompanyManagment.App.Contracts.WorkshopPlan;
using CompanyManagment.EFCore.Migrations;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration.UserSecrets;
using Microsoft.Identity.Client;
using Workshop = Company.Domain.WorkshopAgg.Workshop;
@@ -754,10 +755,21 @@ public class WorkshopAppliction : IWorkshopApplication
return _personalContractingPartyRepository.GetAccountByPersonalContractingParty(contractingParty.id);
}
//public List<ConnectedPersonnelViewModel> GetConnectedPersonnelsForMain(long workshopId)
//{
// return _workshopRepository.GetConnectedPersonnelsForMain(workshopId);
//}
#endregion
//public List<ConnectedPersonnelViewModel> GetConnectedPersonnelsForMain(long workshopId)
//{
// return _workshopRepository.GetConnectedPersonnelsForMain(workshopId);
//}
#endregion
#region Insurance
public List<WorkshopViewModel> GetWorkshopSelectListInsuransce()
{
return _workshopRepository.GetWorkshopSelectListInsuransce();
}
#endregion
}

View File

@@ -148,4 +148,19 @@ public class YearlySalaryApplication : IYearlySalaryApplication
{
return _yearlySalaryRepository.HolidayShamsi(shamsiDate);
}
#region Insurance
/// <summary>
/// دریافت مقادیر برای استفاده در بیمه
/// </summary>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
/// <param name="year"></param>
/// <returns></returns>
public InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year)
{
return _yearlySalaryRepository.GetInsuranceItems(startDate, endDate, year);
}
#endregion
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class AddBaseYearsToInsurance : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "SumOfBaseYears",
table: "InsuranceLists",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "SumOfDailyWagePlusBaseYears",
table: "InsuranceLists",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "SumOfMarriedAllowance",
table: "InsuranceLists",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "BaseYears",
table: "EmployeeInsurancListData",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "DailyWagePlusBaseYears",
table: "EmployeeInsurancListData",
type: "float",
nullable: false,
defaultValue: 0.0);
migrationBuilder.AddColumn<double>(
name: "MarriedAllowance",
table: "EmployeeInsurancListData",
type: "float",
nullable: false,
defaultValue: 0.0);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SumOfBaseYears",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "SumOfDailyWagePlusBaseYears",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "SumOfMarriedAllowance",
table: "InsuranceLists");
migrationBuilder.DropColumn(
name: "BaseYears",
table: "EmployeeInsurancListData");
migrationBuilder.DropColumn(
name: "DailyWagePlusBaseYears",
table: "EmployeeInsurancListData");
migrationBuilder.DropColumn(
name: "MarriedAllowance",
table: "EmployeeInsurancListData");
}
}
}

View File

@@ -1651,6 +1651,9 @@ namespace CompanyManagment.EFCore.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("id"));
b.Property<double>("BaseYears")
.HasColumnType("float");
b.Property<double>("BenefitsIncludedContinuous")
.HasColumnType("float");
@@ -1663,6 +1666,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<double>("DailyWage")
.HasColumnType("float");
b.Property<double>("DailyWagePlusBaseYears")
.HasColumnType("float");
b.Property<long>("EmployeeId")
.HasColumnType("bigint");
@@ -1681,6 +1687,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime?>("LeftWorkDate")
.HasColumnType("datetime2(7)");
b.Property<double>("MarriedAllowance")
.HasColumnType("float");
b.Property<double>("MonthlyBenefits")
.HasColumnType("float");
@@ -2932,15 +2941,24 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("StartDate")
.HasColumnType("datetime2");
b.Property<double>("SumOfBaseYears")
.HasColumnType("float");
b.Property<double>("SumOfBenefitsIncluded")
.HasColumnType("float");
b.Property<double>("SumOfDailyWage")
.HasColumnType("float");
b.Property<double>("SumOfDailyWagePlusBaseYears")
.HasColumnType("float");
b.Property<int>("SumOfEmployees")
.HasColumnType("int");
b.Property<double>("SumOfMarriedAllowance")
.HasColumnType("float");
b.Property<double>("SumOfSalaries")
.HasColumnType("float");

View File

@@ -136,29 +136,41 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
{
var emps = _context.WorkshopEmployers.Where(x => x.WorkshopId == workshopId)
.Select(x => x.EmployerId).ToList();
var employerlist = _context.Employers.Where(x => emps.Contains(x.id)).ToList();
var employers = new List<EmprViewModel>();
foreach (var element in employerlist)
{
var employer = new EmprViewModel()
var result = _context.WorkshopEmployers.Where(x => x.WorkshopId == workshopId).Include(x=>x.Employer)
.Select(x=> new EmprViewModel()
{
EmployerFullName = element.FName + " " + element.LName,
Id = element.id,
FName = element.FName,
EmployerLName = element.EmployerLName,
IsLegal = element.IsLegal,
LName = element.LName,
IsBlockContractingParty = _context.PersonalContractingParties.FirstOrDefault(x => x.id == element.ContractingPartyId)?.IsBlock,
};
employers.Add(employer);
}
EmployerFullName = x.Employer.FName + " " + x.Employer.LName,
Id = x.Employer.id,
FName = x.Employer.FName,
EmployerLName = x.Employer.EmployerLName,
IsLegal = x.Employer.IsLegal,
LName = x.Employer.LName,
IsBlockContractingParty = _context.PersonalContractingParties
.Where(p => p.Employers.Any(e => e.id == x.Employer.id))
.Select(p => p.IsBlock)
.FirstOrDefault(),
});
//var employerlist = _context.Employers.Where(x => emps.Contains(x.id)).ToList();
//var employers = new List<EmprViewModel>();
//foreach (var element in employerlist)
//{
// var employer = new EmprViewModel()
// {
// EmployerFullName = element.FName + " " + element.LName,
// Id = element.id,
// FName = element.FName,
// EmployerLName = element.EmployerLName,
// IsLegal = element.IsLegal,
// LName = element.LName,
// IsBlockContractingParty = _context.PersonalContractingParties.FirstOrDefault(x => x.id == element.ContractingPartyId)?.IsBlock,
// };
// employers.Add(employer);
//}
return employers;
return result.ToList();
}
public List<EmployerViewModel> GetEmployerByContracrtingPartyID(long contractingPartyId)
@@ -712,5 +724,50 @@ public class EmployerRepository : RepositoryBase<long, Employer>, IEmployerRepos
IsLegal = x.IsLegal,
}).ToList();
}
#endregion
#endregion
#region Insurance
/// <summary>
/// نام کارفرما
/// وضعیت حقیقی حقوقی
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
public (string employerName, bool isLegal) InsuranceEmployerByWorkshopId(long workshopId)
{
var res = _context.WorkshopEmployers.Where(x => x.WorkshopId == workshopId)
.Include(x => x.Employer).Select(x => new EmprViewModel
{
//EmployerFullName = x.Employer.IsLegal == "حقوقی" ?
// (x.Employer.EmployerLName != "#" ? x.Employer.FName + " " + x.Employer.EmployerLName: x.Employer.LName) : x.Employer.FullName,
FName = x.Employer.FName,
LName = x.Employer.LName,
EmployerLName = x.Employer.EmployerLName,
EmployerFullName = x.Employer.FullName,
IsLegal = x.Employer.IsLegal,
});
string employer = "";
bool isLegal = res.Any(x=>x.IsLegal == "حقوقی");
//اگر حقوقی بود نام همان کارفرما کافیست
if (isLegal)
{
var legalEmloyer = res.FirstOrDefault(x => x.IsLegal == "حقوقی");
employer = legalEmloyer.EmployerLName != "#" ? legalEmloyer.FName + " " + legalEmloyer.EmployerLName : legalEmloyer.LName;
return (employer,true);
}
//در غیر این صورت رشته ای از نام کارفرماها ساخته می شود
foreach (var item in res)
employer += (item.EmployerFullName + ",");
employer = employer.Substring(0, employer.Length - 1);
return (employer,false);
}
#endregion
}

View File

@@ -1,18 +1,23 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using _0_Framework.Application;
using _0_Framework.InfraStructure;
using Company.Domain.EmployeeChildrenAgg;
using Company.Domain.EmployeeInsurancListDataAgg;
using Company.Domain.InsuranceListAgg;
using Company.Domain.InsuranceWorkshopAgg;
using Company.Domain.InsuranceYearlySalaryAgg;
using Company.Domain.InsurancWorkshopInfoAgg;
using CompanyManagment.App.Contracts.EmployeeInsurancListData;
using CompanyManagment.App.Contracts.InsuranceList;
using CompanyManagment.App.Contracts.InsuranceWorkshopInfo;
using CompanyManagment.App.Contracts.PersonalContractingParty;
using Microsoft.EntityFrameworkCore;
using Microsoft.Identity.Client;
using PersianTools.Core;
namespace CompanyManagment.EFCore.Repository;
@@ -25,7 +30,8 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
private readonly IInsuranceWorkshopInfoRepository _insuranceWorkshopInfoRepository;
private readonly IAuthHelper _authHelper;
private readonly IPersonalContractingPartyApp _contractingPartyApp;
public InsuranceListRepository(CompanyContext context, IEmployeeInsurancListDataRepository employeeInsurancListDataRepository, IInsuranceListWorkshopRepository insuranceListWorkshopRepository , IInsuranceWorkshopInfoRepository insuranceWorkshopInfoRepository, IAuthHelper authHelper, IPersonalContractingPartyApp contractingPartyApp) : base(context)
private readonly IInsuranceYearlySalaryRepository _insuranceYearlySalaryRepository;
public InsuranceListRepository(CompanyContext context, IEmployeeInsurancListDataRepository employeeInsurancListDataRepository, IInsuranceListWorkshopRepository insuranceListWorkshopRepository , IInsuranceWorkshopInfoRepository insuranceWorkshopInfoRepository, IAuthHelper authHelper, IPersonalContractingPartyApp contractingPartyApp, IInsuranceYearlySalaryRepository insuranceYearlySalaryRepository) : base(context)
{
_context = context;
_employeeInsurancListDataRepository = employeeInsurancListDataRepository;
@@ -33,6 +39,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
_insuranceWorkshopInfoRepository = insuranceWorkshopInfoRepository;
_authHelper = authHelper;
_contractingPartyApp = contractingPartyApp;
_insuranceYearlySalaryRepository = insuranceYearlySalaryRepository;
}
public OperationResult CreateInsuranceListworkshop(long id, List<long> workshopIds)
{
@@ -60,7 +67,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
//}
return operation;
}
/// <summary>
/// ذخیره اطلاعات کارگاه برای مشاهده در بیمه
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public OperationResult CreateInsuranceListworkshopInfo(CreateInsuranceWorkshopInfo command)
{
var operation = new OperationResult();
@@ -92,7 +103,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
{
var insuranceListObj = Get(command.Id);
insuranceListObj.Edit(command.SumOfEmployees,command.SumOfWorkingDays,command.SumOfSalaries,command.SumOfBenefitsIncluded,command.Included,command.IncludedAndNotIncluded,command.InsuredShare,
command.EmployerShare,command.UnEmploymentInsurance,command.DifficultJobsInsuranc,command.StartDate,command.SumOfDailyWage, command.ConfirmSentlist);
command.EmployerShare,command.UnEmploymentInsurance,command.DifficultJobsInsuranc,command.StartDate,command.SumOfDailyWage,command.SumOfBaseYears,command.SumOfMarriedAllowance, command.ConfirmSentlist);
var id = insuranceListObj.id;
if (command.EmployeeInsurancListDataList != null && command.EmployeeInsurancListDataList.Count > 0)
@@ -109,13 +120,14 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
item.BenefitsIncludedContinuous,
item.BenefitsIncludedNonContinuous,
item.InsuranceShare, item.StartWorkDate,
item.LeftWorkDate, item.JobId,item.IncludeStatus);
item.LeftWorkDate, item.JobId,item.IncludeStatus,item.BaseYears,item.MarriedAllowance);
_employeeInsurancListDataRepository.Create(employeeInsurancListData);
}
else
{
var employeeInsurancListDataObj = _employeeInsurancListDataRepository.Get(item.EmployeeInsurancListDataId);
employeeInsurancListDataObj.Edit(item.WorkingDays,item.DailyWage,item.MonthlySalary,item.MonthlyBenefits,item .MonthlyBenefitsIncluded,item.BenefitsIncludedContinuous,item.BenefitsIncludedNonContinuous,item.InsuranceShare,item.StartWorkDate,item.LeftWorkDate,item.JobId,item.IncludeStatus);
employeeInsurancListDataObj.Edit(item.WorkingDays,item.DailyWage,item.MonthlySalary,item.MonthlyBenefits,item .MonthlyBenefitsIncluded,item.BenefitsIncludedContinuous,
item.BenefitsIncludedNonContinuous,item.InsuranceShare,item.StartWorkDate,item.LeftWorkDate,item.JobId,item.IncludeStatus,item.BaseYears,item.MarriedAllowance);
}
}
_employeeInsurancListDataRepository.SaveChanges();
@@ -307,8 +319,141 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
return editInsuranceList;
}
public List<InsuranceListViewModel> OptimizedSearch(InsuranceListSearchModel searchModel)
{
var acountId = _authHelper.CurrentAccountId();
var workshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId).Select(x => x.WorkshopId);
#region sample
//var query = _context.InsuranceListSet
// .Where(x => workshopIds.Contains(x.WorkshopId))
// .Join(_context.Workshops.Include(x => x.InsuranceWorkshopInfo),
// insurance => insurance.WorkshopId,
// workshop => workshop.id,
// (insurance, workshop) => new { insurance, workshop })
// .Join(_context.WorkshopEmployers,
// result => result.workshop.id,
// employer => employer.WorkshopId,
// (result, employer) => new InsuranceListViewModel
// {
// Id = result.insurance.id,
// Year = result.insurance.Year,
// MonthNumber = result.insurance.Month,
// Month = result.insurance.Month.GetMonthByNumber(),
// WorkShopId = result.insurance.WorkshopId,
// WorkShopCode = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.InsuranceCode : result.workshop.InsuranceCode,
// WorkShopName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.WorkshopName : result.workshop.WorkshopFullName,
// TypeOfInsuranceSend = result.workshop.TypeOfInsuranceSend == "NormalList" ? "عادی" :
// result.workshop.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
// result.workshop.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
// FixedSalary = result.workshop.FixedSalary,
// StrFixedSalary = result.workshop.FixedSalary ? "دارد" : "ندارد",
// EmployerName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.EmployerName : result.workshop.WorkshopFullName,
// Branch = "",
// City = "",
// ConfirmSentlist = result.insurance.ConfirmSentlist,
// IsBlockCantracingParty = "",
// EmployerId = employer.EmployerId,
// });
#endregion
var query = _context.InsuranceListSet
.Where(x => workshopIds.Contains(x.WorkshopId))
.Join(_context.Workshops.Include(x => x.InsuranceWorkshopInfo),
insurance => insurance.WorkshopId,
workshop => workshop.id,
(insurance, workshop) => new { insurance, workshop })
.Join(_context.WorkshopEmployers,
result => result.workshop.id,
employer => employer.WorkshopId,
(result, employer) => new { result.insurance, result.workshop, employer })
.Select(result => new InsuranceListViewModel
{
Id = result.insurance.id,
Year = result.insurance.Year,
Month = result.insurance.Month,
MonthNumber = result.insurance.Month,
WorkShopId = result.insurance.WorkshopId,
WorkShopCode = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.InsuranceCode : result.workshop.InsuranceCode,
WorkShopName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.WorkshopName : result.workshop.WorkshopFullName,
TypeOfInsuranceSend = result.workshop.TypeOfInsuranceSend == "NormalList" ? "عادی" :
result.workshop.TypeOfInsuranceSend == "Govermentlist" ? "کمک دولت" :
result.workshop.TypeOfInsuranceSend == "Familylist" ? "خانوادگی" : "",
FixedSalary = result.workshop.FixedSalary,
StrFixedSalary = result.workshop.FixedSalary ? "دارد" : "ندارد",
EmployerName = result.workshop.InsuranceWorkshopInfo != null ? result.workshop.InsuranceWorkshopInfo.EmployerName : result.workshop.WorkshopFullName,
Branch = "",
City = "",
ConfirmSentlist = result.insurance.ConfirmSentlist,
IsBlockCantracingParty = _context.PersonalContractingParties
.Where(p => p.Employers.Any(e => e.id == result.employer.EmployerId))
.Select(p => p.IsBlock)
.FirstOrDefault(),
EmployerId = result.employer.EmployerId
});
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0" && !string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
query = query.Where(x => x.Year == searchModel.Year && x.Month == searchModel.Month).OrderByDescending(x => x.Id);
else
{
if (!string.IsNullOrEmpty(searchModel.Month) && searchModel.Month != "0")
query = query.Where(x => x.Month == searchModel.Month).OrderByDescending(x => x.WorkShopName).ThenByDescending(x => x.EmployerName).ThenByDescending(x => x.Year);
if (!string.IsNullOrEmpty(searchModel.Year) && searchModel.Year != "0")
query = query.Where(x => x.Year == searchModel.Year).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.WorkShopName).ThenByDescending(x => x.Month);
}
if (!string.IsNullOrEmpty(searchModel.WorkShopCode))
query = query.Where(x => x.WorkShopCode == searchModel.WorkShopCode).OrderByDescending(x => x.Year).OrderByDescending(x => x.Month).ThenByDescending(x => x.EmployerName);
if (!string.IsNullOrEmpty(searchModel.WorkShopName))
query = query.Where(x => x.WorkShopName.Contains(searchModel.WorkShopName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
if (searchModel.WorkshopId > 0)
{
var workshopName = query.FirstOrDefault(u => u.WorkShopId == searchModel.WorkshopId)?.WorkShopName;
query = query.Where(x => x.WorkShopName.Contains(workshopName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
}
if (searchModel.EmployerId > 0)
{
var employerName = query.FirstOrDefault(u => u.EmployerId == searchModel.EmployerId)?.EmployerName;
query = query.Where(x => x.EmployerName.Contains(employerName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
}
if (!string.IsNullOrEmpty(searchModel.EmployerName))
query = query.Where(x => x.EmployerName.Contains(searchModel.EmployerName)).OrderByDescending(x => x.EmployerName).ThenByDescending(x => x.Year).OrderByDescending(x => x.Month);
if (searchModel.FixedSalary != null)
query = query.Where(x => x.FixedSalary == searchModel.FixedSalary);
if (!string.IsNullOrEmpty(searchModel.TypeOfInsuranceSend) && searchModel.TypeOfInsuranceSend != "0")
query = query.Where(x => x.TypeOfInsuranceSend == searchModel.TypeOfInsuranceSend);
if (!string.IsNullOrEmpty(searchModel.City) && searchModel.City != "0")
query = query.Where(x => x.City == searchModel.City);
if (!string.IsNullOrEmpty(searchModel.Branch))
query = query.Where(x => x.Branch.Contains(searchModel.Branch));
//var testquery = query.Where(x => x.Year == searchModel.Year).AsEnumerable();
return query.ToList();
}
public List<InsuranceListViewModel> Search(InsuranceListSearchModel searchModel)
{
var cornometr = new Stopwatch();
cornometr.Start();
var acountID = _authHelper.CurrentAccountId();
var workshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountID).Select(x => x.WorkshopId).ToList();
List<InsuranceListViewModel> list = new List<InsuranceListViewModel>();
@@ -411,7 +556,8 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
if (!string.IsNullOrEmpty(searchModel.Branch))
list = list.Where(x => x.Branch.Contains(searchModel.Branch)).ToList();
Console.WriteLine("Old Search Time : " + cornometr.Elapsed);
cornometr.Stop();
return list; //.OrderByDescending(x => x.Id).ToList();
}
@@ -452,7 +598,11 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
return result;
}
/// <summary>
/// ایجاد لیست بیمه
/// </summary>
/// <param name="command"></param>
/// <returns></returns>
public OperationResult CreateInsuranceList(CreateInsuranceList command)
{
OperationResult result = new OperationResult();
@@ -467,7 +617,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
command.InsuredShare,
command.EmployerShare, command.UnEmploymentInsurance, command.DifficultJobsInsuranc,
command.StartDate,
command.EndDate, command.SumOfDailyWage);
command.EndDate, command.SumOfDailyWage,command.SumOfBaseYears,command.SumOfMarriedAllowance);
Create(insuranceListObj);
SaveChanges();
var id = insuranceListObj.id;
@@ -483,7 +633,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
item.BenefitsIncludedContinuous,
item.BenefitsIncludedNonContinuous,
item.InsuranceShare, item.StartWorkDate,
item.LeftWorkDate, item.JobId,item.IncludeStatus);
item.LeftWorkDate, item.JobId,item.IncludeStatus,item.BaseYears,item.MarriedAllowance);
_employeeInsurancListDataRepository.Create(employeeInsurancListData);
}_employeeInsurancListDataRepository.SaveChanges();
@@ -523,7 +673,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
}
return result;
}
//ویرایش
public EditInsuranceList GetDetailsForEdit(long id)
{
var editInsuranceList = new EditInsuranceList();
@@ -838,7 +988,7 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
{
var insuranceListObj = Get(id);
insuranceListObj.Edit(insuranceListObj.SumOfEmployees, insuranceListObj.SumOfWorkingDays, insuranceListObj.SumOfSalaries, insuranceListObj.SumOfBenefitsIncluded, insuranceListObj.Included, insuranceListObj.IncludedAndNotIncluded, insuranceListObj.InsuredShare,
insuranceListObj.EmployerShare, insuranceListObj.UnEmploymentInsurance, insuranceListObj.DifficultJobsInsuranc, insuranceListObj.StartDate, insuranceListObj.SumOfDailyWage,true);
insuranceListObj.EmployerShare, insuranceListObj.UnEmploymentInsurance, insuranceListObj.DifficultJobsInsuranc, insuranceListObj.StartDate, insuranceListObj.SumOfDailyWage,insuranceListObj.SumOfBaseYears,insuranceListObj.SumOfMarriedAllowance,true);
SaveChanges();
@@ -1032,4 +1182,54 @@ public class InsuranceListRepository : RepositoryBase<long, InsuranceList>, IIns
#endregion
public (int insuranceHistoryYearsCount, double baseYear) GetEmployeeInsuranceBaseYear(long employeeId, long workshopId, int countWorkingDay,DateTime listStartDate, DateTime listEndDate, DateTime startWorkDate, DateTime leftDate, bool hasLeft)
{
var lefts = _context.LeftWorkInsuranceList
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x=> new
{
startWork = x.StartWorkDate,
leftWork = x.LeftWorkDate == null ? listEndDate : x.LeftWorkDate.Value,
}).OrderBy(x=>x.startWork).ToList();
int countDay = 0;
foreach (var left in lefts)
{
var start = left.startWork.ToPersianDateTime();
var end = left.leftWork.ToPersianDateTime();
var count = (int)(end - start).TotalDays +1;
countDay += count;
}
if (countDay < 365)
return (0, 0);
//تعداد سال های سابقه بیمه
int yearsCount = countDay / 365;
//بدست آوردن مزد سنوات بر اساس سابقه به سال
var baseYear = _insuranceYearlySalaryRepository.GetBaseYearByDate(listStartDate, yearsCount);
if(baseYear == 0)
return (0, 0);
//اگر ترک کار کرده بود
//یا
//شروع به کارش بعد از یکم ماه بود
if (hasLeft || listStartDate < startWorkDate)
{
//تعداد روزهای ماه در این لیست بیمه
var monthDayCont = (int)(listEndDate - listStartDate).TotalDays + 1;
//پایه سنوات به ازای هر روز
var baseyarPerDay = baseYear / monthDayCont;
// پایه سنوات یک روز ضرب در روزهای کارکرد در ماه
baseYear = baseyarPerDay * countWorkingDay;
}
return (yearsCount, baseYear);
}
}

View File

@@ -10,6 +10,7 @@ using Company.Domain.PersonnelCodeAgg;
using CompanyManagment.App.Contracts.InsuranceList;
using CompanyManagment.App.Contracts.LeftWorkInsurance;
using CompanyManagment.App.Contracts.PersonnleCode;
using Microsoft.EntityFrameworkCore;
namespace CompanyManagment.EFCore.Repository;
@@ -691,4 +692,67 @@ public class LeftWorkInsuranceRepository : RepositoryBase<long, LeftWorkInsuranc
}
}
#region Insurance
public List<EmployeeDetailsForInsuranceListViewModel> GetEmployeeInsuranceLeftWorksAndInformation(long workshopId, DateTime startDate, DateTime endDate)
{
if (workshopId == 0)
return [];
var query = _context.LeftWorkInsuranceList.Include(x => x.Employee)
.Where(x => x.WorkshopId == workshopId)
.Where(x =>
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
((DateTime)x.LeftWorkDate >= startDate &&
(DateTime)x.LeftWorkDate <= endDate)) ||
((x.LeftWorkDate != null && x.LeftWorkDate != DateTime.MinValue) &&
(DateTime)x.LeftWorkDate >= endDate) ||
(x.LeftWorkDate == null || x.LeftWorkDate == DateTime.MinValue))
.Where(x => x.StartWorkDate <= endDate)
.Join(_context.Jobs,
left => left.JobId,
job => job.id,
(left, job) => new { left, job })
.GroupJoin(_context.InsuranceEmployeeInformationSet.AsSplitQuery(),
result => result.left.EmployeeId,
employeeInfo => employeeInfo.EmployeeId,
(result, employeeInfo) => new
{
result.left,
result.job,
employeeInfo
})
.SelectMany(x => x.employeeInfo.DefaultIfEmpty(), (x, employeeInfo) => new { x, employeeInfo })
.Select(result => new EmployeeDetailsForInsuranceListViewModel
{
StartWorkDateGr = result.x.left.StartWorkDate,
LeftWorkDateGr = result.x.left.LeftWorkDate,
IncludeStatus = result.x.left.IncludeStatus,
JobId = result.x.left.JobId,
JobName = result.x.job != null ? result.x.job.JobName : string.Empty,
JobCode = result.x.job != null ? result.x.job.JobCode : string.Empty,
InsuranceEmployeeInformationId = result.employeeInfo != null ? result.employeeInfo.id : 0,
EmployeeId = result.x.left.EmployeeId,
//اطلاعات هویتی
FName = result.employeeInfo != null ? result.employeeInfo.FName : result.x.left.Employee.FName,
LName = result.employeeInfo != null ? result.employeeInfo.LName : result.x.left.Employee.LName,
FatherName = result.employeeInfo != null ? result.employeeInfo.FatherName : result.x.left.Employee.FatherName,
DateOfBirthGr = result.employeeInfo != null ? result.employeeInfo.DateOfBirth : result.x.left.Employee.DateOfBirth,
DateOfIssueGr = result.employeeInfo != null ? result.employeeInfo.DateOfIssue : result.x.left.Employee.DateOfIssue,
PlaceOfIssue = result.employeeInfo != null ? result.employeeInfo.PlaceOfIssue : result.x.left.Employee.PlaceOfIssue,
IdNumber = result.employeeInfo != null ? result.employeeInfo.IdNumber : result.x.left.Employee.IdNumber,
Gender = result.employeeInfo != null ? result.employeeInfo.Gender : result.x.left.Employee.Gender,
NationalCode = result.x.left.Employee.NationalCode,
Nationality = result.x.left.Employee.Nationality,
InsuranceCode = result.x.left.Employee.InsuranceCode,
MaritalStatus = result.x.left.Employee.MaritalStatus,
IsMaritalStatusSet = !string.IsNullOrWhiteSpace(result.x.left.Employee.MaritalStatus)
}).ToList();
return query;
}
#endregion
}

View File

@@ -445,6 +445,18 @@ public class PersonalContractingPartyRepository : RepositoryBase<long, PersonalC
return $"NotFound";
}
#region Insurance
public bool IsBlockCheckByWorkshopId(long workshopId)
{
var e = _context.WorkshopEmployers
.Where(x => x.WorkshopId == workshopId)
.Include(x => x.Employer)
.ThenInclude(x => x.ContractingParty)
.Select(c => c.Employer.ContractingParty);
return e.Any(x => x.IsBlock == "true");
}
#endregion
#region ForClients
public ContractingPartyAndStatmentIdViewModel GetContractingpartyIdByAccountId(long accountId)

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using _0_Framework.Application;
@@ -106,17 +107,14 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
}
public List<WorkshopViewModel> GetWorkshopAccount()
{
var AcountID = _authHelper.CurrentAccountId();
//var workshopAcounts = _context.WorkshopAccounts.Where(x => x.AccountId == AcountID)
// .Select(x => x.WorkshopId).ToList();
var workshopAcountsList = _context.WorkshopAccounts.Where(x => x.AccountId == AcountID);
//var res = (e => contractData.Contains(e.Id))
var workshopAcounts = workshopAcountsList.Select(x => x.WorkshopId).ToList();
var cornometr = new Stopwatch();
cornometr.Start();
var acountId = _authHelper.CurrentAccountId();
var workshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId).Select(x => x.WorkshopId);
var work = _context.Workshops
.Include(x => x.WorkshopEmployers).ThenInclude(x=>x.Employer).ToList();
var result =work
var result = _context.Workshops.Where(x => workshopIds.Contains(x.id) && x.IsActiveString == "true")
.Include(x => x.WorkshopEmployers).ThenInclude(x=>x.Employer)
.Select(x => new WorkshopViewModel
{
Id = x.id,
@@ -146,8 +144,12 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
HasRollCallFreeVip = x.HasRollCallFreeVip,
EmpList = x.WorkshopEmployers.Select(y => new EmployerViewModel() { Id = y.EmployerId, FullName = y.Employer.FullName }).ToList()
}).Where(e => workshopAcounts.Contains(e.Id)).ToList();
return result.Where(x => x.IsActiveString == "true").ToList();
});
Console.WriteLine("old list Time : " + cornometr.Elapsed);
cornometr.Stop();
return result.ToList();
}
public EditWorkshop GetDetails(long id)
@@ -1066,6 +1068,7 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
}
#endregion
#region NewByHeydari
//public List<WorkshopViewModel> GetWorkshopByWorkshopIds(List<long> workshopIds)
@@ -1513,4 +1516,30 @@ public class WorkshopRepository : RepositoryBase<long, Company.Domain.WorkshopAg
}
#endregion
#region Insurance
public List<WorkshopViewModel> GetWorkshopSelectListInsuransce()
{
var cornometr = new Stopwatch();
cornometr.Start();
var acountId = _authHelper.CurrentAccountId();
var workshopIds = _context.WorkshopAccounts.Where(x => x.AccountId == acountId).Select(x => x.WorkshopId);
var res = _context.Workshops
.Where(x=> workshopIds.Contains(x.id) && !string.IsNullOrWhiteSpace(x.TypeOfInsuranceSend) && x.TypeOfInsuranceSend != "false" && x.IsActiveString == "true")
.Select(x=> new WorkshopViewModel()
{
Id = x.id,
WorkshopFullName = x.WorkshopFullName,
});
Console.WriteLine("Optimized list Time : " + cornometr.Elapsed);
cornometr.Stop();
return res.ToList();
}
#endregion
}

View File

@@ -3472,5 +3472,27 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
#endregion
#region Insurance
public InsuranceYearlySalaryModel GetInsuranceItems(DateTime startDate, DateTime endDate, string year)
{
var query = _context.YearlySalaries
.Where(x => x.StartDate <= startDate && x.EndDate >= endDate && x.Year == year)
.Include(x => x.YearlySalaryItemsList)
.Select(x=> new InsuranceYearlySalaryModel
{
DayliWage = x.YearlySalaryItemsList.FirstOrDefault(item=>item.ItemName == "مزد روزانه").ItemValue,
ConsumableItems = x.YearlySalaryItemsList.FirstOrDefault(item => item.ItemName == "کمک هزینه اقلام").ItemValue,
HousingAllowance = x.YearlySalaryItemsList.FirstOrDefault(item => item.ItemName == "کمک هزینه مسکن").ItemValue,
MarriedAllowance = x.YearlySalaryItemsList.Any(item => item.ItemName == "حق تاهل")? x.YearlySalaryItemsList.FirstOrDefault(item => item.ItemName == "حق تاهل").ItemValue : 0,
}).FirstOrDefault();
return query;
}
#endregion
}

View File

@@ -1,7 +1,7 @@
@using _0_Framework.Application
@model CompanyManagment.App.Contracts.InsuranceList.MainEmployeeDetailsViewModel
@{
<style>
<style>
.firstCheckAlert {
background-color: #f06b31;
animation: color-change 800ms linear infinite;
@@ -25,198 +25,206 @@
}
}
</style>
}
<input type="hidden" id="maritalStatusErr" name="maritalStatusErr"/>
<input type="hidden" id="maritalStatusVal" value="@Model.MaritalStatus" asp-for="@Model.MaritalStatus"/>
@if (Model.EmployeeDetailsForInsuranceList != null)
{
var index = 1;
var index = 1;
if (Model.EmployeeDetailsForInsuranceList.Any(x => !x.IsMaritalStatusSet))
{
<script>
if (Model.EmployeeDetailsForInsuranceList.Any(x => !x.IsMaritalStatusSet))
{
<script>
$('#maritalStatusErr').val(true);
</script>
<table id="DSKWOR" class="table table-bordered table-striped dataTable" style="min-width: 473px;">
<colgroup>
$('#maritalStatusErr').val(true);
</script>
<table id="DSKWOR" class="table table-bordered table-striped dataTable" style="min-width: 473px;">
<colgroup>
<col class="colgp-4">
<col class="colgp-3">
<col class="colgp-2">
<col class="colgp-1">
</colgroup>
<thead>
<tr>
<th colspan="4">
<col class="colgp-4">
<col class="colgp-3">
<col class="colgp-2">
<col class="colgp-1">
</colgroup>
<thead>
<tr>
<th colspan="4">
<p style="color: red">
ابتدا وضعیت تاهل پرسنل در لیست زیر را مشخص نمایید
</p>
</th>
</tr>
<tr>
<p style="color: red">
ابتدا وضعیت تاهل پرسنل در لیست زیر را مشخص نمایید
</p>
</th>
</tr>
<tr>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> کدملی </th>
<th class="header-styledit-btn sorting_asc_disabled sorting_desc_disabled"> نام خانوادگی </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> نام </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled">#</th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> کدملی </th>
<th class="header-styledit-btn sorting_asc_disabled sorting_desc_disabled"> نام خانوادگی </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> نام </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled">#</th>
</tr>
</tr>
</thead>
</thead>
<tbody>
@foreach (var item in Model.EmployeeDetailsForInsuranceList)
{
if (!item.IsMaritalStatusSet)
{
<tr>
<tbody>
@foreach (var item in Model.EmployeeDetailsForInsuranceList)
{
if (!item.IsMaritalStatusSet)
{
<tr>
<td class="td-ellipsis @(item.Nationality == "ایرانی" ? "emptyTR" : "")">@item.NationalCode</td>
<td class="td-ellipsis emptyTR">@item.LName</td>
<td class="td-ellipsis emptyTR">@item.FName</td>
<td class="td-ellipsis ">@index</td>
</tr>
index++;
}
}
<td class="td-ellipsis @(item.Nationality == "ایرانی" ? "emptyTR" : "")">@item.NationalCode</td>
<td class="td-ellipsis emptyTR">@item.LName</td>
<td class="td-ellipsis emptyTR">@item.FName</td>
<td class="td-ellipsis ">@index</td>
</tr>
index++;
}
}
</tbody>
</table>
}
else
{
<script>
</tbody>
</table>
}
else
{
<script>
$('#maritalStatusErr').val(false);
</script>
}
$('#maritalStatusErr').val(false);
</script>
}
<div class="col-md-6 @(Model.EmployeeDetailsForInsuranceList.Any(x => !x.IsMaritalStatusSet) ? "hideDataTable" : "")" style="float: left; ">
<button id="btnPrint" type="button" class="btn btn-success btn-rounded waves-effect waves-light" style="float: left">پرینت </button>
</div>
<table id="DSKWOR-datatable" class="table table-bordered table-striped dataTable @(Model.EmployeeDetailsForInsuranceList.Any(x => !x.IsMaritalStatusSet) ? "hideDataTable" : "")">
<colgroup>
<col class="colgp-21">
<col class="colgp-20">
<col class="colgp-19">
<col class="colgp-18">
<col class="colgp-17">
<col class="colgp-16">
<col class="colgp-15">
<col class="colgp-14">
<col class="colgp-13">
<col class="colgp-12">
<col class="colgp-11">
<col class="colgp-10">
<col class="colgp-9">
<col class="colgp-8">
<col class="colgp-7">
<col class="colgp-6">
<col class="colgp-5">
<col class="colgp-4">
<col class="colgp-3">
<col class="colgp-2">
<col class="colgp-1">
</colgroup>
<thead>
<tr>
<th class="sorting_asc_disabled sorting_desc_disabled"></th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> تاریخ ترک کار </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled">تاریخ آغاز بکار </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> شغل</th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حق بیمه سهم بیمه شده </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حقوق و مزایای ماهیانه مشمول و غیر مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حقوق و مزایای ماهیانه مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> مزایای ماهیانه مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حقوق ماهیانه مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> دستمزد روزانه </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> روزهای کارکرد </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> ش شناسنامه </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> تاریخ تولد </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> محل صدور </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> کدملی </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> نام پدر </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> جنسیت </th>
<th class="header-styledit-btn sorting_asc_disabled sorting_desc_disabled"> نام خانوادگی </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> نام </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> شماره بیمه </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled">#</th>
</tr>
</thead>
<tbody>
<div class="col-md-6 @(Model.EmployeeDetailsForInsuranceList.Any(x => !x.IsMaritalStatusSet) ? "hideDataTable" : "")" style="float: left; ">
<button id="btnPrint" type="button" class="btn btn-success btn-rounded waves-effect waves-light" style="float: left">پرینت </button>
</div>
<table id="DSKWOR-datatable" class="table table-bordered table-striped dataTable @(Model.EmployeeDetailsForInsuranceList.Any(x => !x.IsMaritalStatusSet) ? "hideDataTable" : "")">
<colgroup>
<col class="colgp-23">
<col class="colgp-22">
<col class="colgp-21">
<col class="colgp-20">
<col class="colgp-19">
<col class="colgp-18">
<col class="colgp-17">
<col class="colgp-16">
<col class="colgp-15">
<col class="colgp-14">
<col class="colgp-13">
<col class="colgp-12">
<col class="colgp-11">
<col class="colgp-10">
<col class="colgp-9">
<col class="colgp-8">
<col class="colgp-7">
<col class="colgp-6">
<col class="colgp-5">
<col class="colgp-4">
<col class="colgp-3">
<col class="colgp-2">
<col class="colgp-1">
</colgroup>
<thead>
<tr>
<th class="sorting_asc_disabled sorting_desc_disabled"></th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> تاریخ ترک کار </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled">تاریخ آغاز بکار </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> شغل</th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حق بیمه سهم بیمه شده </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حقوق و مزایای ماهیانه مشمول و غیر مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حقوق و مزایای ماهیانه مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> مزایای ماهیانه مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حقوق ماهیانه مشمول </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> حق تاهل </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> پایه سنوات روزانه</th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> دستمزد روزانه </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> روزهای کارکرد </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> ش شناسنامه </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> تاریخ تولد </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> محل صدور </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> کدملی </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> نام پدر </th>
<th class="header-style small-font sorting_asc_disabled sorting_desc_disabled"> جنسیت </th>
<th class="header-styledit-btn sorting_asc_disabled sorting_desc_disabled"> نام خانوادگی </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> نام </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled"> شماره بیمه </th>
<th class="header-style sorting_asc_disabled sorting_desc_disabled">#</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.EmployeeDetailsForInsuranceList)
{
if (item.LeftWorkDate == item.StartMonthCurrent)
{
<tr data-hasconfilictjobs="@item.HasConfilictJobs" data-nationality="@item.Nationality" data-yearlySalaryItem="@item.YearlySalaryItem" data-IncludeStatus="@Convert.ToInt32(item.IncludeStatus)" class="leftwork" data-employeeId="@item.EmployeeId" data-insuranceEmployeeInformationId="@item.InsuranceEmployeeInformationId" data-DateOfIssue="@item.DateOfIssue">
<td>
<i onclick="editList(this)" class="fa fa-edit edit-btn"></i>
@* <a permission="10418" onclick="OpenLeftWorkInsurance(@item.EmployeeId,'@(item.FName +" "+item.LName)')" >
@foreach (var item in Model.EmployeeDetailsForInsuranceList)
{
if (item.LeftWorkDate == item.StartMonthCurrent)
{
<tr data-hasconfilictjobs="@item.HasConfilictJobs" data-nationality="@item.Nationality" data-yearlySalaryItem="@item.YearlySalaryItem" data-IncludeStatus="@Convert.ToInt32(item.IncludeStatus)" class="leftwork" data-employeeId="@item.EmployeeId" data-insuranceEmployeeInformationId="@item.InsuranceEmployeeInformationId" data-DateOfIssue="@item.DateOfIssue">
<td>
<i onclick="editList(this)" class="fa fa-edit edit-btn"></i>
@* <a permission="10418" onclick="OpenLeftWorkInsurance(@item.EmployeeId,'@(item.FName +" "+item.LName)')" >
<i class="fa faSize fa-sign-out"></i>
</a>*@
</td>
<td data-LeftWorkDate="@item.LeftWorkDateGr" class="small-font td-ellipsis ">@item.LeftWorkDate</td>
<td data-StartWorkDate="@item.StartWorkDateGr" class="small-font td-ellipsis emptyTR">@item.StartWorkDate</td>
<td data-Id="@item.JobId" data-jobcode="@item.JobCode" class="@(item.HasConfilictJobs && item.JobId != 10 ? "blink" : "") small-font td-ellipsis emptyTR" id="JobName">@item.JobName</td>
<td data-InsuranceShare="0" data-EmployerShare="0" data-UnemploymentInsurance="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-IncludedAndNotIncluded="0" data-BenefitsIncludedNonContinuous="0" class="small-font td-ellipsis emptyTR">0 </td>
<td data-BenefitsIncludedContinuous="0" class="small-font td-ellipsis emptyTR">0 </td>
<td data-MonthlyBenefits="0" class="small-font td-ellipsis emptyTR">0 </td>
<td data-MonthlySalary="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-DailyWage="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-EndMonthCurrentDay="@item.EndMonthCurrentDay" data-OldWorkingDays="0" data-HousingAllowance="@item.HousingAllowance" data-ConsumableItems="@item.ConsumableItems" class="small-font td-ellipsis emptyTR">0</td>
<td class="td-ellipsis emptyTR">@item.IdNumber</td>
<td class="td-ellipsis emptyTR">@item.DateOfBirth</td>
<td class="td-ellipsis emptyTR">@item.PlaceOfIssue</td>
<td class="td-ellipsis @(item.Nationality == "ایرانی" ? "emptyTR" : "")">@item.NationalCode</td>
<td class="td-ellipsis emptyTR">@item.FatherName</td>
<td class="small-font td-ellipsis emptyTR">@item.Gender</td>
<td class="td-ellipsis emptyTR">@item.LName</td>
<td class="td-ellipsis emptyTR">@item.FName</td>
<td class="td-ellipsis emptyTR">@item.InsuranceCode</td>
<td class="td-ellipsis ">@index</td>
</tr>
}
else
{
<tr data-hasconfilictjobs="@item.HasConfilictJobs" data-nationality="@item.Nationality" data-yearlySalaryItem="@item.YearlySalaryItem" data-IncludeStatus="@Convert.ToInt32(item.IncludeStatus)" class="@(item.HasLeftWorkInMonth ? "leftwork" : item.HasStartWorkInMonth ? "startwork" : "")" ondblclick="rowdbClick(this)" data-employeeId="@item.EmployeeId" data-insuranceEmployeeInformationId="@item.InsuranceEmployeeInformationId" data-DateOfIssue="@item.DateOfIssue">
<td>
<i onclick="editList(this)" class="fa fa-edit edit-btn"></i>
@* <a permission="10418" onclick="OpenLeftWorkInsurance(@item.EmployeeId,'@(item.FName +" "+item.LName)')" >
</td>
<td data-LeftWorkDate="@item.LeftWorkDateGr" class="small-font td-ellipsis ">@item.LeftWorkDate</td>
<td data-StartWorkDate="@item.StartWorkDateGr" class="small-font td-ellipsis emptyTR">@item.StartWorkDate</td>
<td data-Id="@item.JobId" data-jobcode="@item.JobCode" class="@(item.HasConfilictJobs && item.JobId != 10 ? "blink" : "") small-font td-ellipsis emptyTR" id="JobName">@item.JobName</td>
<td data-InsuranceShare="0" data-EmployerShare="0" data-UnemploymentInsurance="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-IncludedAndNotIncluded="0" data-BenefitsIncludedNonContinuous="0" class="small-font td-ellipsis emptyTR">0 </td>
<td data-BenefitsIncludedContinuous="0" class="small-font td-ellipsis emptyTR">0 </td>
<td data-MonthlyBenefits="0" class="small-font td-ellipsis emptyTR">0 </td>
<td data-MonthlySalary="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-MarriedAllowance="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-BaseYears="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-DailyWage="0" class="small-font td-ellipsis emptyTR">0</td>
<td data-EndMonthCurrentDay="@item.EndMonthCurrentDay" data-OldWorkingDays="0" data-HousingAllowance="@item.HousingAllowance" data-ConsumableItems="@item.ConsumableItems" class="small-font td-ellipsis emptyTR">0</td>
<td class="td-ellipsis emptyTR">@item.IdNumber</td>
<td class="td-ellipsis emptyTR">@item.DateOfBirth</td>
<td class="td-ellipsis emptyTR">@item.PlaceOfIssue</td>
<td class="td-ellipsis @(item.Nationality == "ایرانی" ? "emptyTR" : "")">@item.NationalCode</td>
<td class="td-ellipsis emptyTR">@item.FatherName</td>
<td class="small-font td-ellipsis emptyTR">@item.Gender</td>
<td class="td-ellipsis emptyTR">@item.LName</td>
<td class="td-ellipsis emptyTR">@item.FName</td>
<td class="td-ellipsis emptyTR">@item.InsuranceCode</td>
<td class="td-ellipsis ">@index</td>
</tr>
}
else
{
<tr data-hasconfilictjobs="@item.HasConfilictJobs" data-nationality="@item.Nationality" data-yearlySalaryItem="@item.YearlySalaryItem" data-IncludeStatus="@Convert.ToInt32(item.IncludeStatus)" class="@(item.HasLeftWorkInMonth ? "leftwork" : item.HasStartWorkInMonth ? "startwork" : "")" ondblclick="rowdbClick(this)" data-employeeId="@item.EmployeeId" data-insuranceEmployeeInformationId="@item.InsuranceEmployeeInformationId" data-DateOfIssue="@item.DateOfIssue">
<td>
<i onclick="editList(this)" class="fa fa-edit edit-btn"></i>
@* <a permission="10418" onclick="OpenLeftWorkInsurance(@item.EmployeeId,'@(item.FName +" "+item.LName)')" >
<i class="fa faSize fa-sign-out"></i>
</a>*@
</td>
<td data-LeftWorkDate="@item.LeftWorkDateGr" class="small-font td-ellipsis ">@item.LeftWorkDate</td>
<td data-StartWorkDate="@item.StartWorkDateGr" class="small-font td-ellipsis emptyTR">@item.StartWorkDate</td>
<td data-Id="@item.JobId" data-jobcode="@item.JobCode" class="@(item.HasConfilictJobs && item.JobId != 10 ? "blink" : "") small-font td-ellipsis emptyTR jobName">@item.JobName</td>
<td data-InsuranceShare="@item.InsuranceShare" data-EmployerShare="@item.EmployerShare" data-UnemploymentInsurance="@item.UnEmploymentInsurance" class="small-font td-ellipsis emptyTR">@item.InsuranceShare.ToMoney()</td>
<td data-IncludedAndNotIncluded="@item.IncludedAndNotIncluded" data-BenefitsIncludedNonContinuous="@item.BenefitsIncludedNonContinuous" class="small-font td-ellipsis emptyTR">@item.IncludedAndNotIncluded.ToMoney() </td>
<td data-BenefitsIncludedContinuous="@item.BenefitsIncludedContinuous" class="small-font td-ellipsis emptyTR">@item.BenefitsIncludedContinuous.ToMoney() </td>
<td data-MonthlyBenefits="@item.MonthlyBenefits" class="small-font td-ellipsis emptyTR">@item.MonthlyBenefits.ToMoney() </td>
<td data-MonthlySalary="@(item.HasConfilictJobs ? 0 : item.MonthlySalary)" class="small-font td-ellipsis emptyTR">@(item.HasConfilictJobs ? "" : item.MonthlySalary.ToMoney())</td>
<td data-DailyWage="@(item.HasConfilictJobs ? 0 : item.DailyWage)" class="small-font td-ellipsis emptyTR">@(item.HasConfilictJobs ? "" : item.DailyWageStr)</td>
<td data-EndMonthCurrentDay="@item.EndMonthCurrentDay" data-OldWorkingDays="@item.WorkingDays" data-HousingAllowance="@item.HousingAllowance" data-ConsumableItems="@item.ConsumableItems" class="small-font td-ellipsis emptyTR">@item.WorkingDays</td>
<td class="td-ellipsis emptyTR">@item.IdNumber</td>
<td class="td-ellipsis emptyTR">@item.DateOfBirth</td>
<td class="td-ellipsis emptyTR">@item.PlaceOfIssue</td>
<td class="td-ellipsis @(item.Nationality == "ایرانی" ? "emptyTR" : "")">@item.NationalCode</td>
<td class="td-ellipsis emptyTR">@item.FatherName</td>
<td class="small-font td-ellipsis emptyTR">@item.Gender</td>
<td class="td-ellipsis emptyTR">@item.LName</td>
<td class="td-ellipsis emptyTR">@item.FName</td>
<td class="td-ellipsis emptyTR">@item.InsuranceCode</td>
<td class="td-ellipsis ">@index</td>
</tr>
}
index = index + 1;
}
</td>
<td data-LeftWorkDate="@item.LeftWorkDateGr" class="small-font td-ellipsis ">@item.LeftWorkDate</td>
<td data-StartWorkDate="@item.StartWorkDateGr" class="small-font td-ellipsis emptyTR">@item.StartWorkDate</td>
<td data-Id="@item.JobId" data-jobcode="@item.JobCode" class="@(item.HasConfilictJobs && item.JobId != 10 ? "blink" : "") small-font td-ellipsis emptyTR jobName">@item.JobName</td>
<td data-InsuranceShare="@item.InsuranceShare" data-EmployerShare="@item.EmployerShare" data-UnemploymentInsurance="@item.UnEmploymentInsurance" class="small-font td-ellipsis emptyTR">@item.InsuranceShare.ToMoney()</td>
<td data-IncludedAndNotIncluded="@item.IncludedAndNotIncluded" data-BenefitsIncludedNonContinuous="@item.BenefitsIncludedNonContinuous" class="small-font td-ellipsis emptyTR">@item.IncludedAndNotIncluded.ToMoney() </td>
<td data-BenefitsIncludedContinuous="@item.BenefitsIncludedContinuous" class="small-font td-ellipsis emptyTR">@item.BenefitsIncludedContinuous.ToMoney() </td>
<td data-MonthlyBenefits="@item.MonthlyBenefits" class="small-font td-ellipsis emptyTR">@item.MonthlyBenefits.ToMoney() </td>
<td data-MonthlySalary="@(item.HasConfilictJobs ? 0 : item.MonthlySalary)" class="small-font td-ellipsis emptyTR">@(item.HasConfilictJobs ? "" : item.MonthlySalary.ToMoney())</td>
<td data-MarriedAllowance="@item.MarriedAllowance" class="small-font td-ellipsis emptyTR">@item.MarriedAllowance.ToMoney()</td>
<td data-BaseYears="@item.BaseYears" class="small-font td-ellipsis emptyTR">@item.BaseYears.ToMoney()</td>
<td data-DailyWage="@(item.HasConfilictJobs ? 0 : item.DailyWage)" class="small-font td-ellipsis emptyTR">@(item.HasConfilictJobs ? "" : item.DailyWageStr)</td>
<td data-EndMonthCurrentDay="@item.EndMonthCurrentDay" data-OldWorkingDays="@item.WorkingDays" data-HousingAllowance="@item.HousingAllowance" data-ConsumableItems="@item.ConsumableItems" class="small-font td-ellipsis emptyTR">@item.WorkingDays</td>
<td class="td-ellipsis emptyTR">@item.IdNumber</td>
<td class="td-ellipsis emptyTR">@item.DateOfBirth</td>
<td class="td-ellipsis emptyTR">@item.PlaceOfIssue</td>
<td class="td-ellipsis @(item.Nationality == "ایرانی" ? "emptyTR" : "")">@item.NationalCode</td>
<td class="td-ellipsis emptyTR">@item.FatherName</td>
<td class="small-font td-ellipsis emptyTR">@item.Gender</td>
<td class="td-ellipsis emptyTR">@item.LName</td>
<td class="td-ellipsis emptyTR">@item.FName</td>
<td class="td-ellipsis emptyTR">@item.InsuranceCode</td>
<td class="td-ellipsis ">@index</td>
</tr>
}
</tbody>
</table>
index = index + 1;
}
</tbody>
</table>
}
@@ -226,14 +234,14 @@
$(document).ready(function(){
$(".ring").remove();
$('#DSKWOR-datatable').dataTable({
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]],
"pageLength": -1, // set the default page length to "All"
"ordering": false
});
$('#DSKWOR-datatable').dataTable({
"lengthMenu": [[25, 10, 50, 100, -1], [25, 10, 50, 100, "All"]],
"pageLength": -1, // set the default page length to "All"
"ordering": false
});
if($('#maritalStatusErr').val() == "true")
{
@@ -268,79 +276,79 @@
});
});
@if (Model != null && Model.IsBlock)
@if (Model != null && Model.IsBlock)
{
<text>
$("#resultExistPersonel").show();
$("#resultExistPersonel").html(' این کارگاه بلاک شده است ');
<text>
$("#resultExistPersonel").show();
$("#resultExistPersonel").html(' این کارگاه بلاک شده است ');
</text>
}
else if (Model != null && Model.IsExist && Model.IsBlock != true)
else if (Model != null && Model.IsExist && Model.IsBlock != true)
{
<text>
$("#resultExistPersonel").show();
$("#Year").addClass("errored");
$("#ddlMonth").addClass("errored");
$("#resultExistPersonel").html('برای این کارگاه در ماه و سال انتخاب شده لیست بیمه تنظیم گردیده است، در صورت نیاز به ثبت این لیست،لیست قبلی را حذف نمایید.');
<text>
$("#resultExistPersonel").show();
$("#Year").addClass("errored");
$("#ddlMonth").addClass("errored");
$("#resultExistPersonel").html('برای این کارگاه در ماه و سال انتخاب شده لیست بیمه تنظیم گردیده است، در صورت نیاز به ثبت این لیست،لیست قبلی را حذف نمایید.');
</text>
}
else
else
{
<text>
$("#resultExistPersonel").hide();
$("#Year").removeClass("errored");
$("#ddlMonth").removeClass("errored");
$("#resultExistPersonel").html('');
document.getElementById("btnPrint").onclick = function () {
printElement(document.getElementById("DSKWOR-datatable"));
};
<text>
$("#resultExistPersonel").hide();
$("#Year").removeClass("errored");
$("#ddlMonth").removeClass("errored");
$("#resultExistPersonel").html('');
document.getElementById("btnPrint").onclick = function () {
printElement(document.getElementById("DSKWOR-datatable"));
};
function printElement(elem) {
var domClone = elem.cloneNode(true);
function printElement(elem) {
var domClone = elem.cloneNode(true);
// create a new stylesheet to hide everything except the modal
var style = document.createElement("style");
style.innerHTML = `
@@media print {
body * {
visibility: hidden;
}
#printSection, #printSection * {
visibility: visible;
}
#printSection {
position: absolute;
left: 0;
top: 0;
}
// create a new stylesheet to hide everything except the modal
var style = document.createElement("style");
style.innerHTML = `
@@media print {
body * {
visibility: hidden;
}
#printSection, #printSection * {
visibility: visible;
}
#printSection {
position: absolute;
left: 0;
top: 0;
}
}
`;
document.head.appendChild(style);
// create a new section to hold the modal for printing
var $printSection = document.getElementById("printSection");
if (!$printSection) {
$printSection = document.createElement("div");
$printSection.id = "printSection";
document.body.appendChild($printSection);
}
`;
document.head.appendChild(style);
// create a new section to hold the modal for printing
var $printSection = document.getElementById("printSection");
if (!$printSection) {
$printSection = document.createElement("div");
$printSection.id = "printSection";
document.body.appendChild($printSection);
$printSection.innerHTML = "";
$printSection.appendChild(domClone);
window.print();
// remove the new stylesheet after printing
document.head.removeChild(style);
}
$printSection.innerHTML = "";
$printSection.appendChild(domClone);
window.print();
// remove the new stylesheet after printing
document.head.removeChild(style);
}
</text>
}
var jobName = $('#JobId option:selected').text();
// console.log($("#EmployeeId").val(),jobName);
//شروع محاسبه کارگاه
setDataTable($("#EmployeeId").val(),jobName);
//$(function () {

View File

@@ -165,7 +165,7 @@
<input type="hidden" asp-for="searchModel.EmployerName" />
<input type="search" id="empSearchEmployer" value="@Model.EmployerFullName" class="form-control inpt @{
if(!string.IsNullOrWhiteSpace(@Model.EmployerFullName)){
@selctedOption
@selctedOption
}
}" autocomplete="off" placeholder=" نام کارفرما " style="width: 100%;position: relative">
<div id="empEmployer" class="selectDiv" style="display: none;">
@@ -180,7 +180,7 @@
<input type="hidden" asp-for="searchModel.WorkShopName" />
<input type="search" id="empSearchWorkshop" value="@Model.WorkshopFullName" class="form-control @{
if(!string.IsNullOrWhiteSpace(@Model.WorkshopFullName)){
@selctedOption
@selctedOption
}
}" autocomplete="off" placeholder=" نام کارگاه /شماره بایگانی " style="width: 100%; position: relative">
<div id="empWorkshop" class="selectDiv" style="display: none;">
@@ -298,6 +298,8 @@ $('.btn-search1').on('click', function () {
function removeSearch()
{
var month = '@Model.BeforCurrentMonth_';
console.log(month);
$("#waiting").show();
var myTable = $("#datatable");
myTable.remove();
@@ -306,8 +308,8 @@ $('.btn-search1').on('click', function () {
$("#searchModel_WorkShopName").val('');
$("#searchModel_EmployerName").val('');
$(".form-control").val('');
$("#searchModel_Year").val(0);
$("#searchModel_Month").val(0);
$("#searchModel_Year").val(@Model.CurrentYear_);
$("#searchModel_Month").val(month);
$("#searchModel_TypeOfInsuranceSend").val(0);
$("#searchModel_City").val(0);
$("#searchModel_FixedSalary").val('لیست مقطوع');

View File

@@ -56,6 +56,9 @@ public class IndexModel : PageModel
_webHostEnvironment = webHostEnvironment;
}
#region MainPageList
public void OnGet()
{
var date = DateTime.Now.ToFarsi();
@@ -69,14 +72,16 @@ public class IndexModel : PageModel
YearlyList = _yearlySalaryApplication.GetYears();
}
/// <summary>
/// لیستهای بیمه صفحه اصلی
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
public IActionResult OnGetSearch(InsuranceListSearchModel searchModel)
{
var searchResult = _insuranceListApplication.Search(searchModel);
//foreach (var item in searchResult)
//{
// item.Month = item.Month.GetMonthByNumber();
//}
var result = new MainViewModel();
result.MainList = searchResult;
@@ -84,7 +89,14 @@ public class IndexModel : PageModel
return Partial("./MainSearch", result);
}
#endregion
#region CreateInsurance
//-1
/// <summary>
/// دکمه ایجاد لیست بیمه
/// </summary>
/// <returns></returns>
public IActionResult OnGetCreate()
{
var date = DateTime.Now.ToFarsi();
@@ -93,23 +105,295 @@ public class IndexModel : PageModel
var day = Convert.ToInt32(date.Substring(8, 2));
var persianDate = new PersianDateTime(year, month, day);
var persianBeforeDate = persianDate.AddMonths(-1).ToString("yyyy/MM/dd");
//کارگاه هایی نوع ارسال لیست بیمه آنها مشخص شده
var workshopList = _workshopApplication.GetWorkshopAccount().Where(x =>
!string.IsNullOrWhiteSpace(x.TypeOfInsuranceSend) && x.TypeOfInsuranceSend != "false").ToList();
var workshopList = _workshopApplication.GetWorkshopSelectListInsuransce();
var command = new CreateInsuranceList
{
//WorkShopSelectList = new SelectList(_workshopApplication.GetWorkshopAccount(),"Id", "WorkshopFullName"),
WorkShopSelectList = new SelectList(workshopList, "Id", "WorkshopFullName"),
YearList = _yearlySalaryApplication.GetYears(),
//ماه قبل
BeforCurrentMonth = persianBeforeDate.Substring(5, 2),
//سال جاری
CurrentYear = persianBeforeDate.Substring(0, 4)
CurrentYear = persianBeforeDate.Substring(0, 4),
InsuranceWorkshopInfo = new InsuranceWorkshopInfoViewModel(),
};
return Partial("./Create", command);
}
//-2
/// <summary>
/// دریافت اطلاعات کارگاه وکارفرما برای نمایش در مودال ایجاد بیمه
/// </summary>
/// <param name="workshopId"></param>
/// <returns></returns>
public IActionResult OnPostGetEmployerAndWorkshopInfo(int workshopId)
{
var workshopInfo = _insuranceWorkshopInfoApplication.GetDetails(workshopId);
var employer = _employerApplication.InsuranceEmployerByWorkshopId(workshopId);
return new JsonResult(new
{
EmployerNames = employer.employerName,
WorkshopInfo = workshopInfo,
IsLegal = employer.isLegal
});
}
//-3
/// <summary>
/// لود اطلاعات پرسنل در مودال ایجاد بیمه -- DSKWOR
/// محاسبه تب پرسنل
/// </summary>
/// <param name="searchModel"></param>
/// <returns></returns>
public IActionResult OnGetEmployeeSearch(EmployeeForCreateInsuranceListSearchModel searchModel)
{
var result = _insuranceListApplication.SearchEmployeeForCreateInsuranceList(searchModel);
return Partial("./EmployeeDatatable", result);
}
// -4
/// <summary>
/// زمان لود مودال ایجاد یا ویرایش محاسبه - DSSKAR
/// محاسبه تب کارگاه
/// </summary>
/// <param name="employeeDetailsForInsuranceList"></param>
/// <param name="typeOfInsuranceSendWorkshop"></param>
/// <returns></returns>
public IActionResult OnPostComputeInsuranceList(
List<EmployeeDetailsForInsuranceListViewModel> employeeDetailsForInsuranceList,
string typeOfInsuranceSendWorkshop)
{
double sumOfEmployees = employeeDetailsForInsuranceList.Count();
double included = 0; //مشمول
double sumOfWorkingDays = 0;
double benefitsIncludedNonContinuous = 0; //مشمول غیر مستمر
double sumOfSalaries = 0;
double sumOfDailyWage = 0;
double insuredShare = 0;
double employerShare = 0; //سهم بیمه کارفرما
double sumOfIncluded = 0;
double unEmploymentInsurance = 0; //سهم بیمه بیکاری
double monthlyBenefits = 0; //مزایای ماهیانه
double sumForunEmploymentInsurance = 0;
double benefitsIncludedContinuous = 0;
double sumOfIncludedKarfarma = 0;
var hasKarfarma = false;
double countWithoutLeft = 0;
double sumOfBaseYears = 0;
double sumOfMarriedAllowance = 0;
for (var i = 0; i < employeeDetailsForInsuranceList.Count; i++)
{
var leftWorkDay = "";
if (!string.IsNullOrWhiteSpace(employeeDetailsForInsuranceList[i].LeftWorkDate))
{
leftWorkDay = employeeDetailsForInsuranceList[i].LeftWorkDate.Substring(8, 2);
if (leftWorkDay == "01")
countWithoutLeft = countWithoutLeft + 1;
else
leftWorkDay = "";
}
else
{
leftWorkDay = "";
}
//بدست آوردن جمع پایه سنواتی
var baseYear = employeeDetailsForInsuranceList[i].BaseYears *
employeeDetailsForInsuranceList[i].WorkingDays;
sumOfBaseYears += baseYear;
//بدست آوردن جمع حق تاهل
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 &&
(employeeDetailsForInsuranceList[i].JobCode == "027079" ||
employeeDetailsForInsuranceList[i].JobCode == "024398" ||
employeeDetailsForInsuranceList[i].JobCode == "011015" ||
employeeDetailsForInsuranceList[i].JobCode == "020010")) // 10 --> karfarma
{
benefitsIncludedContinuous = 0;
sumForunEmploymentInsurance = sumForunEmploymentInsurance;
}
else
{
sumForunEmploymentInsurance = sumForunEmploymentInsurance +
employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
}
//if (employeeDetailsForInsuranceList[i].JobId == 10)//کارفرما
if (employeeDetailsForInsuranceList[i].JobCode == "024398") //کارفرما
{
hasKarfarma = true;
sumOfIncludedKarfarma = employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
}
sumOfWorkingDays = sumOfWorkingDays + employeeDetailsForInsuranceList[i].WorkingDays;
sumOfDailyWage = sumOfDailyWage + employeeDetailsForInsuranceList[i].DailyWage;
sumOfSalaries = sumOfSalaries + employeeDetailsForInsuranceList[i].MonthlySalary;
monthlyBenefits = monthlyBenefits + +employeeDetailsForInsuranceList[i].MonthlyBenefits;
sumOfIncluded = sumOfIncluded + employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود
benefitsIncludedNonContinuous = benefitsIncludedNonContinuous +
employeeDetailsForInsuranceList[i].IncludedAndNotIncluded;
insuredShare = insuredShare + employeeDetailsForInsuranceList[i].InsuranceShare;
}
employerShare = GetRoundValueWhitGovermentlist(sumOfIncluded * 20 / 100, typeOfInsuranceSendWorkshop);
unEmploymentInsurance =
GetRoundValueWhitGovermentlist(sumForunEmploymentInsurance * 3 / 100, typeOfInsuranceSendWorkshop);
var totalEmployee = sumOfEmployees;
//sumOfEmployees = sumOfEmployees - countWithoutLeft;
#region heydari
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 5 && !hasKarfarma)
//console.log(1);
employerShare = 0;
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 6 && hasKarfarma)
{
//console.log(sumOfIncludedKarfarma);
var result = sumOfIncludedKarfarma * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft >= 6 && !hasKarfarma)
{
//ابتدا جمع کل مزایا به دست می آید
//جمع کل مزایا تقسیم بر تعداد کارگران منهای کسانی که ترک کار کرده اند.
//حاصل عبارت بالا در 5 ضرب میشو یعنی میانگینی برای محاسبه قیمت 5 نفر حساب می کنیم تا از طریق دولت پرداخت شود
var result = (sumOfIncluded - sumOfIncluded / (sumOfEmployees - countWithoutLeft) * 5) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft > 6 && hasKarfarma)
{
// console.log(4);
//مجموع حقوق و مزایای ماهانه مشمول - حقوق و مزایای ماهانه مشمول کارفرما
var sum = sumOfIncluded - sumOfIncludedKarfarma; //ستون مربوط به کارفرما محاسبه نمی شود
var result = (sum - sum / (sumOfEmployees - countWithoutLeft - 1) * 5 + sumOfIncludedKarfarma) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
#endregion
//sumOfIncluded مجموع حقوق و مزایای ماهیانه مشمول
// عادی
//if (typeOfInsuranceSendWorkshop != "Govermentlist" && !hasKarfarma)
//{
// var empployerShare = (sumOfIncluded * 20) / 100; //سهم حق کارفرما
// insuredShare = (sumOfIncluded * 7) / 100; //سهم حق بیمه شده
// unEmploymentInsurance = (sumOfIncluded * 3) / 100; //بیمه بیکاری
// employerShare = GetRoundValueWhitGovermentlist(empployerShare, typeOfInsuranceSendWorkshop);
//}
//else if (typeOfInsuranceSendWorkshop != "Govermentlist" && hasKarfarma)
//{
// var tweniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sum = sumOfIncluded - sumOfIncludedKarfarma;
// var tweni= (sum * 20) / 100;
// var empployerShare = tweniSeven + tweni;
// insuredShare = (sum * 7) / 100;
// unEmploymentInsurance = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(empployerShare, typeOfInsuranceSendWorkshop);
//}
// کمک دولت
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees <= 5 && !hasKarfarma)
//{ //console.log(1);
// employerShare = 0;
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees <= 6 && hasKarfarma)
//{
// var tweniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sum = sumOfIncluded - sumOfIncludedKarfarma;
// insuredShare = (sum * 7) / 100;
// unEmploymentInsurance = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(tweniSeven, typeOfInsuranceSendWorkshop);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees >= 6 && !hasKarfarma)
//{
// var person = sumOfEmployees - 5;
// var divide = sumOfIncluded / sumOfEmployees;
// var result = divide * person;
// var finalresult = (result * 20) / 100;
// employerShare = GetRoundValueWhitGovermentlist(finalresult, typeOfInsuranceSendWorkshop);
// // employerShare =getRoundValue(((sumOfIncluded/sumOfEmployees)*(sumOfEmployees-5))*20/100);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees > 6 && hasKarfarma)
//{ // console.log(4);
// var sum = sumOfIncluded - sumOfIncludedKarfarma;//ستون مربوط به کارفرما محاسبه نمی شود
// sumOfEmployees = sumOfEmployees - 1;
// var person = sumOfEmployees - 5;
// var divide = sum / sumOfEmployees;
// var result = divide * person;
// var finalresult = (result * 20) / 100;
// var toeniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sumOfUp = finalresult + toeniSeven;
// insuredShare = (sum * 7) / 100;
// var treePercent = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(sumOfUp, typeOfInsuranceSendWorkshop);
//}
return new JsonResult(new
{
//تعداد نفرات
SumOfEmployees = totalEmployee,
//جمع حقوق ماهیانه
SumOfSalaries = sumOfSalaries.ToMoney(),
//جمع دستمزد روزانه
SumOfDailyWage = sumOfDailyWage.ToMoney(),
//جمع روزهای کارکرد
SumOfWorkingDays = sumOfWorkingDays,
//جمع مزایای ماهانه مشمول
SumOfBenefitsIncluded = monthlyBenefits.ToMoney(),
//مشمول
Included = sumOfIncluded.ToMoney(),
////مشمول و غیر مشمول
IncludedAndNotIncluded = benefitsIncludedNonContinuous.ToMoney(),
////IncludedAndNotIncluded = (sumOfIncluded + benefitsIncludedNonContinuous).ToMoney(),
//سهم حق بیمه شده
InsuredShare = insuredShare.ToMoney(),
//سهم حق کارفرما
EmployerShare = employerShare.ToMoney(),
//بیمه بیکاری
UnEmploymentInsurance = unEmploymentInsurance.ToMoney(),
//جمع پایه سنواتی
SumOfBaseYears = sumOfBaseYears.ToMoney(),
//جمع حق تاهل
SumOfMarriedAllowance = sumOfMarriedAllowance.ToMoney(),
});
}
public IActionResult OnPostCreate(CreateInsuranceList command)
{
//var result =new OperationResult();
@@ -136,60 +420,8 @@ public class IndexModel : PageModel
return new JsonResult(result);
}
public IActionResult OnPostGetEmployerName(int workshopId)
{
var names = "";
var employerList = _employerApplication.GetEmployerByWorkshopId(workshopId);
var workshopInfo = _insuranceWorkshopInfoApplication.GetDetails(workshopId);
// var personelInfo = _employeeApplication.(workshopId);
var isLegal = employerList.FirstOrDefault().IsLegal;
var boolIsLegal = isLegal == "حقوقی" ? true : false;
foreach (var item in employerList)
if (boolIsLegal)
names = item.EmployerLName != "#" ? item.FName + " " + item.EmployerLName : item.LName;
else
names = names + item.EmployerFullName + ",";
if (!boolIsLegal)
names = names.Substring(0, names.Length - 1);
return new JsonResult(new
{
EmployerNames = names,
WorkshopInfo = workshopInfo,
IsLegal = boolIsLegal
});
}
//public IActionResult OnGetEmployeeSearch(CreateInsuranceList command)
//{
// var searchModel = new EmployeeForCreateInsuranceListSearchModel();
// searchModel.Year = command.Year;
// searchModel.Month = command.Month;
// searchModel.WorkshopIds = command.WorkshopIds;
// var searchResult = _insuranceListApplication.SearchEmployeeForCreateInsuranceList(searchModel);
// var result = new List<EmployeeDetailsForInsuranceListViewModel>();
// //result.MainList = searchResult;
// //if (searchModel.WorkshopId != 0 || searchModel.EmployeeId != 0)
// //{
// // result.WorkshopSearch = "true";
// //}
// //else
// //{
// // result.WorkshopSearch = "false";
// //}
// return Partial("./EmployeeDatatable", result);
//}
//لود جدول پرسنل در مودال ایجاد بیمه -- DSKWOR
public IActionResult OnGetEmployeeSearch(EmployeeForCreateInsuranceListSearchModel searchModel)
{
var result = _insuranceListApplication.SearchEmployeeForCreateInsuranceList(searchModel);
return Partial("./EmployeeDatatable", result);
}
#endregion
public IActionResult OnPostCreateEmployeeDetailsInfo(EmployeeDetailsForInsuranceListViewModel command)
{
@@ -213,6 +445,13 @@ public class IndexModel : PageModel
});
}
/// <summary>
/// حذف لیست بیمه
/// </summary>
/// <param name="id"></param>
/// <param name="pathDSKKAR00"></param>
/// <param name="pathDSKWOR00"></param>
/// <returns></returns>
public IActionResult OnPostRemoveInsuranceList(long id, string pathDSKKAR00, string pathDSKWOR00)
{
var result = _insuranceListApplication.Remove(id);
@@ -281,6 +520,7 @@ public class IndexModel : PageModel
// Directory.CreateDirectory(dayPath);
//فعلا قرار شد روی فایل قبلی ریپلیس بشه
// string fileName = currentDay + "_" + currentdate.Hour + "_" + currentdate.Month + "_" + currentdate.Second +"_";
//ایجاد فایل کارگاه - DSK
if (createInsuranceList.InsuranceWorkshopInfo != null)
{
var odbf = new DbfFile(Encoding.GetEncoding(1256));
@@ -305,14 +545,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));
// مجموع کل دستمزد و مزایای ماهانه مشمول و غیر مشمول
@@ -331,7 +571,12 @@ public class IndexModel : PageModel
odbf.Header.AddColumn(new DbfColumn("DSK_BIMH", DbfColumn.DbfColumnType.Number, 12, 0));
//ردیف پیمان
odbf.Header.AddColumn(new DbfColumn("MON_PYM", DbfColumn.DbfColumnType.Character, 3, 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);
@@ -353,12 +598,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();
//مجموع دستمزد و مزایای ماهانه مشمول
@@ -379,13 +624,20 @@ public class IndexModel : PageModel
orec[21] = createInsuranceList.DifficultJobsInsuranc.ToString();
//ردیف پیمان
orec[22] = GetSpecifiedCharactes(createInsuranceList.InsuranceWorkshopInfo.AgreementNumber, 12);
odbf.Write(orec);
//مجموع پایه سنواتی ها
orec[23] = createInsuranceList.SumOfBaseYears.ToString();
//مجموع حق تاهل ها
orec[24] = createInsuranceList.SumOfMarriedAllowance.ToString();
odbf.Write(orec);
//odbf.Header.RecordCount = 50;
odbf.WriteHeader();
odbf.Close();
}
//ایجاد فایل پرسنل - DSW
if (createInsuranceList.EmployeeInsurancListDataList != null)
{
//لیست پرسنل
@@ -446,7 +698,12 @@ public class IndexModel : PageModel
// کد ملی
dsw.Header.AddColumn(new DbfColumn("PER_NATCOD", DbfColumn.DbfColumnType.Character, 10, 0));
foreach (var item in createInsuranceList.EmployeeInsurancListDataList)
// پایه سنوات
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)
{
var employee = createInsuranceList.EmployeeDetailsForInsuranceList
.Where(p => p.EmployeeId == item.EmployeeId).FirstOrDefault();
@@ -525,207 +782,14 @@ public class IndexModel : PageModel
//کد ملی
dswrec[26] = employee.NationalCode;
dsw.Write(dswrec);
//پایه سنوات
dswrec[27] = item.BaseYears.ToString();
//حق تاهل
dswrec[28] = item.MarriedAllowance.ToString();
dsw.Write(dswrec);
}
//var dswrec = new DbfRecord(dsw.Header);
////کد کارگاه
//dswrec[0] = GetSpecifiedCharactes("9008289145", 10);
////سال
//dswrec[1] = "2";
////ماه
//dswrec[2] = "2";
////شماره لیست
//dswrec[3] = GetSpecifiedCharactes("01", 12);
////شماره بیمه
//dswrec[4] = GetSpecifiedCharactes("48071464", 8);
//// نام
//dswrec[5] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("راضیه", 100),
// IranSystemNumbers.DontConvert);
////خانوادگی نام
//dswrec[6] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("پیردهقان", 100),
// IranSystemNumbers.DontConvert);
////پدر نام
//dswrec[7] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("غلام", 100),
// IranSystemNumbers.DontConvert);
////شماره شناسنامه
//dswrec[8] = "2650230614";
////محل صدور
//dswrec[9] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("رشت", 100),
// IranSystemNumbers.DontConvert);
//;
////تاریخ صدور
//dswrec[10] = "13770805";
////تاریخ تولد
//dswrec[11] = "13770721";
////جنسیت
//dswrec[12] =
// ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("زن", 3), IranSystemNumbers.DontConvert);
////ملیت
//dswrec[13] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("ایرانی", 10),
// IranSystemNumbers.DontConvert);
////شرح شغل
//dswrec[14] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("کارشناس نرم افزار کامپیوتر", 100),
// IranSystemNumbers.DontConvert);
////تاریخ شروع بکار
//dswrec[15] = "14000201";
////تاریخ ترک کار
//dswrec[16] = "";
////تعداد روزهای کارکرد
//dswrec[17] = "31";
////دستمزد روزانه
//dswrec[18] = "1769428";
////دستمزد مااهانه
//dswrec[19] = "54852268";
////مزایای ماهانه
//dswrec[20] = "20000000";
////دستمزد و مزایای ماهانه مشمول
//dswrec[21] = "74852268";
////جمع کل دستمزد و مزایای ماهانه مسمول غیرمشمول
//dswrec[22] = "74852268";
////حق بیمه سهم بیمه شده
//dswrec[23] = "5239659";
////نرخ پورسانتاژ
//dswrec[24] = "0";
////کد شغل
//dswrec[25] = "033022";
////کد ملی
//dswrec[26] = "2650230614";
//dsw.Write(dswrec);
//var dswrec2 = new DbfRecord(dsw.Header);
////کد کارگاه
//dswrec2[0] = GetSpecifiedCharactes("9008289145", 10);
////سال
//dswrec2[1] = "2";
////ماه
//dswrec2[2] = "2";
////شماره لیست
//dswrec2[3] = GetSpecifiedCharactes("01", 12);
////شماره بیمه
//dswrec2[4] = GetSpecifiedCharactes("34157806", 8);
//// نام
//dswrec2[5] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("پیمان", 100),
// IranSystemNumbers.DontConvert);
////خانوادگی نام
//dswrec2[6] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("افشاری بجاربنه", 100),
// IranSystemNumbers.DontConvert);
////پدر نام
//dswrec2[7] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("علیرضا", 100),
// IranSystemNumbers.DontConvert);
////شماره شناسنامه
//dswrec2[8] = "2580900713";
////محل صدور
//dswrec2[9] =
// ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("رشت", 100), IranSystemNumbers.DontConvert);
//;
////تاریخ صدور
//dswrec2[10] = "";
////تاریخ تولد
//dswrec2[11] = "13750229";
////جنسیت
//dswrec2[12] =
// ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("مرد", 3), IranSystemNumbers.DontConvert);
////ملیت
//dswrec2[13] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("ایرانی", 10),
// IranSystemNumbers.DontConvert);
////شرح شغل
//dswrec2[14] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("کارشناس نرم افزار کامپیوتر", 100),
// IranSystemNumbers.DontConvert);
////تاریخ شروع بکار
//dswrec2[15] = "14010701";
////تاریخ ترک کار
//dswrec2[16] = "";
////تعداد روزهای کارکرد
//dswrec2[17] = "31";
////دستمزد روزانه
//dswrec2[18] = "1769428";
////دستمزد مااهانه
//dswrec2[19] = "54852268";
////مزایای ماهانه
//dswrec2[20] = "20000000";
////دستمزد و مزایای ماهانه مشمول
//dswrec2[21] = "74852268";
////جمع کل دستمزد و مزایای ماهانه مسمول غیرمشمول
//dswrec2[22] = "74852268";
////حق بیمه سهم بیمه شده
//dswrec2[23] = "5239659";
////نرخ پورسانتاژ
//dswrec2[24] = "0";
////کد شغل
//dswrec2[25] = "033022";
////کد ملی
//dswrec2[26] = "2580900713";
//dsw.Write(dswrec2);
//var dswrec3 = new DbfRecord(dsw.Header);
////کد کارگاه
//dswrec3[0] = GetSpecifiedCharactes("9008289145", 10);
////سال
//dswrec3[1] = "2";
////ماه
//dswrec3[2] = "2";
////شماره لیست
//dswrec3[3] = GetSpecifiedCharactes("01", 12);
////شماره بیمه
//dswrec3[4] = GetSpecifiedCharactes("48076618", 8);
//// نام
//dswrec3[5] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("فاطمه", 100),
// IranSystemNumbers.DontConvert);
////خانوادگی نام
//dswrec3[6] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("پادکان", 100),
// IranSystemNumbers.DontConvert);
////پدر نام
//dswrec3[7] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("محمدفرشاد", 100),
// IranSystemNumbers.DontConvert);
////شماره شناسنامه
//dswrec3[8] = "2581230231";
////محل صدور
//dswrec3[9] =
// ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("رشت", 100), IranSystemNumbers.DontConvert);
//;
////تاریخ صدور
//dswrec3[10] = "";
////تاریخ تولد
//dswrec3[11] = "13780926";
////جنسیت
//dswrec3[12] =
// ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("زن", 3), IranSystemNumbers.DontConvert);
////ملیت
//dswrec3[13] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("ایرانی", 10),
// IranSystemNumbers.DontConvert);
////شرح شغل
//dswrec3[14] = ConvertToIranSystem.ToIranSystem(GetSpecifiedCharactes("کارشناس نرم افزار کامپیوتر", 100),
// IranSystemNumbers.DontConvert);
////تاریخ شروع بکار
//dswrec3[15] = "14010701";
////تاریخ ترک کار
//dswrec3[16] = "";
////تعداد روزهای کارکرد
//dswrec3[17] = "31";
////دستمزد روزانه
//dswrec3[18] = "1769428";
////دستمزد مااهانه
//dswrec3[19] = "54852268";
////مزایای ماهانه
//dswrec3[20] = "20000000";
////دستمزد و مزایای ماهانه مشمول
//dswrec3[21] = "74852268";
////جمع کل دستمزد و مزایای ماهانه مسمول غیرمشمول
//dswrec3[22] = "74852268";
////حق بیمه سهم بیمه شده
//dswrec3[23] = "5239659";
////نرخ پورسانتاژ
//dswrec3[24] = "0";
////کد شغل
//dswrec3[25] = "001094";
////کد ملی
//dswrec3[26] = "2581230231";
//dsw.Write(dswrec3);
dsw.WriteHeader();
@@ -743,7 +807,7 @@ public class IndexModel : PageModel
public IActionResult OnGetEdit(long id)
{
var insurance = _insuranceListApplication.GetDetailsForEdit(id);
var workshopList = _workshopApplication.GetWorkshopAccount();
var workshopList = _workshopApplication.GetWorkshopSelectListInsuransce();
var workshopObj = workshopList.Where(x => x.Id == insurance.WorkshopId)?.FirstOrDefault();
insurance.WorkshopName = workshopObj == null ? string.Empty : workshopObj.WorkshopFullName;
insurance.TypeOfInsuranceSend = workshopObj.TypeOfInsuranceSend;
@@ -893,220 +957,7 @@ public class IndexModel : PageModel
});
}
// زمان لود مودال ایجاد یا ویرایش محاسبه dsskar
public IActionResult OnPostComputeInsuranceList(
List<EmployeeDetailsForInsuranceListViewModel> employeeDetailsForInsuranceList,
string typeOfInsuranceSendWorkshop)
{
double sumOfEmployees = employeeDetailsForInsuranceList.Count();
double included = 0; //مشمول
double sumOfWorkingDays = 0;
double benefitsIncludedNonContinuous = 0; //مشمول غیر مستمر
double sumOfSalaries = 0;
double sumOfDailyWage = 0;
double insuredShare = 0;
double employerShare = 0; //سهم بیمه کارفرما
double sumOfIncluded = 0;
double unEmploymentInsurance = 0; //سهم بیمه بیکاری
double monthlyBenefits = 0; //مزایای ماهیانه
double sumForunEmploymentInsurance = 0;
double benefitsIncludedContinuous = 0;
double sumOfIncludedKarfarma = 0;
var hasKarfarma = false;
double countWithoutLeft = 0;
for (var i = 0; i < employeeDetailsForInsuranceList.Count; i++)
{
var leftWorkDay = "";
if (!string.IsNullOrWhiteSpace(employeeDetailsForInsuranceList[i].LeftWorkDate))
{
leftWorkDay = employeeDetailsForInsuranceList[i].LeftWorkDate.Substring(8, 2);
if (leftWorkDay == "01")
countWithoutLeft = countWithoutLeft + 1;
else
leftWorkDay = "";
}
else
{
leftWorkDay = "";
}
// 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" ||
employeeDetailsForInsuranceList[i].JobCode == "020010")) // 10 --> karfarma
{
benefitsIncludedContinuous = 0;
sumForunEmploymentInsurance = sumForunEmploymentInsurance;
}
else
{
sumForunEmploymentInsurance = sumForunEmploymentInsurance +
employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
}
//if (employeeDetailsForInsuranceList[i].JobId == 10)//کارفرما
if (employeeDetailsForInsuranceList[i].JobCode == "024398") //کارفرما
{
hasKarfarma = true;
sumOfIncludedKarfarma = employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
}
sumOfWorkingDays = sumOfWorkingDays + employeeDetailsForInsuranceList[i].WorkingDays;
sumOfDailyWage = sumOfDailyWage + employeeDetailsForInsuranceList[i].DailyWage;
sumOfSalaries = sumOfSalaries + employeeDetailsForInsuranceList[i].MonthlySalary;
monthlyBenefits = monthlyBenefits + +employeeDetailsForInsuranceList[i].MonthlyBenefits;
sumOfIncluded = sumOfIncluded + employeeDetailsForInsuranceList[i].BenefitsIncludedContinuous;
if (leftWorkDay != "01") //اگر ترک کار آن یکم ماه نبود
benefitsIncludedNonContinuous = benefitsIncludedNonContinuous +
employeeDetailsForInsuranceList[i].IncludedAndNotIncluded;
insuredShare = insuredShare + employeeDetailsForInsuranceList[i].InsuranceShare;
}
employerShare = GetRoundValueWhitGovermentlist(sumOfIncluded * 20 / 100, typeOfInsuranceSendWorkshop);
unEmploymentInsurance =
GetRoundValueWhitGovermentlist(sumForunEmploymentInsurance * 3 / 100, typeOfInsuranceSendWorkshop);
var totalEmployee = sumOfEmployees;
//sumOfEmployees = sumOfEmployees - countWithoutLeft;
#region heydari
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 5 && !hasKarfarma)
//console.log(1);
employerShare = 0;
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft <= 6 && hasKarfarma)
{
//console.log(sumOfIncludedKarfarma);
var result = sumOfIncludedKarfarma * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft >= 6 && !hasKarfarma)
{
//ابتدا جمع کل مزایا به دست می آید
//جمع کل مزایا تقسیم بر تعداد کارگران منهای کسانی که ترک کار کرده اند.
//حاصل عبارت بالا در 5 ضرب میشو یعنی میانگینی برای محاسبه قیمت 5 نفر حساب می کنیم تا از طریق دولت پرداخت شود
var result = (sumOfIncluded - sumOfIncluded / (sumOfEmployees - countWithoutLeft) * 5) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees - countWithoutLeft > 6 && hasKarfarma)
{
// console.log(4);
//مجموع حقوق و مزایای ماهانه مشمول - حقوق و مزایای ماهانه مشمول کارفرما
var sum = sumOfIncluded - sumOfIncludedKarfarma; //ستون مربوط به کارفرما محاسبه نمی شود
var result = (sum - sum / (sumOfEmployees - countWithoutLeft - 1) * 5 + sumOfIncludedKarfarma) * 20 / 100;
employerShare = GetRoundValueWhitGovermentlist(result, typeOfInsuranceSendWorkshop);
}
#endregion
//sumOfIncluded مجموع حقوق و مزایای ماهیانه مشمول
// عادی
//if (typeOfInsuranceSendWorkshop != "Govermentlist" && !hasKarfarma)
//{
// var empployerShare = (sumOfIncluded * 20) / 100; //سهم حق کارفرما
// insuredShare = (sumOfIncluded * 7) / 100; //سهم حق بیمه شده
// unEmploymentInsurance = (sumOfIncluded * 3) / 100; //بیمه بیکاری
// employerShare = GetRoundValueWhitGovermentlist(empployerShare, typeOfInsuranceSendWorkshop);
//}
//else if (typeOfInsuranceSendWorkshop != "Govermentlist" && hasKarfarma)
//{
// var tweniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sum = sumOfIncluded - sumOfIncludedKarfarma;
// var tweni= (sum * 20) / 100;
// var empployerShare = tweniSeven + tweni;
// insuredShare = (sum * 7) / 100;
// unEmploymentInsurance = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(empployerShare, typeOfInsuranceSendWorkshop);
//}
// کمک دولت
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees <= 5 && !hasKarfarma)
//{ //console.log(1);
// employerShare = 0;
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees <= 6 && hasKarfarma)
//{
// var tweniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sum = sumOfIncluded - sumOfIncludedKarfarma;
// insuredShare = (sum * 7) / 100;
// unEmploymentInsurance = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(tweniSeven, typeOfInsuranceSendWorkshop);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees >= 6 && !hasKarfarma)
//{
// var person = sumOfEmployees - 5;
// var divide = sumOfIncluded / sumOfEmployees;
// var result = divide * person;
// var finalresult = (result * 20) / 100;
// employerShare = GetRoundValueWhitGovermentlist(finalresult, typeOfInsuranceSendWorkshop);
// // employerShare =getRoundValue(((sumOfIncluded/sumOfEmployees)*(sumOfEmployees-5))*20/100);
//}
//if (typeOfInsuranceSendWorkshop == "Govermentlist" && sumOfEmployees > 6 && hasKarfarma)
//{ // console.log(4);
// var sum = sumOfIncluded - sumOfIncludedKarfarma;//ستون مربوط به کارفرما محاسبه نمی شود
// sumOfEmployees = sumOfEmployees - 1;
// var person = sumOfEmployees - 5;
// var divide = sum / sumOfEmployees;
// var result = divide * person;
// var finalresult = (result * 20) / 100;
// var toeniSeven = (sumOfIncludedKarfarma * 27) / 100;
// var sumOfUp = finalresult + toeniSeven;
// insuredShare = (sum * 7) / 100;
// var treePercent = (sum * 3) / 100;
// employerShare = GetRoundValueWhitGovermentlist(sumOfUp, typeOfInsuranceSendWorkshop);
//}
return new JsonResult(new
{
//تعداد نفرات
SumOfEmployees = totalEmployee,
//جمع حقوق ماهیانه
SumOfSalaries = sumOfSalaries.ToMoney(),
//جمع دستمزد روزانه
SumOfDailyWage = sumOfDailyWage.ToMoney(),
//جمع روزهای کارکرد
SumOfWorkingDays = sumOfWorkingDays,
//جمع مزایای ماهانه مشمول
SumOfBenefitsIncluded = monthlyBenefits.ToMoney(),
//مشمول
Included = sumOfIncluded.ToMoney(),
////مشمول و غیر مشمول
IncludedAndNotIncluded = benefitsIncludedNonContinuous.ToMoney(),
////IncludedAndNotIncluded = (sumOfIncluded + benefitsIncludedNonContinuous).ToMoney(),
//سهم حق بیمه شده
InsuredShare = insuredShare.ToMoney(),
//سهم حق کارفرما
EmployerShare = employerShare.ToMoney(),
//بیمه بیکاری
UnEmploymentInsurance = unEmploymentInsurance.ToMoney()
});
}
public double GetRoundValueWhitGovermentlist(double value, string type)
{
@@ -1130,7 +981,11 @@ public class IndexModel : PageModel
}
#region New by heydari
/// <summary>
/// جستجوی کارگاه در صفحه اصلی بیمه
/// </summary>
/// <param name="searchText"></param>
/// <returns></returns>
public IActionResult OnGetWorkshopName(string searchText)
{
var result = _workshopApplication.GetWorkshopByTextSearch(searchText);