test moda completed
This commit is contained in:
@@ -33,6 +33,35 @@ public static class Tools
|
||||
public static string[] DayNames = { "شنبه", "یکشنبه", "دو شنبه", "سه شنبه", "چهار شنبه", "پنج شنبه", "جمعه" };
|
||||
public static string[] DayNamesG = { "یکشنبه", "دو شنبه", "سه شنبه", "چهار شنبه", "پنج شنبه", "جمعه", "شنبه" };
|
||||
|
||||
/// <summary>
|
||||
/// نام ستون از جدول مزد سنوات طبثه بندی را میگیرد و دیتای داخل آن ستون را برمیگرداند
|
||||
/// </summary>
|
||||
/// <param name="obj"></param>
|
||||
/// <param name="propertyName"></param>
|
||||
/// <returns></returns>
|
||||
public static double? GetDynamicDouble(object obj, string propertyName)
|
||||
{
|
||||
if (obj == null || string.IsNullOrWhiteSpace(propertyName))
|
||||
return null;
|
||||
|
||||
var propertyInfo = obj.GetType().GetProperty(propertyName);
|
||||
if (propertyInfo == null)
|
||||
return null;
|
||||
|
||||
var value = propertyInfo.GetValue(obj);
|
||||
if (value == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
return Convert.ToDouble(value);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static bool IsMobileValid(this string mobileNo)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -24,5 +26,17 @@ public interface IClassificationSchemeRepository : IRepository<long, Classificat
|
||||
Task<EditClassificationScheme> GetClassificationScheme(long id);
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// متد محاسبه پایه سنوات برا افراد تک گروه
|
||||
/// </summary>
|
||||
/// <param name="schemeStart">تاریخ شروع طرح</param>
|
||||
/// <param name="schemeEnd">تاریخ پاین طرح، اجباری نیست</param>
|
||||
/// <param name="contractStart">تاریخ شروع قراداد</param>
|
||||
/// <param name="contractEnd">تاریخ پایان قراداد</param>
|
||||
/// <param name="groupNo">شماره گروه</param>
|
||||
/// <param name="employeeId">آی دی پرسنل</param>
|
||||
/// <param name="workshopId">آی دی کارگاه</param>
|
||||
/// <returns></returns>
|
||||
Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
|
||||
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ public class AddEmployeeToGroup
|
||||
/// <summary>
|
||||
/// شماره گروه
|
||||
/// </summary>
|
||||
public long GoroupNo { get; set; }
|
||||
public string GoroupNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// آی دی شغل
|
||||
|
||||
@@ -32,6 +32,8 @@ public class EmployeeInfoTab
|
||||
/// لیست پرسنل
|
||||
/// </summary>
|
||||
public List<EmployeeInfoList> EmployeeInfoList { get; set; }
|
||||
|
||||
public List<string> YearlyList { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using _0_Framework.Application;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -147,4 +149,19 @@ public interface IClassificationSchemeApplication
|
||||
/// <returns></returns>
|
||||
Task<AddEmployeeToGroup> GetEmployeeMemberizeData(long employeeId);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// متد محاسبه پایه سنوات برا افراد تک گروه
|
||||
/// </summary>
|
||||
/// <param name="schemeStart">تاریخ شروع طرح</param>
|
||||
/// <param name="schemeEnd">تاریخ پاین طرح، اجباری نیست</param>
|
||||
/// <param name="contractStart">تاریخ شروع قراداد</param>
|
||||
/// <param name="contractEnd">تاریخ پایان قراداد</param>
|
||||
/// <param name="groupNo">شماره گروه</param>
|
||||
/// <param name="employeeId">آی دی پرسنل</param>
|
||||
/// <param name="workshopId">آی دی کارگاه</param>
|
||||
/// <returns></returns>
|
||||
Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
|
||||
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId);
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using Company.Domain.ClassificationSchemeAgg;
|
||||
using CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -397,4 +398,11 @@ public class ClassificationSchemeApplication : IClassificationSchemeApplication
|
||||
|
||||
|
||||
}
|
||||
|
||||
public async Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd, DateTime contractStart, DateTime contractEnd,
|
||||
string groupNo, long employeeId, long workshopId)
|
||||
{
|
||||
return await _classificationSchemeRepository.BaseYearComputeOneGroup(schemeStart, schemeEnd, contractStart,
|
||||
contractEnd, groupNo, employeeId, workshopId);
|
||||
}
|
||||
}
|
||||
@@ -51,14 +51,25 @@ public class ClassificationGroupSalariesRepository : RepositoryBase<long, Classi
|
||||
salaryAndRialCoefficientModel.StartDateFa = startDate;
|
||||
salaryAndRialCoefficientModel.EndDateFa = endDate;
|
||||
salaryAndRialCoefficientModel.TypeOfCoefficient = scheme.TypeOfCoefficient;
|
||||
salaryAndRialCoefficientModel.RialCoefficient = scheme.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient ? rialCoEfficient.RialCoefficient : 0;
|
||||
salaryAndRialCoefficientModel.CoefficientId = scheme.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient ? rialCoEfficient.id : 0;
|
||||
if (rialCoEfficient == null)
|
||||
{
|
||||
salaryAndRialCoefficientModel.RialCoefficient = 0;
|
||||
salaryAndRialCoefficientModel.CoefficientId = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
salaryAndRialCoefficientModel.RialCoefficient = scheme.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient ? rialCoEfficient.RialCoefficient : 0;
|
||||
salaryAndRialCoefficientModel.CoefficientId = scheme.TypeOfCoefficient == TypeOfCoefficient.RialCoefficient ? rialCoEfficient.id : 0;
|
||||
}
|
||||
|
||||
salaryAndRialCoefficientModel.SalariesAndCoefficientList = _context.ClassificationGroupSalaries.Where(x => x.SchemeId == schemeId && x.StartDate == startDatGr).Select(x => new EditClassificationGroupSalaryAndRialCoefficient
|
||||
{
|
||||
Id = x.id,
|
||||
ClassificationGroupId = x.ClassificationGroupId,
|
||||
GroupNo = x.GroupNo,
|
||||
GroupSalaryStr = x.GroupSalary.ToMoney()
|
||||
GroupSalaryStr = x.GroupSalary.ToMoney(),
|
||||
GroupSalary = x.GroupSalary
|
||||
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,10 @@ using _0_Framework.Application;
|
||||
using _0_Framework.InfraStructure;
|
||||
using Company.Domain.ClassificationSchemeAgg;
|
||||
using CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
using CompanyManagment.App.Contracts.LeftWork;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PersianTools.Core;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
@@ -78,5 +81,462 @@ public class ClassificationSchemeRepository :RepositoryBase<long, Classification
|
||||
}).FirstOrDefaultAsync(x => x.Id == id);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// متد محاسبه پایه سنوات برا افراد تک گروه
|
||||
/// </summary>
|
||||
/// <param name="schemeStart">تاریخ شروع طرح</param>
|
||||
/// <param name="schemeEnd">تاریخ پاین طرح، اجباری نیست</param>
|
||||
/// <param name="contractStart">تاریخ شروع قراداد</param>
|
||||
/// <param name="contractEnd">تاریخ پایان قراداد</param>
|
||||
/// <param name="groupNo">شماره گروه</param>
|
||||
/// <param name="employeeId">آی دی پرسنل</param>
|
||||
/// <param name="workshopId">آی دی کارگاه</param>
|
||||
/// <returns></returns>
|
||||
public async Task<BaseYearDataViewModel> BaseYearComputeOneGroup(DateTime schemeStart, DateTime? schemeEnd,
|
||||
DateTime contractStart, DateTime contractEnd, string groupNo, long employeeId, long workshopId)
|
||||
{
|
||||
//خروجی متد
|
||||
var baseYearResult = new BaseYearDataViewModel();
|
||||
baseYearResult.WorkshopId = workshopId;
|
||||
baseYearResult.EmployeeId = employeeId;
|
||||
|
||||
|
||||
|
||||
//لیست شروع بکار / ترک کار پرسنل
|
||||
var leftWorkList = await _context.LeftWorkList
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x=> new LeftWorkViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
StartWorkDateGr = x.StartWorkDate,
|
||||
StartWorkDate = x.StartWorkDate.ToFarsi(),
|
||||
LeftWorkDateGr = x.LeftWorkDate,
|
||||
HasLeft = x.HasLeft,
|
||||
}).OrderBy(x=>x.StartWorkDateGr).ToListAsync();
|
||||
//اولین شروع بکار
|
||||
var firstStartWorkDate = leftWorkList.First().StartWorkDateGr;
|
||||
var firstStartWork = leftWorkList.First().StartWorkDate;
|
||||
//اگر شروع طرح بعد از اولین شروع بکار بود
|
||||
if (schemeStart > firstStartWorkDate)
|
||||
{
|
||||
var leftWorkStart = leftWorkList.FirstOrDefault(x => x.StartWorkDateGr <= schemeStart && x.LeftWorkDateGr > schemeStart);
|
||||
|
||||
if (leftWorkStart != null)
|
||||
{
|
||||
//اگر تاریخ شروع طرح بین بازه اولین شروع بکار و ترک کار قرار گرفت
|
||||
if (leftWorkStart.StartWorkDateGr == firstStartWorkDate)
|
||||
{
|
||||
var changedLeftwork = new LeftWorkViewModel()
|
||||
{
|
||||
Id = leftWorkStart.Id,
|
||||
StartWorkDateGr = schemeStart,
|
||||
StartWorkDate = schemeStart.ToFarsi(),
|
||||
LeftWorkDateGr = leftWorkStart.LeftWorkDateGr,
|
||||
HasLeft = leftWorkStart.HasLeft,
|
||||
};
|
||||
|
||||
leftWorkList.Remove(leftWorkStart);
|
||||
leftWorkList.Add(changedLeftwork);
|
||||
firstStartWork = schemeStart.ToFarsi();
|
||||
}
|
||||
else //اگر تاریخ شروع طرح در بازه شروع به ترک کارهایی بعد از اولین قرارگرفت
|
||||
{
|
||||
//لیست شروع بکار/ ترک کارهایی که باید حذف شوند
|
||||
var leftWorksToBeRemove = leftWorkList.Where(x => x.StartWorkDateGr < leftWorkStart.StartWorkDateGr)
|
||||
.ToList();
|
||||
foreach (var item in leftWorksToBeRemove.ToList())
|
||||
{
|
||||
leftWorkList.Remove(item);
|
||||
}
|
||||
|
||||
var changedLeftwork = new LeftWorkViewModel()
|
||||
{
|
||||
Id = leftWorkStart.Id,
|
||||
StartWorkDateGr = schemeStart,
|
||||
StartWorkDate = schemeStart.ToFarsi(),
|
||||
LeftWorkDateGr = leftWorkStart.LeftWorkDateGr,
|
||||
HasLeft = leftWorkStart.HasLeft,
|
||||
};
|
||||
firstStartWork = schemeStart.ToFarsi();
|
||||
leftWorkList.Remove(leftWorkStart);
|
||||
leftWorkList.Add(changedLeftwork);
|
||||
}
|
||||
|
||||
}
|
||||
else //اگر شروع طرح در فاصله بین شروع بکار/ترک کارها بود
|
||||
{
|
||||
//لیست شروع بکار/ ترک کارهایی که باید حذف شوند
|
||||
var leftWorksToBeRemove = leftWorkList.Where(x => x.StartWorkDateGr < schemeStart)
|
||||
.ToList();
|
||||
foreach (var item in leftWorksToBeRemove.ToList())
|
||||
{
|
||||
leftWorkList.Remove(item);
|
||||
}
|
||||
|
||||
leftWorkList = leftWorkList.OrderBy(x => x.StartWorkDateGr).ToList();
|
||||
firstStartWork = leftWorkList.First().StartWorkDate;
|
||||
|
||||
}
|
||||
}
|
||||
//مرتب سازی
|
||||
leftWorkList = leftWorkList.OrderBy(x => x.StartWorkDateGr).ToList();
|
||||
|
||||
|
||||
//مقادیر سالانه
|
||||
var salary = await _context.YearlySalaries.OrderByDescending(x => x.EndDate).Include(x => x.YearlySalaryItemsList).ToListAsync();
|
||||
|
||||
//مزد سنوات طبقه بندی
|
||||
var classifiedBaseYearList =await _context.ClassifiedSalaries.ToListAsync();
|
||||
|
||||
//آیا در حلقه کبیشه بودن چک شود
|
||||
bool checkKabiseh = true;
|
||||
var isKabiseh = false;
|
||||
var EndOfYaerDate = new DateTime();
|
||||
//لیست تاریخ هایی که پایه سنوات تعلق گرفته
|
||||
var baseYearDateList = new List<DateTime>();
|
||||
|
||||
double baseYear = 0;
|
||||
|
||||
//اگر تاریخ پایان طرح خالی نبود
|
||||
if (schemeEnd.HasValue)
|
||||
{
|
||||
//اگر تاریخ پایان طرخ از تاریخ پایان قرارداد کوچکتر بود
|
||||
//در نتیجه تاریخ پاینه محاسبات همان پایان طرح است
|
||||
if (schemeEnd.Value < contractEnd)
|
||||
contractEnd = schemeEnd.Value;
|
||||
}
|
||||
|
||||
//اگر فقط یک شروع بکار داشت
|
||||
if (leftWorkList.Count < 2)
|
||||
{
|
||||
var leftWork = leftWorkList.First();
|
||||
//اگر ترک کار کرده بود پایان چرخه تاریخ آخرین روز کاری اوست
|
||||
var endComputeDate = leftWork.HasLeft && leftWork.LeftWorkDateGr <= contractEnd ? leftWork.LeftWorkDateGr.AddDays(-1) : contractEnd;
|
||||
//شروع چرخه شروع بکار پرسنل
|
||||
var startComputeDate = leftWork.StartWorkDateGr;
|
||||
|
||||
|
||||
for (var current = startComputeDate; current <= endComputeDate; current = current.AddDays(1))
|
||||
{
|
||||
var currentChanges = new DateTime(current.Year, current.Month, current.Day);
|
||||
|
||||
if (checkKabiseh)
|
||||
{
|
||||
|
||||
isKabiseh = ($"{current.ToFarsi()}").YearTotalDays() == 367 ? true : false;
|
||||
string kabise = "";
|
||||
if (isKabiseh)
|
||||
kabise = "kabise";
|
||||
var currentChangesPc = currentChanges.ToPersianDateTime();
|
||||
EndOfYaerDate = isKabiseh ? ($"{currentChangesPc.AddDays(365)}").ToGeorgianDateTime() : ($"{currentChangesPc.AddDays(364)}").ToGeorgianDateTime();
|
||||
Console.WriteLine($" start : {current.ToFarsi()} {kabise}");
|
||||
}
|
||||
|
||||
checkKabiseh = false;
|
||||
if (current == EndOfYaerDate)
|
||||
{
|
||||
|
||||
|
||||
|
||||
var a = current.AddDays(1);
|
||||
if (a <= endComputeDate)
|
||||
{
|
||||
checkKabiseh = true;
|
||||
baseYearDateList.Add(a);
|
||||
Console.WriteLine($" End : {a.ToFarsi()}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else //اگر بیش از یک شروع بکار داشت
|
||||
{
|
||||
int max365 = 0;
|
||||
int dayCounter = 0;
|
||||
bool hasCute = false;
|
||||
foreach (var leftWork in leftWorkList)
|
||||
{
|
||||
//اگر ترک کار کرده بود پایان چرخه تاریخ آخرین روز کاری اوست
|
||||
var endComputeDate = leftWork.HasLeft && leftWork.LeftWorkDateGr <= contractEnd ? leftWork.LeftWorkDateGr.AddDays(-1) : contractEnd;
|
||||
//شروع چرخه شروع بکار پرسنل
|
||||
var startComputeDate = leftWork.StartWorkDateGr;
|
||||
|
||||
for (var current = startComputeDate; current <= endComputeDate; current = current.AddDays(1))
|
||||
{
|
||||
|
||||
if (checkKabiseh && dayCounter == 0)
|
||||
{
|
||||
|
||||
isKabiseh = ($"{current.ToFarsi()}").YearTotalDays() == 367 ? true : false;
|
||||
string kabise = "";
|
||||
if (isKabiseh)
|
||||
kabise = "kabise";
|
||||
|
||||
max365 = isKabiseh ? 366 : 365;
|
||||
Console.WriteLine($" start : {current.ToFarsi()} {kabise}");
|
||||
}
|
||||
|
||||
dayCounter += 1;
|
||||
checkKabiseh = false;
|
||||
|
||||
if (dayCounter == max365)
|
||||
{
|
||||
|
||||
var a = !hasCute ? current.AddDays(1) : current;
|
||||
if (a <= endComputeDate)
|
||||
{
|
||||
checkKabiseh = true;
|
||||
baseYearDateList.Add(a);
|
||||
Console.WriteLine($" End : {a.ToFarsi()}");
|
||||
Console.WriteLine(dayCounter);
|
||||
if (hasCute)
|
||||
{
|
||||
dayCounter = 1;
|
||||
isKabiseh = ($"{current.ToFarsi()}").YearTotalDays() == 367 ? true : false;
|
||||
max365 = isKabiseh ? 366 : 365;
|
||||
|
||||
string kabise = "";
|
||||
if (isKabiseh)
|
||||
kabise = "kabise";
|
||||
Console.WriteLine($" start : {current.ToFarsi()} {kabise}");
|
||||
}
|
||||
else
|
||||
{
|
||||
dayCounter = 0;
|
||||
}
|
||||
hasCute = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
hasCute = true;
|
||||
max365 += 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
double selectBase = 0;
|
||||
var baseList = new List<(double baseYaer, DateTime start, DateTime end, string baseYearPay, DateTime baseYearPayGr, string year, bool hasStartWork, bool hasLeftWork)>();
|
||||
|
||||
|
||||
if (baseYearDateList.Count > 0)
|
||||
{
|
||||
var firstBaseYearDate = baseYearDateList.First();
|
||||
var res = MonthByMonthList(firstBaseYearDate, contractEnd);
|
||||
var firstbasicSalari =
|
||||
salary.FirstOrDefault(x => x.StartDate <= firstBaseYearDate && x.EndDate >= firstBaseYearDate);
|
||||
var firstClassifiedBaseYear = classifiedBaseYearList.FirstOrDefault(x => x.StartDate <= firstBaseYearDate && x.EndDate >= firstBaseYearDate);
|
||||
|
||||
//پایه سنوات سال جاری
|
||||
var firstBasicObject = Tools.GetDynamicDouble(firstClassifiedBaseYear, $"Group{groupNo}");
|
||||
double firstBasic = firstBasicObject != null ? firstBasicObject.Value : 0;
|
||||
var firstfixFeePercentage = firstbasicSalari
|
||||
.YearlySalaryItemsList.Where(x => x.ItemName == "درصد مزد ثابت").Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
// پایه سنوات سال قبل ضربدر درصد مزد ثابت تقسیم بر صد
|
||||
//var beforePercntBaseYear = ((beforBaseStart * firstfixFeePercentage) / 100) + beforBaseStart;
|
||||
//firstBasic += beforePercntBaseYear;
|
||||
baseYear = firstBasic;
|
||||
res = res.Where(x => x.start != firstBaseYearDate).OrderBy(x => x.start).ToList();
|
||||
//var afterSalary = salary.Where(x => x.StartDate > firstbasicSalari.EndDate).ToList();
|
||||
|
||||
|
||||
var first = (firstBasic, firstbasicSalari.StartDate, firstbasicSalari.EndDate, firstBaseYearDate.ToFarsi(), firstBaseYearDate, firstbasicSalari.Year, false, false);
|
||||
baseList.Add(first);
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.WriteLine($"{1398} -> firstBasic : {firstBasic}");
|
||||
var lastItem = res.Count > 1 ? res.Last() : res.FirstOrDefault();
|
||||
foreach (var item in res)
|
||||
{
|
||||
var lastReecord = baseList.Last();
|
||||
var year = Convert.ToInt32(item.start.ToFarsi().Substring(0, 4));
|
||||
if (item.start > lastReecord.end && lastReecord.year != $"{year}")
|
||||
{
|
||||
|
||||
|
||||
var selectedSalary = salary.Where(x => x.Year == $"{year}").OrderBy(x => x.StartDate).ToList();
|
||||
var currentSalary = selectedSalary.First();
|
||||
if (selectedSalary.Count > 1)
|
||||
{
|
||||
currentSalary = selectedSalary.Last();
|
||||
var firstSalery = selectedSalary.First();
|
||||
if (baseYearDateList.Any(x => x >= firstSalery.StartDate && x <= firstSalery.EndDate) || lastItem.end < currentSalary.StartDate)
|
||||
{
|
||||
currentSalary = firstSalery;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var selectedBaseYear = classifiedBaseYearList.Where(x => x.Year == year).OrderBy(x => x.StartDate).ToList();
|
||||
var currentBaseYear = selectedBaseYear.First();
|
||||
if (selectedBaseYear.Count > 1)
|
||||
{
|
||||
currentBaseYear = selectedBaseYear.Last();
|
||||
var firstBaseYear = selectedBaseYear.First();
|
||||
if (baseYearDateList.Any(x => x >= firstBaseYear.StartDate && x <= firstBaseYear.EndDate) || lastItem.end < currentBaseYear.StartDate)
|
||||
{
|
||||
currentBaseYear = firstBaseYear;
|
||||
}
|
||||
}
|
||||
|
||||
//درصد مزد ثابت تاریخ جاری
|
||||
var fixFeePercentage = currentSalary
|
||||
.YearlySalaryItemsList.Where(x => x.ItemName == "درصد مزد ثابت").Select(x => x.ItemValue).FirstOrDefault();
|
||||
|
||||
// پایه سنوات سال قبل ضربدر درصد مزد ثابت تقسیم بر صد
|
||||
var percntBaseYear = ((lastReecord.baseYaer * fixFeePercentage) / 100) + lastReecord.baseYaer;
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
|
||||
var currentBasicObject = Tools.GetDynamicDouble(currentBaseYear, $"Group{groupNo}");
|
||||
double currentBasic = currentBasicObject != null ? currentBasicObject.Value : 0;
|
||||
//var currentBasic = currentSalary
|
||||
// .YearlySalaryItemsList.Where(x => x.ItemName == "پایه سنوات").Select(x => x.ItemValue).FirstOrDefault();
|
||||
Console.WriteLine($"{year} -> [{lastReecord.baseYaer} * {fixFeePercentage} /100 + {lastReecord.baseYaer}] = {percntBaseYear} => [{currentBasic} + {percntBaseYear}] = {currentBasic + percntBaseYear} ");
|
||||
|
||||
if (!baseYearDateList.Any(x => x >= currentBaseYear.StartDate && x <= currentBaseYear.EndDate))
|
||||
currentBasic = 0;
|
||||
|
||||
var currentBase = currentBasic + percntBaseYear;
|
||||
|
||||
baseYear = currentBase;
|
||||
var baseYearPay = "-";
|
||||
var baseYearPayDayGr = new DateTime();
|
||||
if (baseYearDateList.Any(x => x >= currentBaseYear.StartDate && x <= currentBaseYear.EndDate))
|
||||
{
|
||||
var existBaseYear = baseYearDateList.FirstOrDefault(x => x >= currentBaseYear.StartDate && x <= currentBaseYear.EndDate);
|
||||
baseYearPay = existBaseYear.ToFarsi();
|
||||
baseYearPayDayGr = new DateTime(existBaseYear.Year, existBaseYear.Month, existBaseYear.Day, 17, 01, 01);
|
||||
}
|
||||
else
|
||||
{
|
||||
baseYearPayDayGr = new DateTime(item.start.Year, item.start.Month, item.start.Day, 17, 01, 01);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Console.ForegroundColor = ConsoleColor.DarkYellow;
|
||||
Console.WriteLine(baseYearPay);
|
||||
Console.ResetColor();
|
||||
|
||||
// var round = GetCurrectFirstDailyFee(currentBase, $"{year}");
|
||||
var record = (baseYear, currentSalary.StartDate, currentSalary.EndDate, baseYearPay, baseYearPayDayGr, currentSalary.Year, false, false);
|
||||
baseList.Add(record);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Console.ResetColor();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
selectBase = baseList.Any() ? baseList.Last().baseYaer : 0;
|
||||
//افزودن تاریخ های شروع بکار و ترک کار به لیست
|
||||
foreach (var left in leftWorkList)
|
||||
{
|
||||
var startWork = (0, new DateTime(), new DateTime(), left.StartWorkDateGr.ToFarsi(), left.StartWorkDateGr, "-", true, false);
|
||||
baseList.Add(startWork);
|
||||
|
||||
if (left.HasLeft)
|
||||
{
|
||||
var leftWork = (0, new DateTime(), new DateTime(), left.LeftWorkDateGr.ToFarsi(), left.LeftWorkDateGr, "-", false, true);
|
||||
baseList.Add(leftWork);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
baseYearResult = new BaseYearDataViewModel()
|
||||
{
|
||||
WorkshopId = workshopId,
|
||||
EmployeeId = employeeId,
|
||||
BaseYearResult = selectBase,
|
||||
FirstWorkDayInLeftWork = firstStartWork,
|
||||
BaseYearDataList = baseList.Select(x => new BaseYearDataList()
|
||||
{
|
||||
BaseYear = x.baseYaer,
|
||||
|
||||
StartDateGr = x.start,
|
||||
EndDateGr = x.end,
|
||||
BaseYearPayDay = x.baseYearPay,
|
||||
BaseYearPayDayGr = x.baseYearPayGr,
|
||||
StartDateFa = x.start.ToFarsi(),
|
||||
EndDateFa = x.end.ToFarsi(),
|
||||
Year = x.year,
|
||||
HasLeftWork = x.hasLeftWork,
|
||||
HasStartWork = x.hasStartWork,
|
||||
}).OrderBy(x => x.BaseYearPayDayGr).ToList(),
|
||||
|
||||
};
|
||||
Console.WriteLine("BaseYear : " + selectBase);
|
||||
return baseYearResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// متد کمکی پایه سنوات
|
||||
/// </summary>
|
||||
/// <param name="startDate"></param>
|
||||
/// <param name="endDate"></param>
|
||||
/// <returns></returns>
|
||||
private List<(DateTime start, DateTime end)> MonthByMonthList(DateTime startDate, DateTime endDate)
|
||||
{
|
||||
|
||||
var start = startDate.ToFarsi();
|
||||
var end = endDate.ToFarsi();
|
||||
var ContractPreiodsList = new List<(DateTime start, DateTime end)>();
|
||||
|
||||
|
||||
var syear = Convert.ToInt32(start.Substring(0, 4));
|
||||
var smonth = Convert.ToInt32(start.Substring(5, 2));
|
||||
var sday = Convert.ToInt32(start.Substring(8, 2));
|
||||
|
||||
var eyear = Convert.ToInt32(end.Substring(0, 4));
|
||||
var emonth = Convert.ToInt32(end.Substring(5, 2));
|
||||
var eday = Convert.ToInt32(end.Substring(8, 2));
|
||||
|
||||
var PersianStartDate = new PersianDateTime(syear, smonth, sday);
|
||||
var PersianStartDateAddingMount = new PersianDateTime(syear, smonth, 1);
|
||||
var PersianEndDate = new PersianDateTime(eyear, emonth, eday);
|
||||
|
||||
|
||||
|
||||
var totalmonth = ((PersianEndDate.Year - PersianStartDateAddingMount.Year) * 12) + (PersianEndDate.Month - PersianStartDateAddingMount.Month) + 1;
|
||||
for (int i = 0; i < totalmonth; i++)
|
||||
{
|
||||
|
||||
|
||||
var currentEndDate = PersianStartDateAddingMount.AddMonths(1).AddDays(-1);
|
||||
if (currentEndDate > PersianEndDate)
|
||||
{
|
||||
currentEndDate = PersianEndDate;
|
||||
}
|
||||
|
||||
DateTime startPeriod = ($"{PersianStartDate}").ToGeorgianDateTime();
|
||||
DateTime endPeriod = ($"{currentEndDate}").ToGeorgianDateTime();
|
||||
var record = (startPeriod, endPeriod);
|
||||
ContractPreiodsList.Add(record);
|
||||
//Console.WriteLine($"Month {i + 1} : {PersianStartDate.ToString("yyyy-MM-dd")} to {currentEndDate.ToString("yyyy-MM-dd")}");
|
||||
|
||||
PersianStartDate = PersianStartDate.AddMonths(1);
|
||||
PersianStartDate = new PersianDateTime(PersianStartDate.Year, PersianStartDate.Month, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
return ContractPreiodsList;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,11 @@
|
||||
using Company.Domain.ClassificationSchemeAgg;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Enums;
|
||||
using Company.Domain.ClassificationSchemeAgg;
|
||||
using CompanyManagment.App.Contracts.ClassificationScheme;
|
||||
using CompanyManagment.App.Contracts.Job;
|
||||
using CompanyManagment.App.Contracts.Workshop;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
@@ -14,11 +18,13 @@ public class ClassificationSchemeModel : PageModel
|
||||
{
|
||||
private readonly IClassificationSchemeApplication _classificationSchemeApplication;
|
||||
private readonly IJobApplication _jobApplication;
|
||||
private readonly IYearlySalaryApplication _yearlySalaryApplication;
|
||||
|
||||
public ClassificationSchemeModel(IClassificationSchemeApplication classificationSchemeApplication, IJobApplication jobApplication)
|
||||
public ClassificationSchemeModel(IClassificationSchemeApplication classificationSchemeApplication, IJobApplication jobApplication, IYearlySalaryApplication yearlySalaryApplication)
|
||||
{
|
||||
_classificationSchemeApplication = classificationSchemeApplication;
|
||||
_jobApplication = jobApplication;
|
||||
_yearlySalaryApplication = yearlySalaryApplication;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -110,7 +116,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
|
||||
//تب تعیین مشاغل
|
||||
#region GroupJobsTab
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تب تعیین مشاغل گروه
|
||||
/// </summary>
|
||||
@@ -135,7 +141,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
model.GroupNo = groupNo;
|
||||
model.EditClassificationGroupJob =
|
||||
_classificationSchemeApplication.GetGroupJobs(groupId).GetAwaiter().GetResult();
|
||||
|
||||
|
||||
return Partial("_ClassificationPartials/CreateOrEditGroupJobs", model);
|
||||
}
|
||||
|
||||
@@ -168,7 +174,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
/// بررسی امکان حذف شغل
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetCheckDeleteJob(long id,long groupId)
|
||||
public IActionResult OnGetCheckDeleteJob(long id, long groupId)
|
||||
{
|
||||
var checkExist = _classificationSchemeApplication.CheckEmployeeHasThisJob(id, groupId).GetAwaiter().GetResult();
|
||||
|
||||
@@ -201,7 +207,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
|
||||
#region SalariesTab
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// چک میکند که آیا گروه بدون شغل وجود دارد یا نه
|
||||
@@ -221,11 +227,11 @@ public class ClassificationSchemeModel : PageModel
|
||||
// حالا میتونی بررسی کنی آیا گروهی بدون Job وجود دارد یا نه:
|
||||
bool hasEmptyGroup = hasJobsList.Contains(false);
|
||||
|
||||
// bool hasEmptyGroup = groupAndJobs.Any(g => g.EditClassificationGroupJob == null || g.EditClassificationGroupJob.Count == 0);
|
||||
return new JsonResult(new
|
||||
{
|
||||
hasEmptyGroup = hasEmptyGroup,
|
||||
});
|
||||
// bool hasEmptyGroup = groupAndJobs.Any(g => g.EditClassificationGroupJob == null || g.EditClassificationGroupJob.Count == 0);
|
||||
return new JsonResult(new
|
||||
{
|
||||
hasEmptyGroup = hasEmptyGroup,
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -324,11 +330,11 @@ public class ClassificationSchemeModel : PageModel
|
||||
FullName = fullName,
|
||||
};
|
||||
var result = _classificationSchemeApplication.GetEmployeeDataTab(command).GetAwaiter().GetResult();
|
||||
if(result.EmployeeInfoList == null || !result.EmployeeInfoList.Any())
|
||||
if (result.EmployeeInfoList == null || !result.EmployeeInfoList.Any())
|
||||
return new JsonResult(new
|
||||
{
|
||||
hasEmployee = false
|
||||
|
||||
|
||||
});
|
||||
var personnelList = result.EmployeeInfoList.OrderBy(x => x.Black ? 1 : 0);
|
||||
|
||||
@@ -368,7 +374,7 @@ public class ClassificationSchemeModel : PageModel
|
||||
/// <returns></returns>
|
||||
public IActionResult OnPostAddToGroup(AddEmployeeToGroup command)
|
||||
{
|
||||
|
||||
|
||||
var result = _classificationSchemeApplication.AddEmployeeToGroup(command).GetAwaiter().GetResult();
|
||||
if (!result.IsSuccedded)
|
||||
{
|
||||
@@ -449,4 +455,114 @@ public class ClassificationSchemeModel : PageModel
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
//تست طرح
|
||||
#region TestScheme
|
||||
|
||||
/// <summary>
|
||||
/// لود مودال تست
|
||||
/// </summary>
|
||||
/// <param name="schemeId"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetTestScheme(long schemeId)
|
||||
{
|
||||
var command = new EmployeeInfoTab
|
||||
{
|
||||
SchemeId = schemeId,
|
||||
|
||||
};
|
||||
var result = _classificationSchemeApplication.GetEmployeeDataTab(command).GetAwaiter().GetResult();
|
||||
|
||||
var employeeWithGroup = result.EmployeeInfoList.Where(x => x.HasGroup).ToList();
|
||||
var years =
|
||||
_yearlySalaryApplication.GetYears();
|
||||
var model = new EmployeeInfoTab()
|
||||
{
|
||||
SchemeId = schemeId,
|
||||
EmployeeInfoList = employeeWithGroup,
|
||||
YearlyList = years
|
||||
};
|
||||
|
||||
return Partial("_ClassificationPartials/TestScheme", model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// متد محاسبه تست
|
||||
/// </summary>
|
||||
/// <param name="schemeId"></param>
|
||||
/// <param name="employeeId"></param>
|
||||
/// <param name="year"></param>
|
||||
/// <param name="month"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnGetComputeTest(long schemeId, long employeeId, string year, string month)
|
||||
{
|
||||
var scheme = _classificationSchemeApplication.GetClassificationScheme(schemeId).GetAwaiter().GetResult();
|
||||
var typeOfCoefficient = scheme.TypeOfCoefficient;
|
||||
|
||||
var startDate = $"{year}/{month}/01";
|
||||
var endDate = startDate.FindeEndOfMonth();
|
||||
var startDateGr = startDate.ToGeorgianDateTime();
|
||||
var endDateGr = endDate.ToGeorgianDateTime();
|
||||
double salaryResult = 0;
|
||||
double salary = 0;
|
||||
double coefficient = 0;
|
||||
double rate = 0;
|
||||
string mathModel = "";
|
||||
var employeeMemberizeData = _classificationSchemeApplication.GetEmployeeMemberizeData(employeeId).GetAwaiter().GetResult();
|
||||
|
||||
var groupId = employeeMemberizeData.GroupId;
|
||||
var group = _classificationSchemeApplication.GetGroups(schemeId).GetAwaiter().GetResult();
|
||||
var groupNo = group.FirstOrDefault(x => x.GroupId == groupId)!.GroupNo;
|
||||
var groupSalaryData = _classificationSchemeApplication.GetEditSalariesData(schemeId, startDate, endDate).GetAwaiter()
|
||||
.GetResult();
|
||||
|
||||
var salaryData = groupSalaryData.SalariesAndCoefficientList.FirstOrDefault(x => x.GroupNo == groupNo);
|
||||
if (salaryData != null)
|
||||
{
|
||||
salary = salaryData.GroupSalary;
|
||||
coefficient = groupSalaryData.RialCoefficient;
|
||||
}
|
||||
|
||||
if (typeOfCoefficient != TypeOfCoefficient.RialCoefficient)
|
||||
{
|
||||
coefficient = 0;
|
||||
}
|
||||
|
||||
rate = ClassificationRangeOfGroupRate.GetGroupDistanceRate(groupNo).DistanceRate;
|
||||
|
||||
if (groupNo != "1")
|
||||
{
|
||||
salaryResult = (coefficient * rate) + salary;
|
||||
|
||||
mathModel = $"{salaryResult} = {salary} + ( x {rate} {coefficient} )";
|
||||
}
|
||||
else
|
||||
{
|
||||
salaryResult = salary;
|
||||
|
||||
}
|
||||
|
||||
var baseYearResult = _classificationSchemeApplication.BaseYearComputeOneGroup(scheme.ExecutionDateGr,
|
||||
scheme.EndSchemeDateGr, startDateGr, endDateGr, groupNo, employeeId, scheme.WorkshopId).GetAwaiter().GetResult();
|
||||
var baseYearResultFa = baseYearResult.BaseYearResult > 0 ? baseYearResult.BaseYearResult.ToMoney() : "0";
|
||||
var salaryResultFa = salaryResult.ToMoney();
|
||||
|
||||
double baseYearResultRound = baseYearResultFa != "0" ? baseYearResultFa.MoneyToDouble() : 0;
|
||||
double salaryResultRound = salaryResultFa.MoneyToDouble();
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
salaryResult = salaryResultFa,
|
||||
salary = salary,
|
||||
rate = rate,
|
||||
coefficient = coefficient,
|
||||
salaryResultDouble = salaryResult,
|
||||
baseYearResult = baseYearResultFa,
|
||||
mabnaDailyWage = (baseYearResultRound + salaryResultRound).ToMoney(),
|
||||
baseYearDataList = baseYearResult.BaseYearDataList,
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -94,7 +94,7 @@
|
||||
<div class="col-12 col-md-3 align-items-center" style="float:left; direction:ltr">
|
||||
|
||||
<a
|
||||
style="border-radius:5px;" href="#showmodal=@Url.Page("./ClassificationScheme", "CreateScheme" ,new {workshopId = @Model.WorkshopId})" >
|
||||
style="border-radius:5px;" href="#showmodal=@Url.Page("./ClassificationScheme", "CreateScheme" ,new {workshopId = @Model.WorkshopId})" >
|
||||
<span class="icon-span" style="background-color:#ddd3e0">
|
||||
<svg width="19" height="18" fill="none" xmlns="http://www.w3.org/2000/svg" >
|
||||
<rect width="18.5047" height="18.5047" transform="translate(0.523438 0.523438)" fill="#DDD3E0"></rect>
|
||||
@@ -121,7 +121,7 @@
|
||||
|
||||
<a href="#">
|
||||
<span class="icon-span" style="background-color: #ade7f2;padding: 4px;font-size: 11px;color: #009ee2;">
|
||||
بازنگری
|
||||
بازنگری
|
||||
</span>
|
||||
|
||||
|
||||
@@ -135,4 +135,23 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@if (Model.HasScheme)
|
||||
{
|
||||
<div class="card card-pattern m-t-10">
|
||||
<a class="btn btn-success"
|
||||
style="border-radius:5px;" href="#showmodal=@Url.Page("./ClassificationScheme", "TestScheme" ,new {schemeId = @Model.ClassificationSchemesList.FirstOrDefault()!.Id})">
|
||||
@* <i class="fa fa-user-plus" aria-hidden="true" style="margin: 0px 5px;"></i> *@
|
||||
|
||||
<span class="icon-span">
|
||||
|
||||
<svg width="19" height="19" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="11" cy="11" r="8.25" stroke="white" />
|
||||
<path d="M11 13.75L11 8.25" stroke="white" stroke-linecap="round" />
|
||||
<path d="M13.75 11L8.25 11" stroke="white" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span style="margin-right:4px">تست طرح</span>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -0,0 +1,386 @@
|
||||
@using _0_Framework.Application.Enums
|
||||
@model CompanyManagment.App.Contracts.ClassificationScheme.EmployeeInfoTab
|
||||
@Html.AntiForgeryToken()
|
||||
@{
|
||||
<style>
|
||||
.modal-footer {
|
||||
padding: 0.5rem 1rem !important; /* کوچکتر کردن فاصله */
|
||||
margin-top: -10px; /* کمی بالا آوردن */
|
||||
}
|
||||
|
||||
.modal .modal-dialog .modal-content {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
|
||||
.items {
|
||||
flex: 0 0 calc(33.333% - 8px); /* دقیقاً سهتا در هر سطر */
|
||||
box-sizing: border-box;
|
||||
direction: rtl;
|
||||
justify-content: flex-start;
|
||||
align-items: flex-start; /* آیتمها در یک راستا از بالا */
|
||||
padding: 6px 10px;
|
||||
border-radius: 5px;
|
||||
min-height: 36px; /* برای ارتفاع یکنواخت */
|
||||
}
|
||||
|
||||
.hiddenCompute {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
.trTable {
|
||||
background-color: cadetblue;
|
||||
color: aliceblue;
|
||||
border-radius: 5px;
|
||||
padding: 3px;
|
||||
margin: 3px;
|
||||
}
|
||||
|
||||
|
||||
.st {
|
||||
background: #cecece;
|
||||
border-radius: 8px;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
direction: rtl;
|
||||
font-family: "IranSans", sans-serif;
|
||||
margin: 5px 0px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
|
||||
.st .header {
|
||||
background: #0d4c4c;
|
||||
color: #fff;
|
||||
padding: 10px 14px;
|
||||
text-align: center;
|
||||
font-weight: 700;
|
||||
border-radius: 8px 8px 0 0;
|
||||
}
|
||||
|
||||
|
||||
.st .trTable {
|
||||
padding: 4px 9px;
|
||||
margin: 0;
|
||||
display: block;
|
||||
margin: 3px 3px;
|
||||
}
|
||||
|
||||
|
||||
.st .trTable .content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
|
||||
.st .trTable.green {
|
||||
background: forestgreen;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.st .trTable.red {
|
||||
background: #d9534f;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.st .trTable.teal {
|
||||
background: #5fb0b0;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.st .trTable.orange {
|
||||
background: orangered;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.date {
|
||||
font-family: 'IranText' !important;
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">تست طرح</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="بستن">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body">
|
||||
<div class="lineDiv"></div>
|
||||
<div class="row m-t-10">
|
||||
<div class="col-md-6 mb-3">
|
||||
|
||||
<select id="employeeListSelect" asp-for="EmployeeId" class="form-select form-control">
|
||||
<option value="0">انتخاب پرسنل </option>
|
||||
@foreach (var item in @Model.EmployeeInfoList)
|
||||
{
|
||||
<option value="@item.EmployeeId"><span>@item.FullName</span></option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="col-xs-4">
|
||||
<select class="form-control" id="monthListSelect" asp-for="FullName" style="width: 100% !important">
|
||||
<option value="0"> ماه</option>
|
||||
<option value="01"> فروردین</option>
|
||||
<option value="02"> اردیبهشت</option>
|
||||
<option value="03"> خرداد</option>
|
||||
<option value="04"> تیر</option>
|
||||
<option value="05"> مرداد</option>
|
||||
<option value="06"> شهریور</option>
|
||||
<option value="07"> مهر</option>
|
||||
<option value="08"> آبان</option>
|
||||
<option value="09"> آذر</option>
|
||||
<option value="10"> دی</option>
|
||||
<option value="11"> بهمن</option>
|
||||
<option value="12"> اسفند</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-4">
|
||||
<select class="form-control " id="yearListSelect" asp-for="FullName" style="width: 100% !important">
|
||||
<option value="0"> سال </option>
|
||||
@foreach (string itemi in @Model.YearlyList)
|
||||
{
|
||||
<option style="font-family: 'IranSans' !important;" value="@itemi"> @itemi </option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
انتخاب تاریخ
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="lineDiv"></div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
<span class="compute hiddenCompute" style="direction:ltr; display: flex; padding-left:13px;gap:9px;">
|
||||
|
||||
|
||||
<span>
|
||||
<h4> فرمول محاسبه مزد</h4>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<span class="compute hiddenCompute" style="display: flex; padding-left:13px;gap:9px">
|
||||
|
||||
<span>
|
||||
<h4> مزد شغل</h4>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="text-align center">
|
||||
<div class="col-xs-6">
|
||||
<span class="compute hiddenCompute" style="direction:ltr; display: flex; padding-left:13px;gap:9px;">
|
||||
<span>
|
||||
<h2>(</h2>
|
||||
</span><span id="coeficient"></span>
|
||||
<span>
|
||||
<h2>x</h2>
|
||||
</span><span id="rate"></span>
|
||||
<span>
|
||||
<h2>)</h2>
|
||||
</span>
|
||||
<span>
|
||||
<h2>+</h2>
|
||||
</span><span id="salary"></span>
|
||||
<span>
|
||||
<h2>=</h2>
|
||||
</span><span id="salaryResultDouble"></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
<span class="compute hiddenCompute" style="display: flex; padding-left:13px;gap:9px">
|
||||
<span id="salaryResult"></span><span><h3>ریال</h3></span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="lineDiv compute hiddenCompute"></div>
|
||||
|
||||
<div class="row" style="text-align center">
|
||||
|
||||
<div class="st hiddenCompute">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<span class="compute hiddenCompute" style="display: flex; padding-right:8px;gap:9px">
|
||||
<span ><h4>پایه سنوات</h4></span>
|
||||
</span>
|
||||
<span class="compute hiddenCompute" style="display: flex; padding-right:8px;gap:9px">
|
||||
<span id="baseYearResult"></span>
|
||||
<span>
|
||||
<h3>ریال</h3></span>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="lineDiv compute hiddenCompute"></div>
|
||||
<div class="row">
|
||||
<span class="compute hiddenCompute" style="display: flex; padding-right:8px;gap:9px">
|
||||
<span ><h4>مزد مبنا</h4></span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row" style="text-align center">
|
||||
<span class="compute hiddenCompute" style="display: flex; padding-right:8px;gap:9px">
|
||||
<span id="mabnaDailyWage"></span><span><h3>ریال</h3></span>
|
||||
</span>
|
||||
|
||||
</div>
|
||||
<div class="lineDiv compute hiddenCompute"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer border-0">
|
||||
<button type="button" onclick="computeTest()" class="btn btn-success px-4 rounded-pill">تست</button>
|
||||
<button type="button" class="btn btn-outline-secondary px-4 rounded-pill" data-dismiss="modal">بستن</button>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".date-input").mask("0000/00/00");
|
||||
|
||||
});
|
||||
|
||||
|
||||
function computeTest(selectElement) {
|
||||
|
||||
const employeeSelect = document.getElementById("employeeListSelect");
|
||||
const monthSelect = document.getElementById("monthListSelect");
|
||||
const yearSelect = document.getElementById("yearListSelect");
|
||||
|
||||
const employeeId = employeeSelect.options[employeeSelect.selectedIndex].value;
|
||||
const year = yearSelect.options[yearSelect.selectedIndex].value;
|
||||
const month = monthSelect.options[monthSelect.selectedIndex].value;
|
||||
|
||||
if (employeeSelect == 0) {
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم', "پرسنل را انتخاب کنید");
|
||||
return;
|
||||
}
|
||||
|
||||
if (year == 0) {
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم', "سال را انتخاب کنید");
|
||||
return;
|
||||
}
|
||||
if (month == 0) {
|
||||
$.Notification.autoHideNotify('error', 'top center', 'پیام سیستم', "ماه را انتخاب کنید");
|
||||
return;
|
||||
}
|
||||
|
||||
let schemeId = '@Model.SchemeId';
|
||||
var url = `/Admin/Company/Workshops/ClassificationScheme?handler=ComputeTest&schemeId=${schemeId}&employeeId=${employeeId}&year=${year}&month=${month}`;
|
||||
|
||||
// console.log("Request URL:", url);
|
||||
|
||||
$.get(url, function (data) {
|
||||
$('.compute').removeClass('hiddenCompute');
|
||||
$('.st').removeClass('hiddenCompute');
|
||||
|
||||
$('#coeficient').empty();
|
||||
$('#coeficient').append(`<h2>${data.coefficient}</h2>`);
|
||||
$('#rate').empty();
|
||||
$('#rate').append(`<h2>${data.rate}</h2>`);
|
||||
$('#salary').empty();
|
||||
$('#salary').append(`<h2>${data.salary}</h2>`);
|
||||
$('#salaryResultDouble').empty();
|
||||
$('#salaryResultDouble').append(`<h2>${data.salaryResultDouble}</h2>`);
|
||||
$('#salaryResult').empty();
|
||||
$('#salaryResult').append(`<h2>${data.salaryResult}</h2>`);
|
||||
|
||||
$('#baseYearResult').empty();
|
||||
$('#baseYearResult').append(`<h2>${data.baseYearResult}</h2>`);
|
||||
$('#mabnaDailyWage').empty();
|
||||
$('#mabnaDailyWage').append(`<h2>${data.mabnaDailyWage}</h2>`);
|
||||
|
||||
$('.st').empty();
|
||||
|
||||
if(data.baseYearResult != "0"){
|
||||
$('.st').append(`
|
||||
<div class="header">محاسبه پایه سنوات</div>
|
||||
`);
|
||||
data.baseYearDataList.forEach(item => {
|
||||
|
||||
if(item.hasStartWork){
|
||||
$('.st').append(`
|
||||
|
||||
<div class="trTable green">
|
||||
<div class="content">
|
||||
<div class="date">${item.baseYearPayDay}</div>
|
||||
<div>شروع بکار</div>
|
||||
</div>
|
||||
</div>`);
|
||||
}else if(item.hasLeftWork){
|
||||
$('.st').append(`
|
||||
|
||||
<div class="trTable red">
|
||||
<div class="content">
|
||||
<div class="date">${item.baseYearPayDay}</div>
|
||||
<div>ترک کار</div>
|
||||
</div>
|
||||
</div>`);
|
||||
}else{
|
||||
|
||||
if(item.baseYearPayDay == "-"){
|
||||
|
||||
$('.st').append(`
|
||||
<div class="trTable orange">
|
||||
<div class="content">
|
||||
<div>
|
||||
|
||||
<span class="date">${item.baseYearPayDay}</span>
|
||||
<span>فقط ارتقاء</span>
|
||||
</div>
|
||||
<div class="date">${item.baseYear}</div>
|
||||
</div>
|
||||
</div>`);
|
||||
}else{
|
||||
|
||||
$('.st').append(`
|
||||
<div class="trTable teal">
|
||||
<div class="content">
|
||||
<div class="date">${item.baseYearPayDay}</div>
|
||||
<div class="date">${item.baseYear}</div>
|
||||
</div>
|
||||
</div>`);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}else{
|
||||
$('.st').append(`
|
||||
<div class="trTable">
|
||||
<div class="trTable teal">
|
||||
<div class="content">
|
||||
<div>پایه سنوات ندارد</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
</script>
|
||||
@@ -16,10 +16,10 @@
|
||||
|
||||
|
||||
//local
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
//"MesbahDb": "Data Source=.;Initial Catalog=mesbah_db;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
//dad-mehr
|
||||
//"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
|
||||
"MesbahDb": "Data Source=.;Initial Catalog=teamWork;Integrated Security=True;TrustServerCertificate=true;",
|
||||
|
||||
"TestDb": "Data Source=.;Initial Catalog=TestDb;Integrated Security=True;TrustServerCertificate=true;"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user