Merge branch 'feature/accounts/show-admin-based-on-role' into Feature/InstitutionContract/add-registration-style
This commit is contained in:
2
.github/workflows/dotnet-developPublish.yml
vendored
2
.github/workflows/dotnet-developPublish.yml
vendored
@@ -37,7 +37,7 @@ jobs:
|
||||
& "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" `
|
||||
-verb:sync `
|
||||
-source:contentPath="$publishFolder" `
|
||||
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName=".\deployuser",password="R2rNpdnetP3j>q5b18",authType="Basic" `
|
||||
-dest:contentPath="dadmehrg",computerName="https://171.22.24.15:8172/msdeploy.axd?site=dadmehrg",userName="Administrator",password="R2rNpdnetP3j>q5b18",authType="Basic" `
|
||||
-allowUntrusted `
|
||||
-enableRule:AppOffline
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class UidBasicInformation
|
||||
{
|
||||
"GENDER_MALE" => Application.Gender.Male,
|
||||
"GENDER_FEMALE" => Application.Gender.Female,
|
||||
_ => throw new ArgumentOutOfRangeException()
|
||||
_ => Application.Gender.None
|
||||
};
|
||||
}
|
||||
public record IdentificationInformation(string NationalId, string BirthDate, string ShenasnameSeri, string ShenasnameSerial, string ShenasnamehNumber);
|
||||
|
||||
@@ -64,4 +64,6 @@ public interface IAccountApplication
|
||||
/// <param name="userName"></param>
|
||||
/// <returns></returns>
|
||||
public bool CheckExistClientAccount(string userName);
|
||||
List<AccountViewModel> GetAdminAccountsNew();
|
||||
|
||||
}
|
||||
@@ -799,4 +799,8 @@ public class AccountApplication : IAccountApplication
|
||||
return _accountRepository.CheckExistClientAccount(userName);
|
||||
}
|
||||
|
||||
public List<AccountViewModel> GetAdminAccountsNew()
|
||||
{
|
||||
return _accountRepository.GetAdminAccountsNew();
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ namespace Company.Domain.ClassifiedSalaryAgg
|
||||
{
|
||||
public class ClassifiedSalary : EntityBase
|
||||
{
|
||||
//test
|
||||
public ClassifiedSalary(double group1, double group2, double group3, double group4, double group5, double group6, double group7, double group8, double group9, double group10, double group11, double group12, double group13, double group14, double group15, double group16, double group17, double group18, double group19, double group20, DateTime startDate, DateTime endDate, int year)
|
||||
{
|
||||
Group1 = group1;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Company.Domain.RollCallAgg;
|
||||
|
||||
public interface IRollCallMandatoryRepository : IRepository<long, RollCall>
|
||||
{
|
||||
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute);
|
||||
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
|
||||
|
||||
/// <summary>
|
||||
/// محاسبه ساعات کارکرد پرسنل در صورت داشتن حضور غیاب
|
||||
|
||||
@@ -61,5 +61,9 @@ public class ComputingViewModel
|
||||
/// </summary>
|
||||
public TimeSpan EmployeeMandatoryHours { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// مجموع مرخصی های پرسنل در این فیش حقوقی
|
||||
/// </summary>
|
||||
//public TimeSpan TotalLeaveOnThisCheckout { get; set; }
|
||||
//public List<string> holidays;
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace CompanyManagment.App.Contracts.RollCall;
|
||||
public interface IRollCallMandatoryApplication
|
||||
{
|
||||
bool HasRollCallRecord(long employeeId, long workshopId, DateTime contractStart);
|
||||
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute);
|
||||
ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute);
|
||||
|
||||
/// <summary>
|
||||
/// گزارش نوبت کاری حضور غیاب
|
||||
|
||||
@@ -184,7 +184,8 @@ public class CheckoutApplication : ICheckoutApplication
|
||||
{
|
||||
command.AbsenceDeduction = command.AbsenceDeduction - command.OvertimePay;
|
||||
command.OvertimePay = 0;
|
||||
}
|
||||
command.OverTimeWorkValue = "00:00";
|
||||
}
|
||||
else
|
||||
{
|
||||
command.OvertimePay = command.OvertimePay - command.AbsenceDeduction;
|
||||
|
||||
@@ -21,9 +21,9 @@ public class RollCallMandatoryApplication : IRollCallMandatoryApplication
|
||||
return _rollCallMandatoryRepository.Exists(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.StartDate.Value.Date >= contractStart.Date);
|
||||
}
|
||||
|
||||
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute)
|
||||
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd, CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute,bool totalLeaveCompute)
|
||||
{
|
||||
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute);
|
||||
return _rollCallMandatoryRepository.MandatoryCompute(employeeId,workshopId, contractStart, contractEnd, command, holidayWorking, isStaticCheckout, rotatingShiftCompute, totalLeaveCompute);
|
||||
}
|
||||
|
||||
public async Task<ComputingViewModel> RotatingShiftReport(long workshopId, long employeeId, DateTime contractStart, DateTime contractEnd,
|
||||
|
||||
@@ -1131,7 +1131,7 @@ public class CheckoutRepository : RepositoryBase<long, Checkout>, ICheckoutRepos
|
||||
ch.TotalBreakTimeStr = ch.CheckoutRollCall.TotalBreakTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||
ch.TotalPresentTimeStr = ch.CheckoutRollCall.TotalPresentTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||
ch.TotalMandatoryTimeStr = ch.CheckoutRollCall.TotalMandatoryTimeSpan.ToFarsiHoursAndMinutes("-");
|
||||
ch.TotalPaidLeave = ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.ToFarsiDaysAndHoursAndMinutes("-");
|
||||
ch.TotalPaidLeave = Tools.ToFarsiHoursAndMinutes(Convert.ToInt32(ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.TotalHours), ch.CheckoutRollCall.TotalPaidLeaveTmeSpan.Minutes, "-");
|
||||
ch.MonthlyRollCall = ch.CheckoutRollCall.RollCallDaysCollection
|
||||
.Select(x => new CheckoutDailyRollCallViewModel
|
||||
{
|
||||
|
||||
@@ -165,7 +165,8 @@ public class FinancialStatmentRepository : RepositoryBase<long, FinancialStatmen
|
||||
Type = t.TypeOfTransaction == "debt"
|
||||
? FinancialTransactionType.Debt
|
||||
: FinancialTransactionType.Credit,
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد"
|
||||
TypeStr = t.TypeOfTransaction == "debt" ? "ایجاد درآمد" : "دریافت درآمد",
|
||||
Id = t.id
|
||||
};
|
||||
}).OrderByDescending(x=>x.DateTimeGr).ToList(),
|
||||
};
|
||||
|
||||
@@ -39,6 +39,7 @@ using PersianTools.Core;
|
||||
|
||||
|
||||
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository;
|
||||
|
||||
public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRollCallMandatoryRepository
|
||||
@@ -64,12 +65,12 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
}
|
||||
|
||||
#region OfficialChckout
|
||||
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
|
||||
DateTime contractEnd,
|
||||
CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute)
|
||||
{
|
||||
#region Entities
|
||||
#region OfficialChckout
|
||||
public ComputingViewModel MandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
|
||||
DateTime contractEnd,
|
||||
CreateWorkingHoursTemp command, bool holidayWorking, bool isStaticCheckout, bool rotatingShiftCompute, bool totalLeaveCompute)
|
||||
{
|
||||
#region Entities
|
||||
|
||||
string SumWorkeTime = string.Empty;
|
||||
var weeklyTime = new TimeSpan();
|
||||
@@ -144,7 +145,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.ShiftDate.Date).Select(x =>
|
||||
{
|
||||
|
||||
|
||||
|
||||
DateTime friday = new DateTime();
|
||||
|
||||
@@ -197,19 +198,19 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
BreakTimeSpan = x.BreakTimeSpan
|
||||
}).ToList();
|
||||
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x =>
|
||||
{
|
||||
TimeSpan breakTime;
|
||||
if (contractStart > endOfFarvardin)
|
||||
{
|
||||
breakTime = CalculateBreakTime(
|
||||
x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)));
|
||||
}
|
||||
else
|
||||
{
|
||||
breakTime = CalculateBreakTime(breakTimeEntity, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)));
|
||||
}
|
||||
groupedRollCall = rollCallResult.GroupBy(x => x.CreationDate.Date).Select(x =>
|
||||
{
|
||||
TimeSpan breakTime;
|
||||
if (contractStart > endOfFarvardin)
|
||||
{
|
||||
breakTime = CalculateBreakTime(
|
||||
x.First().BreakTimeSpan,
|
||||
new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)));
|
||||
}
|
||||
else
|
||||
{
|
||||
breakTime = CalculateBreakTime(breakTimeEntity, new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)));
|
||||
}
|
||||
|
||||
DateTime friday = new DateTime();
|
||||
|
||||
@@ -220,7 +221,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
s.StartDate != null && s.EndDate != null &&
|
||||
(s.StartDate.Value.DayOfWeek == DayOfWeek.Friday))
|
||||
.StartDate.Value;
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (x.Any(s =>
|
||||
@@ -233,15 +234,15 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
}
|
||||
|
||||
return new GroupedRollCalls()
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value, EndWithOutResTime = s.EndDate!.Value })
|
||||
.ToList(),
|
||||
//HasFriday = x.Any(s =>
|
||||
// s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday ||
|
||||
// s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
{
|
||||
CreationDate = x.Key,
|
||||
ShiftList = x.Select(s => new ShiftList() { Start = s.StartDate!.Value, End = s.EndDate!.Value, EndWithOutResTime = s.EndDate!.Value })
|
||||
.ToList(),
|
||||
//HasFriday = x.Any(s =>
|
||||
// s.StartDate != null && s.EndDate != null && (s.StartDate.Value.DayOfWeek == DayOfWeek.Friday ||
|
||||
// s.EndDate.Value!.DayOfWeek == DayOfWeek.Friday)),
|
||||
|
||||
Fridays = friday,
|
||||
Fridays = friday,
|
||||
|
||||
SumOneDaySpan = new TimeSpan(x.Sum(shift => shift.ShiftSpan.Ticks)) - breakTime,
|
||||
|
||||
@@ -265,7 +266,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
|
||||
TimeSpan sumSpans = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
TimeSpan sumSpansWhitOutleaves = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
TimeSpan sumSpansWhitOutleaves = new TimeSpan(groupedRollCall.Sum(x => x.SumOneDaySpan.Ticks));
|
||||
|
||||
|
||||
//بدست آوردن مرخصی ساعتی
|
||||
@@ -323,6 +324,9 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
TimeSpan totalLeaveSpan = TimeSpan.Zero;
|
||||
TimeSpan starndardHoursesPerTotalDaysSapn = new TimeSpan(hours, minutes, 0);
|
||||
|
||||
//محموع تمام مرخصی های این ماه
|
||||
//TimeSpan totalLeaveOnThisCheckout = TimeSpan.Zero;
|
||||
if (leaveSearchResult.Count > 0 || hoursesleave.Count > 0)
|
||||
{
|
||||
if (leaveSearchResult.Any(x => x.HasShiftDuration))
|
||||
@@ -342,8 +346,11 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
TimeSpan totalLeave = new TimeSpan(leaveSearchResult.Sum(x => x.ShiftDuration.Ticks));
|
||||
totalLeave = totalLeave.Add(hoursesleaveTimeSpans);
|
||||
//totalLeaveOnThisCheckout = totalLeave;
|
||||
var totalLeaveDouble = (totalLeave.TotalMinutes) / 60;
|
||||
if (totalLeaveDouble > starndardHoursesPerTotalDays)
|
||||
|
||||
//اگر مدت مرخصی از مجاز بیشتر بود و مدل محاسبه کامل نبود
|
||||
if (totalLeaveDouble > starndardHoursesPerTotalDays && !totalLeaveCompute)
|
||||
{
|
||||
|
||||
sumSpans = sumSpans.Add(starndardHoursesPerTotalDaysSapn);
|
||||
@@ -402,7 +409,7 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
}
|
||||
|
||||
|
||||
if (sumLeave > starndardHoursesPerTotalDaysSapn)
|
||||
if (sumLeave > starndardHoursesPerTotalDaysSapn && !totalLeaveCompute)
|
||||
{
|
||||
sumSpans = sumSpans.Add(starndardHoursesPerTotalDaysSapn);
|
||||
totalLeaveSpan = starndardHoursesPerTotalDaysSapn;
|
||||
@@ -413,7 +420,11 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
totalLeaveSpan = sumLeave;
|
||||
}
|
||||
|
||||
|
||||
//#region TotalLeaveOnThisCheckout
|
||||
|
||||
//totalLeaveOnThisCheckout = (leavingDayCout * workingPerDayAve).Add(hoursesleaveTimeSpans);
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -886,9 +897,13 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
// مرخصی استحقاقی
|
||||
TotalPaidLeave = totalLeaveSpan,
|
||||
|
||||
//// مجموع مرخصی های پرسنل در این فیش حقوقی
|
||||
//TotalLeaveOnThisCheckout = totalLeaveOnThisCheckout,
|
||||
|
||||
//مرخصی استعلاجی
|
||||
TotalSickLeave = new TimeSpan(sickLeaveTimeSpans.Sum(x => x.Ticks)),
|
||||
|
||||
|
||||
//ساعت موظفی پرسنل در این ماه
|
||||
EmployeeMandatoryHours = mandatoryHoursTimeSpan,
|
||||
#endregion
|
||||
@@ -1787,6 +1802,69 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
var startDateAndTime = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute);
|
||||
var startContract = new PersianDateTime(syear, smonth, sday, start.Hour, start.Minute);
|
||||
var endContract = new PersianDateTime(eyear, emonth, eday, 23, 59);
|
||||
var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList();
|
||||
//int totalLeaveDays = countLeves.Sum(x => int.Parse(x.LeaveHourses));
|
||||
List<LeaveViewModel> affectedLeaves = new List<LeaveViewModel>();
|
||||
|
||||
DateTime contractStart = ($"{startContract}").ToGeorgianDateTime();
|
||||
DateTime contractEnd = ($"{endContract}").ToGeorgianDateTime();
|
||||
int leavingDayCout = 0;
|
||||
List<LeaveViewModel> thisCheckoutLeaves = new List<LeaveViewModel>();
|
||||
|
||||
|
||||
if (leaveSearchResult.Count > 0)
|
||||
{
|
||||
foreach (var leave in leaveSearchResult)
|
||||
{
|
||||
//مرخصی های مابین
|
||||
if (leave.StartLeaveGr >= contractStart && leave.EndLeaveGr <= contractEnd)
|
||||
{
|
||||
var modifyleave = new LeaveViewModel()
|
||||
{
|
||||
Id = leave.Id,
|
||||
StartLeaveGr = leave.StartLeaveGr,
|
||||
EndLeaveGr = leave.EndLeaveGr
|
||||
};
|
||||
thisCheckoutLeaves.Add(leave);
|
||||
}
|
||||
|
||||
// مرخصی که شروعش قبل از شروع تصفیه حساب است
|
||||
if (leave.StartLeaveGr < contractStart && leave.EndLeaveGr <= contractEnd)
|
||||
{
|
||||
var modifyleave = new LeaveViewModel()
|
||||
{
|
||||
Id = leave.Id,
|
||||
StartLeaveGr = contractStart,
|
||||
EndLeaveGr = leave.EndLeaveGr
|
||||
};
|
||||
thisCheckoutLeaves.Add(modifyleave);
|
||||
}
|
||||
// مرخصی که پایانش بعد از پایان تصفیه حساب است
|
||||
if (leave.EndLeaveGr > contractEnd && leave.StartLeaveGr >= contractStart)
|
||||
{
|
||||
var modifyleave = new LeaveViewModel()
|
||||
{
|
||||
Id = leave.Id,
|
||||
StartLeaveGr = leave.StartLeaveGr,
|
||||
EndLeaveGr = contractEnd,
|
||||
};
|
||||
thisCheckoutLeaves.Add(modifyleave);
|
||||
}
|
||||
|
||||
//مرخصی استثنا که تمام بازه فیش را پوشش میدهد
|
||||
if (leave.StartLeaveGr < contractStart && leave.EndLeaveGr > contractEnd)
|
||||
{
|
||||
var modifyleave = new LeaveViewModel()
|
||||
{
|
||||
Id = leave.Id,
|
||||
StartLeaveGr = leave.StartLeaveGr,
|
||||
EndLeaveGr = contractEnd,
|
||||
};
|
||||
thisCheckoutLeaves.Add(modifyleave);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var da = startDateAndTime; da <= endContract; da = da.AddHours(addHours))
|
||||
{
|
||||
|
||||
@@ -1810,14 +1888,31 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
end.Second);
|
||||
Console.WriteLine($"{currentDateFa} - {currentDateGr.Date} - start : {startComplex} end : {endComplex}");
|
||||
|
||||
rollCallList.Add(new RollCallViewModel()
|
||||
|
||||
var hasLeave = thisCheckoutLeaves.Any(x => startComplex.Date <= x.EndLeaveGr.Date && endComplex.Date >= x.StartLeaveGr.Date);
|
||||
if (!hasLeave)
|
||||
{
|
||||
StartDate = startComplex,
|
||||
EndDate = endComplex,
|
||||
ShiftSpan = (endComplex - startComplex),
|
||||
ShiftDate = currentDateGr,
|
||||
ShiftEndWithoutRest = endComplex
|
||||
});
|
||||
rollCallList.Add(new RollCallViewModel()
|
||||
{
|
||||
StartDate = startComplex,
|
||||
EndDate = endComplex,
|
||||
ShiftSpan = (endComplex - startComplex),
|
||||
ShiftDate = currentDateGr,
|
||||
ShiftEndWithoutRest = endComplex
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var affected = thisCheckoutLeaves.FirstOrDefault(x => startComplex.Date <= x.EndLeaveGr.Date && endComplex.Date >= x.StartLeaveGr.Date);
|
||||
var modifyleave = new LeaveViewModel()
|
||||
{
|
||||
Id = affected.Id,
|
||||
StartLeaveGr = affected.StartLeaveGr,
|
||||
EndLeaveGr = affected.EndLeaveGr
|
||||
};
|
||||
affectedLeaves.Add(modifyleave);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var endCal = end - start;
|
||||
@@ -1826,14 +1921,20 @@ public class RollCallMandatoryRepository : RepositoryBase<long, RollCall>, IRoll
|
||||
|
||||
}
|
||||
|
||||
var countLeves = leaveSearchResult.Where(x => x.PaidLeaveType == "روزانه").ToList();
|
||||
if (countLeves.Count > 0)
|
||||
|
||||
|
||||
affectedLeaves = affectedLeaves.DistinctBy(x => x.Id).ToList();
|
||||
|
||||
//مرخصی هایی که تاریخ آن ها بین رکورد های حضور پرسنل بوده و اعمال نشده
|
||||
var exceptionLeaves = thisCheckoutLeaves
|
||||
.Where(t => !affectedLeaves.Select(a => a.Id).Contains(t.Id))
|
||||
.ToList();
|
||||
|
||||
//حذف رکورد های حضور به تعداد مرخصی های اعمال نشده
|
||||
if (exceptionLeaves.Count > 0)
|
||||
{
|
||||
int totalDays = countLeves.Sum(x => int.Parse(x.LeaveHourses));
|
||||
|
||||
|
||||
int countRollCall = rollCallList.Count();
|
||||
int takRollCall = totalDays < countRollCall ? (countRollCall - totalDays) : 0;
|
||||
int takRollCall = exceptionLeaves.Count < countRollCall ? (countRollCall - exceptionLeaves.Count) : 0;
|
||||
rollCallList = rollCallList.Take(takRollCall).ToList();
|
||||
}
|
||||
|
||||
|
||||
@@ -2133,6 +2133,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
else if (isOldContract && contractEnd > start1403)
|
||||
{
|
||||
var startDate = startWorkDate >= start1403 ? startWorkDate : start1403;
|
||||
|
||||
|
||||
var endOfYearRes = EndOfYearCantoleaveList(startDate, separationEndDate, workshopId, employeeId, hasleft, leftWorkDate, fridayStartToEnd, officialHoliday, totalHoursH, totalHorsM, separationStartDate)
|
||||
.FirstOrDefault(x => x.ContractStart == separationStartDate);
|
||||
@@ -2141,12 +2142,13 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
var end = EndOfYearCantoleaveList(startDate, separationEndDate, workshopId, employeeId,
|
||||
hasleft, leftWorkDate, fridayStartToEnd, officialHoliday, totalHoursH, totalHorsM,
|
||||
separationStartDate);
|
||||
|
||||
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
result.LeaveCheckout = true;
|
||||
|
||||
var canTolv = endOfYearRes.CanToLeave;
|
||||
var absence = end.Sum(x => x.PeriodOfAbsence);
|
||||
var absence = end.Where(x=>x.ContractStart >= startDayOfYearGr).Sum(x => x.PeriodOfAbsence);
|
||||
|
||||
if (canTolv >= absence)
|
||||
{
|
||||
@@ -2208,8 +2210,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
separationStartDate);
|
||||
|
||||
var canTolv = endOfYearRes.CanToLeave;
|
||||
var absence = end.Sum(x => x.PeriodOfAbsence);
|
||||
if (canTolv >= absence)
|
||||
var absence = end.Where(x => x.ContractStart >= startDayOfYearGr).Sum(x => x.PeriodOfAbsence);
|
||||
if (canTolv >= absence)
|
||||
{
|
||||
canTolv -= absence;
|
||||
absence = 0;
|
||||
|
||||
@@ -8,6 +8,7 @@ public class AccountController:AdminBaseController
|
||||
{
|
||||
private readonly IAccountApplication _accountApplication;
|
||||
|
||||
|
||||
public AccountController(IAccountApplication accountApplication)
|
||||
{
|
||||
_accountApplication = accountApplication;
|
||||
@@ -22,4 +23,28 @@ public class AccountController:AdminBaseController
|
||||
var res = await _accountApplication.GetAdminSelectList();
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet("admins-by-role")]
|
||||
public ActionResult<AdminAccountByRoleResponse> GetAdminAccountsByRole()
|
||||
{
|
||||
var adminAccounts = _accountApplication.GetAdminAccountsNew().Select(x=> new AccountSelectListViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Name = x.Fullname,
|
||||
RoleId = x.RoleId
|
||||
}).ToList();
|
||||
|
||||
var seniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 3).ToList();
|
||||
var juniorContractAccountsList = adminAccounts.Where(x => x.RoleId == 5).ToList();
|
||||
var seniorInsuranceAccountList = adminAccounts.Where(x => x.RoleId == 7).ToList();
|
||||
var juniorInsuranceAccountsList = adminAccounts.Where(x => x.RoleId == 8).ToList();
|
||||
return new AdminAccountByRoleResponse(seniorContractAccountsList, juniorContractAccountsList,
|
||||
seniorInsuranceAccountList, juniorInsuranceAccountsList);
|
||||
}
|
||||
}
|
||||
|
||||
public record AdminAccountByRoleResponse(
|
||||
List<AccountSelectListViewModel> SeniorContractAccountsList,
|
||||
List<AccountSelectListViewModel> JuniorContractAccountsList,
|
||||
List<AccountSelectListViewModel> SeniorInsuranceAccountList,
|
||||
List<AccountSelectListViewModel> JuniorInsuranceAccountsList);
|
||||
75
ServiceHost/Areas/Admin/Controllers/DashboardController.cs
Normal file
75
ServiceHost/Areas/Admin/Controllers/DashboardController.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using AccountManagement.Application.Contracts.Task;
|
||||
using AccountManagement.Application.Contracts.Ticket;
|
||||
using CompanyManagment.App.Contracts.ClientDashboard;
|
||||
using CompanyManagment.App.Contracts.HolidayItem;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using PersianTools.Core;
|
||||
using ServiceHost.BaseControllers;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Controllers;
|
||||
|
||||
public class DashboardController : AdminBaseController
|
||||
{
|
||||
private readonly ISmsService _smsService;
|
||||
private readonly IHolidayItemApplication _holidayItemApplication;
|
||||
private readonly ITaskApplication _taskApplication;
|
||||
private readonly ITicketApplication _ticketApplication;
|
||||
private long UserId;
|
||||
|
||||
public DashboardController(ISmsService smsService, IHolidayItemApplication holidayItemApplication, ITaskApplication taskApplication,IAuthHelper authHelper, ITicketApplication ticketApplication)
|
||||
{
|
||||
_smsService = smsService;
|
||||
_holidayItemApplication = holidayItemApplication;
|
||||
_taskApplication = taskApplication;
|
||||
_ticketApplication = ticketApplication;
|
||||
UserId = authHelper.CurrentAccountId();
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<AdminDashboardViewModel>> Index()
|
||||
{
|
||||
var calenderList = new List<CalenderViewModel>();
|
||||
|
||||
var todayGr = DateTime.Today;
|
||||
var todayFa = todayGr.ToFarsi();
|
||||
|
||||
var todayPersian = new PersianDateTime(
|
||||
int.Parse(todayFa.Substring(0, 4)),
|
||||
int.Parse(todayFa.Substring(5, 2)),
|
||||
int.Parse(todayFa.Substring(8, 2))
|
||||
);
|
||||
|
||||
var startDate =new PersianDateTime(todayGr.AddDays(-3));
|
||||
var endDate =new PersianDateTime(todayGr.AddDays(3));
|
||||
|
||||
|
||||
for (var day = startDate; day <= endDate; day = day.AddDays(1))
|
||||
{
|
||||
var calenderNewItem = new CalenderViewModel
|
||||
{
|
||||
DayNumber = day.ToString("dd"),
|
||||
IsToday = day.DateTime == todayGr,
|
||||
DayOfWeek = day.DayOfWeek,
|
||||
Holiday = _holidayItemApplication.IsHoliday(day.ToGregorianDateTime()) || day.DayOfWeek== "جمعه"
|
||||
};
|
||||
calenderList.Add(calenderNewItem);
|
||||
}
|
||||
var taskCount = await _taskApplication.RequestedAndOverdueTasksCount(UserId);
|
||||
var ticketCount = _ticketApplication.GetAdminTicketsCount();
|
||||
|
||||
|
||||
return new AdminDashboardViewModel(calenderList, taskCount, ticketCount);
|
||||
}
|
||||
|
||||
[HttpGet("sms-remaining")]
|
||||
public async Task<ActionResult<SmsRemainingResult>> OnGetSmsRemaining()
|
||||
{
|
||||
var result = (int)await _smsService.GetCreditAmount();
|
||||
return new SmsRemainingResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
public record SmsRemainingResult(int Data);
|
||||
|
||||
public record AdminDashboardViewModel(List<CalenderViewModel> Calender, int TaskCount, int TicketCount);
|
||||
@@ -31,6 +31,7 @@ using PersianTools.Core;
|
||||
using ServiceHost.Hubs;
|
||||
using System.Diagnostics.Contracts;
|
||||
using WorkFlow.Application.Contracts.WorkFlow;
|
||||
using System.Globalization;
|
||||
|
||||
namespace ServiceHost.Areas.Admin.Pages.Company.Checkouts;
|
||||
|
||||
@@ -766,9 +767,51 @@ public class IndexModel : PageModel
|
||||
var workingHours = _workingHoursTempApplication.GetByContractIdConvertToShiftwork4(contract.Id);
|
||||
var separation = _contractApplication.contractSeparation(ConvertYear, ConvertMonth,
|
||||
contract.ContractStartGr, contract.ContractEndGr, contract.EmployeeId, contract.WorkshopIds);
|
||||
|
||||
|
||||
if (separation.checker)
|
||||
{
|
||||
//workshopInfo
|
||||
var workshop = _workshopApplication.GetDetails(contract.WorkshopIds);
|
||||
|
||||
var employeeOptions =
|
||||
_employeeComputeOptionsApplication.GetAllByWorkshopId(contract.WorkshopIds);
|
||||
var getYearsOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
|
||||
var yearsOption = getYearsOption == null ? workshop.YearsOptions : getYearsOption.YearsOptions;
|
||||
var getBonusesOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
|
||||
var bonusesOption = getBonusesOption == null
|
||||
? workshop.BonusesOptions
|
||||
: getBonusesOption.BonusesOptions;
|
||||
var getComputeOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
|
||||
var computeOption = getComputeOption == null
|
||||
? workshop.ComputeOptions
|
||||
: getComputeOption.ComputeOptions;
|
||||
//آیا کل مرخصی به ساعت کاراضافه شود؟
|
||||
bool totalLeaveCompute = false;
|
||||
//آیا غیبت محاسبه شود؟
|
||||
bool abcenseDeduction = false;
|
||||
switch (computeOption)
|
||||
{
|
||||
case "OnEndOfYear":
|
||||
var endOfYearCheckout = separation.ContractEnd.Substring(5, 2);
|
||||
|
||||
|
||||
totalLeaveCompute = true;
|
||||
abcenseDeduction = separation.HasLeft || endOfYearCheckout == "12";
|
||||
break;
|
||||
case "OnLeftWork":
|
||||
|
||||
totalLeaveCompute = true;
|
||||
abcenseDeduction = separation.HasLeft;
|
||||
break;
|
||||
case "OnEndOfContract":
|
||||
var startMonth = contract.ContarctStart.Substring(5, 2);
|
||||
var endMonth = contract.ContractEnd.Substring(5, 2);
|
||||
|
||||
totalLeaveCompute = startMonth == endMonth ? false : true;
|
||||
abcenseDeduction = (startMonth != endMonth && separation.HasLeft) || (startMonth != endMonth && contract.ContractEndGr == separation.ContractEndGr);
|
||||
break;
|
||||
}
|
||||
|
||||
workingHours.ContractStartGr = separation.ContractStartGr;
|
||||
workingHours.ContractEndGr = separation.ContractEndGr;
|
||||
workingHours.ContarctStart = separation.ContarctStart;
|
||||
@@ -777,8 +820,7 @@ public class IndexModel : PageModel
|
||||
workingHours.GetWorkDateHide = contract.GetWorkDate;
|
||||
workingHours.WorkshopId = contract.WorkshopIds;
|
||||
workingHours.EmployeeId = contract.EmployeeId;
|
||||
//workshopInfo
|
||||
var workshop = _workshopApplication.GetDetails(contract.WorkshopIds);
|
||||
|
||||
var mandatoryCompute = new ComputingViewModel();
|
||||
|
||||
var hasRollCall = _rollCallEmployeeStatusApp.HasRollCallRecord(contract.EmployeeId,
|
||||
@@ -790,13 +832,13 @@ public class IndexModel : PageModel
|
||||
{
|
||||
mandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId,
|
||||
contract.WorkshopIds,
|
||||
separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, false,workshop.RotatingShiftCompute);
|
||||
separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, false,workshop.RotatingShiftCompute, totalLeaveCompute);
|
||||
}
|
||||
else
|
||||
{
|
||||
mandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId,
|
||||
contract.WorkshopIds,
|
||||
separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, true,workshop.RotatingShiftCompute);
|
||||
separation.ContractStartGr, separation.ContractEndGr, workingHours, workshop.WorkshopHolidayWorking, true,workshop.RotatingShiftCompute, totalLeaveCompute);
|
||||
//var hasLeave = _leaveApplication.LeavOnChekout(separation.ContractStartGr,
|
||||
// separation.ContractEndGr, contract.EmployeeId, contract.WorkshopIds);
|
||||
//if (hasLeave != null)
|
||||
@@ -842,18 +884,6 @@ public class IndexModel : PageModel
|
||||
// workshop.ComputeOptions = "OnEndOfContract";
|
||||
//}
|
||||
|
||||
var employeeOptions =
|
||||
_employeeComputeOptionsApplication.GetAllByWorkshopId(contract.WorkshopIds);
|
||||
var getYearsOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
|
||||
var yearsOption = getYearsOption == null ? workshop.YearsOptions : getYearsOption.YearsOptions;
|
||||
var getBonusesOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
|
||||
var bonusesOption = getBonusesOption == null
|
||||
? workshop.BonusesOptions
|
||||
: getBonusesOption.BonusesOptions;
|
||||
var getComputeOption = employeeOptions.FirstOrDefault(x => x.EmployeeId == contract.EmployeeId);
|
||||
var computeOption = getComputeOption == null
|
||||
? workshop.ComputeOptions
|
||||
: getComputeOption.ComputeOptions;
|
||||
|
||||
//سنوات
|
||||
var yearsPay = _yearlySalaryRepository.Years(separation.ContractStartGr, separation.LeftWorkDate,
|
||||
@@ -904,7 +934,7 @@ public class IndexModel : PageModel
|
||||
{
|
||||
foundMandatoryCompute = _rollCallMandatoryApplication.MandatoryCompute(contract.EmployeeId,
|
||||
contract.WorkshopIds,
|
||||
found.ContractStart, found.ContractEnd, foundWorkingHours, workshop.WorkshopHolidayWorking, false, workshop.RotatingShiftCompute);
|
||||
found.ContractStart, found.ContractEnd, foundWorkingHours, workshop.WorkshopHolidayWorking, false, workshop.RotatingShiftCompute, totalLeaveCompute);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -949,6 +979,8 @@ public class IndexModel : PageModel
|
||||
contract.ContractEndGr, contract.WorkshopIds, contract.EmployeeId, fridayStartToEnd,
|
||||
officialHoliday, totalHoursH, totalHoursM, consumableItemDouble, housingAllowanceDouble,
|
||||
familyAllowanceDouble, marriedAllowanceDouble, workshop.IsOldContract);
|
||||
|
||||
|
||||
var command = new CreateCheckout
|
||||
{
|
||||
EmployeeFullName = employee.EmployeeFullName,
|
||||
@@ -997,7 +1029,7 @@ public class IndexModel : PageModel
|
||||
//مدت غیبت
|
||||
AbsencePeriod = leavePayNew.AbsencePeriod,
|
||||
//کسری غیبت
|
||||
AbsenceDeduction = 0,
|
||||
AbsenceDeduction = abcenseDeduction ? leavePayNew.AbsenceDeduction : 0,
|
||||
//وضعیت تصفیه مزد مرخصی
|
||||
LeaveCheckout = leavePayNew.LeaveCheckout,
|
||||
//میانگین ساعت کار در روز
|
||||
|
||||
@@ -571,6 +571,12 @@
|
||||
} else if (response.data.gender === 1) {
|
||||
$('#GenderFemale').prop('checked', true);
|
||||
$('#soldier').prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$('#GenderMale').removeClass("disable");
|
||||
$('#GenderFemale').removeClass("disable");
|
||||
$('#divGender .radio-box').removeClass('disable');
|
||||
|
||||
}
|
||||
currentStep++;
|
||||
showStep(currentStep);
|
||||
|
||||
@@ -571,6 +571,11 @@
|
||||
} else if (response.data.gender === 1) {
|
||||
$('#GenderFemale').prop('checked', true);
|
||||
$('#soldier').prop('disabled', true);
|
||||
}
|
||||
else{
|
||||
$('#GenderMale').removeClass("disable");
|
||||
$('#GenderFemale').removeClass("disable");
|
||||
$('#divGender .radio-box').removeClass('disable');
|
||||
}
|
||||
currentStep++;
|
||||
showStep(currentStep);
|
||||
|
||||
@@ -315,6 +315,7 @@ app.UseCors("AllowSpecificOrigins");
|
||||
|
||||
//the backend Tester
|
||||
if (builder.Environment.IsDevelopment())
|
||||
|
||||
{
|
||||
using var scope = app.Services.CreateScope();
|
||||
var tester = scope.ServiceProvider.GetRequiredService<Tester>();
|
||||
|
||||
Reference in New Issue
Block a user