merge from edit checkout on change salary aid and ....
This commit is contained in:
@@ -320,8 +320,16 @@ public class SmsService : ISmsService
|
||||
|
||||
public async Task<double> GetCreditAmount()
|
||||
{
|
||||
var credit = await SmsIr.GetCreditAsync();
|
||||
return (double)credit.Data;
|
||||
try
|
||||
{
|
||||
var credit = await SmsIr.GetCreditAsync();
|
||||
return (double)credit.Data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -475,25 +475,30 @@ public static class Tools
|
||||
public static double MoneyToDouble(this string myMoney)
|
||||
{
|
||||
string bb = string.Empty;
|
||||
bool isNegative = false;
|
||||
|
||||
for (int x = 0; x < myMoney.Length; x++)
|
||||
{
|
||||
if (char.IsDigit(myMoney[x]))
|
||||
{
|
||||
bb += myMoney[x];
|
||||
}
|
||||
else if (myMoney[x] == '-' && bb.Length == 0)
|
||||
{
|
||||
// اگر علامت منفی قبل از اولین عدد آمد، در نظر بگیر
|
||||
isNegative = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (bb.Length > 0)
|
||||
{
|
||||
double res = double.Parse(bb);
|
||||
return res;
|
||||
return isNegative ? -res : res;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
public static string ToFileName(this DateTime date)
|
||||
{
|
||||
@@ -615,90 +620,90 @@ public static class Tools
|
||||
/// <returns></returns>
|
||||
public static int YearTotalDays(this string date)
|
||||
{
|
||||
int y2 = 365;
|
||||
int y2 = 366;
|
||||
var year = Convert.ToInt32(date.Substring(0, 4));
|
||||
|
||||
|
||||
switch (year)
|
||||
{
|
||||
case 1346:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1350:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1354:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1358:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1362:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1366:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1370:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1375:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1379:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1383:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1387:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1391:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1395:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1399:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1403:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1408:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1412:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1416:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1420:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1424:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1428:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1432:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1436:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1441:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
case 1445:
|
||||
y2 = 366;
|
||||
y2 = 367;
|
||||
break;
|
||||
|
||||
default:
|
||||
y2 = 365;
|
||||
y2 = 366;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@@ -1866,7 +1866,7 @@ public class TaskRepository : RepositoryBase<long, Tasks>, ITaskRepository
|
||||
.Include(x => x.Task).ThenInclude(x => x.TaskSchedule)
|
||||
.Where(x =>
|
||||
x.Task.IsActiveString == "true" && x.Task.SenderId == accountId
|
||||
&& x.Task.TaskScheduleId != null && x.Task.TaskScheduleId > 0 && (!x.IsCanceledRequest && !x.TimeRequest && !x.IsDoneRequest));
|
||||
&& x.Task.TaskScheduleId != null && x.Task.TaskScheduleId > 0 && (!x.IsCanceledRequest && !x.TimeRequest && !x.IsDoneRequest) && x.Task.TaskSchedule.IsActive == IsActive.True);
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.GeneralSearch))
|
||||
{
|
||||
raw = raw.Where(x =>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Domain;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
@@ -18,20 +19,20 @@ public class CustomizeCheckout : EntityBase
|
||||
private CustomizeCheckout()
|
||||
{ }
|
||||
public CustomizeCheckout(DateTime contractStart, DateTime contractEnd, long employeeId, string employeeFName,
|
||||
string employeeLName, DateTime employeeDateOfBirth,
|
||||
string employeeNationalCode, string workshopFullName, long workshopId, long? contractId,
|
||||
double monthlySalary, double fridayPay, double overTimePay, double baseYearsPay, double bonusesPay,
|
||||
double nightWorkPay,
|
||||
double marriedAllowance, double shiftPay, double familyAllowance, double leavePay, double insuranceDeduction,
|
||||
double fineAbsenceDeduction,
|
||||
double lateToWorkDeduction, double earlyExitDeduction, double rewardPay, double salaryAidDeduction,
|
||||
double installmentDeduction,
|
||||
double fineDeduction, double taxDeduction, string sumOfWorkingDays, string totalClaims, string totalDeductions,
|
||||
double totalPayment, string contractNo, ICollection<CustomizeCheckoutFine> checkoutFines,
|
||||
ICollection<CustomizeCheckoutLoanInstallments> customizeCheckoutLoanInstallments,
|
||||
ICollection<CustomizeCheckoutSalaryAid> customizeCheckoutSalaryAids,
|
||||
ICollection<CustomizeCheckoutReward> customizeCheckoutRewards, TimeSpan lateToWorkValue, double settingSalary,
|
||||
double dailyWage, WorkshopShiftStatus shiftStatus, IrregularShift irregularShift,
|
||||
string employeeLName, DateTime employeeDateOfBirth,
|
||||
string employeeNationalCode, string workshopFullName, long workshopId, long? contractId,
|
||||
double monthlySalary, double fridayPay, double overTimePay, double baseYearsPay, double bonusesPay,
|
||||
double nightWorkPay,
|
||||
double marriedAllowance, double shiftPay, double familyAllowance, double leavePay, double insuranceDeduction,
|
||||
double fineAbsenceDeduction,
|
||||
double lateToWorkDeduction, double earlyExitDeduction, double rewardPay, double salaryAidDeduction,
|
||||
double installmentDeduction,
|
||||
double fineDeduction, double taxDeduction, string sumOfWorkingDays, string totalClaims, string totalDeductions,
|
||||
double totalPayment, string contractNo, ICollection<CustomizeCheckoutFine> checkoutFines,
|
||||
ICollection<CustomizeCheckoutLoanInstallments> customizeCheckoutLoanInstallments,
|
||||
ICollection<CustomizeCheckoutSalaryAid> customizeCheckoutSalaryAids,
|
||||
ICollection<CustomizeCheckoutReward> customizeCheckoutRewards, TimeSpan lateToWorkValue, double settingSalary,
|
||||
double dailyWage, WorkshopShiftStatus shiftStatus, IrregularShift irregularShift,
|
||||
ICollection<CustomizeRotatingShift> customizeRotatingShifts, ICollection<CustomizeCheckoutRegularShift> employeeSettingsShifts)
|
||||
{
|
||||
YearInt = Convert.ToInt32(contractStart.ToFarsi().Substring(0, 4));
|
||||
@@ -77,8 +78,8 @@ public class CustomizeCheckout : EntityBase
|
||||
|
||||
LateToWorkValue = lateToWorkValue;
|
||||
SettingSalary = settingSalary;
|
||||
DailyWage = dailyWage;
|
||||
ShiftStatus = shiftStatus;
|
||||
DailyWage = dailyWage;
|
||||
ShiftStatus = shiftStatus;
|
||||
IrregularShift = irregularShift;
|
||||
CustomizeRotatingShifts = customizeRotatingShifts;
|
||||
RegularShifts = employeeSettingsShifts;
|
||||
@@ -257,17 +258,17 @@ public class CustomizeCheckout : EntityBase
|
||||
/// </summary>
|
||||
public double TotalPayment { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// مزد روزانه
|
||||
/// </summary>
|
||||
public double DailyWage { get; private set; }
|
||||
/// <summary>
|
||||
/// مزد روزانه
|
||||
/// </summary>
|
||||
public double DailyWage { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// حقوق تعیین شده
|
||||
/// </summary>
|
||||
public double SettingSalary { get; private set; }
|
||||
/// <summary>
|
||||
/// حقوق تعیین شده
|
||||
/// </summary>
|
||||
public double SettingSalary { get; private set; }
|
||||
|
||||
public WorkshopShiftStatus ShiftStatus { get; set; }
|
||||
public WorkshopShiftStatus ShiftStatus { get; set; }
|
||||
|
||||
|
||||
#region Values
|
||||
@@ -301,4 +302,78 @@ public class CustomizeCheckout : EntityBase
|
||||
|
||||
#endregion
|
||||
|
||||
public void SetValueObjects(ICollection<CustomizeCheckoutFine> checkoutFines,
|
||||
ICollection<CustomizeCheckoutLoanInstallments> customizeCheckoutLoanInstallments,
|
||||
ICollection<CustomizeCheckoutSalaryAid> customizeCheckoutSalaryAids,
|
||||
ICollection<CustomizeCheckoutReward> customizeCheckoutRewards)
|
||||
{
|
||||
CheckoutFines = checkoutFines;
|
||||
CustomizeCheckoutLoanInstallments = customizeCheckoutLoanInstallments;
|
||||
CustomizeCheckoutSalaryAids = customizeCheckoutSalaryAids;
|
||||
CustomizeCheckoutRewards = customizeCheckoutRewards;
|
||||
}
|
||||
|
||||
public void SetRewards(ICollection<CustomizeCheckoutReward> rewards)
|
||||
{
|
||||
var previousTotalAmount = CustomizeCheckoutRewards.Sum(x => x.Amount.MoneyToDouble());
|
||||
var newTotalAmount = rewards.Sum(x => x.Amount.MoneyToDouble());
|
||||
RewardPay = newTotalAmount;
|
||||
IncreaseTotalPayment(previousTotalAmount, newTotalAmount);
|
||||
RecalculateTotalClaims(previousTotalAmount, newTotalAmount);
|
||||
CustomizeCheckoutRewards = rewards;
|
||||
}
|
||||
|
||||
public void SetSalaryAids(ICollection<CustomizeCheckoutSalaryAid> salaryAids)
|
||||
{
|
||||
var previousTotalAmount = CustomizeCheckoutSalaryAids.Sum(x => x.Amount.MoneyToDouble());
|
||||
var newTotalAmount = salaryAids.Sum(x => x.Amount.MoneyToDouble());
|
||||
SalaryAidDeduction = newTotalAmount;
|
||||
ReduceTotalPayment(previousTotalAmount, newTotalAmount);
|
||||
RecalculateTotalDeduction(previousTotalAmount, newTotalAmount);
|
||||
CustomizeCheckoutSalaryAids = salaryAids;
|
||||
}
|
||||
|
||||
public void SetFines(ICollection<CustomizeCheckoutFine> fines)
|
||||
{
|
||||
var previousTotalAmount = CheckoutFines.Sum(x => x.Amount.MoneyToDouble());
|
||||
var newTotalAmount = fines.Sum(x => x.Amount.MoneyToDouble());
|
||||
FineDeduction = newTotalAmount;
|
||||
ReduceTotalPayment(previousTotalAmount, newTotalAmount);
|
||||
RecalculateTotalDeduction(previousTotalAmount, newTotalAmount);
|
||||
CheckoutFines = fines;
|
||||
}
|
||||
|
||||
public void SetLoanInstallment(ICollection<CustomizeCheckoutLoanInstallments> installments)
|
||||
{
|
||||
var previousTotalAmount = CustomizeCheckoutLoanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());
|
||||
var newTotalAmount = installments.Sum(x => x.AmountForMonth.MoneyToDouble());
|
||||
InstallmentDeduction = newTotalAmount;
|
||||
ReduceTotalPayment(previousTotalAmount, newTotalAmount);
|
||||
RecalculateTotalDeduction(previousTotalAmount, newTotalAmount);
|
||||
CustomizeCheckoutLoanInstallments = installments;
|
||||
}
|
||||
|
||||
|
||||
private void RecalculateTotalClaims(double previousTotalAmount, double newTotalAmount)
|
||||
{
|
||||
TotalClaims = (TotalClaims.MoneyToDouble() - previousTotalAmount + newTotalAmount).ToMoney();
|
||||
}
|
||||
|
||||
|
||||
private void RecalculateTotalDeduction(double previousTotalAmount, double newTotalAmount)
|
||||
{
|
||||
TotalDeductions = (TotalDeductions.MoneyToDouble() - previousTotalAmount + newTotalAmount).ToMoney();
|
||||
}
|
||||
|
||||
private void ReduceTotalPayment(double previousAmount, double newAmount)
|
||||
{
|
||||
TotalPayment = TotalPayment + previousAmount - newAmount;
|
||||
}
|
||||
private void IncreaseTotalPayment(double previousAmount, double newAmount)
|
||||
{
|
||||
TotalPayment = TotalPayment - previousAmount + newAmount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -3,7 +3,7 @@ using _0_Framework.Domain;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using _0_Framework.Application;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.CustomizeCheckoutAgg
|
||||
{
|
||||
@@ -15,5 +15,12 @@ namespace Company.Domain.CustomizeCheckoutAgg
|
||||
void RemoveEmployeeCustomizeCheckoutInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth);
|
||||
IEnumerable<CustomizeCheckout> GetRange(long workshopId, List<long> ids);
|
||||
void RemoveRange(IEnumerable<CustomizeCheckout> entities);
|
||||
List<CustomizeCheckout> GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startDate, DateTime endDate);
|
||||
|
||||
Task<CustomizeCheckout> GetByWorkshopIdEmployeeIdMonthYear(long workshopId, long employeeId, int year,
|
||||
int month);
|
||||
|
||||
(bool Checkout, bool CustomizeCheckout, bool CustomizeCheckoutTemp) ValidateExistsCheckouts(
|
||||
DateTime startDate, DateTime endDate, long workshopId, List<long> employeeId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
|
||||
public record CustomizeCheckoutFine
|
||||
{
|
||||
public CustomizeCheckoutFine(string title, string amount, string fineDateFa, DateTime fineDateGr, IsActive isActive, DateTime creationDate)
|
||||
public CustomizeCheckoutFine(string title, string amount, string fineDateFa, DateTime fineDateGr, IsActive isActive, DateTime creationDate, long entityId)
|
||||
{
|
||||
Title = title;
|
||||
Amount = amount;
|
||||
@@ -13,6 +13,7 @@ public record CustomizeCheckoutFine
|
||||
FineDateGr = fineDateGr;
|
||||
IsActive = isActive;
|
||||
CreationDate = creationDate;
|
||||
EntityId = entityId;
|
||||
}
|
||||
|
||||
public string Title { get; private set; }
|
||||
@@ -21,4 +22,5 @@ public record CustomizeCheckoutFine
|
||||
public DateTime FineDateGr { get; private set; }
|
||||
public IsActive IsActive { get; private set; }
|
||||
public DateTime CreationDate { get; private set; }
|
||||
public long EntityId { get; set; }
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
|
||||
public class CustomizeCheckoutLoanInstallments
|
||||
{
|
||||
public CustomizeCheckoutLoanInstallments(string amountForMonth, string month, string year, IsActive isActive, string loanRemaining, string loanAmount)
|
||||
public CustomizeCheckoutLoanInstallments(string amountForMonth, string month, string year, IsActive isActive, string loanRemaining, string loanAmount, long entityId)
|
||||
{
|
||||
AmountForMonth = amountForMonth;
|
||||
Month = month;
|
||||
@@ -13,6 +13,7 @@ public class CustomizeCheckoutLoanInstallments
|
||||
IsActive = isActive;
|
||||
LoanRemaining = loanRemaining;
|
||||
LoanAmount = loanAmount;
|
||||
EntityId = entityId;
|
||||
}
|
||||
|
||||
public string AmountForMonth { get; private set; }
|
||||
@@ -21,5 +22,7 @@ public class CustomizeCheckoutLoanInstallments
|
||||
public string LoanRemaining { get; set; }
|
||||
public IsActive IsActive { get; private set; }
|
||||
public string LoanAmount { get; set; }
|
||||
public long EntityId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
|
||||
public class CustomizeCheckoutReward
|
||||
{
|
||||
public CustomizeCheckoutReward(string amount, string description, DateTime grantDate, string grantDateFa, IsActive isActive, string title)
|
||||
public CustomizeCheckoutReward(string amount, string description, DateTime grantDate, string grantDateFa, IsActive isActive, string title, long entityId)
|
||||
{
|
||||
Amount = amount;
|
||||
Description = description;
|
||||
@@ -13,6 +13,7 @@ public class CustomizeCheckoutReward
|
||||
GrantDateFa = grantDateFa;
|
||||
IsActive = isActive;
|
||||
Title = title;
|
||||
EntityId = entityId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,5 +40,7 @@ public class CustomizeCheckoutReward
|
||||
|
||||
|
||||
public IsActive IsActive { get; private set; }
|
||||
public long EntityId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -4,13 +4,14 @@ namespace Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
|
||||
public class CustomizeCheckoutSalaryAid
|
||||
{
|
||||
public CustomizeCheckoutSalaryAid(string amount, DateTime salaryAidDateTime, string salaryAidDateTimeFa, DateTime calculationDateTime, string calculationDateTimeFa)
|
||||
public CustomizeCheckoutSalaryAid(string amount, DateTime salaryAidDateTime, string salaryAidDateTimeFa,DateTime calculationDateTime,string calculationDateTimeFa, long entityId)
|
||||
{
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidDateTime;
|
||||
SalaryAidDateTimeFa = salaryAidDateTimeFa;
|
||||
CalculationDateTime = calculationDateTime;
|
||||
CalculationDateTimeFa = calculationDateTimeFa;
|
||||
EntityId = entityId;
|
||||
}
|
||||
|
||||
public string Amount { get; private set; }
|
||||
@@ -19,4 +20,7 @@ public class CustomizeCheckoutSalaryAid
|
||||
|
||||
public DateTime CalculationDateTime { get; private set; }
|
||||
public string CalculationDateTimeFa { get; private set; }
|
||||
|
||||
public long EntityId { get; set; }
|
||||
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using System.Collections.Generic;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Enums;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.ValueObjects;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
namespace Company.Domain.CustomizeCheckoutTempAgg;
|
||||
@@ -303,6 +304,77 @@ public class CustomizeCheckoutTemp : EntityBase
|
||||
public Workshop Workshop { get; set; }
|
||||
public Employee Employee { get; set; }
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public void SetValueObjects(ICollection<CustomizeCheckoutTempFine> checkoutFines,
|
||||
ICollection<CustomizeCheckoutTempLoanInstallments> customizeCheckoutLoanInstallments,
|
||||
ICollection<CustomizeCheckoutTempSalaryAid> customizeCheckoutSalaryAids,
|
||||
ICollection<CustomizeCheckoutTempReward> customizeCheckoutRewards)
|
||||
{
|
||||
CheckoutFines = checkoutFines;
|
||||
CustomizeCheckoutLoanInstallments = customizeCheckoutLoanInstallments;
|
||||
CustomizeCheckoutSalaryAids = customizeCheckoutSalaryAids;
|
||||
CustomizeCheckoutRewards = customizeCheckoutRewards;
|
||||
}
|
||||
|
||||
public void SetRewards(ICollection<CustomizeCheckoutTempReward> rewards)
|
||||
{
|
||||
var previousTotalAmount = CustomizeCheckoutRewards.Sum(x => x.Amount.MoneyToDouble());
|
||||
var newTotalAmount = rewards.Sum(x => x.Amount.MoneyToDouble());
|
||||
RewardPay = newTotalAmount;
|
||||
IncreaseTotalPayment(previousTotalAmount,newTotalAmount);
|
||||
RecalculateTotalClaims(previousTotalAmount, newTotalAmount);
|
||||
CustomizeCheckoutRewards = rewards;
|
||||
}
|
||||
|
||||
public void SetSalaryAids(ICollection<CustomizeCheckoutTempSalaryAid> salaryAids)
|
||||
{
|
||||
var previousTotalAmount = CustomizeCheckoutSalaryAids.Sum(x => x.Amount.MoneyToDouble());
|
||||
var newTotalAmount = salaryAids.Sum(x => x.Amount.MoneyToDouble());
|
||||
SalaryAidDeduction = newTotalAmount;
|
||||
ReduceTotalPayment(previousTotalAmount,newTotalAmount);
|
||||
RecalculateTotalDeduction(previousTotalAmount, newTotalAmount);
|
||||
CustomizeCheckoutSalaryAids = salaryAids;
|
||||
}
|
||||
|
||||
public void SetFines(ICollection<CustomizeCheckoutTempFine> fines)
|
||||
{
|
||||
var previousTotalAmount = CheckoutFines.Sum(x => x.Amount.MoneyToDouble());
|
||||
var newTotalAmount = fines.Sum(x => x.Amount.MoneyToDouble());
|
||||
FineDeduction = newTotalAmount;
|
||||
ReduceTotalPayment(previousTotalAmount,newTotalAmount);
|
||||
RecalculateTotalDeduction(previousTotalAmount, newTotalAmount);
|
||||
CheckoutFines = fines;
|
||||
}
|
||||
|
||||
public void SetLoanInstallment(ICollection<CustomizeCheckoutTempLoanInstallments> installments)
|
||||
{
|
||||
var previousTotalAmount = CustomizeCheckoutLoanInstallments.Sum(x => x.AmountForMonth.MoneyToDouble());
|
||||
var newTotalAmount = installments.Sum(x => x.AmountForMonth.MoneyToDouble());
|
||||
InstallmentDeduction = newTotalAmount;
|
||||
ReduceTotalPayment(previousTotalAmount,newTotalAmount);
|
||||
RecalculateTotalDeduction(previousTotalAmount, newTotalAmount);
|
||||
CustomizeCheckoutLoanInstallments = installments;
|
||||
}
|
||||
|
||||
|
||||
private void RecalculateTotalClaims(double previousTotalAmount, double newTotalAmount)
|
||||
{
|
||||
TotalClaims = (TotalClaims.MoneyToDouble() - previousTotalAmount + newTotalAmount).ToMoney();
|
||||
}
|
||||
|
||||
|
||||
private void RecalculateTotalDeduction(double previousTotalAmount, double newTotalAmount)
|
||||
{
|
||||
TotalDeductions = (TotalDeductions.MoneyToDouble() - previousTotalAmount + newTotalAmount).ToMoney();
|
||||
}
|
||||
|
||||
private void ReduceTotalPayment(double previousAmount, double newAmount)
|
||||
{
|
||||
TotalPayment = TotalPayment + previousAmount - newAmount;
|
||||
}
|
||||
private void IncreaseTotalPayment(double previousAmount, double newAmount)
|
||||
{
|
||||
TotalPayment = TotalPayment - previousAmount + newAmount;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using Company.Domain.CustomizeCheckoutAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Company.Domain.CustomizeCheckoutTempAgg
|
||||
{
|
||||
@@ -19,5 +20,7 @@ namespace Company.Domain.CustomizeCheckoutTempAgg
|
||||
|
||||
IEnumerable<CustomizeCheckoutTemp> GetRange(long workshopId, List<long> ids);
|
||||
void RemoveRange(IEnumerable<CustomizeCheckoutTemp> entities);
|
||||
List<CustomizeCheckoutTemp> GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startDate, DateTime endDate);
|
||||
Task<CustomizeCheckoutTemp> GetByWorkshopIdEmployeeIdInDate(long workshopId, long employeeId, DateTime inDate);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,14 @@ namespace Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
public class CustomizeCheckoutTempSalaryAid
|
||||
{
|
||||
public CustomizeCheckoutTempSalaryAid(string amount, DateTime salaryAidDateTime, string salaryAidDateTimeFa,
|
||||
DateTime calculationDateTime, string calculationDateTimeFa)
|
||||
DateTime calculationDateTime, string calculationDateTimeFa, long entityId)
|
||||
{
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidDateTime;
|
||||
SalaryAidDateTimeFa = salaryAidDateTimeFa;
|
||||
CalculationDateTime = calculationDateTime;
|
||||
CalculationDateTimeFa = calculationDateTimeFa;
|
||||
EntityId = entityId;
|
||||
}
|
||||
|
||||
public string Amount { get; private set; }
|
||||
@@ -20,4 +21,6 @@ public class CustomizeCheckoutTempSalaryAid
|
||||
|
||||
public DateTime CalculationDateTime { get; private set; }
|
||||
public string CalculationDateTimeFa { get; private set; }
|
||||
public long EntityId { get; set; }
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
|
||||
public record CustomizeCheckoutTempFine
|
||||
{
|
||||
public CustomizeCheckoutTempFine(string title, string amount, string fineDateFa, DateTime fineDateGr, IsActive isActive, DateTime creationDate)
|
||||
public CustomizeCheckoutTempFine(string title, string amount, string fineDateFa, DateTime fineDateGr, IsActive isActive, DateTime creationDate, long entityId)
|
||||
{
|
||||
Title = title;
|
||||
Amount = amount;
|
||||
@@ -14,7 +14,7 @@ public record CustomizeCheckoutTempFine
|
||||
FineDateGr = fineDateGr;
|
||||
IsActive = isActive;
|
||||
CreationDate = creationDate;
|
||||
|
||||
EntityId = entityId;
|
||||
}
|
||||
public string Title { get; private set; }
|
||||
public string Amount { get; private set; }
|
||||
@@ -22,4 +22,6 @@ public record CustomizeCheckoutTempFine
|
||||
public DateTime FineDateGr { get; private set; }
|
||||
public IsActive IsActive { get; private set; }
|
||||
public DateTime CreationDate { get; private set; }
|
||||
public long EntityId { get; set; }
|
||||
|
||||
}
|
||||
@@ -4,7 +4,7 @@ namespace Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
|
||||
public class CustomizeCheckoutTempLoanInstallments
|
||||
{
|
||||
public CustomizeCheckoutTempLoanInstallments(string amountForMonth, string month, string year, IsActive isActive, string loanRemaining, string loanAmount)
|
||||
public CustomizeCheckoutTempLoanInstallments(string amountForMonth, string month, string year, IsActive isActive, string loanRemaining, string loanAmount, long entityId)
|
||||
{
|
||||
AmountForMonth = amountForMonth;
|
||||
Month = month;
|
||||
@@ -12,6 +12,7 @@ public class CustomizeCheckoutTempLoanInstallments
|
||||
IsActive = isActive;
|
||||
LoanRemaining = loanRemaining;
|
||||
LoanAmount = loanAmount;
|
||||
EntityId = entityId;
|
||||
}
|
||||
|
||||
public string AmountForMonth { get; private set; }
|
||||
@@ -20,5 +21,7 @@ public class CustomizeCheckoutTempLoanInstallments
|
||||
public IsActive IsActive { get; private set; }
|
||||
public string LoanRemaining { get; set; }
|
||||
public string LoanAmount { get; set; }
|
||||
public long EntityId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
|
||||
public class CustomizeCheckoutTempReward
|
||||
{
|
||||
public CustomizeCheckoutTempReward(string amount, string description, DateTime grantDate, string grantDateFa, IsActive isActive, string title)
|
||||
public CustomizeCheckoutTempReward(string amount, string description, DateTime grantDate, string grantDateFa, IsActive isActive, string title, long entityId)
|
||||
{
|
||||
Amount = amount;
|
||||
Description = description;
|
||||
@@ -13,6 +13,7 @@ public class CustomizeCheckoutTempReward
|
||||
GrantDateFa = grantDateFa;
|
||||
IsActive = isActive;
|
||||
Title = title;
|
||||
EntityId = entityId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -37,4 +38,6 @@ public class CustomizeCheckoutTempReward
|
||||
|
||||
public IsActive IsActive { get; private set; }
|
||||
public string Title { get; set; }
|
||||
public long EntityId { get; set; }
|
||||
|
||||
}
|
||||
@@ -5,21 +5,23 @@ using Hangfire.Annotations;
|
||||
|
||||
namespace Company.Domain.SalaryAidAgg;
|
||||
|
||||
public class SalaryAid:EntityBase
|
||||
public class SalaryAid : EntityBase
|
||||
{
|
||||
private SalaryAid()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
public SalaryAid(long employeeId, long workshopId, double amount, DateTime salaryAidDateTime, long createdByAccountId, UserType createdByUserType, DateTime calculationDate)
|
||||
public SalaryAid(long employeeId, long workshopId, double amount, DateTime salaryAidDateTime, long createdByAccountId, UserType createdByUserType, int calculationMonth, int calculationYear)
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidDateTime;
|
||||
CalculationDate = calculationDate;
|
||||
CreatedByUserType = createdByUserType;
|
||||
CreatedByAccountId = createdByAccountId;
|
||||
CalculationDate = $"{calculationYear:0000}/{calculationMonth:00}/01".ToGeorgianDateTime();
|
||||
CalculationMonth = calculationMonth;
|
||||
CalculationYear = calculationYear;
|
||||
}
|
||||
public long EmployeeId { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
@@ -33,6 +35,10 @@ public class SalaryAid:EntityBase
|
||||
/// </summary>
|
||||
public DateTime CalculationDate { get; private set; }
|
||||
|
||||
public int CalculationMonth { get; set; }
|
||||
public int CalculationYear { get; set; }
|
||||
|
||||
|
||||
|
||||
public long CreatedByAccountId { get; private set; }
|
||||
public UserType CreatedByUserType { get; private set; }
|
||||
@@ -43,12 +49,14 @@ public class SalaryAid:EntityBase
|
||||
public UserType LastModifiedByUserType { get; private set; }
|
||||
|
||||
|
||||
public void Edit(double amount, DateTime salaryAidTime, long modifiedByAccountId, UserType modifiedByUserType, DateTime calculationDate)
|
||||
public void Edit(double amount, DateTime salaryAidTime, long modifiedByAccountId, UserType modifiedByUserType, int calculationMonth, int calculationYear)
|
||||
{
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidTime;
|
||||
LastModifiedByAccountId = modifiedByAccountId;
|
||||
LastModifiedByUserType = modifiedByUserType;
|
||||
CalculationDate = calculationDate;
|
||||
CalculationDate = $"{calculationYear:0000}/{calculationMonth:00}/01".ToGeorgianDateTime();
|
||||
CalculationMonth = calculationMonth;
|
||||
CalculationYear = calculationYear;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using LicenseContext = OfficeOpenXml.LicenseContext;
|
||||
|
||||
namespace CompanyManagement.Infrastructure.Excel.SalaryAid;
|
||||
|
||||
public record SalaryAidImportData(long EmployeeId, long WorkshopId, string FullName, double Amount, string AccountNumber, string NationalCode, string SalaryAidDateTime,string CalculationDate, int Row, bool Duplicated);
|
||||
public record SalaryAidImportData(long EmployeeId, long WorkshopId, string FullName, double Amount, string AccountNumber, string NationalCode, string SalaryAidDateTime, int calculationMonth, int calculationYear, int Row, bool Duplicated);
|
||||
|
||||
public class ExcelValidation<T>
|
||||
{
|
||||
@@ -80,30 +80,41 @@ public class SalaryAidImportExcel
|
||||
|
||||
|
||||
// بررسی اینکه هدرها همان چیزی هستند که ما انتظار داریم
|
||||
if (worksheet.Cells[2, 1].Text != "نام و نام خانوادگی" ||
|
||||
worksheet.Cells[2, 2].Text != "کد ملی" ||
|
||||
worksheet.Cells[2, 3].Text != "شماره حساب" ||
|
||||
worksheet.Cells[2, 4].Text != "مبلغ قابل پرداخت" ||
|
||||
if (worksheet.Cells[3, 1].Text != "نام و نام خانوادگی" ||
|
||||
worksheet.Cells[3, 2].Text != "کد ملی" ||
|
||||
worksheet.Cells[3, 3].Text != "شماره حساب" ||
|
||||
worksheet.Cells[3, 4].Text != "مبلغ قابل پرداخت" ||
|
||||
worksheet.Cells[1, 3].Text != "تاریخ پرداخت" ||
|
||||
worksheet.Cells[1, 1].Text != "تاریخ محاسبه")
|
||||
worksheet.Cells[1, 1].Text != "سال محاسبه" ||
|
||||
worksheet.Cells[1, 2].Text != "ماه محسابه")
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("ساختار فایل اکسل اشتباه است.", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
return result;
|
||||
}
|
||||
|
||||
var salaryDateFa = worksheet.Cells[1, 4].Text;
|
||||
var calculationDate = worksheet.Cells[1, 2].Text;
|
||||
var salaryDateFa = worksheet.Cells[2, 3].Text;
|
||||
|
||||
var calculationMonth = Convert.ToInt32(string.IsNullOrWhiteSpace(worksheet.Cells[2, 2].Text) ? "0" : worksheet.Cells[2, 2].Text);
|
||||
var calculationYear = Convert.ToInt32(string.IsNullOrWhiteSpace(worksheet.Cells[2, 1].Text) ? "0" : worksheet.Cells[2, 1].Text);
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(salaryDateFa))
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("لطفا در سلول زرد رنگ تاریخ پرداخت را وارد کنید", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
return result;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(calculationDate))
|
||||
if (calculationMonth == 0)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("لطفا در سلول آبی رنگ تاریخ محاسبه را وارد کنید", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
result.Errors.Add(new SalaryAidImportExcelError("لطفا در سلول آبی رنگ ماه محاسبه را وارد کنید", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
return result;
|
||||
}
|
||||
if (calculationYear == 0)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("لطفا در سلول آبی رنگ سال محاسبه را وارد کنید", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
return result;
|
||||
}
|
||||
|
||||
var calculationDate = $"{calculationYear:0000}/{calculationMonth:00}/01";
|
||||
|
||||
if (salaryDateFa.TryToGeorgianDateTime(out var salaryDateTime) == false)
|
||||
{
|
||||
@@ -121,7 +132,7 @@ public class SalaryAidImportExcel
|
||||
}
|
||||
int rowCount = worksheet.Dimension.Rows;
|
||||
|
||||
int rowStart = 3;
|
||||
int rowStart = 4;
|
||||
|
||||
if (rowCount < rowStart)
|
||||
{
|
||||
@@ -142,7 +153,7 @@ public class SalaryAidImportExcel
|
||||
result.Errors.Add(new SalaryAidImportExcelError("مبلغ خالی یا نامعتبر است", row, SalaryAidExcelColumns.Amount.ToString()));
|
||||
|
||||
}
|
||||
result.RawData.Add(new SalaryAidImportData(0, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationDate,row, false));
|
||||
result.RawData.Add(new SalaryAidImportData(0, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationMonth, calculationYear, row, false));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fullName))
|
||||
{
|
||||
@@ -217,24 +228,60 @@ public class SalaryAidImportExcel
|
||||
var year = Convert.ToInt32(salaryDateFa.Substring(0, 4));
|
||||
|
||||
|
||||
if (_companyContext.CustomizeCheckouts.Any(x => x.WorkshopId == workshopId && x.EmployeeId == employee.id && x.YearInt == year && x.MonthInt == month))
|
||||
//if (_companyContext.CustomizeCheckouts.Any(x => x.WorkshopId == workshopId && x.EmployeeId == employee.id && x.YearInt == year && x.MonthInt == month))
|
||||
//{
|
||||
// result.Errors.Add(new SalaryAidImportExcelError($" پرسنل {fullName} در تاریخ {salaryDateFa} دارای فیش حقوقی غیررسمی است.", row, SalaryAidExcelColumns.None.ToString()));
|
||||
//}
|
||||
|
||||
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
if (oneMonthAgoGr > calculationDateTime)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError($" پرسنل {fullName} در تاریخ {salaryDateFa} دارای فیش حقوقی غیررسمی است.", row, SalaryAidExcelColumns.None.ToString()));
|
||||
bool customizeCheckout = false;
|
||||
bool customizeCheckoutTemp = false;
|
||||
bool checkout = false;
|
||||
if (_companyContext.CustomizeCheckouts.Any(x => x.WorkshopId == workshopId && employee.id == x.EmployeeId &&
|
||||
x.ContractStart <= oneMonthAgoGr && x.ContractEnd >= calculationDateTime))
|
||||
{
|
||||
customizeCheckout = true;
|
||||
}
|
||||
|
||||
if (_companyContext.CustomizeCheckoutTemps.Any(x => x.WorkshopId == workshopId && employee.id == x.EmployeeId &&
|
||||
x.ContractStart <= calculationDateTime && x.ContractEnd >= oneMonthAgoGr))
|
||||
{
|
||||
customizeCheckoutTemp = true;
|
||||
}
|
||||
|
||||
if (_companyContext.CheckoutSet.Any(x => x.WorkshopId == workshopId && employee.id == x.EmployeeId &&
|
||||
x.ContractStart <= calculationDateTime && x.ContractEnd >= oneMonthAgoGr))
|
||||
{
|
||||
checkout = true;
|
||||
}
|
||||
if (customizeCheckout || customizeCheckoutTemp)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError($"شما نمیتوانید به پرسنل {fullName} در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد مساعده دهید", row, SalaryAidExcelColumns.None.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
//if(_companyContext.CheckoutSet.Any(x => x.WorkshopId == workshopId && employee.id == x.EmployeeId &&
|
||||
// x.ContractStart <= calculationDateTime && x.ContractEnd >= calculationDateTime))
|
||||
// result.Errors.Add(new SalaryAidImportExcelError($"پرسنل {fullName} در تاریخ {calculationDate} دارای فیش رسمی میباشد", row, SalaryAidExcelColumns.None.ToString()));
|
||||
|
||||
|
||||
if (_companyContext.SalaryAids.Any(x => x.Amount == amount && x.EmployeeId == employee.id && x.WorkshopId == workshopId && x.SalaryAidDateTime == salaryDateTime))
|
||||
{
|
||||
// TODO MAHAN: Vafa Add this Code! Please Check it!
|
||||
|
||||
result.RawData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationDate, row, true));
|
||||
result.RawData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationMonth, calculationYear, row, true));
|
||||
continue;
|
||||
}
|
||||
result.ValidData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationDate, row, false));
|
||||
result.ValidData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationMonth, calculationYear, row, false));
|
||||
}
|
||||
|
||||
result.RawData = result.RawData.GroupBy(x => x.Row).Select(x => new SalaryAidImportData(x.First().EmployeeId,
|
||||
result.RawData = result.RawData.GroupBy(x => x.Row).Select(x => new SalaryAidImportData(x.Last().EmployeeId,
|
||||
x.First().WorkshopId, x.First().FullName,
|
||||
x.First().Amount, x.First().AccountNumber, x.First().NationalCode, x.First().SalaryAidDateTime, x.First().CalculationDate,x.Key,
|
||||
x.First().Amount, x.First().AccountNumber, x.First().NationalCode, x.First().SalaryAidDateTime, x.First().calculationMonth, x.First().calculationYear, x.Key,
|
||||
x.Any(s => s.Duplicated))).ToList();
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
|
||||
using System;
|
||||
using _0_Framework.Application;
|
||||
using System.Collections.Generic;
|
||||
|
||||
@@ -17,5 +18,9 @@ namespace CompanyManagment.App.Contracts.CustomizeCheckout
|
||||
OperationResult GroupRemove(long workshopId,List<long> idList);
|
||||
OperationResult Create(CreateCustomizeCheckout command);
|
||||
|
||||
}
|
||||
(bool Checkout, bool CustomizeCheckout, bool CustomizeCheckoutTemp) ValidateExistsCheckouts(
|
||||
DateTime startDate, DateTime endDate, long workshopId, List<long> employeeId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@ namespace CompanyManagment.App.Contracts.Loan;
|
||||
|
||||
public class LoanInstallmentViewModel
|
||||
{
|
||||
public string Year { get; set; }
|
||||
public long Id { get; set; }
|
||||
public string Year { get; set; }
|
||||
public string Month { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public double AmountDouble { get; set; }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
|
||||
namespace CompanyManagment.App.Contracts.Reward;
|
||||
@@ -6,7 +7,7 @@ namespace CompanyManagment.App.Contracts.Reward;
|
||||
public interface IRewardApplication
|
||||
{
|
||||
OperationResult Create(CreateRewardViewModel command);
|
||||
OperationResult Edit(EditRewardViewModel command);
|
||||
OperationResult Edit(EditRewardViewModel command);
|
||||
List<RewardViewModel> GetSearchList(RewardSearchModel searchViewModel);
|
||||
EditRewardViewModel GetDetails(long id);
|
||||
OperationResult Remove(long id);
|
||||
|
||||
@@ -10,4 +10,6 @@ public class CreateSalaryAidViewModel
|
||||
public string SalaryDateTime { get; set; }
|
||||
public string CalculationDateTime { get; set; }
|
||||
public string NationalCode { get; set; }
|
||||
}
|
||||
public int CalculationMonth { get; set; }
|
||||
public int CalculationYear { get; set; }
|
||||
}
|
||||
|
||||
@@ -22,5 +22,5 @@ public interface ISalaryAidApplication
|
||||
SalaryAidsGroupedViewModel GetSearchListAsGrouped(SalaryAidSearchViewModel searchModel);
|
||||
#endregion
|
||||
|
||||
Task<OperationResult> CreateRange(List<CreateSalaryAidViewModel> commands);
|
||||
OperationResult CreateRange(List<CreateSalaryAidViewModel> commands);
|
||||
}
|
||||
@@ -16,10 +16,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using Company.Domain.PersonnelCodeAgg;
|
||||
using CompanyManagment.App.Contracts.PersonnleCode;
|
||||
using Company.Domain.CustomizeWorkshopGroupSettingsAgg;
|
||||
|
||||
namespace CompanyManagment.Application
|
||||
{
|
||||
@@ -34,10 +36,14 @@ namespace CompanyManagment.Application
|
||||
private readonly IContractRepository _contractRepository;
|
||||
private readonly IWorkshopRepository _workshopRepository;
|
||||
private readonly ICustomizeWorkshopSettingsRepository _customizeWorkshopSettingsRepository;
|
||||
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository;
|
||||
private readonly ICheckoutRepository _checkoutRepository;
|
||||
|
||||
private readonly ICustomizeWorkshopGroupSettingsRepository _customizeWorkshopGroupSettingsRepository;
|
||||
|
||||
public CustomizeCheckoutApplication(ICustomizeCheckoutRepository customizeCheckoutRepository,
|
||||
IRollCallEmployeeStatusRepository rollCallEmployeeStatusRepository, ILeftWorkRepository leftWorkRepository, IEmployeeRepository employeeRepository,
|
||||
IRollCallMandatoryRepository rollCallMandatoryRepository, IContractRepository contractRepository, IWorkshopRepository workshopRepository, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository)
|
||||
IRollCallMandatoryRepository rollCallMandatoryRepository, IContractRepository contractRepository, IWorkshopRepository workshopRepository, ICustomizeWorkshopSettingsRepository customizeWorkshopSettingsRepository, IPersonnelCodeRepository personnelCodeRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, ICheckoutRepository checkoutRepository, ICustomizeWorkshopGroupSettingsRepository customizeWorkshopGroupSettingsRepository)
|
||||
{
|
||||
_customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
_rollCallEmployeeStatusRepository = rollCallEmployeeStatusRepository;
|
||||
@@ -48,6 +54,8 @@ namespace CompanyManagment.Application
|
||||
_workshopRepository = workshopRepository;
|
||||
_customizeWorkshopSettingsRepository = customizeWorkshopSettingsRepository;
|
||||
_personnelCodeRepository = personnelCodeRepository;
|
||||
_customizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
_checkoutRepository = checkoutRepository;
|
||||
_customizeWorkshopGroupSettingsRepository = customizeWorkshopGroupSettingsRepository;
|
||||
}
|
||||
|
||||
@@ -89,18 +97,19 @@ namespace CompanyManagment.Application
|
||||
x.Amount,
|
||||
x.FineDate,
|
||||
x.FineDate.ToGeorgianDateTime(),
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime())
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime(),
|
||||
x.Id)
|
||||
).ToList();
|
||||
|
||||
var rewards = result.RewardViewModels.Select(x =>
|
||||
new CustomizeCheckoutReward(x.Amount, x.Description, x.GrantDateGr, x.GrantDateFa,
|
||||
x.IsActive,x.Title)).ToList();
|
||||
x.IsActive, x.Title,x.Id)).ToList();
|
||||
|
||||
var loanInstallments = result.InstallmentViewModels.Select(x =>
|
||||
new CustomizeCheckoutLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive,x.RemainingAmount,x.LoanAmount)).ToList();
|
||||
new CustomizeCheckoutLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount,x.Id)).ToList();
|
||||
|
||||
var salaryAids = result.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa,x.Id)).ToList();
|
||||
|
||||
|
||||
var regularShift = result.EmployeeSettingsShifts.Select(x =>
|
||||
@@ -113,15 +122,23 @@ namespace CompanyManagment.Application
|
||||
result.FamilyAllowance, result.LeavePay, result.InsuranceDeduction, result.FineAbsenceDeduction,
|
||||
result.LateToWorkDeduction, result.EarlyExitDeduction, result.RewardPay, result.SalaryAidDeduction, result.InstallmentDeduction, result.FineDeduction,
|
||||
result.TaxDeduction, result.SumOfWorkingDays, result.TotalClaimsStr, result.TotalDeductionsStr, result.TotalPayment, contract?.ContractNo ?? "-",
|
||||
fines,loanInstallments,salaryAids,rewards, result.LateToWorkValue, result.SettingSalary, result.DailyWage, result.ShiftStatus,result.IrregularShift,result.CustomizeRotatingShifts,
|
||||
fines, loanInstallments, salaryAids, rewards, result.LateToWorkValue, result.SettingSalary, result.DailyWage, result.ShiftStatus, result.IrregularShift, result.CustomizeRotatingShifts,
|
||||
regularShift);
|
||||
|
||||
|
||||
_customizeCheckoutRepository.Create(entity);
|
||||
_customizeCheckoutRepository.Create(entity);
|
||||
_customizeCheckoutRepository.RemoveEmployeeCustomizeCheckoutInDates(command.WorkshopId, employee.id, command.ContractStart, command.ContractEnd);
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public (bool Checkout, bool CustomizeCheckout, bool CustomizeCheckoutTemp) ValidateExistsCheckouts(DateTime startDate,
|
||||
DateTime endDate, long workshopId, List<long> employeeId)
|
||||
{
|
||||
return _customizeCheckoutRepository.ValidateExistsCheckouts(startDate, endDate, workshopId, employeeId);
|
||||
}
|
||||
|
||||
|
||||
public OperationResult GroupCreate(CreateCustomizeCheckoutGroup command)
|
||||
{
|
||||
OperationResult op = new();
|
||||
@@ -146,18 +163,18 @@ namespace CompanyManagment.Application
|
||||
x.Amount,
|
||||
x.FineDate,
|
||||
x.FineDate.ToGeorgianDateTime(),
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime())
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime(), x.Id)
|
||||
).ToList();
|
||||
|
||||
var rewards = computations.RewardViewModels.Select(x =>
|
||||
new CustomizeCheckoutReward(x.Amount, x.Description, x.GrantDateGr, x.GrantDateFa,
|
||||
x.IsActive,x.Title)).ToList();
|
||||
x.IsActive, x.Title,x.Id)).ToList();
|
||||
|
||||
var loanInstallments = computations.InstallmentViewModels.Select(x =>
|
||||
new CustomizeCheckoutLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive,x.RemainingAmount, x.LoanAmount)).ToList();
|
||||
new CustomizeCheckoutLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
|
||||
|
||||
var salaryAids = computations.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa,x.Id)).ToList();
|
||||
|
||||
var regularShift = computations.EmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeCheckoutRegularShift(x.StartTime, x.EndTime, x.Placement)).ToList();
|
||||
@@ -169,20 +186,20 @@ namespace CompanyManagment.Application
|
||||
computations.FamilyAllowance, computations.LeavePay, computations.InsuranceDeduction, computations.FineAbsenceDeduction,
|
||||
computations.LateToWorkDeduction, computations.EarlyExitDeduction, computations.RewardPay, computations.SalaryAidDeduction, computations.InstallmentDeduction, computations.FineDeduction,
|
||||
computations.TaxDeduction, computations.SumOfWorkingDays, computations.TotalClaimsStr, computations.TotalDeductionsStr, computations.TotalPayment, contract?.ContractNo ?? "-",
|
||||
fines,loanInstallments,salaryAids,rewards, computations.LateToWorkValue, computations.SettingSalary, computations.DailyWage, computations.ShiftStatus,computations.IrregularShift,
|
||||
fines, loanInstallments, salaryAids, rewards, computations.LateToWorkValue, computations.SettingSalary, computations.DailyWage, computations.ShiftStatus, computations.IrregularShift,
|
||||
computations.CustomizeRotatingShifts, regularShift);
|
||||
|
||||
_customizeCheckoutRepository.Create(entity);
|
||||
_customizeCheckoutRepository.Create(entity);
|
||||
_customizeCheckoutRepository.RemoveEmployeeCustomizeCheckoutInDates(command.WorkshopId, employeeId, command.ContractStart, command.ContractEnd);
|
||||
}
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public OperationResult GroupRemove(long workshopId,List<long> idList)
|
||||
public OperationResult GroupRemove(long workshopId, List<long> idList)
|
||||
{
|
||||
OperationResult op = new();
|
||||
var entities = _customizeCheckoutRepository.GetRange(workshopId,idList);
|
||||
var entities = _customizeCheckoutRepository.GetRange(workshopId, idList);
|
||||
if (entities == null)
|
||||
return op.Succcedded();
|
||||
_customizeCheckoutRepository.RemoveRange(entities);
|
||||
@@ -218,12 +235,12 @@ namespace CompanyManagment.Application
|
||||
return op.Failed("خطای سیستمی");
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
var checkoutDate = new DateTime(yearFa, monthFa, 1,pc);
|
||||
var checkoutDate = new DateTime(yearFa, monthFa, 1, pc);
|
||||
var nextMonth = checkoutDate.AddMonthsFa(1, out _).ToGeorgianDateTime().Date;
|
||||
var today = DateTime.Today;
|
||||
|
||||
if (nextMonth > today)
|
||||
return op.Failed("امکان ایجاد فیش برای ماه جاری یا آینده وجود ندارد");
|
||||
return op.Failed("امکان ایجاد فیش برای ماه جاری یا آینده وجود ندارد");
|
||||
|
||||
//validate parsed datetime
|
||||
var startOfMonth = new DateTime(yearFa, monthFa, 1, new PersianCalendar()).Date;
|
||||
@@ -261,7 +278,7 @@ namespace CompanyManagment.Application
|
||||
WorkshopId = workshopId
|
||||
});
|
||||
var workshopGroups = _customizeWorkshopSettingsRepository
|
||||
.GetWorkshopIncludeGroupsByWorkshopId(workshopId)?
|
||||
.GetWorkshopIncludeGroupsByWorkshopId(workshopId)?
|
||||
.GroupSettings.Where(x => x.MainGroup == false);
|
||||
var employeeSettings = _customizeWorkshopSettingsRepository.GetEmployeeSettingsByWorkshopId(workshopId);
|
||||
|
||||
@@ -302,7 +319,7 @@ namespace CompanyManagment.Application
|
||||
|
||||
if (workshopId == 170)
|
||||
{
|
||||
var exceptionEmployeeIds =_customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x=>x.EmployeeId).ToList();
|
||||
var exceptionEmployeeIds = _customizeWorkshopGroupSettingsRepository.GetEmployeeSettingsByGroupSettingsId(117).Select(x => x.EmployeeId).ToList();
|
||||
foreach (var employeesId in exceptionEmployeeIds)
|
||||
{
|
||||
|
||||
@@ -334,16 +351,16 @@ namespace CompanyManagment.Application
|
||||
}
|
||||
color = reason switch
|
||||
{
|
||||
"فاقد تعیین حقوق" => "orange",
|
||||
"فاقد تعیین حقوق" => "orange",
|
||||
|
||||
"فاقد گروهبندی" => "red",
|
||||
"فاقد گروهبندی" => "red",
|
||||
|
||||
"خطای سیستمی" => "black",
|
||||
"خطای سیستمی" => "black",
|
||||
|
||||
"دارای فیش غیر رسمی" =>"green",
|
||||
"دارای فیش غیر رسمی" => "green",
|
||||
|
||||
_ => "white"
|
||||
};
|
||||
_ => "white"
|
||||
};
|
||||
return new EligibleEmployeesForCustomizeCheckoutViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
@@ -353,7 +370,7 @@ namespace CompanyManagment.Application
|
||||
Color = color,
|
||||
PersonnelCode = personnelCodes.FirstOrDefault(y => x.Id == y.EmployeeId)?.PersonnelCode.ToString() ?? "-"
|
||||
};
|
||||
}).OrderByDescending(x=>x.IsEligible).ThenByDescending(x=>x.Reason).ToList();
|
||||
}).OrderByDescending(x => x.IsEligible).ThenByDescending(x => x.Reason).ToList();
|
||||
return op.Succcedded(employees);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,18 +74,18 @@ namespace CompanyManagment.Application
|
||||
x.Amount,
|
||||
x.FineDate,
|
||||
x.FineDate.ToGeorgianDateTime(),
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime())
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime(), x.Id)
|
||||
).ToList();
|
||||
|
||||
var rewards = result.RewardViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempReward(x.Amount, x.Description, x.GrantDateGr, x.GrantDateFa,
|
||||
x.IsActive,x.Title)).ToList();
|
||||
x.IsActive, x.Title, x.Id)).ToList();
|
||||
|
||||
var loanInstallments = result.InstallmentViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount,x.LoanAmount)).ToList();
|
||||
new CustomizeCheckoutTempLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
|
||||
|
||||
var salaryAids = result.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa, x.Id)).ToList();
|
||||
|
||||
var regularShift = result.EmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeCheckoutRegularShift(x.StartTime, x.EndTime, x.Placement)).ToList();
|
||||
@@ -97,11 +97,11 @@ namespace CompanyManagment.Application
|
||||
result.FamilyAllowance, result.LeavePay, result.InsuranceDeduction, result.FineAbsenceDeduction,
|
||||
result.LateToWorkDeduction, result.EarlyExitDeduction, result.RewardPay, result.SalaryAidDeduction, result.InstallmentDeduction, result.FineDeduction,
|
||||
result.TaxDeduction, result.SumOfWorkingDays, result.TotalClaimsStr, result.TotalDeductionsStr, result.TotalPayment, contract?.ContractNo ?? "-",
|
||||
fines, loanInstallments, salaryAids, rewards,result.LateToWorkValue, result.SettingSalary,result.DailyWage, result.ShiftStatus, result.IrregularShift, result.CustomizeRotatingShifts,
|
||||
fines, loanInstallments, salaryAids, rewards, result.LateToWorkValue, result.SettingSalary, result.DailyWage, result.ShiftStatus, result.IrregularShift, result.CustomizeRotatingShifts,
|
||||
regularShift);
|
||||
|
||||
|
||||
_customizeCheckoutTempRepository.Create(entity);
|
||||
_customizeCheckoutTempRepository.Create(entity);
|
||||
_customizeCheckoutTempRepository.RemoveEmployeeTemporaryCheckoutInDates(command.WorkshopId, employee.id, command.ContractStart, command.ContractEnd);
|
||||
_customizeCheckoutTempRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
@@ -127,18 +127,18 @@ namespace CompanyManagment.Application
|
||||
x.Amount,
|
||||
x.FineDate,
|
||||
x.FineDate.ToGeorgianDateTime(),
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime())
|
||||
x.IsActive, x.CreationDate.ToGeorgianDateTime(), x.Id)
|
||||
).ToList();
|
||||
|
||||
var rewards = computations.RewardViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempReward(x.Amount, x.Description, x.GrantDateGr, x.GrantDateFa,
|
||||
x.IsActive,x.Title)).ToList();
|
||||
x.IsActive, x.Title, x.Id)).ToList();
|
||||
|
||||
var loanInstallments = computations.InstallmentViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount,x.LoanAmount)).ToList();
|
||||
new CustomizeCheckoutTempLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount, x.LoanAmount, x.Id)).ToList();
|
||||
|
||||
var salaryAids = computations.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa, x.Id)).ToList();
|
||||
|
||||
var contract = contracts.Where(x => x.IsActiveString == "true").FirstOrDefault(x => x.EmployeeId == employeeId);
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace CompanyManagment.Application
|
||||
computations.FamilyAllowance, computations.LeavePay, computations.InsuranceDeduction, computations.FineAbsenceDeduction,
|
||||
computations.LateToWorkDeduction, computations.EarlyExitDeduction, computations.RewardPay, computations.SalaryAidDeduction, computations.InstallmentDeduction, computations.FineDeduction,
|
||||
computations.TaxDeduction, computations.SumOfWorkingDays, computations.TotalClaimsStr, computations.TotalDeductionsStr, computations.TotalPayment, contract?.ContractNo ?? "-",
|
||||
fines, loanInstallments, salaryAids, rewards,computations.LateToWorkValue, computations.SettingSalary, computations.DailyWage, computations.ShiftStatus, computations.IrregularShift,
|
||||
fines, loanInstallments, salaryAids, rewards, computations.LateToWorkValue, computations.SettingSalary, computations.DailyWage, computations.ShiftStatus, computations.IrregularShift,
|
||||
computations.CustomizeRotatingShifts, regularShift);
|
||||
_customizeCheckoutTempRepository.Create(entity);
|
||||
_customizeCheckoutTempRepository.RemoveEmployeeTemporaryCheckoutInDates(command.WorkshopId, employeeId, command.ContractStart, command.ContractEnd);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
@@ -9,7 +10,10 @@ using Company.Domain.EmployeeAgg;
|
||||
using Company.Domain.File1;
|
||||
using Company.Domain.FineAgg;
|
||||
using Company.Domain.WorkshopAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.Fine;
|
||||
using CompanyManagment.EFCore.Repository;
|
||||
using Microsoft.EntityFrameworkCore.Scaffolding.Metadata;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
@@ -22,18 +26,26 @@ public class FineApplication : IFineApplication
|
||||
private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository;
|
||||
public readonly ICustomizeCheckoutTempRepository CustomizeCheckoutTempRepository;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
|
||||
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository;
|
||||
private readonly ICustomizeCheckoutTempApplication _customizeCheckoutTempApplication;
|
||||
|
||||
|
||||
|
||||
public FineApplication(IFineRepository fineRepository, IEmployeeRepository employeeRepository,
|
||||
IWorkshopRepository workshopRepository, ICustomizeCheckoutRepository customizeCheckoutRepository,
|
||||
IAuthHelper authHelper,ICustomizeCheckoutTempRepository customizeCheckoutTempRepository)
|
||||
IAuthHelper authHelper, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, ICustomizeCheckoutApplication customizeCheckoutApplication, ICustomizeCheckoutTempApplication customizeCheckoutTempApplication)
|
||||
{
|
||||
_fineRepository = fineRepository;
|
||||
_employeeRepository = employeeRepository;
|
||||
_workshopRepository = workshopRepository;
|
||||
_customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
_authHelper = authHelper;
|
||||
_customizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
|
||||
CustomizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
_customizeCheckoutApplication = customizeCheckoutApplication;
|
||||
_customizeCheckoutTempApplication = customizeCheckoutTempApplication;
|
||||
}
|
||||
|
||||
public List<FineViewModel> GetSearchList(FineSearchViewModel searchModel)
|
||||
@@ -127,36 +139,94 @@ public class FineApplication : IFineApplication
|
||||
|
||||
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x =>
|
||||
x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year &&
|
||||
x.MonthInt == month))
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است جریمه ای دهید");
|
||||
//if (_customizeCheckoutRepository.Exists(x =>
|
||||
// x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year &&
|
||||
// x.MonthInt == month))
|
||||
//{
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است جریمه ای دهید");
|
||||
|
||||
//}
|
||||
|
||||
//if (CustomizeCheckoutTempRepository.Exists(x =>
|
||||
// x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year &&
|
||||
// x.MonthInt == month &&
|
||||
// x.ContractStart <= fineDate && x.ContractEnd >= fineDate))
|
||||
//{
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است جریمه ای دهید");
|
||||
|
||||
//}
|
||||
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
if (oneMonthAgoGr > fineDate)
|
||||
{
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(fineDate,
|
||||
oneMonthAgoGr, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد جریمه ای دهید");
|
||||
}
|
||||
}
|
||||
|
||||
if (CustomizeCheckoutTempRepository.Exists(x =>
|
||||
x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year &&
|
||||
x.MonthInt == month &&
|
||||
x.ContractStart <= fineDate && x.ContractEnd >= fineDate))
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است جریمه ای دهید");
|
||||
|
||||
}
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(fineDate,
|
||||
fineDate, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
//if (existsCheckouts.Checkout)
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی رسمی صادر شده است جریمه ای دهید");
|
||||
|
||||
#endregion
|
||||
|
||||
DateTime date = command.FineDate.ToGeorgianDateTime();
|
||||
var (userId, userType,_) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
Fine entity = new Fine(employeeId, command.WorkshopId, command.Title, command.Amount.MoneyToDouble(), date,
|
||||
userId, userType);
|
||||
_fineRepository.Create(entity);
|
||||
_fineRepository.SaveChanges();
|
||||
|
||||
if (existsCheckouts.CustomizeCheckout)
|
||||
{
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdMonthYear(
|
||||
command.WorkshopId, employeeId,
|
||||
year, month).GetAwaiter().GetResult();
|
||||
|
||||
if (customizeCheckouts != null)
|
||||
{
|
||||
|
||||
var fines = customizeCheckouts.CheckoutFines.ToList();
|
||||
|
||||
fines.Add(new(entity.Title,entity.Amount.ToMoney(),
|
||||
entity.FineDate.ToFarsi(),entity.FineDate,entity.IsActive,entity.CreationDate,entity.id));
|
||||
customizeCheckouts.SetFines(fines);
|
||||
}
|
||||
}
|
||||
|
||||
if (existsCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
var customizeCheckoutTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
command.WorkshopId, employeeId, fineDate).GetAwaiter().GetResult();
|
||||
|
||||
if (customizeCheckoutTemp != null)
|
||||
{
|
||||
var fines = customizeCheckoutTemp.CheckoutFines.ToList();
|
||||
|
||||
|
||||
fines.Add(new(entity.Title, entity.Amount.ToMoney(),
|
||||
entity.FineDate.ToFarsi(), entity.FineDate, entity.IsActive, entity.CreationDate, entity.id));
|
||||
customizeCheckoutTemp.SetFines(fines);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
_fineRepository.SaveChanges();
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
transaction.Complete();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -196,20 +266,17 @@ public class FineApplication : IFineApplication
|
||||
}
|
||||
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x =>
|
||||
x.WorkshopId == command.WorkshopId && command.EmployeeId == x.EmployeeId && x.YearInt == year &&
|
||||
x.MonthInt == month))
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است جریمه ای دهید");
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
}
|
||||
|
||||
if (CustomizeCheckoutTempRepository.Exists(x =>
|
||||
x.WorkshopId == command.WorkshopId && command.EmployeeId == x.EmployeeId && x.YearInt == year &&
|
||||
x.MonthInt == month &&
|
||||
x.ContractStart <= fineDate && x.ContractEnd >= fineDate))
|
||||
if (oneMonthAgoGr > fineDate)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است جریمه ای دهید");
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(fineDate,
|
||||
oneMonthAgoGr, entity.WorkshopId, [entity.EmployeeId]);
|
||||
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد جریمه ای دهید");
|
||||
}
|
||||
}
|
||||
|
||||
if (!_employeeRepository.Exists(x => x.id == command.EmployeeId))
|
||||
@@ -217,14 +284,63 @@ public class FineApplication : IFineApplication
|
||||
return op.Failed("شخص وارد شده معتبر نمیباشد");
|
||||
}
|
||||
|
||||
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(fineDate,
|
||||
fineDate, entity.WorkshopId, [entity.EmployeeId]);
|
||||
|
||||
DateTime date = command.FineDate.ToGeorgianDateTime();
|
||||
var (userId, userType,_) = _authHelper.GetUserTypeWithId();
|
||||
var (userId, userType, _) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
|
||||
|
||||
entity.Edit(command.EmployeeId, command.WorkshopId, command.Title, command.Amount.MoneyToDouble(), date,
|
||||
userId, userType);
|
||||
|
||||
_fineRepository.SaveChanges();
|
||||
|
||||
if (existsCheckouts.CustomizeCheckout)
|
||||
{
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdMonthYear(
|
||||
entity.WorkshopId, entity.EmployeeId,
|
||||
year, month).GetAwaiter().GetResult();
|
||||
|
||||
var fines = customizeCheckouts.CheckoutFines.ToList();
|
||||
|
||||
var existsSalaryAid = fines.FirstOrDefault(x => x.EntityId == entity.id);
|
||||
if (existsSalaryAid != null)
|
||||
{
|
||||
fines.Remove(existsSalaryAid);
|
||||
}
|
||||
|
||||
fines.Add(new(entity.Title, entity.Amount.ToMoney(), entity.FineDate.ToFarsi(), entity.FineDate,
|
||||
entity.IsActive, entity.CreationDate, entity.id));
|
||||
|
||||
customizeCheckouts.SetFines(fines);
|
||||
|
||||
}
|
||||
if (existsCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
var customizeCheckoutTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
entity.WorkshopId, entity.EmployeeId, fineDate).GetAwaiter().GetResult();
|
||||
|
||||
var fines = customizeCheckoutTemp.CheckoutFines.ToList();
|
||||
|
||||
var existsFines = fines.FirstOrDefault(x => x.EntityId == entity.id);
|
||||
if (existsFines!= null)
|
||||
{
|
||||
fines.Remove(existsFines);
|
||||
}
|
||||
|
||||
|
||||
fines.Add(new(entity.Title, entity.Amount.ToMoney(), entity.FineDate.ToFarsi(), entity.FineDate,
|
||||
entity.IsActive, entity.CreationDate, entity.id));
|
||||
|
||||
customizeCheckoutTemp.SetFines(fines);
|
||||
|
||||
}
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
transaction.Complete();
|
||||
return op.Succcedded(entity.id);
|
||||
|
||||
}
|
||||
|
||||
@@ -1633,7 +1633,8 @@ public class InsuranceListApplication: IInsuranceListApplication
|
||||
dateSaleryviewModel.StartDateGr = startDateGr;
|
||||
dateSaleryviewModel.EndDateGr = endDateGr;
|
||||
var _dateSalary = _dateSalaryRepository.GetDateSalaryViewModel(dateSaleryviewModel);
|
||||
if (_dateSalary != null && _dateSalary.Id >0)
|
||||
// && _dateSalary.Id >0
|
||||
if (_dateSalary != null)
|
||||
{
|
||||
var dateSaleryItemviewModel = new DateSalaryItemSearchModel();
|
||||
dateSaleryItemviewModel.DateSalaryId = _dateSalary.Id;
|
||||
|
||||
@@ -4,12 +4,14 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection.Metadata.Ecma335;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using Company.Domain.LoanAgg;
|
||||
using Company.Domain.LoanAgg.Entities;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using Hangfire.States;
|
||||
using Microsoft.AspNetCore.Mvc.Infrastructure;
|
||||
@@ -23,12 +25,16 @@ public class LoanApplication : ILoanApplication
|
||||
private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository;
|
||||
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
|
||||
private readonly ICustomizeCheckoutTempApplication _customizeCheckoutTempApplication;
|
||||
|
||||
public LoanApplication(ILoanRepository loanRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, IAuthHelper authHelper)
|
||||
public LoanApplication(ILoanRepository loanRepository, ICustomizeCheckoutRepository customizeCheckoutRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, IAuthHelper authHelper, ICustomizeCheckoutApplication customizeCheckoutApplication, ICustomizeCheckoutTempApplication customizeCheckoutTempApplication)
|
||||
{
|
||||
_loanRepository = loanRepository;
|
||||
_customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
_authHelper = authHelper;
|
||||
_customizeCheckoutApplication = customizeCheckoutApplication;
|
||||
_customizeCheckoutTempApplication = customizeCheckoutTempApplication;
|
||||
_customizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
}
|
||||
|
||||
@@ -63,11 +69,11 @@ public class LoanApplication : ILoanApplication
|
||||
return op.Failed("تاریخ شروع وام نمیتواند در گذشته باشد");
|
||||
}
|
||||
|
||||
if (loanGrantDate>now)
|
||||
if (loanGrantDate > now)
|
||||
{
|
||||
return op.Failed("تاریخ پرداخت وام می بایست تاریخ امروز یا قبل تر باشد");
|
||||
}
|
||||
|
||||
|
||||
if (!command.LoanGrantDate.TryToGeorgianDateTime(out var grantDate))
|
||||
{
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
@@ -75,34 +81,87 @@ public class LoanApplication : ILoanApplication
|
||||
if (amountD < 1000000)
|
||||
return op.Failed("حداقل مبلغ وام 1.000.000 ریال میباشد");
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x =>
|
||||
command.EmployeeIds.Contains(x.EmployeeId) && x.WorkshopId == command.WorkshopId &&
|
||||
(x.ContractStart > startInstallmentDate && x.ContractStart < lastInstallment)))
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است وام دهید");
|
||||
}
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(startInstallmentDate, lastInstallment,
|
||||
command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
if (_customizeCheckoutTempRepository.Exists(x =>
|
||||
command.EmployeeIds.Contains(x.EmployeeId) && x.WorkshopId == command.WorkshopId &&
|
||||
(x.ContractStart >= startInstallmentDate && x.ContractStart <= lastInstallment)))
|
||||
if (existsCheckouts.Checkout)
|
||||
{
|
||||
return op.Failed("پرسنل در بازه اقساط خود دارای فیش غیررسمی است");
|
||||
return op.Failed("پرسنل در این تاریخ دارای فیش حقوقی رسمی است");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
var (userId, userType, _) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
var (userId, userType,_) = _authHelper.GetUserTypeWithId();
|
||||
using var transaction = new TransactionScope();
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
|
||||
var entity = new Loan(employeeId, command.WorkshopId, startInstallmentDate, command.Count.ToString(),
|
||||
command.Amount.MoneyToDouble(),
|
||||
installment.First().Amount.MoneyToDouble(),
|
||||
installment.Select(x =>
|
||||
new LoanInstallment(x.Amount.MoneyToDouble(), x.Month, x.Year, x.DateGr)).ToList()
|
||||
, command.GetRounded, grantDate,userId,userType);
|
||||
, command.GetRounded, grantDate, userId, userType);
|
||||
_loanRepository.Create(entity);
|
||||
|
||||
//var existInCheckout = _customizeCheckoutApplication.ValidateExistsCheckouts(startInstallmentDate, lastInstallment,
|
||||
// command.WorkshopId, [employeeId]);
|
||||
//if (existInCheckout.CustomizeCheckout)
|
||||
//{
|
||||
// var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdInDates(command.WorkshopId, employeeId,
|
||||
// startInstallmentDate, lastInstallment);
|
||||
|
||||
// var ccRemoveResult = _customizeCheckoutApplication.GroupRemove(command.WorkshopId,
|
||||
// customizeCheckouts.Select(x => x.id).ToList());
|
||||
|
||||
// if (!ccRemoveResult.IsSuccedded)
|
||||
// return op.Failed("خطا در حذف فیش غیررسمی نهایی:"+ccRemoveResult.Message);
|
||||
|
||||
// var groupedCustomizeCheckouts= customizeCheckouts.GroupBy(x => new { x.Month, x.Year }).ToList();
|
||||
|
||||
// foreach (var groupedCustomizeCheckout in groupedCustomizeCheckouts)
|
||||
// {
|
||||
// var ccCreateResult = _customizeCheckoutApplication.GroupCreate(new CreateCustomizeCheckoutGroup()
|
||||
// {
|
||||
// WorkshopId = command.WorkshopId,
|
||||
// EmployeeIds = groupedCustomizeCheckout.Select(x => x.EmployeeId).ToList(),
|
||||
// MonthFa = groupedCustomizeCheckout.First().MonthInt,
|
||||
// YearFa = groupedCustomizeCheckout.First().YearInt,
|
||||
// });
|
||||
|
||||
// if (!ccCreateResult.IsSuccedded)
|
||||
// return op.Failed("خطا در ایجاد فیش غیررسمی نهایی:" + ccCreateResult.Message);
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
//if (existInCheckout.CustomizeCheckoutTemp)
|
||||
//{
|
||||
// var customizeCheckoutsTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDates(command.WorkshopId, employeeId,
|
||||
// startInstallmentDate, lastInstallment);
|
||||
|
||||
// var groupedCustomizeCheckoutsTemp = customizeCheckoutsTemp.GroupBy(x => new { x.Month, x.Year}).ToList();
|
||||
|
||||
// foreach (var groupedCustomizeCheckout in groupedCustomizeCheckoutsTemp)
|
||||
// {
|
||||
// var ccCreateResult = _customizeCheckoutTempApplication.GroupCreate(new CreateCustomizeCheckoutTempGroup()
|
||||
// {
|
||||
// WorkshopId = command.WorkshopId,
|
||||
// EmployeeIds = groupedCustomizeCheckout.Select(x=>x.EmployeeId).ToList(),
|
||||
// MonthFa = groupedCustomizeCheckout.First().MonthInt,
|
||||
// YearFa =
|
||||
// });
|
||||
|
||||
// if (!ccCreateResult.IsSuccedded)
|
||||
// return op.Failed("خطا در ایجاد فیش غیررسمی نهایی:" + ccCreateResult.Message);
|
||||
// }
|
||||
|
||||
// if (!ccRemoveResult.IsSuccedded)
|
||||
// return op.Failed("خطا در حذف فیش غیررسمی نهایی:" + ccRemoveResult.Message);
|
||||
|
||||
|
||||
|
||||
//}
|
||||
|
||||
}
|
||||
|
||||
_loanRepository.SaveChanges();
|
||||
@@ -117,7 +176,7 @@ public class LoanApplication : ILoanApplication
|
||||
|
||||
var installments = new List<LoanInstallmentViewModel>();
|
||||
|
||||
|
||||
|
||||
bool endOfMonth = day == 31;
|
||||
|
||||
double amountD = amount.MoneyToDouble();
|
||||
@@ -171,7 +230,7 @@ public class LoanApplication : ILoanApplication
|
||||
Year = loanStartDate.Substring(0, 4),
|
||||
Day = loanStartDate.Substring(8, 2)
|
||||
|
||||
};
|
||||
};
|
||||
installments.Add(lastInstallment);
|
||||
return installments;
|
||||
}
|
||||
@@ -224,7 +283,7 @@ public class LoanApplication : ILoanApplication
|
||||
Year = loanStartDate.Substring(0, 4),
|
||||
Day = loanStartDate.Substring(8, 2)
|
||||
|
||||
};
|
||||
};
|
||||
installments.Add(lastInstallment);
|
||||
return installments;
|
||||
}
|
||||
@@ -273,6 +332,6 @@ public class LoanApplication : ILoanApplication
|
||||
|
||||
public LoanGroupedViewModel GetSearchListAsGrouped(LoanSearchViewModel searchModel)
|
||||
{
|
||||
return _loanRepository.GetSearchListAsGrouped(searchModel);
|
||||
return _loanRepository.GetSearchListAsGrouped(searchModel);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Transactions;
|
||||
using _0_Framework.Application;
|
||||
using Company.Domain.CheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using Company.Domain.RewardAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -19,13 +17,17 @@ public class RewardApplication : IRewardApplication
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository;
|
||||
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository;
|
||||
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
|
||||
private readonly ICustomizeCheckoutTempApplication _customizeCheckoutTempApplication;
|
||||
|
||||
public RewardApplication(IRewardRepository rewardRepository, IAuthHelper authHelper, ICustomizeCheckoutRepository customizeCheckoutRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository)
|
||||
public RewardApplication(IRewardRepository rewardRepository, IAuthHelper authHelper, ICustomizeCheckoutRepository customizeCheckoutRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, ICustomizeCheckoutTempApplication customizeCheckoutTempApplication, ICustomizeCheckoutApplication customizeCheckoutApplication)
|
||||
{
|
||||
_rewardRepository = rewardRepository;
|
||||
_authHelper = authHelper;
|
||||
_customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
_customizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
_customizeCheckoutTempApplication = customizeCheckoutTempApplication;
|
||||
_customizeCheckoutApplication = customizeCheckoutApplication;
|
||||
}
|
||||
|
||||
public List<RewardViewModel> GetSearchList(RewardSearchModel searchModel)
|
||||
@@ -34,10 +36,6 @@ public class RewardApplication : IRewardApplication
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public EditRewardViewModel GetDetails(long id)
|
||||
{
|
||||
return _rewardRepository.GetDetails(id);
|
||||
@@ -65,6 +63,9 @@ public class RewardApplication : IRewardApplication
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
_rewardRepository.Remove(entity);
|
||||
_rewardRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
@@ -105,16 +106,37 @@ public class RewardApplication : IRewardApplication
|
||||
var month = Convert.ToInt32(command.GrantDate.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.GrantDate.Substring(0, 4));
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year && x.MonthInt == month))
|
||||
//if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year && x.MonthInt == month))
|
||||
//{
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است پاداشی دهید");
|
||||
//}
|
||||
|
||||
//if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) &&
|
||||
// x.YearInt == year && x.MonthInt == month && x.ContractStart <= grantDate && x.ContractEnd >= grantDate))
|
||||
//{
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است پاداشی دهید");
|
||||
//}
|
||||
|
||||
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
if (oneMonthAgoGr > grantDate)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است پاداشی دهید");
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(grantDate,
|
||||
oneMonthAgoGr, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد پاداشی دهید");
|
||||
}
|
||||
}
|
||||
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) &&
|
||||
x.YearInt == year && x.MonthInt == month && x.ContractStart <= grantDate && x.ContractEnd >= grantDate))
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است پاداشی دهید");
|
||||
}
|
||||
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(grantDate,
|
||||
grantDate, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
//if (existsCheckouts.Checkout)
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی رسمی صادر شده است پاداشی دهید");
|
||||
|
||||
|
||||
|
||||
@@ -122,16 +144,50 @@ public class RewardApplication : IRewardApplication
|
||||
#endregion
|
||||
var (userId, userType, _) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
var entity = new Reward(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), command.Description,
|
||||
userId, userType,grantDate,command.Title);
|
||||
var entity = new Reward(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), command.Description,
|
||||
userId, userType, grantDate, command.Title);
|
||||
|
||||
_rewardRepository.Create(entity);
|
||||
}
|
||||
_rewardRepository.SaveChanges();
|
||||
if (existsCheckouts.CustomizeCheckout)
|
||||
{
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdMonthYear(
|
||||
command.WorkshopId, employeeId,
|
||||
year, month).GetAwaiter().GetResult();
|
||||
if (customizeCheckouts != null)
|
||||
{
|
||||
|
||||
_rewardRepository.SaveChanges();
|
||||
var rewards = customizeCheckouts.CustomizeCheckoutRewards.ToList();
|
||||
|
||||
rewards.Add(new(entity.Amount.ToMoney(), entity.Description, entity.GrantDate, entity.GrantDate.ToFarsi(), entity.IsActive, entity.Title, entity.id));
|
||||
customizeCheckouts.SetRewards(rewards);
|
||||
}
|
||||
}
|
||||
|
||||
if (existsCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
var customizeCheckoutTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
command.WorkshopId, employeeId, grantDate).GetAwaiter().GetResult();
|
||||
if (customizeCheckoutTemp != null)
|
||||
{
|
||||
var rewards = customizeCheckoutTemp.CustomizeCheckoutRewards.ToList();
|
||||
|
||||
rewards.Add(new(entity.Amount.ToMoney(), entity.Description, entity.GrantDate, entity.GrantDate.ToFarsi(), entity.IsActive, entity.Title, entity.id));
|
||||
customizeCheckoutTemp.SetRewards(rewards);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
|
||||
transaction.Complete();
|
||||
return op.Succcedded();
|
||||
|
||||
}
|
||||
|
||||
public OperationResult Edit(EditRewardViewModel command)
|
||||
@@ -160,34 +216,85 @@ public class RewardApplication : IRewardApplication
|
||||
var month = Convert.ToInt32(command.GrantDate.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.GrantDate.Substring(0, 4));
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeId == x.EmployeeId && x.YearInt == year && x.MonthInt == month))
|
||||
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
if (oneMonthAgoGr > grantDate)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است پاداشی دهید");
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(grantDate,
|
||||
oneMonthAgoGr, entity.WorkshopId, [entity.EmployeeId]);
|
||||
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد پاداشی دهید");
|
||||
}
|
||||
}
|
||||
var (userId, userType, _) = _authHelper.GetUserTypeWithId();
|
||||
var (userId, userType,_) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && entity.EmployeeId == x.EmployeeId &&
|
||||
x.YearInt == year && x.MonthInt == month && x.ContractStart <= grantDate && x.ContractEnd >= grantDate))
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است پاداشی دهید");
|
||||
}
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(grantDate,
|
||||
grantDate, entity.WorkshopId, [entity.EmployeeId]);
|
||||
|
||||
|
||||
entity.Edit(command.Amount.MoneyToDouble(),command.Description,userId,userType, grantDate,command.Title);
|
||||
using var transaction = new TransactionScope();
|
||||
|
||||
entity.Edit(command.Amount.MoneyToDouble(), command.Description, userId, userType, grantDate, command.Title);
|
||||
_rewardRepository.SaveChanges();
|
||||
|
||||
if (existsCheckouts.CustomizeCheckout)
|
||||
{
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdMonthYear(
|
||||
entity.WorkshopId, entity.EmployeeId,
|
||||
year, month).GetAwaiter().GetResult();
|
||||
if (customizeCheckouts != null)
|
||||
{
|
||||
|
||||
var rewards = customizeCheckouts.CustomizeCheckoutRewards.ToList();
|
||||
|
||||
var existsReward = rewards.FirstOrDefault(x => x.EntityId == entity.id);
|
||||
if (existsReward != null)
|
||||
{
|
||||
rewards.Remove(existsReward);
|
||||
}
|
||||
|
||||
rewards.Add(new(entity.Amount.ToMoney(), entity.Description, entity.GrantDate, entity.GrantDate.ToFarsi(), entity.IsActive, entity.Title, entity.id));
|
||||
customizeCheckouts.SetRewards(rewards);
|
||||
}
|
||||
}
|
||||
|
||||
if (existsCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
var customizeCheckoutTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
command.WorkshopId, entity.EmployeeId, grantDate).GetAwaiter().GetResult();
|
||||
if (customizeCheckoutTemp != null)
|
||||
{
|
||||
|
||||
var rewards = customizeCheckoutTemp.CustomizeCheckoutRewards.ToList();
|
||||
|
||||
var existsReward = rewards.FirstOrDefault(x => x.EntityId == entity.id);
|
||||
if (existsReward != null)
|
||||
{
|
||||
rewards.Remove(existsReward);
|
||||
}
|
||||
|
||||
rewards.Add(new(entity.Amount.ToMoney(), entity.Description, entity.GrantDate, entity.GrantDate.ToFarsi(), entity.IsActive, entity.Title, entity.id));
|
||||
customizeCheckoutTemp.SetRewards(rewards);
|
||||
}
|
||||
}
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
transaction.Complete();
|
||||
return op.Succcedded(entity.id);
|
||||
}
|
||||
|
||||
#region Pooya
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// گروهبندی بر اساس ماه هنگام جستجو با انتخاب کارمند
|
||||
/// </summary>
|
||||
public RewardsGroupedViewModel GetSearchListAsGrouped(RewardSearchModel searchModel)
|
||||
{
|
||||
return _rewardRepository.GetSearchListAsGrouped(searchModel);
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// گروهبندی بر اساس ماه هنگام جستجو با انتخاب کارمند
|
||||
/// </summary>
|
||||
public RewardsGroupedViewModel GetSearchListAsGrouped(RewardSearchModel searchModel)
|
||||
{
|
||||
return _rewardRepository.GetSearchListAsGrouped(searchModel);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
@@ -7,11 +7,14 @@ using Company.Domain.CheckoutAgg;
|
||||
using CompanyManagment.App.Contracts.Checkout;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Transactions;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg;
|
||||
using Company.Domain.EmployeeAgg;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using OfficeOpenXml.Drawing.Chart;
|
||||
using CompanyManagment.EFCore.Migrations;
|
||||
|
||||
namespace CompanyManagment.Application;
|
||||
|
||||
@@ -22,14 +25,18 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
private readonly IEmployeeRepository _employeeRepository;
|
||||
private readonly ICustomizeCheckoutTempRepository _customizeCheckoutTempRepository;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
|
||||
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
|
||||
private readonly ICustomizeCheckoutTempApplication _customizeCheckoutTempApplication;
|
||||
|
||||
|
||||
public SalaryAidApplication(ISalaryAidRepository salaryAidRepository, ICustomizeCheckoutRepository customizeCheckoutRepository,
|
||||
IEmployeeRepository employeeRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, IAuthHelper authHelper)
|
||||
IEmployeeRepository employeeRepository, ICustomizeCheckoutTempRepository customizeCheckoutTempRepository, IAuthHelper authHelper, ICustomizeCheckoutApplication customizeCheckoutApplication, ICustomizeCheckoutTempApplication customizeCheckoutTempApplication)
|
||||
{
|
||||
_salaryAidRepository = salaryAidRepository;
|
||||
_customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
_authHelper = authHelper;
|
||||
_customizeCheckoutApplication = customizeCheckoutApplication;
|
||||
_customizeCheckoutTempApplication = customizeCheckoutTempApplication;
|
||||
_employeeRepository = employeeRepository;
|
||||
_customizeCheckoutTempRepository = customizeCheckoutTempRepository;
|
||||
}
|
||||
@@ -48,10 +55,16 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
public OperationResult Create(CreateSalaryAidViewModel command)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
|
||||
if (!command.SalaryDateTime.TryToGeorgianDateTime(out var startDate))
|
||||
{
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
}
|
||||
var calculationDate = $"{command.CalculationYear:0000}/{command.CalculationMonth:00}/01";
|
||||
if (!calculationDate.TryToGeorgianDateTime(out var calculationDateGr))
|
||||
{
|
||||
return op.Failed("تاریخ محاسبه وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (!command.CalculationDateTime.TryToGeorgianDateTime(out var calculationDateTime))
|
||||
{
|
||||
@@ -69,28 +82,73 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
return op.Failed("مبلغ وارد شده معتبر نیست");
|
||||
}
|
||||
|
||||
var month = Convert.ToInt32(command.CalculationDateTime.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.CalculationDateTime.Substring(0, 4));
|
||||
var month = Convert.ToInt32(command.CalculationMonth);
|
||||
var year = Convert.ToInt32(command.CalculationYear);
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year && x.MonthInt == month))
|
||||
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
if (oneMonthAgoGr > calculationDateGr)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است مساعده ای دهید");
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(calculationDateGr,
|
||||
oneMonthAgoGr, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد مساعده دهید");
|
||||
}
|
||||
}
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) &&
|
||||
x.YearInt == year && x.MonthInt == month && x.ContractStart <= startDate && x.ContractEnd >= startDate))
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است مساعده ای دهید");
|
||||
}
|
||||
var (userId, userType, _) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(calculationDateGr,
|
||||
calculationDateGr, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
//if (existsCheckouts.Checkout)
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی رسمی صادر شده است مساعده ای دهید");
|
||||
|
||||
|
||||
var (userId, userType,_) = _authHelper.GetUserTypeWithId();
|
||||
using var transaction = new TransactionScope();
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
|
||||
var entity = new SalaryAid(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), startDate,userId,userType,calculationDateTime);
|
||||
var entity = new SalaryAid(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), startDate,userId,userType,command.CalculationMonth,command.CalculationYear);
|
||||
_salaryAidRepository.Create(entity);
|
||||
_salaryAidRepository.SaveChanges();
|
||||
if (existsCheckouts.CustomizeCheckout)
|
||||
{
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdMonthYear(
|
||||
command.WorkshopId, employeeId,
|
||||
year, month).GetAwaiter().GetResult();
|
||||
|
||||
if (customizeCheckouts != null)
|
||||
{
|
||||
|
||||
var salaryAids = customizeCheckouts.CustomizeCheckoutSalaryAids.ToList();
|
||||
|
||||
salaryAids.Add(new(entity.Amount.ToMoney(), entity.SalaryAidDateTime, entity.SalaryAidDateTime.ToFarsi(), entity.CalculationDate, entity.CalculationDate.ToFarsi(), entity.id));
|
||||
customizeCheckouts.SetSalaryAids(salaryAids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (existsCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
var customizeCheckoutTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
command.WorkshopId, employeeId, calculationDateGr).GetAwaiter().GetResult();
|
||||
|
||||
if (customizeCheckoutTemp != null)
|
||||
{
|
||||
var salaryAids = customizeCheckoutTemp.CustomizeCheckoutSalaryAids.ToList();
|
||||
|
||||
salaryAids.Add(new(entity.Amount.ToMoney(), entity.SalaryAidDateTime, entity.SalaryAidDateTime.ToFarsi(), entity.CalculationDate, entity.CalculationDate.ToFarsi(), entity.id));
|
||||
customizeCheckoutTemp.SetSalaryAids(salaryAids);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
_salaryAidRepository.SaveChanges();
|
||||
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
transaction.Complete();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -103,7 +161,8 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (!command.CalculationDateTime.TryToGeorgianDateTime(out var calculationDateTime))
|
||||
var calculationDate = $"{command.CalculationYear:0000}/{command.CalculationMonth:00}/01";
|
||||
if (!calculationDate.TryToGeorgianDateTime(out var calculationDateGr))
|
||||
{
|
||||
return op.Failed("تاریخ محاسبه وارد شده نامعتبر است");
|
||||
}
|
||||
@@ -121,21 +180,78 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
if (entity == null)
|
||||
return op.Failed("چنین مساعده ای وجود ندارد");
|
||||
|
||||
var month = Convert.ToInt32(command.CalculationDateTime.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.CalculationDateTime.Substring(0, 4));
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == entity.WorkshopId && entity.EmployeeId == x.EmployeeId && x.YearInt == year && x.MonthInt == month))
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است مساعده ای دهید");
|
||||
var month = Convert.ToInt32(command.CalculationMonth);
|
||||
var year = Convert.ToInt32(command.CalculationYear);
|
||||
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) &&
|
||||
x.YearInt == year && x.MonthInt == month && x.ContractStart <= startDate && x.ContractEnd >= startDate))
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
if (oneMonthAgoGr > calculationDateGr)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی موقت صادر شده است مساعده ای دهید");
|
||||
}
|
||||
var (userId, userType, _) = _authHelper.GetUserTypeWithId();
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(calculationDateGr,
|
||||
oneMonthAgoGr, entity.WorkshopId, [entity.EmployeeId]);
|
||||
|
||||
entity.Edit(Tools.MoneyToDouble(command.Amount),startDate,userId,userType,calculationDateTime);
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد مساعده ای دهید");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(calculationDateGr,
|
||||
calculationDateGr, entity.WorkshopId, [entity.EmployeeId]);
|
||||
|
||||
//if (existsCheckouts.Checkout)
|
||||
// return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی رسمی صادر شده است مساعده ای دهید");
|
||||
|
||||
|
||||
using var transaction = new TransactionScope();
|
||||
var (userId, userType,_) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
entity.Edit(Tools.MoneyToDouble(command.Amount),startDate,userId,userType,command.CalculationMonth,command.CalculationYear);
|
||||
_salaryAidRepository.SaveChanges();
|
||||
|
||||
if (existsCheckouts.CustomizeCheckout)
|
||||
{
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdMonthYear(
|
||||
entity.WorkshopId, entity.EmployeeId,
|
||||
year, month).GetAwaiter().GetResult();
|
||||
|
||||
var salaryAids = customizeCheckouts.CustomizeCheckoutSalaryAids.ToList();
|
||||
|
||||
var existsSalaryAid = salaryAids.FirstOrDefault(x => x.EntityId == entity.id);
|
||||
if (existsSalaryAid != null)
|
||||
{
|
||||
salaryAids.Remove(existsSalaryAid);
|
||||
}
|
||||
|
||||
salaryAids.Add(new(entity.Amount.ToMoney(), entity.SalaryAidDateTime, entity.SalaryAidDateTime.ToFarsi(),
|
||||
entity.CalculationDate, entity.CalculationDate.ToFarsi(), entity.id));
|
||||
|
||||
customizeCheckouts.SetSalaryAids(salaryAids);
|
||||
|
||||
}
|
||||
if (existsCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
var customizeCheckoutTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
entity.WorkshopId, entity.EmployeeId, calculationDateGr).GetAwaiter().GetResult();
|
||||
|
||||
var salaryAids = customizeCheckoutTemp.CustomizeCheckoutSalaryAids.ToList();
|
||||
|
||||
var existsSalaryAid = salaryAids.FirstOrDefault(x => x.EntityId == entity.id);
|
||||
if (existsSalaryAid != null)
|
||||
{
|
||||
salaryAids.Remove(existsSalaryAid);
|
||||
}
|
||||
|
||||
salaryAids.Add(new(entity.Amount.ToMoney(), entity.SalaryAidDateTime, entity.SalaryAidDateTime.ToFarsi(),
|
||||
entity.CalculationDate, entity.CalculationDate.ToFarsi(), entity.id));
|
||||
|
||||
customizeCheckoutTemp.SetSalaryAids(salaryAids);
|
||||
|
||||
}
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
transaction.Complete();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
@@ -154,7 +270,7 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
|
||||
|
||||
if (_customizeCheckoutTempRepository.Exists(x => x.WorkshopId == entity.WorkshopId && entity.EmployeeId == x.EmployeeId &&
|
||||
x.YearInt == year && x.MonthInt == month && x.ContractStart <= entity.SalaryAidDateTime && x.ContractEnd >= entity.SalaryAidDateTime))
|
||||
x.YearInt == year && x.MonthInt == month && x.ContractStart <= entity.CalculationDate && x.ContractEnd >= entity.CalculationDate))
|
||||
{
|
||||
return op.Failed("این پرسنل در این تاریخ دارای فیش حقوقی موقت است");
|
||||
}
|
||||
@@ -174,9 +290,10 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
}
|
||||
|
||||
|
||||
public async Task<OperationResult> CreateRange(List<CreateSalaryAidViewModel> commands)
|
||||
public OperationResult CreateRange(List<CreateSalaryAidViewModel> commands)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
using var transaction = new TransactionScope();
|
||||
foreach (var command in commands)
|
||||
{
|
||||
|
||||
@@ -184,6 +301,11 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
{
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
}
|
||||
var calculationDate = $"{command.CalculationYear:0000}/{command.CalculationMonth:00}/01";
|
||||
if (!calculationDate.TryToGeorgianDateTime(out var calculationDateGr))
|
||||
{
|
||||
return op.Failed("تاریخ محاسبه وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (!command.CalculationDateTime.TryToGeorgianDateTime(out var calculationDateTime))
|
||||
{
|
||||
@@ -199,17 +321,30 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
{
|
||||
return op.Failed("مبلغ وارد شده معتبر نیست");
|
||||
}
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
var month = Convert.ToInt32(command.CalculationDateTime.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.CalculationDateTime.Substring(0, 4));
|
||||
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == command.WorkshopId && command.EmployeeIds.Contains(x.EmployeeId) && x.YearInt == year && x.MonthInt == month))
|
||||
if (oneMonthAgoGr > calculationDateGr)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است مساعده ای دهید");
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(calculationDateGr,
|
||||
oneMonthAgoGr, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.Checkout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
return op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد مساعده دهید");
|
||||
}
|
||||
}
|
||||
var (userId, userType, _) = _authHelper.GetUserTypeWithId();
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(calculationDateGr,
|
||||
calculationDateGr, command.WorkshopId, command.EmployeeIds);
|
||||
|
||||
var month = Convert.ToInt32(command.CalculationMonth);
|
||||
var year = Convert.ToInt32(command.CalculationYear);
|
||||
|
||||
|
||||
|
||||
var (userId, userType,_) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
var id = employeeId;
|
||||
if (employeeId == 0)
|
||||
@@ -218,11 +353,44 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
id = employee.id;
|
||||
}
|
||||
|
||||
var entity = new SalaryAid(id, command.WorkshopId, command.Amount.MoneyToDouble(), startDate, userId, userType,calculationDateTime);
|
||||
await _salaryAidRepository.CreateAsync(entity);
|
||||
var entity = new SalaryAid(id, command.WorkshopId, command.Amount.MoneyToDouble(), startDate, userId, userType, command.CalculationMonth, command.CalculationYear);
|
||||
_salaryAidRepository.Create(entity);
|
||||
_salaryAidRepository.SaveChanges();
|
||||
|
||||
if (existsCheckouts.CustomizeCheckout)
|
||||
{
|
||||
var customizeCheckouts = _customizeCheckoutRepository.GetByWorkshopIdEmployeeIdMonthYear(
|
||||
command.WorkshopId, employeeId,
|
||||
year, month).GetAwaiter().GetResult();
|
||||
|
||||
if (customizeCheckouts != null)
|
||||
{
|
||||
|
||||
var salaryAids = customizeCheckouts.CustomizeCheckoutSalaryAids.ToList();
|
||||
|
||||
salaryAids.Add(new(entity.Amount.ToMoney(), entity.SalaryAidDateTime, entity.SalaryAidDateTime.ToFarsi(), entity.CalculationDate, entity.CalculationDate.ToFarsi(), entity.id));
|
||||
customizeCheckouts.SetSalaryAids(salaryAids);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (existsCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
var customizeCheckoutTemp = _customizeCheckoutTempRepository.GetByWorkshopIdEmployeeIdInDate(
|
||||
command.WorkshopId, employeeId, calculationDateGr).GetAwaiter().GetResult();
|
||||
|
||||
if (customizeCheckoutTemp != null)
|
||||
{
|
||||
var salaryAids = customizeCheckoutTemp.CustomizeCheckoutSalaryAids.ToList();
|
||||
|
||||
salaryAids.Add(new(entity.Amount.ToMoney(), entity.SalaryAidDateTime, entity.SalaryAidDateTime.ToFarsi(), entity.CalculationDate, entity.CalculationDate.ToFarsi(), entity.id));
|
||||
customizeCheckoutTemp.SetSalaryAids(salaryAids);
|
||||
}
|
||||
}
|
||||
}
|
||||
_customizeCheckoutRepository.SaveChanges();
|
||||
}
|
||||
await _salaryAidRepository.SaveChangesAsync();
|
||||
transaction.Complete();
|
||||
return op.Succcedded();
|
||||
}
|
||||
#region Pooya
|
||||
@@ -234,6 +402,6 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
return _salaryAidRepository.GetSearchListAsGrouped(searchModel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -86,6 +86,7 @@ public class CustomizeCheckoutMapping : IEntityTypeConfiguration<CustomizeChecko
|
||||
salaryAid.Property(x => x.SalaryAidDateTimeFa).HasMaxLength(15);
|
||||
salaryAid.Property(x => x.Amount).HasMaxLength(25);
|
||||
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
|
||||
|
||||
});
|
||||
|
||||
builder.OwnsMany(x => x.CustomizeCheckoutRewards, rewards =>
|
||||
|
||||
@@ -85,6 +85,7 @@ public class CustomizeCheckoutTempMapping : IEntityTypeConfiguration<CustomizeCh
|
||||
salaryAid.Property(x => x.SalaryAidDateTimeFa).HasMaxLength(15);
|
||||
salaryAid.Property(x => x.Amount).HasMaxLength(25);
|
||||
salaryAid.Property(x => x.CalculationDateTimeFa).HasMaxLength(15);
|
||||
|
||||
});
|
||||
|
||||
builder.OwnsMany(x => x.CustomizeCheckoutRewards, rewards =>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,184 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addcalculationdatetosalaryaidandaddentityidtocustomizecheckoutvalueobjects : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CalculationDate",
|
||||
table: "SalaryAids",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CalculationMonth",
|
||||
table: "SalaryAids",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "CalculationYear",
|
||||
table: "SalaryAids",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CalculationDateTime",
|
||||
table: "CustomizeCheckoutTempSalaryAid",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CalculationDateTimeFa",
|
||||
table: "CustomizeCheckoutTempSalaryAid",
|
||||
type: "nvarchar(15)",
|
||||
maxLength: 15,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempSalaryAid",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempReward",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempLoanInstallments",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempFine",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CalculationDateTime",
|
||||
table: "CustomizeCheckoutSalaryAid",
|
||||
type: "datetime2",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "CalculationDateTimeFa",
|
||||
table: "CustomizeCheckoutSalaryAid",
|
||||
type: "nvarchar(15)",
|
||||
maxLength: 15,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutSalaryAid",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutReward",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutLoanInstallments",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
|
||||
migrationBuilder.AddColumn<long>(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutFine",
|
||||
type: "bigint",
|
||||
nullable: false,
|
||||
defaultValue: 0L);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDate",
|
||||
table: "SalaryAids");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationMonth",
|
||||
table: "SalaryAids");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationYear",
|
||||
table: "SalaryAids");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTime",
|
||||
table: "CustomizeCheckoutTempSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTimeFa",
|
||||
table: "CustomizeCheckoutTempSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempReward");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempLoanInstallments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutTempFine");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTime",
|
||||
table: "CustomizeCheckoutSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTimeFa",
|
||||
table: "CustomizeCheckoutSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutReward");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutLoanInstallments");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "EntityId",
|
||||
table: "CustomizeCheckoutFine");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4767,6 +4767,12 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<DateTime>("CalculationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("CalculationMonth")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CalculationYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("CreatedByAccountId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@@ -6336,6 +6342,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b1.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("FineDateFa")
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("nvarchar(12)");
|
||||
@@ -6375,6 +6384,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("IsActive")
|
||||
.IsRequired()
|
||||
.HasMaxLength(5)
|
||||
@@ -6422,6 +6434,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b1.Property<string>("Description")
|
||||
.HasColumnType("ntext");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<DateTime>("GrantDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -6468,6 +6483,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<DateTime>("SalaryAidDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -6618,6 +6636,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b1.Property<DateTime>("CreationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("FineDateFa")
|
||||
.HasMaxLength(12)
|
||||
.HasColumnType("nvarchar(12)");
|
||||
@@ -6657,6 +6678,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<string>("IsActive")
|
||||
.IsRequired()
|
||||
.HasMaxLength(5)
|
||||
@@ -6704,6 +6728,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b1.Property<string>("Description")
|
||||
.HasColumnType("ntext");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<DateTime>("GrantDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -6750,6 +6777,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
|
||||
b1.Property<long>("EntityId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b1.Property<DateTime>("SalaryAidDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
|
||||
@@ -17,17 +17,15 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Domain.CustomizeCheckoutShared.Base;
|
||||
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using CompanyManagment.App.Contracts.Fine;
|
||||
using CompanyManagment.App.Contracts.Loan;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using CompanyManagment.App.Contracts.EmployeeDocuments;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using System.IO;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
@@ -37,7 +35,8 @@ namespace CompanyManagment.EFCore.Repository
|
||||
private readonly IRollCallRepository _rollCallRepository;
|
||||
private readonly AccountContext _accountContext;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
public CustomizeCheckoutRepository(CompanyContext context, IRollCallRepository rollCallRepository, AccountContext accountContext, IWebHostEnvironment webHostEnvironment) : base(context)
|
||||
|
||||
public CustomizeCheckoutRepository(CompanyContext context, IRollCallRepository rollCallRepository, AccountContext accountContext, IWebHostEnvironment webHostEnvironment) : base(context)
|
||||
{
|
||||
_companyContext = context;
|
||||
_rollCallRepository = rollCallRepository;
|
||||
@@ -77,152 +76,152 @@ namespace CompanyManagment.EFCore.Repository
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
public List<CustomizeCheckoutViewModel> PrintAll(long workshopId, IEnumerable<long> customizeCheckoutIds)
|
||||
{
|
||||
public List<CustomizeCheckoutViewModel> PrintAll(long workshopId, IEnumerable<long> customizeCheckoutIds)
|
||||
{
|
||||
|
||||
//var pc = new PersianCalendar();
|
||||
//var year = pc.GetYear(monthStart);
|
||||
//var month = pc.GetMonth(monthStart);
|
||||
//var pc = new PersianCalendar();
|
||||
//var year = pc.GetYear(monthStart);
|
||||
//var month = pc.GetMonth(monthStart);
|
||||
|
||||
IQueryable<CustomizeCheckout> customizeCheckoutsQuery = _companyContext.CustomizeCheckouts.AsSplitQuery()
|
||||
.Where(x => customizeCheckoutIds.Contains(x.id)).Include(x => x.CheckoutFines);
|
||||
IQueryable<CustomizeCheckout> customizeCheckoutsQuery = _companyContext.CustomizeCheckouts.AsSplitQuery()
|
||||
.Where(x => customizeCheckoutIds.Contains(x.id)).Include(x => x.CheckoutFines);
|
||||
|
||||
IQueryable<Workshop> workshopsQuery = _companyContext.Workshops.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.id));
|
||||
IQueryable<Workshop> workshopsQuery = _companyContext.Workshops.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.id));
|
||||
|
||||
IQueryable<long> workshopEmployersIdsQuery = _companyContext.WorkshopEmployers.Where(x => x.WorkshopId == workshopId).Select(x => x.EmployerId);
|
||||
IQueryable<Employer> employersQuery = _companyContext.Employers.Where(x => workshopEmployersIdsQuery.Contains(x.id));
|
||||
IQueryable<long> workshopEmployersIdsQuery = _companyContext.WorkshopEmployers.Where(x => x.WorkshopId == workshopId).Select(x => x.EmployerId);
|
||||
IQueryable<Employer> employersQuery = _companyContext.Employers.Where(x => workshopEmployersIdsQuery.Contains(x.id));
|
||||
|
||||
IQueryable<PersonnelCodeDomain> personnelCodesQuery = _companyContext.PersonnelCodeSet
|
||||
.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId));
|
||||
IQueryable<PersonnelCodeDomain> personnelCodesQuery = _companyContext.PersonnelCodeSet
|
||||
.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId));
|
||||
|
||||
//IQueryable<LeftWork> leftWorksQuery = _companyContext.LeftWorkList
|
||||
// .Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
// x.LeftWorkDate.AddDays(-1) >= monthStart && x.StartWorkDate <= monthEnd);
|
||||
//IQueryable<LeftWork> leftWorksQuery = _companyContext.LeftWorkList
|
||||
// .Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
// x.LeftWorkDate.AddDays(-1) >= monthStart && x.StartWorkDate <= monthEnd);
|
||||
|
||||
//IQueryable<Employee> employeesQuery = _companyContext.Employees.Where(x => customizeCheckoutsQuery.Any(y => y.EmployeeId == x.id));
|
||||
//IQueryable<Employee> employeesQuery = _companyContext.Employees.Where(x => customizeCheckoutsQuery.Any(y => y.EmployeeId == x.id));
|
||||
|
||||
var loans = _companyContext.Loans.AsSplitQuery().Where(x => x.WorkshopId == workshopId).ToList();
|
||||
var loans = _companyContext.Loans.AsSplitQuery().Where(x => x.WorkshopId == workshopId).ToList();
|
||||
|
||||
List<(string Picture, long Id)> employeePictures;
|
||||
List<(string Picture, long Id)> employeePictures;
|
||||
|
||||
|
||||
var employeePicMediaIdInEmployeeDoc = _companyContext.EmployeeDocumentItems.Where(x => customizeCheckoutsQuery
|
||||
.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
x.DocumentLabel == DocumentItemLabel.EmployeePicture &&
|
||||
x.DocumentStatus == DocumentStatus.Confirmed)
|
||||
?.Select(x => new { x.EmployeeId, x.MediaId }).ToList();
|
||||
var employeePicMediaIdInEmployeeDoc = _companyContext.EmployeeDocumentItems.Where(x => customizeCheckoutsQuery
|
||||
.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
x.DocumentLabel == DocumentItemLabel.EmployeePicture &&
|
||||
x.DocumentStatus == DocumentStatus.Confirmed)
|
||||
?.Select(x => new { x.EmployeeId, x.MediaId }).ToList();
|
||||
|
||||
var mediasInEmployeeDoc = _accountContext.Medias.Where(x => employeePicMediaIdInEmployeeDoc.Select(y => y.MediaId).Contains(x.id)).ToList();
|
||||
employeePictures = employeePicMediaIdInEmployeeDoc.Select(x =>
|
||||
{
|
||||
var media = mediasInEmployeeDoc.First(m => m.id == x.MediaId);
|
||||
var filePath = media.Path;
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
throw new FileNotFoundException("فایل مورد نظر یافت نشد.", filePath);
|
||||
var mediasInEmployeeDoc = _accountContext.Medias.Where(x => employeePicMediaIdInEmployeeDoc.Select(y => y.MediaId).Contains(x.id)).ToList();
|
||||
employeePictures = employeePicMediaIdInEmployeeDoc.Select(x =>
|
||||
{
|
||||
var media = mediasInEmployeeDoc.First(m => m.id == x.MediaId);
|
||||
var filePath = media.Path;
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
throw new FileNotFoundException("فایل مورد نظر یافت نشد.", filePath);
|
||||
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
|
||||
return (base64, x.EmployeeId);
|
||||
}).ToList();
|
||||
return (base64, x.EmployeeId);
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
var employeeIds = customizeCheckoutsQuery.Select(x => x.EmployeeId).ToList()
|
||||
.Where(x => !employeePictures.Select(e => e.Id).Contains(x)).ToList();
|
||||
var employeeIds = customizeCheckoutsQuery.Select(x => x.EmployeeId).ToList()
|
||||
.Where(x => !employeePictures.Select(e => e.Id).Contains(x)).ToList();
|
||||
|
||||
|
||||
foreach (var employeeId in employeeIds)
|
||||
{
|
||||
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}\\1.jpg";
|
||||
foreach (var employeeId in employeeIds)
|
||||
{
|
||||
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}\\1.jpg";
|
||||
|
||||
if (!System.IO.File.Exists(directoryPath))
|
||||
continue;
|
||||
if (!System.IO.File.Exists(directoryPath))
|
||||
continue;
|
||||
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(directoryPath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(directoryPath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
|
||||
employeePictures.Add((base64, employeeId));
|
||||
}
|
||||
employeePictures.Add((base64, employeeId));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
List<CustomizeCheckoutViewModel> customizeCheckoutsList = customizeCheckoutsQuery.Select(x => new CustomizeCheckoutViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId == null ? 0 : x.ContractId.Value,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
CreationDate = x.CreationDate,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
WorkshopName = x.WorkshopFullName,
|
||||
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
||||
NationalCode = x.NationalCode,
|
||||
EmployeeFName = x.EmployeeFName,
|
||||
EmployeeLName = x.EmployeeLName,
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FineViewModelList = x.CheckoutFines.Select(y => new FineViewModel()
|
||||
{
|
||||
Amount = y.Amount,
|
||||
FineDate = y.FineDateFa,
|
||||
Title = y.Title
|
||||
}).ToList(),
|
||||
InstallmentViewModels = x.CustomizeCheckoutLoanInstallments.Select(i => new LoanInstallmentViewModel()
|
||||
{
|
||||
Amount = i.AmountForMonth,
|
||||
AmountDouble = i.AmountForMonth.MoneyToDouble(),
|
||||
Year = i.Year,
|
||||
Month = i.Month,
|
||||
IsActive = i.IsActive,
|
||||
RemainingAmount = i.LoanRemaining,
|
||||
LoanAmount = i.LoanAmount
|
||||
}).ToList(),
|
||||
RewardViewModels = x.CustomizeCheckoutRewards.Select(r => new RewardViewModel()
|
||||
{
|
||||
IsActive = r.IsActive,
|
||||
Title = r.Title,
|
||||
Amount = r.Amount,
|
||||
AmountDouble = r.Amount.MoneyToDouble(),
|
||||
Description = r.Description,
|
||||
GrantDateFa = r.GrantDateFa,
|
||||
GrantDateGr = r.GrantDate
|
||||
}).ToList(),
|
||||
SalaryAidViewModels = x.CustomizeCheckoutSalaryAids.Select(s => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = s.Amount,
|
||||
AmountDouble = s.Amount.MoneyToDouble(),
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
List<CustomizeCheckoutViewModel> customizeCheckoutsList = customizeCheckoutsQuery.Select(x => new CustomizeCheckoutViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId == null ? 0 : x.ContractId.Value,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
CreationDate = x.CreationDate,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
WorkshopName = x.WorkshopFullName,
|
||||
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
||||
NationalCode = x.NationalCode,
|
||||
EmployeeFName = x.EmployeeFName,
|
||||
EmployeeLName = x.EmployeeLName,
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FineViewModelList = x.CheckoutFines.Select(y => new FineViewModel()
|
||||
{
|
||||
Amount = y.Amount,
|
||||
FineDate = y.FineDateFa,
|
||||
Title = y.Title
|
||||
}).ToList(),
|
||||
InstallmentViewModels = x.CustomizeCheckoutLoanInstallments.Select(i => new LoanInstallmentViewModel()
|
||||
{
|
||||
Amount = i.AmountForMonth,
|
||||
AmountDouble = i.AmountForMonth.MoneyToDouble(),
|
||||
Year = i.Year,
|
||||
Month = i.Month,
|
||||
IsActive = i.IsActive,
|
||||
RemainingAmount = i.LoanRemaining,
|
||||
LoanAmount = i.LoanAmount
|
||||
}).ToList(),
|
||||
RewardViewModels = x.CustomizeCheckoutRewards.Select(r => new RewardViewModel()
|
||||
{
|
||||
IsActive = r.IsActive,
|
||||
Title = r.Title,
|
||||
Amount = r.Amount,
|
||||
AmountDouble = r.Amount.MoneyToDouble(),
|
||||
Description = r.Description,
|
||||
GrantDateFa = r.GrantDateFa,
|
||||
GrantDateGr = r.GrantDate
|
||||
}).ToList(),
|
||||
SalaryAidViewModels = x.CustomizeCheckoutSalaryAids.Select(s => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = s.Amount,
|
||||
AmountDouble = s.Amount.MoneyToDouble(),
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
|
||||
LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{(int)x.LateToWorkValue.TotalHours}:{Convert.ToInt32(x.LateToWorkValue.TotalMinutes % 60):00}",
|
||||
|
||||
@@ -231,7 +230,7 @@ namespace CompanyManagment.EFCore.Repository
|
||||
ShiftStatus = x.ShiftStatus,
|
||||
IrregularShift = x.IrregularShift,
|
||||
CustomizeRotatingShifts = x.CustomizeRotatingShifts.ToList(),
|
||||
RegularShift = x.RegularShifts.Select(s=> (CustomizeSifts)s).ToList()
|
||||
RegularShift = x.RegularShifts.Select(s => (CustomizeSifts)s).ToList()
|
||||
|
||||
}).ToList();
|
||||
List<WorkshopViewModel> workshopsList = workshopsQuery.Select(x => new WorkshopViewModel
|
||||
@@ -268,45 +267,44 @@ namespace CompanyManagment.EFCore.Repository
|
||||
PersonnelCode = Convert.ToInt64(x.PersonnelCode)
|
||||
}).ToList();
|
||||
|
||||
var date = customizeCheckoutsList.FirstOrDefault();
|
||||
var date = customizeCheckoutsList.FirstOrDefault();
|
||||
|
||||
if (date == null)
|
||||
return new();
|
||||
if (date == null)
|
||||
return new();
|
||||
|
||||
var startDate = date.ContractStartGr.AddMonthsFa(0, out _).ToGeorgianDateTime().Date;
|
||||
var endDate = startDate.AddMonthsFa(1, out _).ToGeorgianDateTime().Date.AddTicks(-1);
|
||||
var startDate = date.ContractStartGr.AddMonthsFa(0, out _).ToGeorgianDateTime().Date;
|
||||
var endDate = startDate.AddMonthsFa(1, out _).ToGeorgianDateTime().Date.AddTicks(-1);
|
||||
|
||||
|
||||
List<PersonnelCheckoutDailyRollCallViewModel> personnelRollCalls = _rollCallRepository
|
||||
.GetEmployeeRollCallsForMonth(customizeCheckoutsList.Select(x => x.EmployeeId), workshopId, startDate, endDate);
|
||||
List<PersonnelCheckoutDailyRollCallViewModel> personnelRollCalls = _rollCallRepository
|
||||
.GetEmployeeRollCallsForMonth(customizeCheckoutsList.Select(x => x.EmployeeId), workshopId, startDate, endDate);
|
||||
|
||||
int counter = 1;
|
||||
int counter = 1;
|
||||
|
||||
foreach (var checkout in customizeCheckoutsList)
|
||||
{
|
||||
checkout.EmployeePicture =
|
||||
employeePictures.FirstOrDefault(p => p.Id == checkout.EmployeeId).Picture ?? "";
|
||||
foreach (var checkout in customizeCheckoutsList)
|
||||
{
|
||||
checkout.EmployeePicture =
|
||||
employeePictures.FirstOrDefault(p => p.Id == checkout.EmployeeId).Picture ?? "";
|
||||
|
||||
checkout.PrintCounter = counter++;
|
||||
checkout.PrintCounter = counter++;
|
||||
|
||||
//var leftwork = leftWorksList.FirstOrDefault(x => checkout.WorkshopId == x.WorkshopId && x.EmployeeId == checkout.EmployeeId);
|
||||
//checkout.LeftWorkDateGr = leftwork.LeftWorkDateGr;
|
||||
//var leftwork = leftWorksList.FirstOrDefault(x => checkout.WorkshopId == x.WorkshopId && x.EmployeeId == checkout.EmployeeId);
|
||||
//checkout.LeftWorkDateGr = leftwork.LeftWorkDateGr;
|
||||
|
||||
//var employee = employees.FirstOrDefault(x => x.Id == checkout.EmployeeId);
|
||||
//var employee = employees.FirstOrDefault(x => x.Id == checkout.EmployeeId);
|
||||
|
||||
checkout.EmployerList = workshopEmployersList;
|
||||
checkout.EmployerName = workshopEmployersList.FirstOrDefault()?.FullName ?? "-";
|
||||
checkout.EmployerList = workshopEmployersList;
|
||||
checkout.EmployerName = workshopEmployersList.FirstOrDefault()?.FullName ?? "-";
|
||||
|
||||
|
||||
checkout.MonthlyRollCall = personnelRollCalls.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId);
|
||||
checkout.PersonnelCode = personnelCodeList.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId)?.PersonnelCode ?? 0;
|
||||
checkout.MonthlyRollCall = personnelRollCalls.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId);
|
||||
checkout.PersonnelCode = personnelCodeList.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId)?.PersonnelCode ?? 0;
|
||||
|
||||
}
|
||||
return customizeCheckoutsList.OrderBy(x => x.EmployeeFullName).ToList();
|
||||
}
|
||||
return customizeCheckoutsList.OrderBy(x => x.EmployeeFullName).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void RemoveEmployeeCustomizeCheckoutInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth)
|
||||
{
|
||||
var checkout = _companyContext.CustomizeCheckouts.FirstOrDefault(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId &&
|
||||
@@ -315,143 +313,185 @@ namespace CompanyManagment.EFCore.Repository
|
||||
_companyContext.CustomizeCheckouts.Remove(checkout);
|
||||
}
|
||||
|
||||
public IEnumerable<CustomizeCheckout> GetRange(long workshopId,List<long> ids)
|
||||
public IEnumerable<CustomizeCheckout> GetRange(long workshopId, List<long> ids)
|
||||
{
|
||||
return _companyContext.CustomizeCheckouts.Where(x => x.WorkshopId==workshopId && ids.Contains(x.id)).AsEnumerable();
|
||||
return _companyContext.CustomizeCheckouts.Where(x => x.WorkshopId == workshopId && ids.Contains(x.id)).AsEnumerable();
|
||||
}
|
||||
|
||||
#endregion
|
||||
public List<CustomizeCheckout> GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startDate,
|
||||
DateTime endDate)
|
||||
{
|
||||
var checkouts = _companyContext.CustomizeCheckouts.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId &&
|
||||
x.ContractStart <= endDate && x.ContractEnd >= startDate).ToList();
|
||||
return checkouts;
|
||||
}
|
||||
|
||||
public IEnumerable<CustomizeCheckoutViewModel> Search(SearchCustomizeCheckout searchModel)
|
||||
{
|
||||
OperationResult op = new();
|
||||
var query = _companyContext.CustomizeCheckouts.Include(x => x.Employee)
|
||||
.ThenInclude(x => x.PersonnelCodeList).
|
||||
Include(x => x.Employee).ThenInclude(x => x.EmployeeBankInformationList)
|
||||
.AsSplitQuery().Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
#region parameters initialize
|
||||
public async Task<CustomizeCheckout> GetByWorkshopIdEmployeeIdMonthYear(long workshopId, long employeeId,
|
||||
int year, int month)
|
||||
{
|
||||
return await _companyContext.CustomizeCheckouts.FirstOrDefaultAsync(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.MonthInt == month && x.YearInt == year);
|
||||
}
|
||||
|
||||
////start of search is the first day of the current month by default and end of search is today
|
||||
//var startSearchDate = DateTime.Now.FindFirstDayOfMonth().ToGeorgianDateTime().Date;
|
||||
//var endSearchDate = DateTime.Today;
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
var currentYear = pc.GetYear(DateTime.Now);
|
||||
var currentMonth = pc.GetMonth(DateTime.Now);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.SearchStartFa) && !string.IsNullOrWhiteSpace(searchModel.SearchEndFa) &&
|
||||
searchModel.Year == 0 && searchModel.Month == 0)
|
||||
{
|
||||
var queryStartDate = searchModel.SearchStartFa.ToGeorgianDateTime().Date;
|
||||
var queryEndDate = searchModel.SearchEndFa.ToGeorgianDateTime().Date;
|
||||
|
||||
//if (queryEndDate > queryStartDate && queryEndDate <= DateTime.Today)
|
||||
//{
|
||||
// startSearchDate = queryStartDate;
|
||||
// endSearchDate = queryEndDate;
|
||||
//}
|
||||
//query = query.Where(x => x.ContractEnd.Date >= startSearchDate && x.ContractStart.Date <= endSearchDate);
|
||||
query = query.Where(x => x.ContractEnd.Date >= queryStartDate && x.ContractStart.Date <= queryEndDate);
|
||||
}
|
||||
public (bool Checkout, bool CustomizeCheckout, bool CustomizeCheckoutTemp) ValidateExistsCheckouts(
|
||||
DateTime startDate, DateTime endDate, long workshopId, List<long> employeeIds)
|
||||
{
|
||||
(bool Checkout, bool CustomizeCheckout, bool CustomizeCheckoutTemp) data = new();
|
||||
|
||||
|
||||
if (searchModel.Year > 0 && searchModel.Month > 0 && searchModel.Month < 13)
|
||||
{
|
||||
var queryStartDate = $"{searchModel.Year:0000}/{searchModel.Month:00}/01".ToGeorgianDateTime();
|
||||
queryStartDate.FindFirstDayOfNextMonth(out var queryEndDate);
|
||||
queryEndDate = queryEndDate.Date.AddTicks(-1);
|
||||
if (_companyContext.CustomizeCheckouts.Any(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId) &&
|
||||
x.ContractStart <= endDate && x.ContractEnd >= startDate))
|
||||
{
|
||||
data.CustomizeCheckout = true;
|
||||
}
|
||||
|
||||
if (_companyContext.CustomizeCheckoutTemps.Any(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId) &&
|
||||
x.ContractStart <= endDate && x.ContractEnd >= startDate))
|
||||
{
|
||||
data.CustomizeCheckoutTemp = true;
|
||||
}
|
||||
|
||||
if (_companyContext.CheckoutSet.Any(x => x.WorkshopId == workshopId && employeeIds.Contains(x.EmployeeId) &&
|
||||
x.ContractStart <= endDate && x.ContractEnd >= startDate))
|
||||
{
|
||||
data.Checkout = true;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public IEnumerable<CustomizeCheckoutViewModel> Search(SearchCustomizeCheckout searchModel)
|
||||
{
|
||||
OperationResult op = new();
|
||||
var query = _companyContext.CustomizeCheckouts.Include(x => x.Employee)
|
||||
.ThenInclude(x => x.PersonnelCodeList).
|
||||
Include(x => x.Employee).ThenInclude(x => x.EmployeeBankInformationList)
|
||||
.AsSplitQuery().Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
#region parameters initialize
|
||||
|
||||
////start of search is the first day of the current month by default and end of search is today
|
||||
//var startSearchDate = DateTime.Now.FindFirstDayOfMonth().ToGeorgianDateTime().Date;
|
||||
//var endSearchDate = DateTime.Today;
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
var currentYear = pc.GetYear(DateTime.Now);
|
||||
var currentMonth = pc.GetMonth(DateTime.Now);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.SearchStartFa) && !string.IsNullOrWhiteSpace(searchModel.SearchEndFa) &&
|
||||
searchModel.Year == 0 && searchModel.Month == 0)
|
||||
{
|
||||
var queryStartDate = searchModel.SearchStartFa.ToGeorgianDateTime().Date;
|
||||
var queryEndDate = searchModel.SearchEndFa.ToGeorgianDateTime().Date;
|
||||
|
||||
//if (queryEndDate > queryStartDate && queryEndDate <= DateTime.Today)
|
||||
//{
|
||||
// startSearchDate = queryStartDate;
|
||||
// endSearchDate = queryEndDate;
|
||||
//}
|
||||
//query = query.Where(x => x.ContractEnd.Date >= startSearchDate && x.ContractStart.Date <= endSearchDate);
|
||||
query = query.Where(x => x.ContractEnd.Date >= queryStartDate && x.ContractStart.Date <= queryEndDate);
|
||||
}
|
||||
|
||||
|
||||
//if (queryEndDate >= DateTime.Today)
|
||||
//{
|
||||
// queryEndDate = DateTime.Now.AddDays(-1).Date;
|
||||
//}
|
||||
|
||||
if (searchModel.Year == currentYear && searchModel.Month == currentMonth)
|
||||
{
|
||||
queryEndDate = DateTime.Now.AddDays(-1).Date;
|
||||
}
|
||||
|
||||
query = query.Where(x => x.ContractEnd <= queryEndDate && x.ContractStart >= queryStartDate);
|
||||
}
|
||||
if (searchModel.Year > 0 && searchModel.Month > 0 && searchModel.Month < 12)
|
||||
{
|
||||
var queryStartDate = $"{searchModel.Year:0000}/{searchModel.Month:00}/01".ToGeorgianDateTime();
|
||||
queryStartDate.FindFirstDayOfNextMonth(out var queryEndDate);
|
||||
queryEndDate = queryEndDate.Date.AddTicks(-1);
|
||||
|
||||
|
||||
////Month Index operations
|
||||
//startSearchDate.AddMonthsFa(-1 * (searchModel.MonthIndex), out startSearchDate);
|
||||
//startSearchDate.FindFirstDayOfNextMonth(out endSearchDate);
|
||||
//endSearchDate = endSearchDate.AddDays(-1);
|
||||
if (queryEndDate >= DateTime.Today)
|
||||
{
|
||||
queryEndDate = DateTime.Now.AddDays(-1).Date;
|
||||
}
|
||||
|
||||
else if (searchModel.Year == currentYear && searchModel.Month == currentMonth)
|
||||
{
|
||||
queryEndDate = DateTime.Now.AddDays(-1).Date;
|
||||
}
|
||||
|
||||
query = query.Where(x => x.ContractEnd <= queryEndDate && x.ContractStart >= queryStartDate);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
////Month Index operations
|
||||
//startSearchDate.AddMonthsFa(-1 * (searchModel.MonthIndex), out startSearchDate);
|
||||
//startSearchDate.FindFirstDayOfNextMonth(out endSearchDate);
|
||||
//endSearchDate = endSearchDate.AddDays(-1);
|
||||
|
||||
|
||||
if (searchModel.EmployeeId > 0)
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
#endregion
|
||||
|
||||
|
||||
if (searchModel.BankId > 0)
|
||||
query = query.Where(x => x.Employee.EmployeeBankInformationList.Any(y => y.BankId == searchModel.BankId));
|
||||
|
||||
switch (searchModel.OrderBy)
|
||||
{
|
||||
case CustomizeCheckoutOrderByEnum.ContractStartDesc:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractStart:
|
||||
query = query.OrderBy(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNoDesc:
|
||||
query = query.OrderByDescending(x => x.ContractNo);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNo:
|
||||
query = query.OrderBy(x => x.ContractNo);
|
||||
break;
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
|
||||
}
|
||||
if (searchModel.Year == 0 || searchModel.Month == 0)
|
||||
query = query.Skip(searchModel.PageIndex).Take(30);
|
||||
|
||||
return query.Select(x => new CustomizeCheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
ContractNo = x.ContractNo,
|
||||
EmployeeFName = x.Employee.FName,
|
||||
EmployeeLName = x.Employee.LName,
|
||||
PersonnelCode = x.Employee.PersonnelCodeList.FirstOrDefault(y => y.WorkshopId == searchModel.WorkshopId).PersonnelCode,
|
||||
Month = pc.GetMonth(x.ContractStart).ToFarsiMonthByIntNumber(),
|
||||
Year = pc.GetYear(x.ContractStart).ToString(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
SumOfWorkingDays = x.SumOfWorkingDays.ToString(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
TotalPaymentD = x.TotalPayment,
|
||||
TotalLateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
|
||||
}).ToList();
|
||||
if (searchModel.EmployeeId > 0)
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (searchModel.BankId > 0)
|
||||
query = query.Where(x => x.Employee.EmployeeBankInformationList.Any(y => y.BankId == searchModel.BankId));
|
||||
|
||||
switch (searchModel.OrderBy)
|
||||
{
|
||||
case CustomizeCheckoutOrderByEnum.ContractStartDesc:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractStart:
|
||||
query = query.OrderBy(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNoDesc:
|
||||
query = query.OrderByDescending(x => x.ContractNo);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNo:
|
||||
query = query.OrderBy(x => x.ContractNo);
|
||||
break;
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
|
||||
}
|
||||
if (searchModel.Year == 0 || searchModel.Month == 0)
|
||||
query = query.Skip(searchModel.PageIndex).Take(30);
|
||||
|
||||
return query.Select(x => new CustomizeCheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
ContractNo = x.ContractNo,
|
||||
EmployeeFName = x.Employee.FName,
|
||||
EmployeeLName = x.Employee.LName,
|
||||
PersonnelCode = x.Employee.PersonnelCodeList.FirstOrDefault(y => y.WorkshopId == searchModel.WorkshopId).PersonnelCode,
|
||||
Month = pc.GetMonth(x.ContractStart).ToFarsiMonthByIntNumber(),
|
||||
Year = pc.GetYear(x.ContractStart).ToString(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
SumOfWorkingDays = x.SumOfWorkingDays.ToString(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
TotalPaymentD = x.TotalPayment,
|
||||
TotalLateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
|
||||
}).ToList();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
|
||||
namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
@@ -33,14 +35,13 @@ namespace CompanyManagment.EFCore.Repository
|
||||
private readonly IRollCallRepository _rollCallRepository;
|
||||
private readonly CompanyContext _companyContext;
|
||||
private readonly AccountContext _accountContext;
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
|
||||
public CustomizeCheckoutTempRepository(CompanyContext context, IRollCallRepository rollCallRepository, IWebHostEnvironment webHostEnvironment, AccountContext accountContext) : base(context)
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
public CustomizeCheckoutTempRepository(CompanyContext context, IRollCallRepository rollCallRepository, AccountContext accountContext, IWebHostEnvironment webHostEnvironment) : base(context)
|
||||
{
|
||||
_companyContext = context;
|
||||
_rollCallRepository = rollCallRepository;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_accountContext = accountContext;
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
}
|
||||
#region Pooya
|
||||
public List<CustomizeCheckoutViewModel> GetByWorkshopIdInDates(long workshopId, DateTime startOfMonth, DateTime endOfMonth)
|
||||
@@ -75,294 +76,294 @@ namespace CompanyManagment.EFCore.Repository
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
public IEnumerable<CustomizeCheckoutViewModel> Search(SearchCustomizeCheckout searchModel)
|
||||
{
|
||||
public IEnumerable<CustomizeCheckoutViewModel> Search(SearchCustomizeCheckout searchModel)
|
||||
{
|
||||
|
||||
var query = _companyContext.CustomizeCheckoutTemps.Include(x => x.Employee)
|
||||
.ThenInclude(x => x.PersonnelCodeList)
|
||||
.Include(x => x.Employee).ThenInclude(x => x.EmployeeBankInformationList)
|
||||
.AsSplitQuery().Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
#region parameters initialize
|
||||
var query = _companyContext.CustomizeCheckoutTemps.Include(x => x.Employee)
|
||||
.ThenInclude(x => x.PersonnelCodeList)
|
||||
.Include(x => x.Employee).ThenInclude(x => x.EmployeeBankInformationList)
|
||||
.AsSplitQuery().Where(x => x.WorkshopId == searchModel.WorkshopId);
|
||||
#region parameters initialize
|
||||
|
||||
//start of search is the first day of the current month by default and end of search is today
|
||||
var startSearchDate = DateTime.Now.FindFirstDayOfMonth().ToGeorgianDateTime().Date;
|
||||
var endSearchDate = DateTime.Today;
|
||||
//start of search is the first day of the current month by default and end of search is today
|
||||
var startSearchDate = DateTime.Now.FindFirstDayOfMonth().ToGeorgianDateTime().Date;
|
||||
var endSearchDate = DateTime.Today;
|
||||
|
||||
var pc = new PersianCalendar();
|
||||
var currentYear = pc.GetYear(DateTime.Now);
|
||||
var currentMonth = pc.GetMonth(DateTime.Now);
|
||||
var pc = new PersianCalendar();
|
||||
var currentYear = pc.GetYear(DateTime.Now);
|
||||
var currentMonth = pc.GetMonth(DateTime.Now);
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.SearchStartFa) && !string.IsNullOrWhiteSpace(searchModel.SearchEndFa) &&
|
||||
searchModel.Year == 0 && searchModel.Month == 0)
|
||||
{
|
||||
var queryStartDate = searchModel.SearchStartFa.ToGeorgianDateTime().Date;
|
||||
var queryEndDate = searchModel.SearchEndFa.ToGeorgianDateTime().Date;
|
||||
if (!string.IsNullOrWhiteSpace(searchModel.SearchStartFa) && !string.IsNullOrWhiteSpace(searchModel.SearchEndFa) &&
|
||||
searchModel.Year == 0 && searchModel.Month == 0)
|
||||
{
|
||||
var queryStartDate = searchModel.SearchStartFa.ToGeorgianDateTime().Date;
|
||||
var queryEndDate = searchModel.SearchEndFa.ToGeorgianDateTime().Date;
|
||||
|
||||
if (queryEndDate > queryStartDate)
|
||||
{
|
||||
startSearchDate = queryStartDate;
|
||||
endSearchDate = queryEndDate;
|
||||
}
|
||||
query = query.Where(x => x.ContractEnd.Date >= startSearchDate && x.ContractStart.Date <= endSearchDate);
|
||||
}
|
||||
if (queryEndDate > queryStartDate)
|
||||
{
|
||||
startSearchDate = queryStartDate;
|
||||
endSearchDate = queryEndDate;
|
||||
}
|
||||
query = query.Where(x => x.ContractEnd.Date >= startSearchDate && x.ContractStart.Date <= endSearchDate);
|
||||
}
|
||||
|
||||
|
||||
if (searchModel.Year > 0 && searchModel.Month > 0 && searchModel.Month < 13)
|
||||
{
|
||||
var queryStartDate = $"{searchModel.Year:0000}/{searchModel.Month:00}/01".ToGeorgianDateTime();
|
||||
queryStartDate.FindFirstDayOfNextMonth(out var queryEndDate);
|
||||
queryEndDate = queryEndDate.AddDays(-1);
|
||||
if (searchModel.Year > 0 && searchModel.Month > 0 && searchModel.Month < 13)
|
||||
{
|
||||
var queryStartDate = $"{searchModel.Year:0000}/{searchModel.Month:00}/01".ToGeorgianDateTime();
|
||||
queryStartDate.FindFirstDayOfNextMonth(out var queryEndDate);
|
||||
queryEndDate = queryEndDate.AddDays(-1);
|
||||
|
||||
|
||||
|
||||
|
||||
//if (queryEndDate < DateTime.Today)
|
||||
//{
|
||||
// startSearchDate = queryStartDate;
|
||||
// endSearchDate = queryEndDate;
|
||||
//}
|
||||
//if (queryEndDate < DateTime.Today)
|
||||
//{
|
||||
// startSearchDate = queryStartDate;
|
||||
// endSearchDate = queryEndDate;
|
||||
//}
|
||||
|
||||
if (searchModel.Year == currentYear && searchModel.Month == currentMonth)
|
||||
{
|
||||
queryEndDate = DateTime.Today.AddDays(-1);
|
||||
if (searchModel.Year == currentYear && searchModel.Month == currentMonth)
|
||||
{
|
||||
queryEndDate = DateTime.Today.AddDays(-1);
|
||||
|
||||
startSearchDate = queryStartDate;
|
||||
endSearchDate = queryEndDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
startSearchDate = queryStartDate;
|
||||
endSearchDate = queryEndDate;
|
||||
}
|
||||
query = query.Where(x => x.ContractEnd.Date <= endSearchDate && x.ContractEnd.Date >= startSearchDate);
|
||||
startSearchDate = queryStartDate;
|
||||
endSearchDate = queryEndDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
startSearchDate = queryStartDate;
|
||||
endSearchDate = queryEndDate;
|
||||
}
|
||||
query = query.Where(x => x.ContractEnd.Date <= endSearchDate && x.ContractEnd.Date >= startSearchDate);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////Month Index operations
|
||||
//startSearchDate.AddMonthsFa(-1 * (searchModel.MonthIndex), out startSearchDate);
|
||||
//startSearchDate.FindFirstDayOfNextMonth(out endSearchDate);
|
||||
//endSearchDate = endSearchDate.AddDays(-1);
|
||||
////Month Index operations
|
||||
//startSearchDate.AddMonthsFa(-1 * (searchModel.MonthIndex), out startSearchDate);
|
||||
//startSearchDate.FindFirstDayOfNextMonth(out endSearchDate);
|
||||
//endSearchDate = endSearchDate.AddDays(-1);
|
||||
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
|
||||
if (searchModel.EmployeeId > 0)
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
if (searchModel.EmployeeId > 0)
|
||||
query = query.Where(x => x.EmployeeId == searchModel.EmployeeId);
|
||||
|
||||
if (searchModel.BankId > 0)
|
||||
query = query.Where(x => x.Employee.EmployeeBankInformationList.Any(y => y.BankId == searchModel.BankId));
|
||||
if (searchModel.BankId > 0)
|
||||
query = query.Where(x => x.Employee.EmployeeBankInformationList.Any(y => y.BankId == searchModel.BankId));
|
||||
|
||||
switch (searchModel.OrderBy)
|
||||
{
|
||||
case CustomizeCheckoutOrderByEnum.ContractStartDesc:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractStart:
|
||||
query = query.OrderBy(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNoDesc:
|
||||
query = query.OrderByDescending(x => x.ContractNo);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNo:
|
||||
query = query.OrderBy(x => x.ContractNo);
|
||||
break;
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
switch (searchModel.OrderBy)
|
||||
{
|
||||
case CustomizeCheckoutOrderByEnum.ContractStartDesc:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractStart:
|
||||
query = query.OrderBy(x => x.ContractStart.Date);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNoDesc:
|
||||
query = query.OrderByDescending(x => x.ContractNo);
|
||||
break;
|
||||
case CustomizeCheckoutOrderByEnum.ContractNo:
|
||||
query = query.OrderBy(x => x.ContractNo);
|
||||
break;
|
||||
default:
|
||||
query = query.OrderByDescending(x => x.ContractStart.Date);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (searchModel.Month == 0 || searchModel.Year == 0)
|
||||
query = query.Skip(searchModel.PageIndex).Take(30);
|
||||
if (searchModel.Month == 0 || searchModel.Year == 0)
|
||||
query = query.Skip(searchModel.PageIndex).Take(30);
|
||||
|
||||
|
||||
return query.Select(x => new CustomizeCheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
ContractNo = x.ContractNo,
|
||||
EmployeeFName = x.EmployeeFName,
|
||||
EmployeeLName = x.EmployeeLName,
|
||||
return query.Select(x => new CustomizeCheckoutViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
ContractNo = x.ContractNo,
|
||||
EmployeeFName = x.EmployeeFName,
|
||||
EmployeeLName = x.EmployeeLName,
|
||||
|
||||
PersonnelCode = x.Employee.PersonnelCodeList.FirstOrDefault(y => y.WorkshopId == searchModel.WorkshopId).PersonnelCode,
|
||||
Month = pc.GetMonth(x.ContractStart).ToFarsiMonthByIntNumber(),
|
||||
Year = pc.GetYear(x.ContractStart).ToString(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
SumOfWorkingDays = x.SumOfWorkingDays.ToString(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
TotalPaymentD = x.TotalPayment,
|
||||
TotalLateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
}).ToList();
|
||||
PersonnelCode = x.Employee.PersonnelCodeList.FirstOrDefault(y => y.WorkshopId == searchModel.WorkshopId).PersonnelCode,
|
||||
Month = pc.GetMonth(x.ContractStart).ToFarsiMonthByIntNumber(),
|
||||
Year = pc.GetYear(x.ContractStart).ToString(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
SumOfWorkingDays = x.SumOfWorkingDays.ToString(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
TotalPaymentD = x.TotalPayment,
|
||||
TotalLateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
}).ToList();
|
||||
|
||||
|
||||
}
|
||||
public List<CustomizeCheckoutViewModel> PrintAll(long workshopId, IEnumerable<long> customizeCheckoutIds)
|
||||
{
|
||||
}
|
||||
|
||||
//var pc = new PersianCalendar();
|
||||
//var year = pc.GetYear(monthStart);
|
||||
//var month = pc.GetMonth(monthStart);
|
||||
public List<CustomizeCheckoutViewModel> PrintAll(long workshopId, IEnumerable<long> customizeCheckoutIds)
|
||||
{
|
||||
|
||||
IQueryable<CustomizeCheckoutTemp> customizeCheckoutsQuery = _companyContext.CustomizeCheckoutTemps.AsSplitQuery()
|
||||
//var pc = new PersianCalendar();
|
||||
//var year = pc.GetYear(monthStart);
|
||||
//var month = pc.GetMonth(monthStart);
|
||||
|
||||
IQueryable<CustomizeCheckoutTemp> customizeCheckoutsQuery = _companyContext.CustomizeCheckoutTemps.AsSplitQuery()
|
||||
.Where(x => customizeCheckoutIds.Contains(x.id));
|
||||
|
||||
IQueryable<Workshop> workshopsQuery = _companyContext.Workshops.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.id));
|
||||
IQueryable<Workshop> workshopsQuery = _companyContext.Workshops.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.id));
|
||||
|
||||
IQueryable<long> workshopEmployersIdsQuery = _companyContext.WorkshopEmployers.Where(x => x.WorkshopId == workshopId).Select(x => x.EmployerId);
|
||||
IQueryable<Employer> employersQuery = _companyContext.Employers.Where(x => workshopEmployersIdsQuery.Contains(x.id));
|
||||
IQueryable<long> workshopEmployersIdsQuery = _companyContext.WorkshopEmployers.Where(x => x.WorkshopId == workshopId).Select(x => x.EmployerId);
|
||||
IQueryable<Employer> employersQuery = _companyContext.Employers.Where(x => workshopEmployersIdsQuery.Contains(x.id));
|
||||
|
||||
IQueryable<PersonnelCodeDomain> personnelCodesQuery = _companyContext.PersonnelCodeSet
|
||||
.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId));
|
||||
IQueryable<PersonnelCodeDomain> personnelCodesQuery = _companyContext.PersonnelCodeSet
|
||||
.Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId));
|
||||
|
||||
//IQueryable<LeftWork> leftWorksQuery = _companyContext.LeftWorkList
|
||||
// .Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
// x.LeftWorkDate.AddDays(-1) >= monthStart && x.StartWorkDate <= monthEnd);
|
||||
//IQueryable<LeftWork> leftWorksQuery = _companyContext.LeftWorkList
|
||||
// .Where(x => customizeCheckoutsQuery.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
// x.LeftWorkDate.AddDays(-1) >= monthStart && x.StartWorkDate <= monthEnd);
|
||||
|
||||
//IQueryable<Employee> employeesQuery = _companyContext.Employees.Where(x => customizeCheckoutsQuery.Any(y => y.EmployeeId == x.id));
|
||||
//IQueryable<Employee> employeesQuery = _companyContext.Employees.Where(x => customizeCheckoutsQuery.Any(y => y.EmployeeId == x.id));
|
||||
|
||||
|
||||
List<(string Picture, long Id)> employeePictures;
|
||||
List<(string Picture, long Id)> employeePictures;
|
||||
|
||||
|
||||
var employeePicMediaIdInEmployeeDoc = _companyContext.EmployeeDocumentItems.Where(x => customizeCheckoutsQuery
|
||||
.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
x.DocumentLabel == DocumentItemLabel.EmployeePicture &&
|
||||
x.DocumentStatus == DocumentStatus.Confirmed)
|
||||
?.Select(x => new { x.EmployeeId, x.MediaId }).ToList();
|
||||
var employeePicMediaIdInEmployeeDoc = _companyContext.EmployeeDocumentItems.Where(x => customizeCheckoutsQuery
|
||||
.Any(y => y.WorkshopId == x.WorkshopId && y.EmployeeId == x.EmployeeId) &&
|
||||
x.DocumentLabel == DocumentItemLabel.EmployeePicture &&
|
||||
x.DocumentStatus == DocumentStatus.Confirmed)
|
||||
?.Select(x => new { x.EmployeeId, x.MediaId }).ToList();
|
||||
|
||||
var mediasInEmployeeDoc = _accountContext.Medias.Where(x => employeePicMediaIdInEmployeeDoc.Select(y => y.MediaId).Contains(x.id)).ToList();
|
||||
employeePictures = employeePicMediaIdInEmployeeDoc.Select(x =>
|
||||
{
|
||||
var media = mediasInEmployeeDoc.First(m => m.id == x.MediaId);
|
||||
var filePath = media.Path;
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
throw new FileNotFoundException("فایل مورد نظر یافت نشد.", filePath);
|
||||
var mediasInEmployeeDoc = _accountContext.Medias.Where(x => employeePicMediaIdInEmployeeDoc.Select(y => y.MediaId).Contains(x.id)).ToList();
|
||||
employeePictures = employeePicMediaIdInEmployeeDoc.Select(x =>
|
||||
{
|
||||
var media = mediasInEmployeeDoc.First(m => m.id == x.MediaId);
|
||||
var filePath = media.Path;
|
||||
if (!System.IO.File.Exists(filePath))
|
||||
throw new FileNotFoundException("فایل مورد نظر یافت نشد.", filePath);
|
||||
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
|
||||
return (base64, x.EmployeeId);
|
||||
}).ToList();
|
||||
return (base64, x.EmployeeId);
|
||||
}).ToList();
|
||||
|
||||
|
||||
|
||||
var employeeIds = customizeCheckoutsQuery.Select(x => x.EmployeeId).ToList()
|
||||
.Where(x => !employeePictures.Select(e => e.Id).Contains(x)).ToList();
|
||||
var employeeIds = customizeCheckoutsQuery.Select(x => x.EmployeeId).ToList()
|
||||
.Where(x => !employeePictures.Select(e => e.Id).Contains(x)).ToList();
|
||||
|
||||
foreach (var employeeId in employeeIds)
|
||||
{
|
||||
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}\\1.jpg";
|
||||
foreach (var employeeId in employeeIds)
|
||||
{
|
||||
var directoryPath = $"{_webHostEnvironment.ContentRootPath}\\Faces\\{workshopId}\\{employeeId}\\1.jpg";
|
||||
|
||||
if (!System.IO.File.Exists(directoryPath))
|
||||
continue;
|
||||
if (!System.IO.File.Exists(directoryPath))
|
||||
continue;
|
||||
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(directoryPath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
byte[] fileBytes = System.IO.File.ReadAllBytes(directoryPath);
|
||||
var base64 = Convert.ToBase64String(fileBytes);
|
||||
|
||||
employeePictures.Add((base64, employeeId));
|
||||
}
|
||||
employeePictures.Add((base64, employeeId));
|
||||
}
|
||||
|
||||
|
||||
List<CustomizeCheckoutViewModel> customizeCheckoutsList = customizeCheckoutsQuery.Select(x => new CustomizeCheckoutViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId == null ? 0 : x.ContractId.Value,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
CreationDate = x.CreationDate,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
WorkshopName = x.WorkshopFullName,
|
||||
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
||||
NationalCode = x.NationalCode,
|
||||
EmployeeFName = x.EmployeeFName,
|
||||
EmployeeLName = x.EmployeeLName,
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FineViewModelList = x.CheckoutFines.Select(y => new FineViewModel()
|
||||
{
|
||||
Amount = y.Amount,
|
||||
FineDate = y.FineDateFa,
|
||||
Title = y.Title
|
||||
}).ToList(),
|
||||
InstallmentViewModels = x.CustomizeCheckoutLoanInstallments.Select(i => new LoanInstallmentViewModel()
|
||||
{
|
||||
Amount = i.AmountForMonth,
|
||||
AmountDouble = i.AmountForMonth.MoneyToDouble(),
|
||||
Year = i.Year,
|
||||
Month = i.Month,
|
||||
IsActive = i.IsActive,
|
||||
RemainingAmount = i.LoanRemaining,
|
||||
LoanAmount = i.LoanAmount
|
||||
}).ToList(),
|
||||
RewardViewModels = x.CustomizeCheckoutRewards.Select(r => new RewardViewModel()
|
||||
{
|
||||
IsActive = r.IsActive,
|
||||
Title = r.Title,
|
||||
Amount = r.Amount,
|
||||
AmountDouble = r.Amount.MoneyToDouble(),
|
||||
Description = r.Description,
|
||||
GrantDateFa = r.GrantDateFa,
|
||||
GrantDateGr = r.GrantDate
|
||||
}).ToList(),
|
||||
SalaryAidViewModels = x.CustomizeCheckoutSalaryAids.Select(s => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = s.Amount,
|
||||
AmountDouble = s.Amount.MoneyToDouble(),
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
List<CustomizeCheckoutViewModel> customizeCheckoutsList = customizeCheckoutsQuery.Select(x => new CustomizeCheckoutViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
WorkshopId = x.WorkshopId,
|
||||
ContractId = x.ContractId == null ? 0 : x.ContractId.Value,
|
||||
EmployeeId = x.EmployeeId,
|
||||
Month = x.Month,
|
||||
Year = x.Year,
|
||||
ContractNo = x.ContractNo,
|
||||
MonthlySalary = x.MonthlySalary.ToMoney(),
|
||||
BaseYearsPay = x.BaseYearsPay.ToMoney(),
|
||||
OvertimePay = x.OverTimePay.ToMoney(),
|
||||
NightworkPay = x.NightWorkPay.ToMoney(),
|
||||
FridayPay = x.FridayPay.ToMoney(),
|
||||
ShiftPay = x.ShiftPay.ToMoney(),
|
||||
FamilyAllowance = x.FamilyAllowance.ToMoney(),
|
||||
BonusesPay = x.BonusesPay.ToMoney(),
|
||||
LeavePay = x.LeavePay.ToMoney(),
|
||||
InsuranceDeduction = x.InsuranceDeduction.ToMoney(),
|
||||
TaxDeducation = x.TaxDeduction.ToMoney(),
|
||||
InstallmentDeduction = x.InstallmentDeduction.ToMoney(),
|
||||
SalaryAidDeduction = x.SalaryAidDeduction.ToMoney(),
|
||||
AbsenceDeduction = x.FineAbsenceDeduction.ToMoney(),
|
||||
TotalClaims = x.TotalClaims,
|
||||
TotalDeductions = x.TotalDeductions,
|
||||
TotalPayment = x.TotalPayment.ToMoney(),
|
||||
RewardPay = x.RewardPay.ToMoney(),
|
||||
ContractStartGr = x.ContractStart,
|
||||
ContractEndGr = x.ContractEnd,
|
||||
MarriedAllowance = x.MarriedAllowance.ToMoney(),
|
||||
ContractEndFa = x.ContractEnd.ToFarsi(),
|
||||
ContractStartFa = x.ContractStart.ToFarsi(),
|
||||
CreationDate = x.CreationDate,
|
||||
SumOfWorkingDays = x.SumOfWorkingDays,
|
||||
WorkshopName = x.WorkshopFullName,
|
||||
DateOfBirth = x.DateOfBirth.ToFarsi(),
|
||||
NationalCode = x.NationalCode,
|
||||
EmployeeFName = x.EmployeeFName,
|
||||
EmployeeLName = x.EmployeeLName,
|
||||
EarlyExitDeduction = x.EarlyExitDeduction.ToMoney(),
|
||||
LateToWorkDeduction = x.LateToWorkDeduction.ToMoney(),
|
||||
FineDeduction = x.FineDeduction.ToMoney(),
|
||||
FineViewModelList = x.CheckoutFines.Select(y => new FineViewModel()
|
||||
{
|
||||
Amount = y.Amount,
|
||||
FineDate = y.FineDateFa,
|
||||
Title = y.Title
|
||||
}).ToList(),
|
||||
InstallmentViewModels = x.CustomizeCheckoutLoanInstallments.Select(i => new LoanInstallmentViewModel()
|
||||
{
|
||||
Amount = i.AmountForMonth,
|
||||
AmountDouble = i.AmountForMonth.MoneyToDouble(),
|
||||
Year = i.Year,
|
||||
Month = i.Month,
|
||||
IsActive = i.IsActive,
|
||||
RemainingAmount = i.LoanRemaining,
|
||||
LoanAmount = i.LoanAmount
|
||||
}).ToList(),
|
||||
RewardViewModels = x.CustomizeCheckoutRewards.Select(r => new RewardViewModel()
|
||||
{
|
||||
IsActive = r.IsActive,
|
||||
Title = r.Title,
|
||||
Amount = r.Amount,
|
||||
AmountDouble = r.Amount.MoneyToDouble(),
|
||||
Description = r.Description,
|
||||
GrantDateFa = r.GrantDateFa,
|
||||
GrantDateGr = r.GrantDate
|
||||
}).ToList(),
|
||||
SalaryAidViewModels = x.CustomizeCheckoutSalaryAids.Select(s => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = s.Amount,
|
||||
AmountDouble = s.Amount.MoneyToDouble(),
|
||||
SalaryAidDateTimeFa = s.SalaryAidDateTimeFa,
|
||||
SalaryAidDateTimeGe = s.SalaryAidDateTime
|
||||
}).ToList(),
|
||||
|
||||
//LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{(int)x.LateToWorkValue.TotalHours}:{x.LateToWorkValue.Minutes:D2}"
|
||||
LateToWorkValue = x.LateToWorkValue == TimeSpan.Zero ? "-" : $"{(int)x.LateToWorkValue.TotalHours}:{Convert.ToInt32(x.LateToWorkValue.TotalMinutes % 60):00}",
|
||||
SettingSalary = x.SettingSalary.ToMoney(),
|
||||
DailyWage = x.DailyWage.ToMoney(),
|
||||
@@ -371,103 +372,102 @@ namespace CompanyManagment.EFCore.Repository
|
||||
CustomizeRotatingShifts = x.CustomizeRotatingShifts.ToList(),
|
||||
RegularShift = x.RegularShifts.Select(x => (CustomizeSifts)x).ToList()
|
||||
|
||||
}).ToList();
|
||||
List<WorkshopViewModel> workshopsList = workshopsQuery.Select(x => new WorkshopViewModel
|
||||
{
|
||||
WorkshopFullName = x.WorkshopFullName,
|
||||
Id = x.id
|
||||
}).ToList();
|
||||
List<EmployerViewModel> workshopEmployersList = employersQuery.Select(x => new EmployerViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
FullName = x.FullName
|
||||
}).ToList();
|
||||
//List<LeftWorkViewModel> leftWorksList = leftWorksQuery.Select(x => new LeftWorkViewModel
|
||||
//{
|
||||
// EmployeeId = x.EmployeeId,
|
||||
// WorkshopId = x.WorkshopId,
|
||||
// Id = x.id,
|
||||
// StartWorkDateGr = x.StartWorkDate,
|
||||
// LeftWorkDateGr = x.LeftWorkDate
|
||||
//}).ToList();
|
||||
//List<EmployeeViewModel> employees = employeesQuery.Select(x => new EmployeeViewModel()
|
||||
//{
|
||||
// Id = x.id,
|
||||
// FName = x.FName,
|
||||
// LName = x.LName,
|
||||
// FatherName = x.FatherName,
|
||||
// NationalCode = x.NationalCode,
|
||||
// DateOfBirth = x.DateOfBirth.ToFarsi()
|
||||
//}).ToList();
|
||||
List<PersonnelCodeViewModel> personnelCodeList = personnelCodesQuery.Select(x => new PersonnelCodeViewModel
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
WorkshopId = x.WorkshopId,
|
||||
PersonnelCode = Convert.ToInt64(x.PersonnelCode)
|
||||
}).ToList();
|
||||
|
||||
}).ToList();
|
||||
List<WorkshopViewModel> workshopsList = workshopsQuery.Select(x => new WorkshopViewModel
|
||||
{
|
||||
WorkshopFullName = x.WorkshopFullName,
|
||||
Id = x.id
|
||||
}).ToList();
|
||||
List<EmployerViewModel> workshopEmployersList = employersQuery.Select(x => new EmployerViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
FullName = x.FullName
|
||||
}).ToList();
|
||||
//List<LeftWorkViewModel> leftWorksList = leftWorksQuery.Select(x => new LeftWorkViewModel
|
||||
//{
|
||||
// EmployeeId = x.EmployeeId,
|
||||
// WorkshopId = x.WorkshopId,
|
||||
// Id = x.id,
|
||||
// StartWorkDateGr = x.StartWorkDate,
|
||||
// LeftWorkDateGr = x.LeftWorkDate
|
||||
//}).ToList();
|
||||
//List<EmployeeViewModel> employees = employeesQuery.Select(x => new EmployeeViewModel()
|
||||
//{
|
||||
// Id = x.id,
|
||||
// FName = x.FName,
|
||||
// LName = x.LName,
|
||||
// FatherName = x.FatherName,
|
||||
// NationalCode = x.NationalCode,
|
||||
// DateOfBirth = x.DateOfBirth.ToFarsi()
|
||||
//}).ToList();
|
||||
List<PersonnelCodeViewModel> personnelCodeList = personnelCodesQuery.Select(x => new PersonnelCodeViewModel
|
||||
{
|
||||
EmployeeId = x.EmployeeId,
|
||||
WorkshopId = x.WorkshopId,
|
||||
PersonnelCode = Convert.ToInt64(x.PersonnelCode)
|
||||
}).ToList();
|
||||
var date = customizeCheckoutsList.FirstOrDefault();
|
||||
|
||||
var date = customizeCheckoutsList.FirstOrDefault();
|
||||
if (date == null)
|
||||
return new();
|
||||
|
||||
if (date == null)
|
||||
return new();
|
||||
|
||||
var startDate = date.ContractStartGr.Date;
|
||||
var endDate = date.ContractEndGr.AddDays(1).Date.AddTicks(-1);
|
||||
var startDate = date.ContractStartGr.Date;
|
||||
var endDate = date.ContractEndGr.AddDays(1).Date.AddTicks(-1);
|
||||
|
||||
|
||||
List<PersonnelCheckoutDailyRollCallViewModel> personnelRollCalls = _rollCallRepository
|
||||
.GetEmployeeRollCallsForCustomizeCheckoutTemp(customizeCheckoutsList.Select(x => x.Id).ToList(), workshopId);
|
||||
List<PersonnelCheckoutDailyRollCallViewModel> personnelRollCalls = _rollCallRepository
|
||||
.GetEmployeeRollCallsForCustomizeCheckoutTemp(customizeCheckoutsList.Select(x => x.Id).ToList(), workshopId);
|
||||
|
||||
int counter = 1;
|
||||
foreach (var checkout in customizeCheckoutsList)
|
||||
{
|
||||
checkout.EmployeePicture =
|
||||
employeePictures.FirstOrDefault(p => p.Id == checkout.EmployeeId).Picture ?? "";
|
||||
checkout.PrintCounter = counter++;
|
||||
//var leftwork = leftWorksList.FirstOrDefault(x => checkout.WorkshopId == x.WorkshopId && x.EmployeeId == checkout.EmployeeId);
|
||||
//checkout.LeftWorkDateGr = leftwork.LeftWorkDateGr;
|
||||
int counter = 1;
|
||||
foreach (var checkout in customizeCheckoutsList)
|
||||
{
|
||||
checkout.EmployeePicture =
|
||||
employeePictures.FirstOrDefault(p => p.Id == checkout.EmployeeId).Picture ?? "";
|
||||
checkout.PrintCounter = counter++;
|
||||
//var leftwork = leftWorksList.FirstOrDefault(x => checkout.WorkshopId == x.WorkshopId && x.EmployeeId == checkout.EmployeeId);
|
||||
//checkout.LeftWorkDateGr = leftwork.LeftWorkDateGr;
|
||||
|
||||
//var employee = employees.FirstOrDefault(x => x.Id == checkout.EmployeeId);
|
||||
var rollCalls = personnelRollCalls.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId);
|
||||
//var employee = employees.FirstOrDefault(x => x.Id == checkout.EmployeeId);
|
||||
var rollCalls = personnelRollCalls.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId);
|
||||
|
||||
checkout.EmployerList = workshopEmployersList;
|
||||
checkout.EmployerName = workshopEmployersList.FirstOrDefault()?.FullName ?? "-";
|
||||
checkout.EmployerList = workshopEmployersList;
|
||||
checkout.EmployerName = workshopEmployersList.FirstOrDefault()?.FullName ?? "-";
|
||||
|
||||
checkout.MonthlyRollCall = rollCalls;
|
||||
checkout.MonthlyRollCall.DailyRollCalls = rollCalls.DailyRollCalls.Select(x =>
|
||||
{
|
||||
var isInRange = x.DateTimeGr >= checkout.ContractStartGr && x.DateTimeGr <= checkout.ContractEndGr;
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = isInRange ? x.StartDate1 : "",
|
||||
EndDate1 = isInRange ? x.EndDate1 : "",
|
||||
EndDate2 = isInRange ? x.EndDate2 : "",
|
||||
StartDate2 = isInRange ? x.StartDate2 : "",
|
||||
TotalWorkingHours = isInRange ? x.TotalWorkingHours : "",
|
||||
DayOfWeek = x.DayOfWeek,
|
||||
RollCallDateFa = x.RollCallDateFa,
|
||||
DateTimeGr = x.DateTimeGr,
|
||||
IsSliced = isInRange && x.IsSliced,
|
||||
LeaveType = x.LeaveType,
|
||||
IsBirthDay = x.IsBirthDay,
|
||||
IsAbsent = x.IsAbsent,
|
||||
IsFriday = x.IsFriday,
|
||||
EnterDifferencesMinutes1 = isInRange ? x.EnterDifferencesMinutes1 : "",
|
||||
EnterDifferencesMinutes2 = isInRange ? x.EnterDifferencesMinutes2 : "",
|
||||
ExitDifferencesMinutes1 = isInRange ? x.ExitDifferencesMinutes1 : "",
|
||||
ExitDifferencesMinutes2 = isInRange ? x.ExitDifferencesMinutes2 : ""
|
||||
checkout.MonthlyRollCall = rollCalls;
|
||||
checkout.MonthlyRollCall.DailyRollCalls = rollCalls.DailyRollCalls.Select(x =>
|
||||
{
|
||||
var isInRange = x.DateTimeGr >= checkout.ContractStartGr && x.DateTimeGr <= checkout.ContractEndGr;
|
||||
return new CheckoutDailyRollCallViewModel()
|
||||
{
|
||||
StartDate1 = isInRange ? x.StartDate1 : "",
|
||||
EndDate1 = isInRange ? x.EndDate1 : "",
|
||||
EndDate2 = isInRange ? x.EndDate2 : "",
|
||||
StartDate2 = isInRange ? x.StartDate2 : "",
|
||||
TotalWorkingHours = isInRange ? x.TotalWorkingHours : "",
|
||||
DayOfWeek = x.DayOfWeek,
|
||||
RollCallDateFa = x.RollCallDateFa,
|
||||
DateTimeGr = x.DateTimeGr,
|
||||
IsSliced = isInRange && x.IsSliced,
|
||||
LeaveType = x.LeaveType,
|
||||
IsBirthDay = x.IsBirthDay,
|
||||
IsAbsent = x.IsAbsent,
|
||||
IsFriday = x.IsFriday,
|
||||
EnterDifferencesMinutes1 = isInRange ? x.EnterDifferencesMinutes1 : "",
|
||||
EnterDifferencesMinutes2 = isInRange ? x.EnterDifferencesMinutes2 : "",
|
||||
ExitDifferencesMinutes1 = isInRange ? x.ExitDifferencesMinutes1 : "",
|
||||
ExitDifferencesMinutes2 = isInRange ? x.ExitDifferencesMinutes2 : ""
|
||||
|
||||
};
|
||||
}).ToList();
|
||||
checkout.PersonnelCode = personnelCodeList.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId)?.PersonnelCode ?? 0;
|
||||
};
|
||||
}).ToList();
|
||||
checkout.PersonnelCode = personnelCodeList.FirstOrDefault(x => x.EmployeeId == checkout.EmployeeId)?.PersonnelCode ?? 0;
|
||||
|
||||
}
|
||||
return customizeCheckoutsList.OrderBy(x => x.EmployeeFullName).ToList();
|
||||
}
|
||||
return customizeCheckoutsList.OrderBy(x => x.EmployeeFullName).ToList();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveEmployeeTemporaryCheckoutInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth)
|
||||
public void RemoveEmployeeTemporaryCheckoutInDates(long workshopId, long employeeId, DateTime startOfMonth, DateTime endOfMonth)
|
||||
{
|
||||
var checkout = _companyContext.CustomizeCheckoutTemps.FirstOrDefault(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId &&
|
||||
x.ContractStart.Date <= endOfMonth.Date && x.ContractEnd.Date >= startOfMonth.Date);
|
||||
@@ -480,5 +480,19 @@ namespace CompanyManagment.EFCore.Repository
|
||||
{
|
||||
return _companyContext.CustomizeCheckoutTemps.Where(x => x.WorkshopId == workshopId && ids.Contains(x.id));
|
||||
}
|
||||
|
||||
public List<CustomizeCheckoutTemp> GetByWorkshopIdEmployeeIdInDates(long workshopId, long employeeId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var checkouts = _companyContext.CustomizeCheckoutTemps.Where(x => x.WorkshopId == workshopId && x.EmployeeId == employeeId &&
|
||||
x.ContractStart <= endDate && x.ContractEnd >= startDate).ToList();
|
||||
return checkouts;
|
||||
}
|
||||
|
||||
public async Task<CustomizeCheckoutTemp> GetByWorkshopIdEmployeeIdInDate(long workshopId, long employeeId, DateTime inDate)
|
||||
{
|
||||
return await _companyContext.CustomizeCheckoutTemps.FirstOrDefaultAsync(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.ContractStart <= inDate &&
|
||||
x.ContractEnd >= inDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1223,7 +1223,8 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
public CustomizeCheckoutMandatoryViewModel CustomizeCheckoutMandatoryCompute(long employeeId, long workshopId, DateTime contractStart,
|
||||
DateTime contractEnd)
|
||||
{
|
||||
|
||||
var checkoutEnd = contractEnd;
|
||||
var checkoutStart = contractStart;
|
||||
if (workshopId == 170)
|
||||
return CustomizeCheckoutMandatoryComputeForKebabMahdi(employeeId, workshopId, contractStart, contractEnd);
|
||||
|
||||
@@ -1483,34 +1484,14 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
#endregion
|
||||
#region SalaryAidDeduction
|
||||
|
||||
var salaryAidViewModel = _context.SalaryAids
|
||||
.Where(x => x.SalaryAidDateTime >= contractStart && x.SalaryAidDateTime <= contractEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
}).ToList();
|
||||
var salaryAidViewModel = SalaryAidsForCheckout(employeeId, workshopId, checkoutStart, checkoutEnd);
|
||||
double salaryAidDeduction = salaryAidViewModel.Sum(x => x.AmountDouble);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Loan
|
||||
|
||||
var loanInstallments = _context.Loans
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.SelectMany(x => x.LoanInstallments)
|
||||
.Where(i => i.InstallmentDate > contractStart && i.InstallmentDate < contractEnd && i.IsActive == IsActive.True)
|
||||
.Select(x => new LoanInstallmentViewModel()
|
||||
{
|
||||
Month = x.Month,
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.AmountForMonth.ToMoney(),
|
||||
Year = x.Year,
|
||||
AmountDouble = x.AmountForMonth,
|
||||
RemainingAmount = _context.Loans.SelectMany(l => l.LoanInstallments).Where(i => i.LoanId == x.LoanId && i.IsActive == IsActive.True && i.InstallmentDate > x.InstallmentDate)
|
||||
.Sum(i => i.AmountForMonth).ToMoney()
|
||||
}).ToList();
|
||||
var loanInstallments = LoanInstallmentForCheckout(employeeId, workshopId, contractStart, contractEnd);
|
||||
|
||||
double loanDeduction = loanInstallments.Sum(x => x.AmountDouble);
|
||||
|
||||
@@ -1518,18 +1499,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
|
||||
#region Fine
|
||||
|
||||
var fineViewModels = _context.Fines.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.FineDate >= contractStart &&
|
||||
x.FineDate <= contractEnd && x.IsActive == IsActive.True).Select(x => new FineViewModel()
|
||||
{
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
FineDate = x.FineDate.ToFarsi(),
|
||||
Id = x.id,
|
||||
Title = x.Title,
|
||||
EmployeeId = x.EmployeeId,
|
||||
CreationDate = x.CreationDate.ToFarsi()
|
||||
}).ToList();
|
||||
var fineViewModels = FinesForCheckout(employeeId, workshopId, contractStart, contractEnd);
|
||||
double fineDeduction = fineViewModels.Sum(x => x.Amount.MoneyToDouble());
|
||||
|
||||
#endregion
|
||||
@@ -1676,18 +1646,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
#endregion
|
||||
#region Reward
|
||||
|
||||
var rewardViewModels = _context.Rewards.Where(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= contractEnd &&
|
||||
x.GrantDate >= contractStart).Select(x => new RewardViewModel
|
||||
{
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
Description = x.Description,
|
||||
GrantDateGr = x.GrantDate,
|
||||
GrantDateFa = x.GrantDate.ToFarsi(),
|
||||
IsActive = x.IsActive,
|
||||
}).ToList();
|
||||
var rewardViewModels = RewardForCheckout(employeeId, workshopId, checkoutEnd, checkoutStart);
|
||||
|
||||
double rewardPay = rewardViewModels.Sum(x => x.AmountDouble);
|
||||
#endregion
|
||||
@@ -2289,40 +2248,14 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
|
||||
#region SalaryAidDeduction
|
||||
|
||||
var salaryAidViewModel = _context.SalaryAids
|
||||
.Where(x => x.CalculationDate >= checkoutStart && x.CalculationDate <= checkoutEnd &&
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
CalculationDateTimeGe = x.CalculationDate,
|
||||
CalculationDateTimeFa = x.CalculationDate.ToFarsi(),
|
||||
}).ToList();
|
||||
var salaryAidViewModel = SalaryAidsForCheckout(employeeId, workshopId, checkoutStart, checkoutEnd);
|
||||
double salaryAidDeduction = salaryAidViewModel.Sum(x => x.AmountDouble);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Loan
|
||||
|
||||
var loanInstallments = _context.Loans
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.SelectMany(x => x.LoanInstallments)
|
||||
.Where(i => i.InstallmentDate >= contractStart && i.InstallmentDate <= contractEnd &&
|
||||
i.IsActive == IsActive.True)
|
||||
.Select(x => new LoanInstallmentViewModel()
|
||||
{
|
||||
Month = x.Month,
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.AmountForMonth.ToMoney(),
|
||||
Year = x.Year,
|
||||
AmountDouble = x.AmountForMonth,
|
||||
RemainingAmount = _context.Loans.SelectMany(l => l.LoanInstallments).Where(i =>
|
||||
i.LoanId == x.LoanId && i.IsActive == IsActive.True && i.InstallmentDate > x.InstallmentDate)
|
||||
.Sum(i => i.AmountForMonth).ToMoney(),
|
||||
LoanAmount = _context.Loans.FirstOrDefault(l => l.id == x.LoanId).Amount.ToMoney()
|
||||
}).ToList();
|
||||
var loanInstallments = LoanInstallmentForCheckout(employeeId, workshopId, contractStart, contractEnd);
|
||||
|
||||
double loanDeduction = loanInstallments.Sum(x => x.AmountDouble);
|
||||
|
||||
@@ -2330,18 +2263,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
|
||||
#region Fine
|
||||
|
||||
var fineViewModels = _context.Fines.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.FineDate >= contractStart &&
|
||||
x.FineDate <= contractEnd && x.IsActive == IsActive.True).Select(x => new FineViewModel()
|
||||
{
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
FineDate = x.FineDate.ToFarsi(),
|
||||
Id = x.id,
|
||||
Title = x.Title,
|
||||
EmployeeId = x.EmployeeId,
|
||||
CreationDate = x.CreationDate.ToFarsi()
|
||||
}).ToList();
|
||||
var fineViewModels = FinesForCheckout(employeeId, workshopId, contractStart, contractEnd);
|
||||
double fineDeduction = fineViewModels.Sum(x => x.Amount.MoneyToDouble());
|
||||
|
||||
#endregion
|
||||
@@ -2559,18 +2481,7 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
|
||||
#region Reward
|
||||
|
||||
var rewardViewModels = _context.Rewards.Where(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= checkoutEnd &&
|
||||
x.GrantDate >= checkoutStart).Select(x => new RewardViewModel
|
||||
{
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
Description = x.Description,
|
||||
GrantDateGr = x.GrantDate,
|
||||
GrantDateFa = x.GrantDate.ToFarsi(),
|
||||
IsActive = x.IsActive,
|
||||
}).ToList();
|
||||
var rewardViewModels = RewardForCheckout(employeeId, workshopId, checkoutEnd, checkoutStart);
|
||||
|
||||
double rewardPay = rewardViewModels.Sum(x => x.AmountDouble);
|
||||
|
||||
@@ -2846,37 +2757,14 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
|
||||
#region SalaryAidDeduction
|
||||
|
||||
var salaryAidViewModel = _context.SalaryAids
|
||||
.Where(x => x.CalculationDate >= contractStart && x.CalculationDate <= contractEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
CalculationDateTimeGe = x.CalculationDate,
|
||||
CalculationDateTimeFa = x.CalculationDate.ToFarsi(),
|
||||
|
||||
}).ToList();
|
||||
var salaryAidViewModel = SalaryAidsForCheckout(employeeId, workshopId, contractEnd, contractEnd);
|
||||
double salaryAidDeduction = salaryAidViewModel.Sum(x => x.AmountDouble);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Loan
|
||||
|
||||
var loanInstallments = _context.Loans
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.SelectMany(x => x.LoanInstallments)
|
||||
.Where(i => i.InstallmentDate > contractStart && i.InstallmentDate < contractEnd && i.IsActive == IsActive.True)
|
||||
.Select(x => new LoanInstallmentViewModel()
|
||||
{
|
||||
Month = x.Month,
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.AmountForMonth.ToMoney(),
|
||||
Year = x.Year,
|
||||
AmountDouble = x.AmountForMonth,
|
||||
RemainingAmount = _context.Loans.SelectMany(l => l.LoanInstallments).Where(i => i.LoanId == x.LoanId && i.IsActive == IsActive.True && i.InstallmentDate > x.InstallmentDate)
|
||||
.Sum(i => i.AmountForMonth).ToMoney()
|
||||
}).ToList();
|
||||
var loanInstallments = LoanInstallmentForCheckout(employeeId, workshopId, contractStart, contractEnd);
|
||||
|
||||
double loanDeduction = loanInstallments.Sum(x => x.AmountDouble);
|
||||
|
||||
@@ -2884,35 +2772,13 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
|
||||
#region Fine
|
||||
|
||||
var fineViewModels = _context.Fines.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.FineDate >= contractStart &&
|
||||
x.FineDate <= contractEnd && x.IsActive == IsActive.True).Select(x => new FineViewModel()
|
||||
{
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
FineDate = x.FineDate.ToFarsi(),
|
||||
Id = x.id,
|
||||
Title = x.Title,
|
||||
EmployeeId = x.EmployeeId,
|
||||
CreationDate = x.CreationDate.ToFarsi()
|
||||
}).ToList();
|
||||
var fineViewModels = FinesForCheckout(employeeId, workshopId, contractStart, contractEnd);
|
||||
double fineDeduction = fineViewModels.Sum(x => x.Amount.MoneyToDouble());
|
||||
|
||||
#endregion
|
||||
#region Reward
|
||||
|
||||
var rewardViewModels = _context.Rewards.Where(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= contractEnd &&
|
||||
x.GrantDate >= contractStart).Select(x => new RewardViewModel
|
||||
{
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
Description = x.Description,
|
||||
GrantDateGr = x.GrantDate,
|
||||
GrantDateFa = x.GrantDate.ToFarsi(),
|
||||
IsActive = x.IsActive,
|
||||
}).ToList();
|
||||
var rewardViewModels = RewardForCheckout(employeeId, workshopId, contractStart, contractEnd);
|
||||
|
||||
double rewardPay = rewardViewModels.Sum(x => x.AmountDouble);
|
||||
#endregion
|
||||
@@ -2936,6 +2802,75 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
private List<RewardViewModel> RewardForCheckout(long employeeId, long workshopId, DateTime checkoutEnd, DateTime checkoutStart)
|
||||
{
|
||||
return _context.Rewards.Where(x =>
|
||||
x.WorkshopId == workshopId && x.EmployeeId == employeeId && x.GrantDate <= checkoutEnd &&
|
||||
x.GrantDate >= checkoutStart).Select(x => new RewardViewModel
|
||||
{
|
||||
Title = x.Title,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
Description = x.Description,
|
||||
GrantDateGr = x.GrantDate,
|
||||
GrantDateFa = x.GrantDate.ToFarsi(),
|
||||
IsActive = x.IsActive,
|
||||
Id = x.id
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private List<FineViewModel> FinesForCheckout(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
return _context.Fines.Where(x =>
|
||||
x.EmployeeId == employeeId && x.WorkshopId == workshopId && x.FineDate >= contractStart &&
|
||||
x.FineDate <= contractEnd && x.IsActive == IsActive.True).Select(x => new FineViewModel()
|
||||
{
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.Amount.ToMoney(),
|
||||
FineDate = x.FineDate.ToFarsi(),
|
||||
Id = x.id,
|
||||
Title = x.Title,
|
||||
EmployeeId = x.EmployeeId,
|
||||
CreationDate = x.CreationDate.ToFarsi()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private List<LoanInstallmentViewModel> LoanInstallmentForCheckout(long employeeId, long workshopId, DateTime contractStart, DateTime contractEnd)
|
||||
{
|
||||
return _context.Loans
|
||||
.Where(x => x.EmployeeId == employeeId && x.WorkshopId == workshopId)
|
||||
.SelectMany(x => x.LoanInstallments)
|
||||
.Where(i => i.InstallmentDate >= contractStart && i.InstallmentDate <= contractEnd && i.IsActive == IsActive.True)
|
||||
.Select(x => new LoanInstallmentViewModel()
|
||||
{
|
||||
Id = x.Id,
|
||||
Month = x.Month,
|
||||
IsActive = x.IsActive,
|
||||
Amount = x.AmountForMonth.ToMoney(),
|
||||
Year = x.Year,
|
||||
AmountDouble = x.AmountForMonth,
|
||||
RemainingAmount = _context.Loans.SelectMany(l => l.LoanInstallments).Where(i => i.LoanId == x.LoanId && i.IsActive == IsActive.True && i.InstallmentDate > x.InstallmentDate)
|
||||
.Sum(i => i.AmountForMonth).ToMoney(),
|
||||
LoanAmount = _context.Loans.FirstOrDefault(l => l.id == x.LoanId).Amount.ToMoney()
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private List<SalaryAidViewModel> SalaryAidsForCheckout(long employeeId, long workshopId, DateTime checkoutStart, DateTime checkoutEnd)
|
||||
{
|
||||
return _context.SalaryAids
|
||||
.Where(x => x.CalculationDate >= checkoutStart && x.CalculationDate <= checkoutEnd && x.EmployeeId == employeeId && x.WorkshopId == workshopId).Select(x => new SalaryAidViewModel()
|
||||
{
|
||||
Amount = x.Amount.ToMoney(),
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
CalculationDateTimeGe = x.CalculationDate,
|
||||
CalculationDateTimeFa = x.CalculationDate.ToFarsi(),
|
||||
Id = x.id
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
private void CreateRewardForBirthDay(long employeeId, long workshopId, double amount, int month, int year,
|
||||
DateTime contractStart)
|
||||
{
|
||||
|
||||
@@ -73,7 +73,8 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
|
||||
EmployeeId = entity.EmployeeId,
|
||||
Amount = entity.Amount.ToMoney(),
|
||||
SalaryDateTime = entity.SalaryAidDateTime.ToFarsi(),
|
||||
CalculationDateTime = entity.CalculationDate.ToFarsi()
|
||||
CalculationMonth = entity.CalculationMonth,
|
||||
CalculationYear = entity.CalculationYear,
|
||||
};
|
||||
|
||||
res.EmployeeFullName = _companyContext.Employees.Find(entity.EmployeeId)?.FullName;
|
||||
|
||||
@@ -791,7 +791,7 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
string finalResultMoney = string.Empty;
|
||||
double FinalResult = 0;
|
||||
int DayCounter = 0;
|
||||
int Max365 = 365;
|
||||
int Max365 = 366;
|
||||
double Basic = 0;
|
||||
double BaseResult = 0;
|
||||
DateTime periodStarter = new DateTime();
|
||||
@@ -838,6 +838,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
//مقدار اولیه مزد روزانه
|
||||
var DayliSalaryStep1Fa = DayliSalaryStep1.ToMoney();
|
||||
double firstDayliSalary = DayliSalaryStep1Fa.MoneyToDouble();
|
||||
|
||||
DateTime baseYearDate = new DateTime();
|
||||
|
||||
for (DateTime LoopDate = getWork; LoopDate <= endDateW; LoopDate = LoopDate.AddDays(1))
|
||||
{
|
||||
@@ -867,6 +869,8 @@ public class YearlySalaryRepository : RepositoryBase<long, YearlySalary>, IYearl
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//اگر تاریخ جاری بزرگتر یت مساوی تاریخ شروع ترک کار و کوچکتر یا مساوی تاریخ پایان ترک کار بود
|
||||
if (LoopDateGr >= startPeriod && LoopDateGr <= endtPeriod)
|
||||
{
|
||||
|
||||
@@ -567,8 +567,10 @@
|
||||
$('#IdNumberSeri').val(response.data.idNumberSeri);
|
||||
if (response.data.gender === 0) {
|
||||
$('#GenderMale').prop('checked', true);
|
||||
$('#soldier').prop('disabled', false);
|
||||
} else if (response.data.gender === 1) {
|
||||
$('#GenderFemale').prop('checked', true);
|
||||
$('#soldier').prop('disabled', true);
|
||||
}
|
||||
} else {
|
||||
$.Notification.autoHideNotify('error', 'top right', 'خطا', response.message);
|
||||
|
||||
@@ -240,35 +240,38 @@
|
||||
<div class="row">
|
||||
<div class="gwb-container">
|
||||
|
||||
<div permission="2" id="smsDiv" class="gwb-card">
|
||||
<div type="button" class="click p-1 loadingButton" style="padding: 0 5px">
|
||||
<div class="gwb-card-flex" style="justify-content: space-between;width: 100%;">
|
||||
<div class="gwb-card-flex p-1">
|
||||
<img src="~/AssetsClient/images/sms-icon.png" alt="" class="img-fluid mx-1" width="50px"/>
|
||||
<div class="text-start ms-1">
|
||||
@* <div class="card-title">مقدار اعتبار فعلی</div> *@
|
||||
<div class="card-title">sms.ir</div>
|
||||
</div>
|
||||
</div>
|
||||
<div permission="2" id="smsDiv" class="gwb-card" >
|
||||
<div type="button" class="click p-1 loadingButton" style="padding: 0 5px">
|
||||
<div class="gwb-card-flex" style="justify-content: space-between;width: 100%;">
|
||||
<div class="gwb-card-flex p-1">
|
||||
<img src="~/AssetsClient/images/sms-icon.png" alt="" class="img-fluid mx-1" width="50px"/>
|
||||
<div class="text-start ms-1">
|
||||
@* <div class="card-title">مقدار اعتبار فعلی</div> *@
|
||||
<div class="card-title">sms.ir</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex;flex-direction: column;align-items: end;">
|
||||
<div class="card-amount">
|
||||
<span class="remain-number" style="color: #6D6D6D">پیامک باقیمانده</span>
|
||||
<span id="amountSms">@Model.SmsRemaining</span>
|
||||
</div>
|
||||
<div style="display: flex;flex-direction: column;align-items: end;">
|
||||
<div class="card-amount">
|
||||
<span class="remain-number" style="color: #6D6D6D">پیامک باقیمانده</span>
|
||||
<span id="amountSms"></span>
|
||||
</div>
|
||||
|
||||
<div style="">
|
||||
<a href="https://sms.ir/" target="_blank" rel="noopener noreferrer">
|
||||
<button id="btnSMS" class="btnSms">
|
||||
ورود به سامانه
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="">
|
||||
<a href="https://sms.ir/" target="_blank" rel="noopener noreferrer">
|
||||
<button id="btnSMS" class="btnSms">
|
||||
ورود به سامانه
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="spinner-loading loading rounded-0" id="loadingSmsRemaining" style="display: flex;">
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -793,10 +796,11 @@
|
||||
{
|
||||
<script src="~/admintheme/js/slick.min.js"></script>
|
||||
<script src="~/AssetsAdminNew/report/js/index.js"></script>
|
||||
@* <script>
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var ajaxDataReport = `@Url.Page("./Index", "ReportDataAjax")`;
|
||||
var boolPermissionForReports = @(authHelper.GetPermissions().Any(x => x == 306) ? "true" : "false");
|
||||
</script> *@
|
||||
var smsRemainingUrl = `@Url.Page("./Index", "SmsRemaining")`;
|
||||
// var ajaxDataReport = `@Url.Page("./Index", "ReportDataAjax")`;
|
||||
// var boolPermissionForReports = @(authHelper.GetPermissions().Any(x => x == 306) ? "true" : "false");
|
||||
</script>
|
||||
<script src="~/assetsadmin/page/index/js/index.js?ver=@adminVersion"></script>
|
||||
}
|
||||
@@ -48,7 +48,6 @@ namespace ServiceHost.Areas.Admin.Pages
|
||||
public string FolderPath;
|
||||
public int TaskCount;
|
||||
public int TicketCount;
|
||||
public int SmsRemaining;
|
||||
|
||||
public IndexModel(IWebHostEnvironment webHostEnvironment, IConfiguration configuration, IAuthHelper authHelper, IReportApplication reportApplication, IYearlySalaryApplication yearlySalaryApplication, IWorkshopApplication workshopApplication, IAccountApplication accountApplication, ITaskApplication taskApplication, ITicketApplication ticketApplication, ISmsService smsService)
|
||||
{
|
||||
@@ -82,13 +81,21 @@ namespace ServiceHost.Areas.Admin.Pages
|
||||
|
||||
TaskCount = await _taskApplication.RequestedAndOverdueTasksCount(userId);
|
||||
TicketCount = _ticketApplication.GetAdminTicketsCount();
|
||||
SmsRemaining = (int)await _smsService.GetCreditAmount();
|
||||
//SmsRemaining = (int)await _smsService.GetCreditAmount();
|
||||
|
||||
//foreach (string fileEntry in fileEntries)
|
||||
//{
|
||||
// Console.WriteLine(Path.GetFileName(fileEntry));
|
||||
//}
|
||||
}
|
||||
public async Task<IActionResult> OnGetSmsRemaining()
|
||||
{
|
||||
var result = (int)await _smsService.GetCreditAmount();
|
||||
return new JsonResult(new
|
||||
{
|
||||
data = result
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnGetReportDataAjax()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using _0_Framework.Application;
|
||||
using AccountManagement.Domain.AccountLeftWorkAgg;
|
||||
using AccountMangement.Infrastructure.EFCore;
|
||||
using Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
using Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
using Company.Domain.RewardAgg;
|
||||
using Company.Domain.RollCallAgg.DomainService;
|
||||
using CompanyManagment.App.Contracts.AndroidApkVersion;
|
||||
@@ -53,6 +55,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
//var notEndedRollCalls = rollCalls.Where(x => x.EndDate == null).ToList();
|
||||
//RefactorAllTheRollCallsOnEsfand(endedRollCalls, notEndedRollCalls);
|
||||
//CreateRewardForKebabMahdi().GetAwaiter().GetResult();
|
||||
SetEntityIdForCheckoutValues();
|
||||
SetEntityIdForCheckoutValuesTemp();
|
||||
ViewData["message"] = "ایجاد شد";
|
||||
return Page();
|
||||
}
|
||||
@@ -72,6 +76,140 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
|
||||
return Page();
|
||||
}
|
||||
|
||||
|
||||
private void SetEntityIdForCheckoutValuesTemp()
|
||||
{
|
||||
var customizeCheckouts = _context.CustomizeCheckoutTemps.ToList();
|
||||
foreach (var customizeCheckout in customizeCheckouts)
|
||||
{
|
||||
var newRewards = new List<CustomizeCheckoutTempReward>();
|
||||
foreach (var customizeCheckoutReward in customizeCheckout.CustomizeCheckoutRewards)
|
||||
{
|
||||
var reward = _context.Rewards.FirstOrDefault(x => x.GrantDate == customizeCheckoutReward.GrantDate && x.Title == customizeCheckoutReward.Title && x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId);
|
||||
if (reward != null)
|
||||
{
|
||||
newRewards.Add(new CustomizeCheckoutTempReward(reward.Amount.ToMoney(), reward.Description, reward.GrantDate, reward.GrantDate.ToFarsi(), reward.IsActive, reward.Title, reward.id));
|
||||
}
|
||||
}
|
||||
|
||||
var newSalary = new List<CustomizeCheckoutTempSalaryAid>();
|
||||
foreach (var customizeCheckoutSalaryAid in customizeCheckout.CustomizeCheckoutSalaryAids)
|
||||
{
|
||||
var salary = _context.SalaryAids.FirstOrDefault(x => x.SalaryAidDateTime == customizeCheckoutSalaryAid.SalaryAidDateTime &&
|
||||
x.Amount == customizeCheckoutSalaryAid.Amount.MoneyToDouble() &&
|
||||
x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId);
|
||||
|
||||
if (salary != null)
|
||||
{
|
||||
newSalary.Add(new CustomizeCheckoutTempSalaryAid(salary.Amount.ToMoney(), salary.SalaryAidDateTime,
|
||||
salary.SalaryAidDateTime.ToFarsi(), salary.CalculationDate, salary.CalculationDate.ToFarsi(), salary.id));
|
||||
}
|
||||
}
|
||||
|
||||
var newFines = new List<CustomizeCheckoutTempFine>();
|
||||
foreach (var checkoutFine in customizeCheckout.CheckoutFines)
|
||||
{
|
||||
var fines = _context.Fines.FirstOrDefault(x => x.Amount == checkoutFine.Amount.MoneyToDouble() && x.FineDate == checkoutFine.FineDateGr &&
|
||||
x.Title == checkoutFine.Title && x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId);
|
||||
if (fines != null)
|
||||
{
|
||||
newFines.Add(new CustomizeCheckoutTempFine(fines.Title, fines.Amount.ToMoney(), fines.FineDate.ToFarsi(), fines.FineDate, fines.IsActive, fines.CreationDate, fines.id));
|
||||
}
|
||||
}
|
||||
|
||||
var newInstallments = new List<CustomizeCheckoutTempLoanInstallments>();
|
||||
|
||||
foreach (var customizeCheckoutLoanInstallment in customizeCheckout.CustomizeCheckoutLoanInstallments)
|
||||
{
|
||||
|
||||
var installments = _context.Loans.SelectMany(x => x.LoanInstallments).AsNoTracking().Where(x => x.Month == customizeCheckoutLoanInstallment.Month && x.Year == customizeCheckoutLoanInstallment.Year && x.AmountForMonth == customizeCheckoutLoanInstallment.AmountForMonth.MoneyToDouble()).ToList();
|
||||
var loans = _context.Loans
|
||||
.Where(x => x.Amount == customizeCheckoutLoanInstallment.LoanAmount.MoneyToDouble() && x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId).ToList();
|
||||
|
||||
var installment = installments.First(x => loans.Any(l => l.id == x.LoanId));
|
||||
|
||||
if (installment != null)
|
||||
{
|
||||
newInstallments.Add(new CustomizeCheckoutTempLoanInstallments(installment.AmountForMonth.ToMoney(),
|
||||
installment.Month, installment.Year, installment.IsActive,
|
||||
customizeCheckoutLoanInstallment.LoanRemaining, customizeCheckoutLoanInstallment.LoanAmount,
|
||||
installment.Id));
|
||||
}
|
||||
}
|
||||
customizeCheckout.SetValueObjects(newFines, newInstallments, newSalary, newRewards);
|
||||
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
}
|
||||
}
|
||||
private void SetEntityIdForCheckoutValues()
|
||||
{
|
||||
var customizeCheckouts = _context.CustomizeCheckouts.ToList();
|
||||
foreach (var customizeCheckout in customizeCheckouts)
|
||||
{
|
||||
var newRewards = new List<CustomizeCheckoutReward>();
|
||||
foreach (var customizeCheckoutReward in customizeCheckout.CustomizeCheckoutRewards)
|
||||
{
|
||||
var reward = _context.Rewards.FirstOrDefault(x => x.GrantDate == customizeCheckoutReward.GrantDate && x.Title == customizeCheckoutReward.Title && x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId);
|
||||
if (reward != null)
|
||||
{
|
||||
newRewards.Add(new CustomizeCheckoutReward(reward.Amount.ToMoney(), reward.Description, reward.GrantDate, reward.GrantDate.ToFarsi(), reward.IsActive, reward.Title, reward.id));
|
||||
}
|
||||
}
|
||||
|
||||
var newSalary = new List<CustomizeCheckoutSalaryAid>();
|
||||
foreach (var customizeCheckoutSalaryAid in customizeCheckout.CustomizeCheckoutSalaryAids)
|
||||
{
|
||||
var salary = _context.SalaryAids.FirstOrDefault(x => x.SalaryAidDateTime == customizeCheckoutSalaryAid.SalaryAidDateTime &&
|
||||
x.Amount == customizeCheckoutSalaryAid.Amount.MoneyToDouble() &&
|
||||
x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId);
|
||||
|
||||
if (salary != null)
|
||||
{
|
||||
newSalary.Add(new CustomizeCheckoutSalaryAid(salary.Amount.ToMoney(), salary.SalaryAidDateTime,
|
||||
salary.SalaryAidDateTime.ToFarsi(), salary.CalculationDate, salary.CalculationDate.ToFarsi(), salary.id));
|
||||
}
|
||||
}
|
||||
|
||||
var newFines = new List<CustomizeCheckoutFine>();
|
||||
foreach (var checkoutFine in customizeCheckout.CheckoutFines)
|
||||
{
|
||||
var fines = _context.Fines.FirstOrDefault(x => x.Amount == checkoutFine.Amount.MoneyToDouble() && x.FineDate == checkoutFine.FineDateGr &&
|
||||
x.Title == checkoutFine.Title && x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId);
|
||||
if (fines != null)
|
||||
{
|
||||
newFines.Add(new CustomizeCheckoutFine(fines.Title, fines.Amount.ToMoney(), fines.FineDate.ToFarsi(), fines.FineDate, fines.IsActive, fines.CreationDate, fines.id));
|
||||
}
|
||||
}
|
||||
|
||||
var newInstallments = new List<CustomizeCheckoutLoanInstallments>();
|
||||
|
||||
foreach (var customizeCheckoutLoanInstallment in customizeCheckout.CustomizeCheckoutLoanInstallments)
|
||||
{
|
||||
|
||||
var installments = _context.Loans.SelectMany(x => x.LoanInstallments).AsNoTracking().Where(x => x.Month == customizeCheckoutLoanInstallment.Month && x.Year == customizeCheckoutLoanInstallment.Year && x.AmountForMonth == customizeCheckoutLoanInstallment.AmountForMonth.MoneyToDouble()).ToList();
|
||||
var loans = _context.Loans
|
||||
.Where(x => x.Amount == customizeCheckoutLoanInstallment.LoanAmount.MoneyToDouble() && x.EmployeeId == customizeCheckout.EmployeeId && x.WorkshopId == customizeCheckout.WorkshopId).ToList();
|
||||
|
||||
var installment = installments.First(x => loans.Any(l => l.id == x.LoanId));
|
||||
|
||||
if (installment != null)
|
||||
{
|
||||
newInstallments.Add(new CustomizeCheckoutLoanInstallments(installment.AmountForMonth.ToMoney(),
|
||||
installment.Month, installment.Year, installment.IsActive,
|
||||
customizeCheckoutLoanInstallment.LoanRemaining, customizeCheckoutLoanInstallment.LoanAmount,
|
||||
installment.Id));
|
||||
}
|
||||
}
|
||||
customizeCheckout.SetValueObjects(newFines, newInstallments, newSalary, newRewards);
|
||||
|
||||
|
||||
_context.SaveChanges();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostShiftDateNew2()
|
||||
{
|
||||
//var startRollCall = new DateTime(2025, 3, 21);
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
#printThis {
|
||||
width: 100%;
|
||||
padding: 2rem 1rem;
|
||||
padding: 0rem 1rem;
|
||||
}
|
||||
|
||||
#printThis .section-leave {
|
||||
|
||||
@@ -181,4 +181,4 @@
|
||||
var checkCodeAjax = `@Url.Page("./CameraAccounts", "CheckCode")`;
|
||||
var ajaxCameraValidation = `@Url.Page("./CameraAccounts", "CameraValidation")`;
|
||||
</script>
|
||||
<script src="~/AssetsAdminNew/RollCall/js/ModalCameraAccountChangePassword.js?ver=adssssminVersion"></script>
|
||||
<script src="~/AssetsAdminNew/RollCall/js/ModalCameraAccountChangePassword.js?ver=@adminVersion"></script>
|
||||
@@ -307,4 +307,4 @@
|
||||
var hasGroupWorkshop = @(Model.HasGroupWorkshop ? "true" : "false");
|
||||
var saveCameraAccountAndWorkshopSettingAjax = `@Url.Page("./Index", "SaveCameraAccountAndWorkshopSetting")`;
|
||||
</script>
|
||||
<script src="~/AssetsAdminNew/rollcall/js/modalcameraaccount.js?ver=adminVersion"></script>
|
||||
<script src="~/AssetsAdminNew/rollcall/js/modalcameraaccount.js?ver=@adminVersion"></script>
|
||||
@@ -186,4 +186,4 @@
|
||||
var IsRegularWorkshop = @(Model.WorkshopShiftStatus == WorkshopShiftStatus.Regular ? "true" : "false");
|
||||
|
||||
</script>
|
||||
<script src="~/AssetsAdminNew/rollcall/js/EditSettingWorkTime.js?ver=adminVersion"></script>
|
||||
<script src="~/AssetsAdminNew/rollcall/js/EditSettingWorkTime.js?ver=@adminVersion"></script>
|
||||
@@ -231,4 +231,4 @@
|
||||
var hasErrorPic2 = false;
|
||||
</script>
|
||||
<script src="~/weights/face-api.js"></script>
|
||||
<script src="~/AssetsAdminNew/rollcall/js/modaltakeimages.js?ver=adminVersion"></script>
|
||||
<script src="~/AssetsAdminNew/rollcall/js/modaltakeimages.js?ver=@adminVersion"></script>
|
||||
@@ -1,104 +1,105 @@
|
||||
@page
|
||||
@using _0_Framework.Application
|
||||
@using Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@model ServiceHost.Areas.AdminNew.Pages.Company.WorkFlow.EmployeesDocumentsModel
|
||||
@inject _0_Framework.Application.IAuthHelper AuthHelper;
|
||||
|
||||
@{
|
||||
string clientVersion = _0_Framework.Application.Version.StyleVersion;
|
||||
Layout = "Shared/_Layout";
|
||||
ViewData["title"] = " - بارگذاری مدارک توسط کارفرما";
|
||||
var currentAccount = AuthHelper.CurrentAccountInfo();
|
||||
string clientVersion = _0_Framework.Application.Version.StyleVersion;
|
||||
Layout = "Shared/_Layout";
|
||||
ViewData["title"] = " - بارگذاری مدارک توسط کارفرما";
|
||||
var currentAccount = AuthHelper.CurrentAccountInfo();
|
||||
|
||||
int index = 1;
|
||||
int index = 1;
|
||||
}
|
||||
|
||||
@section Styles {
|
||||
<link href="~/AssetsClient/css/table-style.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/table-responsive.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/css/operation-button.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/filter-search.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/card.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/datetimepicker.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AdminTheme/assets/sweet-alert/sweet-alert.min.css" rel="stylesheet">
|
||||
<link href="~/assetsclient/libs/fancybox/fancybox_2.css" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/table-style.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/table-responsive.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/assetsclient/css/operation-button.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/filter-search.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/card.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AssetsClient/css/datetimepicker.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<link href="~/AdminTheme/assets/sweet-alert/sweet-alert.min.css" rel="stylesheet">
|
||||
<link href="~/assetsclient/libs/fancybox/fancybox_2.css" rel="stylesheet" />
|
||||
|
||||
<link href="~/assetsadminnew/workflow/css/employeesdocuments.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<style>
|
||||
.fancybox__container {
|
||||
z-index: 9999999999999;
|
||||
}
|
||||
</style>
|
||||
<link href="~/assetsadminnew/workflow/css/employeesdocuments.css?ver=@clientVersion" rel="stylesheet" />
|
||||
<style>
|
||||
.fancybox__container {
|
||||
z-index: 9999999999999;
|
||||
}
|
||||
</style>
|
||||
}
|
||||
|
||||
<div class="container-fluid">
|
||||
<div class="row p-2">
|
||||
<div class="col p-0 m-0 d-flex align-items-center justify-content-between">
|
||||
<div class="col d-flex align-items-center justify-content-start">
|
||||
<img src="~/AssetsClient/images/icons/face-scan.png" alt="" class="img-fluid me-2" style="width: 45px;" />
|
||||
<div>
|
||||
<h4 class="title d-flex align-items-center">بارگذاری مدارک توسط کارفرما</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-page="/Company/WorkFlow/Index" class="back-btn" type="button">
|
||||
<span>بازگشت</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row p-2">
|
||||
<div class="col p-0 m-0 d-flex align-items-center justify-content-between">
|
||||
<div class="col d-flex align-items-center justify-content-start">
|
||||
<img src="~/AssetsClient/images/icons/face-scan.png" alt="" class="img-fluid me-2" style="width: 45px;" />
|
||||
<div>
|
||||
<h4 class="title d-flex align-items-center">بارگذاری مدارک توسط کارفرما</h4>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-page="/Company/WorkFlow/Index" class="back-btn" type="button">
|
||||
<span>بازگشت</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row p-lg-2">
|
||||
<div class="row p-lg-2">
|
||||
|
||||
<div class="wrapper p-0">
|
||||
<div class="subAccountHeaderList Rtable Rtable--collapse">
|
||||
<div class="Rtable-row Rtable-row--head align-items-center sticky-div">
|
||||
<div class="rightHeaderMenu px-3">
|
||||
<div class="Rtable-cell column-heading width1">نام نقش</div>
|
||||
</div>
|
||||
<div class="leftHeaderMenu px-4">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
<div class="Rtable-cell column-heading width2">نام کابران</div>
|
||||
<div class="Rtable-cell column-heading text-center width3">عکس پرسنلی</div>
|
||||
<div class="Rtable-cell column-heading text-center width4">کارت ملی</div>
|
||||
<div class="Rtable-cell column-heading text-center width5">کارت پایان خدمت</div>
|
||||
<div class="Rtable-cell column-heading text-center width6">شناسنامه</div>
|
||||
<div class="Rtable-cell column-heading text-end pe-2 width7">عملیات</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-0 d-block d-md-flex overflow-hidden rounded-3 my-2">
|
||||
<div class="wrapper p-0">
|
||||
<div class="subAccountHeaderList Rtable Rtable--collapse">
|
||||
<div class="Rtable-row Rtable-row--head align-items-center sticky-div">
|
||||
<div class="rightHeaderMenu px-3">
|
||||
<div class="Rtable-cell column-heading width1">نام نقش</div>
|
||||
</div>
|
||||
<div class="leftHeaderMenu px-4">
|
||||
<div class="Rtable-cell column-heading width1">ردیف</div>
|
||||
<div class="Rtable-cell column-heading width2">نام کابران</div>
|
||||
<div class="Rtable-cell column-heading text-center width3">عکس پرسنلی</div>
|
||||
<div class="Rtable-cell column-heading text-center width4">کارت ملی</div>
|
||||
<div class="Rtable-cell column-heading text-center width5">کارت پایان خدمت</div>
|
||||
<div class="Rtable-cell column-heading text-center width6">شناسنامه</div>
|
||||
<div class="Rtable-cell column-heading text-end pe-2 width7">عملیات</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="p-0 d-block d-md-flex overflow-hidden rounded-3 my-2">
|
||||
|
||||
<div id="navbar-animmenu">
|
||||
<ul class="show-dropdown main-navbar">
|
||||
<div class="verti-selector">
|
||||
<div class="top"></div>
|
||||
<div class="bottom"></div>
|
||||
</div>
|
||||
<div id="navbar-animmenu">
|
||||
<ul class="show-dropdown main-navbar">
|
||||
<div class="verti-selector">
|
||||
<div class="top"></div>
|
||||
<div class="bottom"></div>
|
||||
</div>
|
||||
|
||||
<li class="active" data-menu="WorkshopDocumentRejectedForAdmin">
|
||||
<div class="d-flex align-items-center justify-content-between" id="clickWorkshopDocumentRejectedForAdminTab">
|
||||
<a href="javascript:void(0);">
|
||||
@(currentAccount.RoleId == 1 ? "تمامی برگشت خورده ها" : "برگشت خورده")
|
||||
</a>
|
||||
<div>
|
||||
<div id="CountWorkshopDocumentRejectedForAdminLoading" class="spinner-grow text-danger d-none" role="status" style="align-items: center; justify-content: center; display: flex; margin: 0 0 0 9px;">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<span id="CountWorkshopDocumentRejectedForAdmin"></span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@if (StaticWorkshopAccounts.EmployeeDocumentWorkFlowRoleIds.Any(x=>x == AuthHelper.GetUserTypeWithId().roleId))
|
||||
<li class="active" data-menu="WorkshopDocumentRejectedForAdmin">
|
||||
<div class="d-flex align-items-center justify-content-between" id="clickWorkshopDocumentRejectedForAdminTab">
|
||||
<a href="javascript:void(0);">
|
||||
عدم تایید توسط ناظر(ادمین)
|
||||
</a>
|
||||
<div>
|
||||
<div id="CountWorkshopDocumentRejectedForAdminLoading" class="spinner-grow text-danger d-none" role="status" style="align-items: center; justify-content: center; display: flex; margin: 0 0 0 9px;">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<span id="CountWorkshopDocumentRejectedForAdmin"></span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
@if (StaticWorkshopAccounts.EmployeeDocumentWorkFlowRoleIds.Any(x => x == AuthHelper.GetUserTypeWithId().roleId))
|
||||
{
|
||||
<li class="" data-menu="CreatedEmployeesWorkshopDocumentForAdmin">
|
||||
<li class="" data-menu="CreatedEmployeesWorkshopDocumentForAdmin">
|
||||
<div class="d-flex align-items-center justify-content-between" id="clickCreatedEmployeesWorkshopDocumentForAdminTab">
|
||||
<a href="javascript:void(0);">
|
||||
@(currentAccount.RoleId == 1 ? "تمامی مدارک پرسنل افزوده شده" : "آپلود مدارک پرسنل افزوده شده")
|
||||
آپلود مدارک پرسنل جدید
|
||||
</a>
|
||||
<div>
|
||||
<div id="CountCreatedEmployeesWorkshopDocumentForAdminLoading" class="spinner-grow text-danger d-none" role="status" style="align-items: center; justify-content: center; display: flex; margin: 0 0 0 9px;">
|
||||
@@ -108,104 +109,101 @@
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="" data-menu="ClientRejectedDocumentWorkshopsForAdmin">
|
||||
<li class="" data-menu="ClientRejectedDocumentWorkshopsForAdmin">
|
||||
<div class="d-flex align-items-center justify-content-between" id="clickClientRejectedDocumentWorkshopsForAdminTab">
|
||||
<a href="javascript:void(0);">
|
||||
@* تمامی برگشت خورده آپلود مدارک پرسنل افزوده شده از سمت مشتری *@
|
||||
@* برگشت خورده آپلود مدارک پرسنل افزوده شده از سمت مشتری *@
|
||||
@(currentAccount.RoleId == 1 ? "تمامی مدارک برگشتی پرسنل افزودهشده" : "مدارک برگشتی پرسنل افزودهشده")
|
||||
عدم تایید توسط ناظر (کلاینت)
|
||||
</a>
|
||||
<div>
|
||||
<div id="CountClientRejectedDocumentWorkshopsForAdminLoading" class="spinner-grow text-danger d-none" role="status" style="align-items: center; justify-content: center; display: flex; margin: 0 0 0 9px;">
|
||||
<span class="visually-hidden">Loading...</span>
|
||||
</div>
|
||||
<span id="CountClientRejectedDocumentWorkshopsForAdmin" style="background-color: #158d8d;"></span>
|
||||
<span id="CountClientRejectedDocumentWorkshopsForAdmin" style="background-color: #158d8d;"></span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
}
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="" id="accountList">
|
||||
<div class="card p-2">
|
||||
<div class="row align-items-center mb-1">
|
||||
<div class="d-none col-12 col-md-4 col-lg-4"></div>
|
||||
<div class="col-1 col-lg-4 text-end"></div>
|
||||
</div>
|
||||
<div class="" id="accountList">
|
||||
<div class="card p-2">
|
||||
<div class="row align-items-center mb-1">
|
||||
<div class="d-none col-12 col-md-4 col-lg-4"></div>
|
||||
<div class="col-1 col-lg-4 text-end"></div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper">
|
||||
<div class="Rtable Rtable--collapse workshopDocumentRejectedForAdminWorkFlowLists">
|
||||
<div id="loadingSkeletonWorkshopDocumentRejectedForAdmin" style="display: contents;">
|
||||
@for (int j = 0; j < 30; j++)
|
||||
{
|
||||
<div class="skeleton-loader" style="margin: 3px 0 !important;height: 39px;"></div>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100" id="loadWorkshopDocumentRejectedForAdminWorkFlowLists">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable Rtable--collapse createdEmployeesWorkshopDocumentForAdminWorkFlowLists" style="display: none">
|
||||
<div id="loadingSkeletonCreatedEmployeesWorkshopDocumentForAdmin" style="display: contents;">
|
||||
@for (int j = 0; j < 30; j++)
|
||||
{
|
||||
<div class="skeleton-loader" style="margin: 3px 0 !important;height: 39px;"></div>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100" id="loadCreatedEmployeesWorkshopDocumentForAdminWorkFlowLists">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="Rtable Rtable--collapse clientRejectedDocumentWorkshopsForAdminWorkFlowLists" style="display: none">
|
||||
<div id="loadingSkeletonClientRejectedDocumentWorkshopsForAdmin" style="display: contents;">
|
||||
@for (int j = 0; j < 30; j++)
|
||||
{
|
||||
<div class="skeleton-loader" style="margin: 3px 0 !important;height: 39px;"></div>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100" id="loadClientRejectedDocumentWorkshopsForAdminWorkFlowLists">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="wrapper">
|
||||
<div class="Rtable Rtable--collapse workshopDocumentRejectedForAdminWorkFlowLists">
|
||||
<div id="loadingSkeletonWorkshopDocumentRejectedForAdmin" style="display: contents;">
|
||||
@for (int j = 0; j < 30; j++)
|
||||
{
|
||||
<div class="skeleton-loader" style="margin: 3px 0 !important;height: 39px;"></div>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100" id="loadWorkshopDocumentRejectedForAdminWorkFlowLists">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="Rtable Rtable--collapse createdEmployeesWorkshopDocumentForAdminWorkFlowLists" style="display: none">
|
||||
<div id="loadingSkeletonCreatedEmployeesWorkshopDocumentForAdmin" style="display: contents;">
|
||||
@for (int j = 0; j < 30; j++)
|
||||
{
|
||||
<div class="skeleton-loader" style="margin: 3px 0 !important;height: 39px;"></div>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100" id="loadCreatedEmployeesWorkshopDocumentForAdminWorkFlowLists">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="Rtable Rtable--collapse clientRejectedDocumentWorkshopsForAdminWorkFlowLists" style="display: none">
|
||||
<div id="loadingSkeletonClientRejectedDocumentWorkshopsForAdmin" style="display: contents;">
|
||||
@for (int j = 0; j < 30; j++)
|
||||
{
|
||||
<div class="skeleton-loader" style="margin: 3px 0 !important;height: 39px;"></div>
|
||||
}
|
||||
</div>
|
||||
<div class="w-100" id="loadClientRejectedDocumentWorkshopsForAdminWorkFlowLists">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="MainModal" class="modal fade" aria-labelledby="myModalLabel" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true" style="display: none;">
|
||||
<div class="modal-dialog modal-xl modal-dialog-centered modalRollCallWidth ">
|
||||
<div class="modal-content" id="ModalContent">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-dialog modal-xl modal-dialog-centered modalRollCallWidth ">
|
||||
<div class="modal-content" id="ModalContent">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@section Script {
|
||||
<script src="~/assetsclient/libs/fancybox/fancybox.umd_2.js"></script>
|
||||
<script src="~/assetsclient/js/site.js?ver=@clientVersion"></script>
|
||||
<script src="~/AdminTheme/assets/sweet-alert/sweet-alert.min.js"></script>
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var showPictureUrl = `@Url.Page("./EmployeesDocuments", "ShowPicture")`;
|
||||
|
||||
// var loadWorkshopsWithDocumentsAwaitingUploadUrl = `@Url.Page("./EmployeesDocuments", "WorkshopsWithDocumentsAwaitingUploadAjax")`;
|
||||
// var loadByWorkshopIdWithItemsForAdminWorkFlowUrl = `@Url.Page("./EmployeesDocuments", "ByWorkshopIdWithItemsForAdminWorkFlow")`;
|
||||
<script src="~/assetsclient/libs/fancybox/fancybox.umd_2.js"></script>
|
||||
<script src="~/assetsclient/js/site.js?ver=@clientVersion"></script>
|
||||
<script src="~/AdminTheme/assets/sweet-alert/sweet-alert.min.js"></script>
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var showPictureUrl = `@Url.Page("./EmployeesDocuments", "ShowPicture")`;
|
||||
|
||||
var loadCountWorkFlowUploadDocumentUrl = `@Url.Page("./EmployeesDocuments", "CountWorkFlowUploadDocument")`;
|
||||
// var loadWorkshopsWithDocumentsAwaitingUploadUrl = `@Url.Page("./EmployeesDocuments", "WorkshopsWithDocumentsAwaitingUploadAjax")`;
|
||||
// var loadByWorkshopIdWithItemsForAdminWorkFlowUrl = `@Url.Page("./EmployeesDocuments", "ByWorkshopIdWithItemsForAdminWorkFlow")`;
|
||||
|
||||
var loadWorkshopDocumentRejectedForAdminUrl = `@Url.Page("./EmployeesDocuments", "WorkshopDocumentRejectedForAdmin")`;
|
||||
var loadGetRejectedItemsByWorkshopIdAndRoleForAdminWorkFlowUrl = `@Url.Page("./EmployeesDocuments", "GetRejectedItemsByWorkshopIdAndRoleForAdminWorkFlow")`;
|
||||
var loadCountWorkFlowUploadDocumentUrl = `@Url.Page("./EmployeesDocuments", "CountWorkFlowUploadDocument")`;
|
||||
|
||||
var loadClientRejectedDocumentWorkshopsForAdminUrl = `@Url.Page("./EmployeesDocuments", "ClientRejectedDocumentWorkshopsForAdmin")`;
|
||||
var loadClientRejectedDocumentByWorkshopIdForAdminUrl = `@Url.Page("./EmployeesDocuments", "ClientRejectedDocumentByWorkshopIdForAdmin")`;
|
||||
var loadWorkshopDocumentRejectedForAdminUrl = `@Url.Page("./EmployeesDocuments", "WorkshopDocumentRejectedForAdmin")`;
|
||||
var loadGetRejectedItemsByWorkshopIdAndRoleForAdminWorkFlowUrl = `@Url.Page("./EmployeesDocuments", "GetRejectedItemsByWorkshopIdAndRoleForAdminWorkFlow")`;
|
||||
|
||||
var loadCreatedEmployeesWorkshopDocumentForAdminUrl = `@Url.Page("./EmployeesDocuments", "CreatedEmployeesWorkshopDocumentForAdmin")`;
|
||||
var loadCreatedEmployeesDocumentByWorkshopIdForAdminUrl = `@Url.Page("./EmployeesDocuments", "CreatedEmployeesDocumentByWorkshopIdForAdmin")`;
|
||||
</script>
|
||||
<script src="~/assetsadminnew/workflow/js/employeesdocuments.js?ver=@clientVersion"></script>
|
||||
var loadClientRejectedDocumentWorkshopsForAdminUrl = `@Url.Page("./EmployeesDocuments", "ClientRejectedDocumentWorkshopsForAdmin")`;
|
||||
var loadClientRejectedDocumentByWorkshopIdForAdminUrl = `@Url.Page("./EmployeesDocuments", "ClientRejectedDocumentByWorkshopIdForAdmin")`;
|
||||
|
||||
var loadCreatedEmployeesWorkshopDocumentForAdminUrl = `@Url.Page("./EmployeesDocuments", "CreatedEmployeesWorkshopDocumentForAdmin")`;
|
||||
var loadCreatedEmployeesDocumentByWorkshopIdForAdminUrl = `@Url.Page("./EmployeesDocuments", "CreatedEmployeesDocumentByWorkshopIdForAdmin")`;
|
||||
</script>
|
||||
<script src="~/assetsadminnew/workflow/js/employeesdocuments.js?ver=@clientVersion"></script>
|
||||
}
|
||||
|
||||
@@ -760,6 +760,8 @@
|
||||
|
||||
var deleteOneAjax = `@Url.Page("/Company/CustomizeCheckout/CheckoutTemporary", "DeleteOne")`;
|
||||
var deleteAllAjax = `@Url.Page("/Company/CustomizeCheckout/CheckoutTemporary", "DeleteAll")`;
|
||||
|
||||
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/CustomizeCheckout/js/CheckoutTemporary.js?ver=@clientVersion"></script>
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Security.Claims;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Infrastructure;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.Error;
|
||||
using CompanyManagment.App.Contracts.Fine;
|
||||
@@ -25,10 +26,11 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine
|
||||
private readonly long _workshopId;
|
||||
public string WorkshopFullName;
|
||||
public int PageIndex = 0;
|
||||
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
|
||||
|
||||
public IndexModel(IFineApplication fineApplication, IWorkshopApplication workshopApplication,
|
||||
public IndexModel(IFineApplication fineApplication, IWorkshopApplication workshopApplication,
|
||||
IPasswordHasher passwordHasher, IFineSubjectApplication fineSubjectApplication,
|
||||
IEmployeeApplication employeeApplication, IAuthHelper authHelper)
|
||||
IEmployeeApplication employeeApplication, IAuthHelper authHelper, ICustomizeCheckoutApplication customizeCheckoutApplication)
|
||||
{
|
||||
_fineApplication = fineApplication;
|
||||
_workshopApplication = workshopApplication;
|
||||
@@ -36,8 +38,9 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine
|
||||
_fineSubjectApplication = fineSubjectApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_authHelper = authHelper;
|
||||
_customizeCheckoutApplication = customizeCheckoutApplication;
|
||||
|
||||
var workshopHash = _authHelper.GetWorkshopSlug();
|
||||
var workshopHash = _authHelper.GetWorkshopSlug();
|
||||
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
|
||||
if (_workshopId < 1)
|
||||
@@ -193,5 +196,19 @@ namespace ServiceHost.Areas.Client.Pages.Company.Fine
|
||||
data = result
|
||||
});
|
||||
}
|
||||
}
|
||||
public IActionResult OnGetCheckoutExists(string fineDate, List<long> employeeIds)
|
||||
{
|
||||
var fineDateGr = fineDate.ToGeorgianDateTime();
|
||||
|
||||
var validateExistsCheckouts =
|
||||
_customizeCheckoutApplication.ValidateExistsCheckouts(fineDateGr, fineDateGr, _workshopId, employeeIds);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
checkout = validateExistsCheckouts.Checkout,
|
||||
customizeCheckout = validateExistsCheckouts.CustomizeCheckout,
|
||||
customizeCheckoutTemp = validateExistsCheckouts.CustomizeCheckoutTemp,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@
|
||||
</div>
|
||||
<div class="col-12 my-1" style="height: 30px;">
|
||||
<div class="d-block">
|
||||
<div id="amountRials" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountTomans" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountRials" class="scroll-container-amount"></div>
|
||||
<div id="amountTomans" class="scroll-container-amount"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
@@ -93,7 +93,7 @@
|
||||
<div id="CRUDFineSubjectModal" style="display: none">
|
||||
<div class="modal-dialog modal-dialog-centered FineSubjectSection">
|
||||
<div class="" id="ModalCRUDSearchSubject">
|
||||
<partial name="CRUDFineSubjectModal"/>
|
||||
<partial name="CRUDFineSubjectModal" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -110,6 +110,7 @@
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var saveNewFineAjax = `@Url.Page("./Index", "Create")`;
|
||||
var checkoutExistsAjaxUrl = `@Url.Page("./Index", "CheckoutExists")`;
|
||||
var employeeListAjax = `@Url.Page("./Index", "EmployeeList")`;
|
||||
var searchFineSubjectModal = '@Url.Page("./Index", "SearchFineSubject")';
|
||||
var fineSubjectModal = '@Url.Page("./Index", "FineSubject")';
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 my-1">
|
||||
<input type="hidden" asp-for="@Model.Id" />
|
||||
<input type="hidden" asp-for="@Model.EmployeeId" />
|
||||
<input type="hidden" asp-for="@Model.EmployeeId" id="employeeSelectId"/>
|
||||
<span class="spanTitleText">نام و نام خانوادگی پرسنل</span>
|
||||
<input type="text" class="form-control" value="@Model.EmployeeFullname" disabled placeholder="نام پرسنل" />
|
||||
</div>
|
||||
@@ -36,8 +36,8 @@
|
||||
</div>
|
||||
<div class="col-12 my-1" style="height: 30px;">
|
||||
<div class="d-block">
|
||||
<div id="amountRials" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountTomans" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountRials" class="scroll-container-amount"></div>
|
||||
<div id="amountTomans" class="scroll-container-amount"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
@@ -78,6 +78,7 @@
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var saveEditFineAjax = `@Url.Page("./Index", "Edit")`;
|
||||
var checkoutExistsAjaxUrl = `@Url.Page("./Index", "CheckoutExists")`;
|
||||
var employeeListAjax = `@Url.Page("./Index", "EmployeeList")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/Fine/js/ModalEditFine.js?ver=@clientVersion"></script>
|
||||
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Security.Claims;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Infrastructure;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.Error;
|
||||
using CompanyManagment.App.Contracts.Reward;
|
||||
@@ -21,11 +22,12 @@ namespace ServiceHost.Areas.Client.Pages.Company.Reward
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly IHttpContextAccessor _contextAccessor;
|
||||
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
|
||||
private readonly long _workshopId;
|
||||
public string WorkshopFullName;
|
||||
public int PageIndex = 0;
|
||||
|
||||
public IndexModel(IWorkshopApplication workshopApplication, IPasswordHasher passwordHasher, IRewardApplication rewardApplication, IAuthHelper authHelper, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor)
|
||||
public IndexModel(IWorkshopApplication workshopApplication, IPasswordHasher passwordHasher, IRewardApplication rewardApplication, IAuthHelper authHelper, IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, ICustomizeCheckoutApplication customizeCheckoutApplication)
|
||||
{
|
||||
_workshopApplication = workshopApplication;
|
||||
_passwordHasher = passwordHasher;
|
||||
@@ -33,6 +35,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Reward
|
||||
_authHelper = authHelper;
|
||||
_employeeApplication = employeeApplication;
|
||||
_contextAccessor = contextAccessor;
|
||||
_customizeCheckoutApplication = customizeCheckoutApplication;
|
||||
|
||||
var workshopHash = _contextAccessor.HttpContext?.User.FindFirstValue("WorkshopSlug");
|
||||
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
@@ -142,5 +145,20 @@ namespace ServiceHost.Areas.Client.Pages.Company.Reward
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetCheckoutExists(string grantDate,List<long> employeeIds)
|
||||
{
|
||||
var grantDateGr = grantDate.ToGeorgianDateTime();
|
||||
|
||||
var validateExistsCheckouts =
|
||||
_customizeCheckoutApplication.ValidateExistsCheckouts(grantDateGr, grantDateGr, _workshopId, employeeIds);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
checkout = validateExistsCheckouts.Checkout,
|
||||
customizeCheckout = validateExistsCheckouts.CustomizeCheckout,
|
||||
customizeCheckoutTemp = validateExistsCheckouts.CustomizeCheckoutTemp,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@
|
||||
</div>
|
||||
<div class="col-12 my-1" style="height: 30px;">
|
||||
<div class="d-block">
|
||||
<div id="amountRials" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountTomans" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountRials" class="scroll-container-amount"></div>
|
||||
<div id="amountTomans" class="scroll-container-amount"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
@@ -81,6 +81,7 @@
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var saveNewRewardAjax = `@Url.Page("./Index", "Create")`;
|
||||
var checkoutExistsAjaxUrl = `@Url.Page("./Index", "CheckoutExists")`;
|
||||
var employeeListAjax = `@Url.Page("./Index", "EmployeeList")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/Reward/js/ModalCreateNewReward.js?ver=@clientVersion"></script>
|
||||
@@ -21,6 +21,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 my-1">
|
||||
<input type="hidden" asp-for="@Model.Id" />
|
||||
<input type="hidden" asp-for="@Model.EmployeeId" id="employeeSelectId" />
|
||||
<span class="spanTitleText">نام و نام خانوادگی پرسنل</span>
|
||||
<input type="text" class="form-control" value="@Model.EmployeeFullName" disabled placeholder="نام پرسنل" />
|
||||
</div>
|
||||
@@ -35,8 +36,8 @@
|
||||
</div>
|
||||
<div class="col-12 my-1" style="height: 30px;">
|
||||
<div class="d-block">
|
||||
<div id="amountRials" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountTomans" style="font-size: 12px;color: #4f4f4f;"></div>
|
||||
<div id="amountRials" class="scroll-container-amount"></div>
|
||||
<div id="amountTomans" class="scroll-container-amount"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
@@ -80,6 +81,7 @@
|
||||
<script src="~/assetsclient/libs/wordifyfa/wordifyfa.min.js"></script>
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var checkoutExistsAjaxUrl = `@Url.Page("./Index", "CheckoutExists")`;
|
||||
var saveEditRewardAjax = `@Url.Page("./Index", "Edit")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/Reward/js/ModalEditReward.js?ver=@clientVersion"></script>
|
||||
@@ -51,10 +51,16 @@
|
||||
$(document).ready(function () {
|
||||
|
||||
new Cleave('.dateModal', {
|
||||
date: true,
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
// new Cleave('.dateModal', {
|
||||
// date: true,
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
|
||||
$('.dateModal').val(dateNow);
|
||||
|
||||
$(".closeConfirmModal").on("click", function () {
|
||||
|
||||
@@ -7,9 +7,12 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using System.Security.Claims;
|
||||
using _0_Framework.Infrastructure;
|
||||
using Company.Domain.CustomizeCheckoutAgg;
|
||||
using CompanyManagement.Infrastructure.Excel.SalaryAid;
|
||||
using CompanyManagment.App.Contracts.CustomizeCheckout;
|
||||
using CompanyManagment.App.Contracts.SalaryAid;
|
||||
using CompanyManagment.App.Contracts.Employee;
|
||||
using CompanyManagment.App.Contracts.YearlySalary;
|
||||
|
||||
namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
{
|
||||
@@ -20,23 +23,29 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
private readonly IPasswordHasher _passwordHasher;
|
||||
private readonly ISalaryAidApplication _salaryAidApplication;
|
||||
private readonly IEmployeeApplication _employeeApplication;
|
||||
private readonly IYearlySalaryApplication _yearlySalaryApplication;
|
||||
private readonly IAuthHelper _authHelper;
|
||||
private readonly ICustomizeCheckoutApplication _customizeCheckoutApplication;
|
||||
private readonly SalaryAidImportExcel _salaryAidImportExcel;
|
||||
|
||||
private readonly long _workshopId;
|
||||
public string WorkshopFullName;
|
||||
public int PageIndex = 0;
|
||||
private readonly ICustomizeCheckoutRepository _customizeCheckoutRepository;
|
||||
|
||||
public IndexModel(IPasswordHasher passwordHasher, ISalaryAidApplication salaryAidApplication,
|
||||
IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, IAuthHelper authHelper, SalaryAidImportExcel salaryAidImportExcel)
|
||||
public IndexModel(IPasswordHasher passwordHasher, ISalaryAidApplication salaryAidApplication,
|
||||
IEmployeeApplication employeeApplication, IHttpContextAccessor contextAccessor, IAuthHelper authHelper, SalaryAidImportExcel salaryAidImportExcel, ICustomizeCheckoutApplication customizeCheckoutApplication, ICustomizeCheckoutRepository customizeCheckoutRepository, IYearlySalaryApplication yearlySalaryApplication)
|
||||
{
|
||||
_passwordHasher = passwordHasher;
|
||||
_salaryAidApplication = salaryAidApplication;
|
||||
_employeeApplication = employeeApplication;
|
||||
_authHelper = authHelper;
|
||||
_salaryAidImportExcel = salaryAidImportExcel;
|
||||
_yearlySalaryApplication = yearlySalaryApplication;
|
||||
_customizeCheckoutApplication = customizeCheckoutApplication;
|
||||
_customizeCheckoutRepository = customizeCheckoutRepository;
|
||||
|
||||
var workshopHash = _authHelper.GetWorkshopSlug();
|
||||
var workshopHash = _authHelper.GetWorkshopSlug();
|
||||
_workshopId = _passwordHasher.SlugDecrypt(workshopHash);
|
||||
|
||||
if (_workshopId < 1)
|
||||
@@ -50,6 +59,16 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
return Page();
|
||||
}
|
||||
|
||||
public IActionResult OnGetYearlyList()
|
||||
{
|
||||
var resultData = _yearlySalaryApplication.GetYears();
|
||||
return new JsonResult(new
|
||||
{
|
||||
success = true,
|
||||
data = resultData
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetLoadDataAjax(SalaryAidSearchViewModel searchViewModel)
|
||||
{
|
||||
searchViewModel.WorkshopId = _workshopId;
|
||||
@@ -156,7 +175,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostCreateFromExcelData(List<SalaryAidImportData> data)
|
||||
public IActionResult OnPostCreateFromExcelData(List<SalaryAidImportData> data)
|
||||
{
|
||||
var commands = data.Select(x => new CreateSalaryAidViewModel()
|
||||
{
|
||||
@@ -165,9 +184,10 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
EmployeeIds = [x.EmployeeId],
|
||||
SalaryDateTime = x.SalaryAidDateTime,
|
||||
NationalCode = x.NationalCode,
|
||||
CalculationDateTime = x.CalculationDate
|
||||
CalculationMonth = x.calculationMonth,
|
||||
CalculationYear = x.calculationYear
|
||||
}).ToList();
|
||||
OperationResult result = await _salaryAidApplication.CreateRange(commands);
|
||||
OperationResult result = _salaryAidApplication.CreateRange(commands);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
@@ -176,6 +196,50 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
});
|
||||
}
|
||||
|
||||
public IActionResult OnGetCreateValidation(DateTime dateTime,List<long> employeeIds,long workshopId)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
_ = DateTime.Now.Date.AddMonthsFa(-1, out var oneMonthAgoGr);
|
||||
|
||||
if (oneMonthAgoGr > dateTime)
|
||||
{
|
||||
var prevCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(dateTime,
|
||||
oneMonthAgoGr, workshopId, employeeIds);
|
||||
|
||||
if (prevCheckouts.CustomizeCheckout || prevCheckouts.Checkout || prevCheckouts.CustomizeCheckoutTemp)
|
||||
{
|
||||
op.Failed("شما نمیتوانید در تاریخ قبل از یک ماه گذشته که فیش صادر شده باشد مساعده دهید");
|
||||
return new JsonResult(new
|
||||
{
|
||||
op.IsSuccedded,
|
||||
op.Message
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var existsCheckouts = _customizeCheckoutRepository.ValidateExistsCheckouts(dateTime,
|
||||
dateTime, workshopId, employeeIds);
|
||||
|
||||
if (existsCheckouts.Checkout)
|
||||
{
|
||||
op.Failed("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی رسمی صادر شده است مساعده دهید");
|
||||
return new JsonResult(new
|
||||
{
|
||||
op.IsSuccedded,
|
||||
op.Message
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
op.Succcedded();
|
||||
return new JsonResult(new
|
||||
{
|
||||
op.IsSuccedded,
|
||||
op.Message,
|
||||
data = existsCheckouts
|
||||
});
|
||||
|
||||
}
|
||||
public IActionResult OnGetSearch(SalaryAidSearchViewModel searchModel)
|
||||
{
|
||||
searchModel.WorkshopId = _workshopId;
|
||||
@@ -185,6 +249,20 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
data = result
|
||||
});
|
||||
}
|
||||
public IActionResult OnGetCheckoutExists(string calculationDate, List<long> employeeIds)
|
||||
{
|
||||
var calculationDateGr = calculationDate.ToGeorgianDateTime();
|
||||
|
||||
}
|
||||
var validateExistsCheckouts =
|
||||
_customizeCheckoutApplication.ValidateExistsCheckouts(calculationDateGr, calculationDateGr, _workshopId, employeeIds);
|
||||
|
||||
return new JsonResult(new
|
||||
{
|
||||
checkout = validateExistsCheckouts.Checkout,
|
||||
customizeCheckout = validateExistsCheckouts.CustomizeCheckout,
|
||||
customizeCheckoutTemp = validateExistsCheckouts.CustomizeCheckoutTemp,
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,14 +36,54 @@
|
||||
<div id="amountTomans" class="scroll-container-amount"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">تاریخ پرداخت</span>
|
||||
<input class="form-control form-control-date text-center dateTime" asp-for="@Model.SalaryDateTime" placeholder="تاریخ پرداخت را وارد نمائید" style="direction: ltr" />
|
||||
</div>
|
||||
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">تاریخ محاسبه</span>
|
||||
@* <input class="form-control form-control-date text-center dateTime" asp-for="@Model.CalculationDateTime" placeholder="تاریخ محاسبه را وارد نمائید" style="direction: ltr" /> *@
|
||||
|
||||
<div class="d-flex align-content-around gap-2">
|
||||
<div class="calculationYear w-100" style="overflow: unset;">
|
||||
<select id="calculationYear" asp-for="@Model.CalculationYear">
|
||||
<option value="0">سال</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="calculationMonth w-100" style="overflow: unset;">
|
||||
<select id="calculationMonth" asp-for="@Model.CalculationMonth">
|
||||
<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>
|
||||
</div>
|
||||
@* <div class="col-12 my-1">
|
||||
<span class="spanTitleText">تاریخ پرداخت</span>
|
||||
<input class="form-control form-control-date text-center dateTime" asp-for="@Model.SalaryDateTime" placeholder="تاریخ پرداخت را وارد نمائید" style="direction: ltr" />
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">تاریخ محاسبه</span>
|
||||
<input class="form-control form-control-date text-center dateTime" asp-for="@Model.CalculationDateTime" placeholder="تاریخ محاسبه را وارد نمائید" style="direction: ltr" />
|
||||
</div>
|
||||
|
||||
|
||||
</div> *@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -77,6 +117,8 @@
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var saveNewSalaryAidAjax = `@Url.Page("./Index", "Create")`;
|
||||
var checkoutExistsAjaxUrl = `@Url.Page("./Index", "CheckoutExists")`;
|
||||
var employeeListAjax = `@Url.Page("./Index", "EmployeeList")`;
|
||||
var yearlyListUrl = `@Url.Page("./Index", "YearlyList")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/SalaryAid/js/ModalCreateNewSalaryAid.js?ver=@clientVersion"></script>
|
||||
@@ -21,6 +21,7 @@
|
||||
<div class="row">
|
||||
<div class="col-12 my-1">
|
||||
<input type="hidden" asp-for="@Model.Id"/>
|
||||
<input type="hidden" asp-for="@Model.EmployeeId" id="employeeSelectId" />
|
||||
<span class="spanTitleText">نام و نام خانوادگی پرسنل</span>
|
||||
<input type="text" class="form-control" value="@Model.EmployeeFullName" disabled placeholder="نام پرسنل"/>
|
||||
</div>
|
||||
@@ -41,7 +42,32 @@
|
||||
</div>
|
||||
<div class="col-12 my-1">
|
||||
<span class="spanTitleText">تاریخ محاسبه</span>
|
||||
<input class="form-control form-control-date text-center dateTime" asp-for="@Model.CalculationDateTime" placeholder="تاریخ محاسبه را وارد نمائید" style="direction: ltr" />
|
||||
@* <input class="form-control form-control-date text-center dateTime" asp-for="@Model.CalculationDateTime" placeholder="تاریخ محاسبه را وارد نمائید" style="direction: ltr" /> *@
|
||||
|
||||
<div class="d-flex align-content-around gap-2">
|
||||
<div class="calculationYear w-100" style="overflow: unset;">
|
||||
<select id="calculationYear" asp-for="@Model.CalculationYear">
|
||||
<option value="0">سال</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="calculationMonth w-100" style="overflow: unset;">
|
||||
<select id="calculationMonth" asp-for="@Model.CalculationMonth">
|
||||
<option value="0">ماه</option>
|
||||
<option value="1">فروردین</option>
|
||||
<option value="2">اردیبهشت</option>
|
||||
<option value="3">خرداد</option>
|
||||
<option value="4">تیر</option>
|
||||
<option value="5">مرداد</option>
|
||||
<option value="6">شهریور</option>
|
||||
<option value="7">مهر</option>
|
||||
<option value="8">آبان</option>
|
||||
<option value="9">آذر</option>
|
||||
<option value="10">دی</option>
|
||||
<option value="11">بهمن</option>
|
||||
<option value="12">اسفند</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,5 +100,8 @@
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var saveEditSalaryAidAjax = `@Url.Page("./Index", "Edit")`;
|
||||
var yearlyListUrl = `@Url.Page("./Index", "YearlyList")`;
|
||||
var year = `@Model.CalculationYear`;
|
||||
var checkoutExistsAjaxUrl = `@Url.Page("./Index", "CheckoutExists")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/SalaryAid/js/ModalEditSalaryAid.js?ver=@clientVersion"></script>
|
||||
@@ -60,7 +60,7 @@
|
||||
<div id="errorsTheStructureOfExcel" class="errorMessageOfExcel"></div>
|
||||
|
||||
|
||||
<div class="spinner-loading loading" style="display: none">
|
||||
<div class="spinner-loading loading" style="display: none; z-index: 2000;">
|
||||
<span class="spinner-border spinner-border-sm loading text-white" role="status" aria-hidden="true"></span>
|
||||
</div>
|
||||
|
||||
@@ -100,6 +100,7 @@
|
||||
<script>
|
||||
var antiForgeryToken = $(`@Html.AntiForgeryToken()`).val();
|
||||
var uploadAndValidate = `@Url.Page("./Index", "ValidateExcel")`;
|
||||
var checkoutExistsAjaxUrl = `@Url.Page("./Index", "CheckoutExists")`;
|
||||
var sendExcelDataAjax = `@Url.Page("./Index", "CreateFromExcelData")`;
|
||||
</script>
|
||||
<script src="~/assetsclient/pages/SalaryAid/js/ModalImportExcel.js?ver=@clientVersion"></script>
|
||||
@@ -72,8 +72,8 @@
|
||||
<li Permission="@SubAccountPermissionHelper.ContractListPermissionCode"><a class="selectLi" asp-page="/Company/Contracts/Index"><span>لیست قرارداد</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.CheckoutListPermissionCode"><a class="selectLi" asp-page="/Company/Checkouts/Index"><span>لیست فیش حقوقی</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.InsuranceListPermissionCode"><a class="selectLi" asp-page="/Company/InsuranceList/Index"><span>لیست بیمه</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.PersonnelStatusIndividualReportPermissionCode"><a class="selectLi" onclick="AjaxUrlContentModal('@Url.Page("/Company/Employees/Index", "ContractCheckoutStatus")');"><span>گزارش وضعیت پرسنل به صورت انفرادی</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.PersonnelStatusGroupReportPermissionCode"><a class="selectLi" onclick="AjaxUrlContentModal('@Url.Page("/Company/Workshop/Index", "ContractCheckoutYearlyStatus")');"><span>گزارش وضعیت پرسنل بصورت گروهی</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.PersonnelStatusIndividualReportPermissionCode"><a class="selectLi" onclick="AjaxUrlContentModal('@Url.Page("/Company/Employees/Index", "ContractCheckoutStatus")');"><span>گزارش وضعیت انفرادی پرسنل</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.PersonnelStatusGroupReportPermissionCode"><a class="selectLi" onclick="AjaxUrlContentModal('@Url.Page("/Company/Workshop/Index", "ContractCheckoutYearlyStatus")');"><span>گزارش وضعیت گروهی پرسنل</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
|
||||
@@ -132,7 +132,7 @@
|
||||
</span>
|
||||
</a>
|
||||
<ul class="submenu">
|
||||
<li Permission="@SubAccountPermissionHelper.CustomizeCheckoutSetGroupAndSalaryPermissionCode"><a class="selectLi" asp-page="/Company/CustomizeCheckout/Grouping"><span>تنظیمات گروهبندی و حقوق پرسنل</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.CustomizeCheckoutSetGroupAndSalaryPermissionCode"><a class="selectLi" asp-page="/Company/CustomizeCheckout/Grouping"><span>گروهبندی فیش حقوقی</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.CustomizeCheckoutTempListPermissionCode"><a class="selectLi" asp-page="/Company/CustomizeCheckout/CheckoutTemporary"><span>لیست فیش حقوقی موقت</span></a></li>
|
||||
<li Permission="@SubAccountPermissionHelper.CustomizeCheckoutListPermissionCode"><a class="selectLi" asp-page="/Company/CustomizeCheckout/CheckoutUnofficial"><span>لیست فیش حقوقی نهایی</span></a></li>
|
||||
</ul>
|
||||
@@ -223,7 +223,7 @@
|
||||
<ul class="submenu">
|
||||
<li Permission="@SubAccountPermissionHelper.WorkFlowRollCallsPermissionCode">
|
||||
<a class="selectLi d-flex align-items-center justify-content-between" asp-page="/Company/WorkFlow/RollCall">
|
||||
<span>حضور و غیاب</span>
|
||||
<span>ایرادات ثبت حضور و غیاب</span>
|
||||
|
||||
<div>
|
||||
<div id="spinnerRollCall" class="spinner-border spinner-border-sm text-light" role="status">
|
||||
@@ -236,7 +236,7 @@
|
||||
|
||||
<li Permission="@SubAccountPermissionHelper.WorkFlowRollCallsPermissionCode">
|
||||
<a class="selectLi d-flex align-items-center justify-content-between" asp-page="/Company/WorkFlow/EmployeeDocuments/Index">
|
||||
<span>بارگزاری مدارک پرسنل</span>
|
||||
<span>ایرادات بارگزاری مدارک پرسنل</span>
|
||||
|
||||
<div>
|
||||
<div id="spinnerEmployeeDocuments" class="spinner-border spinner-border-sm text-light" role="status">
|
||||
|
||||
@@ -5,12 +5,31 @@
|
||||
loadingDiv.show();
|
||||
});
|
||||
|
||||
updateAmountColor();
|
||||
loadSmsRemaining();
|
||||
//if (boolPermissionForReports) {
|
||||
// ReportAjaxData();
|
||||
//}
|
||||
});
|
||||
|
||||
function loadSmsRemaining() {
|
||||
$.ajax({
|
||||
async: true,
|
||||
contentType: 'charset=utf-8',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: smsRemainingUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
success: function (response) {
|
||||
$('#amountSms').text(response.data);
|
||||
$('#loadingSmsRemaining').hide();
|
||||
updateAmountColor();
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateAmountColor() {
|
||||
const amountDiv = document.querySelector("#amountSms");
|
||||
const smsDiv = document.getElementById('smsDiv');
|
||||
|
||||
@@ -18,10 +18,15 @@
|
||||
|
||||
$(".form-control-date").each(function () {
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
|
||||
@@ -5,10 +5,15 @@
|
||||
|
||||
$(".form-control-date").each(function () {
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -550,13 +550,18 @@ input:checked + .sliderEUP {
|
||||
.employee-workshop-header > div {
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
width: 200px;
|
||||
width: 300px;
|
||||
white-space: nowrap;
|
||||
text-align: right;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 1366px) {
|
||||
.employee-workshop-header > div {
|
||||
width: 200px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
#navbar-animmenu ul li a {
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
@@ -578,6 +583,11 @@ input:checked + .sliderEUP {
|
||||
.employee-workshop-header {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.employee-workshop-header > div {
|
||||
width: 200px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.Rtable--collapse .Rtable-row {
|
||||
outline: 1.8px solid #ddd !important;
|
||||
|
||||
@@ -13,10 +13,15 @@
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -55,6 +55,11 @@
|
||||
padding-right: 2rem;
|
||||
}
|
||||
|
||||
.submenu li a span {
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.submenu:before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
|
||||
@@ -126,10 +126,16 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
var filterEmployeeId = $('#employeeId').val();
|
||||
@@ -1397,7 +1403,6 @@ function loadMore() {
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
|
||||
if (response.pageIndex > 0) {
|
||||
var n = pageIndex + 1;
|
||||
@@ -1511,17 +1516,17 @@ function loadMore() {
|
||||
${response.deletePermission === "true" ? `
|
||||
|
||||
<button type="button" class="btn-delete RemoveBtn" data-delete-id="${item.id}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
</button>
|
||||
|
||||
` : ``}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1530,37 +1535,37 @@ function loadMore() {
|
||||
<div class="Rtable-cell--content align-items-center d-flex d-md-block text-end">
|
||||
${response.printPermission === "true" ? `
|
||||
|
||||
<button class="btn-print moreThan992" type="button" onclick="printOne(${item.id}, '${item.year}', '${item.month}')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">
|
||||
<path d="M15.0001 11.2493H15.139C16.0279 11.2493 16.4723 11.2493 16.759 10.9866C16.7805 10.967 16.801 10.9464 16.8207 10.9249C17.0834 10.6382 17.0834 10.1938 17.0834 9.3049V9.3049C17.0834 7.52714 17.0834 6.63826 16.558 6.06484C16.5187 6.02194 16.4775 5.98077 16.4346 5.94146C15.8612 5.41602 14.9723 5.41602 13.1945 5.41602H6.91675C5.03113 5.41602 4.08832 5.41602 3.50253 6.0018C2.91675 6.58759 2.91675 7.5304 2.91675 9.41602V10.2493C2.91675 10.7208 2.91675 10.9565 3.06319 11.1029C3.20964 11.2493 3.44534 11.2493 3.91675 11.2493H5.00008" />
|
||||
<path d="M5.41675 16.3903L5.41675 9.91732C5.41675 8.97451 5.41675 8.5031 5.70964 8.21021C6.00253 7.91732 6.47394 7.91732 7.41675 7.91732L12.5834 7.91732C13.5262 7.91732 13.9976 7.91732 14.2905 8.21021C14.5834 8.5031 14.5834 8.97451 14.5834 9.91732L14.5834 16.3903C14.5834 16.7068 14.5834 16.8651 14.4796 16.9399C14.3758 17.0148 14.2256 16.9647 13.9253 16.8646L12.2572 16.3086C12.1712 16.2799 12.1282 16.2656 12.0839 16.2669C12.0396 16.2682 11.9975 16.285 11.9134 16.3187L10.1858 17.0097C10.0941 17.0464 10.0482 17.0647 10.0001 17.0647C9.95194 17.0647 9.90609 17.0464 9.81439 17.0097L8.0868 16.3187C8.00267 16.285 7.9606 16.2682 7.91627 16.2669C7.87194 16.2656 7.82896 16.2799 7.74299 16.3086L6.07486 16.8646C5.77455 16.9647 5.62439 17.0148 5.52057 16.9399C5.41675 16.8651 5.41675 16.7068 5.41675 16.3903Z" />
|
||||
<path d="M7.91675 11.25L11.2501 11.25" stroke-linecap="round" />
|
||||
<path d="M7.91675 13.75L12.0834 13.75" stroke-linecap="round" />
|
||||
<path d="M14.5834 5.41732V5.41732C14.5834 3.97799 14.5834 3.25833 14.1954 2.76756C14.1087 2.65791 14.0095 2.55874 13.8998 2.47204C13.4091 2.08398 12.6894 2.08398 11.2501 2.08398H8.75008C7.31076 2.08398 6.5911 2.08398 6.10032 2.47204C5.99068 2.55874 5.8915 2.65791 5.8048 2.76756C5.41675 3.25833 5.41675 3.97799 5.41675 5.41732V5.41732" />
|
||||
</svg>
|
||||
</button>
|
||||
<button class="btn-print moreThan992" type="button" onclick="printOne(${item.id}, '${item.year}', '${item.month}')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">
|
||||
<path d="M15.0001 11.2493H15.139C16.0279 11.2493 16.4723 11.2493 16.759 10.9866C16.7805 10.967 16.801 10.9464 16.8207 10.9249C17.0834 10.6382 17.0834 10.1938 17.0834 9.3049V9.3049C17.0834 7.52714 17.0834 6.63826 16.558 6.06484C16.5187 6.02194 16.4775 5.98077 16.4346 5.94146C15.8612 5.41602 14.9723 5.41602 13.1945 5.41602H6.91675C5.03113 5.41602 4.08832 5.41602 3.50253 6.0018C2.91675 6.58759 2.91675 7.5304 2.91675 9.41602V10.2493C2.91675 10.7208 2.91675 10.9565 3.06319 11.1029C3.20964 11.2493 3.44534 11.2493 3.91675 11.2493H5.00008" />
|
||||
<path d="M5.41675 16.3903L5.41675 9.91732C5.41675 8.97451 5.41675 8.5031 5.70964 8.21021C6.00253 7.91732 6.47394 7.91732 7.41675 7.91732L12.5834 7.91732C13.5262 7.91732 13.9976 7.91732 14.2905 8.21021C14.5834 8.5031 14.5834 8.97451 14.5834 9.91732L14.5834 16.3903C14.5834 16.7068 14.5834 16.8651 14.4796 16.9399C14.3758 17.0148 14.2256 16.9647 13.9253 16.8646L12.2572 16.3086C12.1712 16.2799 12.1282 16.2656 12.0839 16.2669C12.0396 16.2682 11.9975 16.285 11.9134 16.3187L10.1858 17.0097C10.0941 17.0464 10.0482 17.0647 10.0001 17.0647C9.95194 17.0647 9.90609 17.0464 9.81439 17.0097L8.0868 16.3187C8.00267 16.285 7.9606 16.2682 7.91627 16.2669C7.87194 16.2656 7.82896 16.2799 7.74299 16.3086L6.07486 16.8646C5.77455 16.9647 5.62439 17.0148 5.52057 16.9399C5.41675 16.8651 5.41675 16.7068 5.41675 16.3903Z" />
|
||||
<path d="M7.91675 11.25L11.2501 11.25" stroke-linecap="round" />
|
||||
<path d="M7.91675 13.75L12.0834 13.75" stroke-linecap="round" />
|
||||
<path d="M14.5834 5.41732V5.41732C14.5834 3.97799 14.5834 3.25833 14.1954 2.76756C14.1087 2.65791 14.0095 2.55874 13.8998 2.47204C13.4091 2.08398 12.6894 2.08398 11.2501 2.08398H8.75008C7.31076 2.08398 6.5911 2.08398 6.10032 2.47204C5.99068 2.55874 5.8915 2.65791 5.8048 2.76756C5.41675 3.25833 5.41675 3.97799 5.41675 5.41732V5.41732" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button class="btn-print lessThan992" type="button" onclick="printOne(${item.id}, '${item.year}', '${item.month}')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">
|
||||
<path d="M15.0001 11.2493H15.139C16.0279 11.2493 16.4723 11.2493 16.759 10.9866C16.7805 10.967 16.801 10.9464 16.8207 10.9249C17.0834 10.6382 17.0834 10.1938 17.0834 9.3049V9.3049C17.0834 7.52714 17.0834 6.63826 16.558 6.06484C16.5187 6.02194 16.4775 5.98077 16.4346 5.94146C15.8612 5.41602 14.9723 5.41602 13.1945 5.41602H6.91675C5.03113 5.41602 4.08832 5.41602 3.50253 6.0018C2.91675 6.58759 2.91675 7.5304 2.91675 9.41602V10.2493C2.91675 10.7208 2.91675 10.9565 3.06319 11.1029C3.20964 11.2493 3.44534 11.2493 3.91675 11.2493H5.00008" />
|
||||
<path d="M5.41675 16.3903L5.41675 9.91732C5.41675 8.97451 5.41675 8.5031 5.70964 8.21021C6.00253 7.91732 6.47394 7.91732 7.41675 7.91732L12.5834 7.91732C13.5262 7.91732 13.9976 7.91732 14.2905 8.21021C14.5834 8.5031 14.5834 8.97451 14.5834 9.91732L14.5834 16.3903C14.5834 16.7068 14.5834 16.8651 14.4796 16.9399C14.3758 17.0148 14.2256 16.9647 13.9253 16.8646L12.2572 16.3086C12.1712 16.2799 12.1282 16.2656 12.0839 16.2669C12.0396 16.2682 11.9975 16.285 11.9134 16.3187L10.1858 17.0097C10.0941 17.0464 10.0482 17.0647 10.0001 17.0647C9.95194 17.0647 9.90609 17.0464 9.81439 17.0097L8.0868 16.3187C8.00267 16.285 7.9606 16.2682 7.91627 16.2669C7.87194 16.2656 7.82896 16.2799 7.74299 16.3086L6.07486 16.8646C5.77455 16.9647 5.62439 17.0148 5.52057 16.9399C5.41675 16.8651 5.41675 16.7068 5.41675 16.3903Z" />
|
||||
<path d="M7.91675 11.25L11.2501 11.25" stroke-linecap="round" />
|
||||
<path d="M7.91675 13.75L12.0834 13.75" stroke-linecap="round" />
|
||||
<path d="M14.5834 5.41732V5.41732C14.5834 3.97799 14.5834 3.25833 14.1954 2.76756C14.1087 2.65791 14.0095 2.55874 13.8998 2.47204C13.4091 2.08398 12.6894 2.08398 11.2501 2.08398H8.75008C7.31076 2.08398 6.5911 2.08398 6.10032 2.47204C5.99068 2.55874 5.8915 2.65791 5.8048 2.76756C5.41675 3.25833 5.41675 3.97799 5.41675 5.41732V5.41732" />
|
||||
</svg>
|
||||
</button>
|
||||
<button class="btn-print lessThan992" type="button" onclick="printOne(${item.id}, '${item.year}', '${item.month}')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">
|
||||
<path d="M15.0001 11.2493H15.139C16.0279 11.2493 16.4723 11.2493 16.759 10.9866C16.7805 10.967 16.801 10.9464 16.8207 10.9249C17.0834 10.6382 17.0834 10.1938 17.0834 9.3049V9.3049C17.0834 7.52714 17.0834 6.63826 16.558 6.06484C16.5187 6.02194 16.4775 5.98077 16.4346 5.94146C15.8612 5.41602 14.9723 5.41602 13.1945 5.41602H6.91675C5.03113 5.41602 4.08832 5.41602 3.50253 6.0018C2.91675 6.58759 2.91675 7.5304 2.91675 9.41602V10.2493C2.91675 10.7208 2.91675 10.9565 3.06319 11.1029C3.20964 11.2493 3.44534 11.2493 3.91675 11.2493H5.00008" />
|
||||
<path d="M5.41675 16.3903L5.41675 9.91732C5.41675 8.97451 5.41675 8.5031 5.70964 8.21021C6.00253 7.91732 6.47394 7.91732 7.41675 7.91732L12.5834 7.91732C13.5262 7.91732 13.9976 7.91732 14.2905 8.21021C14.5834 8.5031 14.5834 8.97451 14.5834 9.91732L14.5834 16.3903C14.5834 16.7068 14.5834 16.8651 14.4796 16.9399C14.3758 17.0148 14.2256 16.9647 13.9253 16.8646L12.2572 16.3086C12.1712 16.2799 12.1282 16.2656 12.0839 16.2669C12.0396 16.2682 11.9975 16.285 11.9134 16.3187L10.1858 17.0097C10.0941 17.0464 10.0482 17.0647 10.0001 17.0647C9.95194 17.0647 9.90609 17.0464 9.81439 17.0097L8.0868 16.3187C8.00267 16.285 7.9606 16.2682 7.91627 16.2669C7.87194 16.2656 7.82896 16.2799 7.74299 16.3086L6.07486 16.8646C5.77455 16.9647 5.62439 17.0148 5.52057 16.9399C5.41675 16.8651 5.41675 16.7068 5.41675 16.3903Z" />
|
||||
<path d="M7.91675 11.25L11.2501 11.25" stroke-linecap="round" />
|
||||
<path d="M7.91675 13.75L12.0834 13.75" stroke-linecap="round" />
|
||||
<path d="M14.5834 5.41732V5.41732C14.5834 3.97799 14.5834 3.25833 14.1954 2.76756C14.1087 2.65791 14.0095 2.55874 13.8998 2.47204C13.4091 2.08398 12.6894 2.08398 11.2501 2.08398H8.75008C7.31076 2.08398 6.5911 2.08398 6.10032 2.47204C5.99068 2.55874 5.8915 2.65791 5.8048 2.76756C5.41675 3.25833 5.41675 3.97799 5.41675 5.41732V5.41732" />
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
` : ``}
|
||||
${response.deletePermission === "true" ? `
|
||||
|
||||
<button type="button" class="btn-delete RemoveBtn" data-delete-id="${item.id}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
</button>
|
||||
|
||||
` : ``}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
let $checkAll = $("#checkAll2");
|
||||
let $checkboxes = $(".foo");
|
||||
|
||||
|
||||
|
||||
|
||||
$checkAll.on("change", function () {
|
||||
$checkboxes.prop("checked", this.checked);
|
||||
@@ -150,7 +150,7 @@ $(document).on('click', '.btn-search-click', function (event) {
|
||||
const selectedMonth = $('#sendDropdownMonth').val();
|
||||
const isYearMonthSelected = selectedYear === "0" && selectedMonth === "0";
|
||||
|
||||
if (!isYearMonthSelected && (selectedYear === "0" || selectedMonth === "0")) {
|
||||
if (!isYearMonthSelected && (selectedYear === "0" || selectedMonth === "0") ) {
|
||||
$('#dropdown-year').addClass("errored");
|
||||
$('#dropdown-month').addClass("errored");
|
||||
|
||||
@@ -175,7 +175,7 @@ $(document).on('click', '.btn-search-click', function (event) {
|
||||
const endDate = $('.end-date').val();
|
||||
const isStartEndDateSelected = startDate.trim() === "" && endDate.trim() === "";
|
||||
|
||||
if (!isStartEndDateSelected && (startDate.trim() === "" || endDate.trim() === "")) {
|
||||
if (!isStartEndDateSelected && (startDate.trim() === "" || endDate.trim() === "") ) {
|
||||
$('.start-date').addClass("errored");
|
||||
$('.end-date').addClass("errored");
|
||||
|
||||
@@ -223,7 +223,7 @@ $(document).ready(function () {
|
||||
} else {
|
||||
$('.btn-clear-filter').addClass('disable');
|
||||
}
|
||||
if (filterStart !== '') {
|
||||
if(filterStart !== '') {
|
||||
$('#start-date').text(filterStart);
|
||||
}
|
||||
if (filterEnd !== '') {
|
||||
@@ -1283,10 +1283,16 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
|
||||
@@ -1503,18 +1509,18 @@ function loadMore() {
|
||||
` : ``}
|
||||
${response.deletePermission === "true" ? `
|
||||
<button type="button" class="btn-delete RemoveBtn" data-delete-id="${item.id}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
</button>
|
||||
|
||||
` : ``}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1523,7 +1529,7 @@ function loadMore() {
|
||||
<div class="Rtable-cell--content align-items-center d-flex d-md-block text-end">
|
||||
${response.printPermission === "true" ? `
|
||||
|
||||
<button class="btn-print moreThan992" type="button" onclick="printOne(${item.id}, '${item.year}', '${item.month}')">
|
||||
<button class="btn-print moreThan992" type="button" onclick="printOne(${item.id}, '${item.year}', '${item.month}')">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke="currentColor">
|
||||
<path d="M15.0001 11.2493H15.139C16.0279 11.2493 16.4723 11.2493 16.759 10.9866C16.7805 10.967 16.801 10.9464 16.8207 10.9249C17.0834 10.6382 17.0834 10.1938 17.0834 9.3049V9.3049C17.0834 7.52714 17.0834 6.63826 16.558 6.06484C16.5187 6.02194 16.4775 5.98077 16.4346 5.94146C15.8612 5.41602 14.9723 5.41602 13.1945 5.41602H6.91675C5.03113 5.41602 4.08832 5.41602 3.50253 6.0018C2.91675 6.58759 2.91675 7.5304 2.91675 9.41602V10.2493C2.91675 10.7208 2.91675 10.9565 3.06319 11.1029C3.20964 11.2493 3.44534 11.2493 3.91675 11.2493H5.00008" />
|
||||
<path d="M5.41675 16.3903L5.41675 9.91732C5.41675 8.97451 5.41675 8.5031 5.70964 8.21021C6.00253 7.91732 6.47394 7.91732 7.41675 7.91732L12.5834 7.91732C13.5262 7.91732 13.9976 7.91732 14.2905 8.21021C14.5834 8.5031 14.5834 8.97451 14.5834 9.91732L14.5834 16.3903C14.5834 16.7068 14.5834 16.8651 14.4796 16.9399C14.3758 17.0148 14.2256 16.9647 13.9253 16.8646L12.2572 16.3086C12.1712 16.2799 12.1282 16.2656 12.0839 16.2669C12.0396 16.2682 11.9975 16.285 11.9134 16.3187L10.1858 17.0097C10.0941 17.0464 10.0482 17.0647 10.0001 17.0647C9.95194 17.0647 9.90609 17.0464 9.81439 17.0097L8.0868 16.3187C8.00267 16.285 7.9606 16.2682 7.91627 16.2669C7.87194 16.2656 7.82896 16.2799 7.74299 16.3086L6.07486 16.8646C5.77455 16.9647 5.62439 17.0148 5.52057 16.9399C5.41675 16.8651 5.41675 16.7068 5.41675 16.3903Z" />
|
||||
@@ -1538,19 +1544,19 @@ function loadMore() {
|
||||
${response.deletePermission === "true" ? `
|
||||
|
||||
<button type="button" class="btn-delete RemoveBtn" data-delete-id="${item.id}">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-linecap="round" />
|
||||
<path d="M2.75 5.9585H19.25V5.9585C18.122 5.9585 17.558 5.9585 17.1279 6.17946C16.7561 6.3704 16.4536 6.67297 16.2626 7.04469C16.0417 7.47488 16.0417 8.03886 16.0417 9.16683V13.8752C16.0417 15.7608 16.0417 16.7036 15.4559 17.2894C14.8701 17.8752 13.9273 17.8752 12.0417 17.8752H9.95833C8.07271 17.8752 7.12991 17.8752 6.54412 17.2894C5.95833 16.7036 5.95833 15.7608 5.95833 13.8752V9.16683C5.95833 8.03886 5.95833 7.47488 5.73737 7.04469C5.54643 6.67297 5.24386 6.3704 4.87214 6.17946C4.44195 5.9585 3.87797 5.9585 2.75 5.9585V5.9585Z" stroke-linecap="round" />
|
||||
<path d="M8.70841 3.20839C8.70841 3.20839 9.16675 2.2915 11.0001 2.2915C12.8334 2.2915 13.2917 3.20817 13.2917 3.20817" stroke-linecap="round" />
|
||||
</svg>
|
||||
<span class="mx-1">حذف</span>
|
||||
</button>
|
||||
|
||||
|
||||
` : ``}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1708,6 +1714,7 @@ function downloadExcelAll() {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
var idlist = "";
|
||||
$('.foo').each(function () {
|
||||
if ($(this).is(":checked")) {
|
||||
|
||||
@@ -54,10 +54,15 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -15,10 +15,15 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
$(".checkNationalCodeAndBirthDate").click(function () {
|
||||
|
||||
@@ -43,10 +43,15 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
//******************** انتخاب همه ی چک باکس ها ********************
|
||||
$(".checkAll").change(function () {
|
||||
|
||||
@@ -96,10 +96,15 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
updateDateInput(0);
|
||||
@@ -275,7 +280,108 @@ function fineSubjectModal() {
|
||||
}
|
||||
|
||||
|
||||
$('#createData').on('click', SaveDataAjax);
|
||||
$('#createData').on('click', CheckExistAjax);
|
||||
|
||||
function CheckExistAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
var employeeSelect = $('#employeeSelect').val();
|
||||
var Title = $('#Title ');
|
||||
var Amount = $('#Amount ');
|
||||
var FineDate = $('#FineDate');
|
||||
|
||||
if (employeeSelect.length === 0) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا اسامی پرسنل را کلیک و مشخص نمائید');
|
||||
$('.select-alert').addClass('errored');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('.select-alert').removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Title.val()) {
|
||||
Title.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا عنوان را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Title.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Amount.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FineDate.val()) {
|
||||
FineDate.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
FineDate.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: checkoutExistsAjaxUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
traditional: true,
|
||||
data: {
|
||||
fineDate: FineDate.val(),
|
||||
employeeIds: employeeSelect
|
||||
},
|
||||
success: function (response) {
|
||||
//if (response.checkout)
|
||||
if (response.customizeCheckout || response.customizeCheckoutTemp) {
|
||||
swal({
|
||||
title: "آیا میخواهید ادامه دهید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
SaveDataAjax();
|
||||
} else {
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SaveDataAjax();
|
||||
}
|
||||
},
|
||||
error: function (err) {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function SaveDataAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
@@ -1,4 +1,35 @@
|
||||
$(document).ready(function () {
|
||||
document.querySelectorAll('.scroll-container-amount').forEach(container => {
|
||||
let isDown = false;
|
||||
let startX;
|
||||
let scrollLeft;
|
||||
|
||||
container.addEventListener('mousedown', (e) => {
|
||||
isDown = true;
|
||||
startX = e.pageX - container.offsetLeft;
|
||||
scrollLeft = container.scrollLeft;
|
||||
container.style.cursor = "grabbing";
|
||||
});
|
||||
|
||||
container.addEventListener('mouseleave', () => {
|
||||
isDown = false;
|
||||
container.style.cursor = "grab";
|
||||
});
|
||||
|
||||
container.addEventListener('mouseup', () => {
|
||||
isDown = false;
|
||||
container.style.cursor = "grab";
|
||||
});
|
||||
|
||||
container.addEventListener('mousemove', (e) => {
|
||||
if (!isDown) return;
|
||||
e.preventDefault();
|
||||
const x = e.pageX - container.offsetLeft;
|
||||
const walk = (x - startX) * 2;
|
||||
container.scrollLeft = scrollLeft - walk;
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.form-control-number').on('keydown', function (e) {
|
||||
const allowedKeys = [
|
||||
'Backspace', 'Tab', 'Escape', 'Enter', 'ArrowLeft', 'ArrowRight',
|
||||
@@ -49,10 +80,15 @@
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -140,7 +176,98 @@ function fineSubjectModal() {
|
||||
}
|
||||
|
||||
|
||||
$('#createData').on('click', SaveDataAjax);
|
||||
$('#createData').on('click', CheckExistAjax);
|
||||
|
||||
function CheckExistAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
var employeeSelect = $('#employeeSelectId').val();
|
||||
var Title = $('#Title ');
|
||||
var Amount = $('#Amount ');
|
||||
var FineDate = $('#FineDate');
|
||||
|
||||
if (!Title.val()) {
|
||||
Title.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا عنوان را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Title.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Amount.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!FineDate.val()) {
|
||||
FineDate.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
FineDate.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: checkoutExistsAjaxUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
traditional: true,
|
||||
data: {
|
||||
fineDate: FineDate.val(),
|
||||
employeeIds: employeeSelect
|
||||
},
|
||||
success: function (response) {
|
||||
//if (response.checkout)
|
||||
if (response.customizeCheckout || response.customizeCheckoutTemp) {
|
||||
swal({
|
||||
title: "آیا میخواهید ادامه دهید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
SaveDataAjax();
|
||||
} else {
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SaveDataAjax();
|
||||
}
|
||||
},
|
||||
error: function (err) {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function SaveDataAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
@@ -204,6 +331,7 @@ function SaveDataAjax() {
|
||||
$('.alert-success-msg p').text('');
|
||||
}, 1500);
|
||||
|
||||
$('#fineEmployeesList').html('');
|
||||
$('#fineListAjax').html('');
|
||||
$('#PageIndex').val(0);
|
||||
pageIndexJs = 0;
|
||||
|
||||
@@ -41,11 +41,16 @@ $(document).ready(function () {
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
new Cleave(this', {
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
//******************** انتخاب همه ی چک باکس ها ********************
|
||||
|
||||
@@ -98,10 +98,15 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
updateDateInput(0);
|
||||
|
||||
@@ -7,11 +7,35 @@ var groupTypeDataInput = '';
|
||||
var loadData = true;
|
||||
var isMobile = "false";
|
||||
var groupData = false;
|
||||
var isMobileInput = window.matchMedia('(max-width: 767px)').matches;
|
||||
|
||||
$(document).ready(function () {
|
||||
loadRewardList();
|
||||
ajaxPersonals();
|
||||
|
||||
const { showType, employeeId, startDate, endDate } = getSearchParamsFromUrl();
|
||||
if (showType === 'group') {
|
||||
$("#group,#groupMobile").prop('checked', true);
|
||||
}
|
||||
if (showType === 'list') {
|
||||
$("#list,#listMobile").prop('checked', true);
|
||||
}
|
||||
|
||||
isMobileInput ? $('#start-date-mobile').val(startDate) : $('#start-date').val(startDate);
|
||||
isMobileInput ? $('#end-date-mobile').val(endDate) : $('#end-date').val(endDate);
|
||||
|
||||
if (employeeId !== "0" || startDate !== '' || endDate !== '', showType !== '') {
|
||||
$('.btn-clear-filter').removeClass('disable');
|
||||
} else {
|
||||
$('.btn-clear-filter').addClass('disable');
|
||||
}
|
||||
|
||||
searchStartDateTime = isMobile ? $('#start-date-mobile').val(startDate) : $('#start-date').val(startDate);
|
||||
searchEndDateTime = isMobile ? $('#end-date-mobile').val(endDate) : $('#end-date').val(endDate);
|
||||
searchName = isMobile ? $('#employeeSelectIndexMobile') : $('#employeeSelectIndex');
|
||||
listTypeDataInput = isMobile ? $('#listMobile') : $('#list');
|
||||
groupTypeDataInput = isMobile ? $('#groupMobile') : $('#group');
|
||||
|
||||
loadRewardList();
|
||||
|
||||
$(".select2OptionIndex").select2({
|
||||
language: "fa",
|
||||
@@ -43,11 +67,16 @@ $(document).ready(function () {
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
new Cleave('.dateInput', {
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
//******************** انتخاب همه ی چک باکس ها ********************
|
||||
@@ -196,6 +225,8 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function
|
||||
|
||||
groupData = $("#group,#groupMobile").is(":checked") ? true : false;
|
||||
|
||||
paramsUrl(searchName.val(), searchStartDateTime, searchEndDateTime);
|
||||
|
||||
pageIndexJs = 0;
|
||||
$('#rewardListAjax').html('');
|
||||
$('#rewardEmployeesList').html('');
|
||||
@@ -204,7 +235,7 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function
|
||||
});
|
||||
|
||||
$(document).on('click', '.btn-clear-filter', function () {
|
||||
window.location.reload();
|
||||
window.location.href = `${window.location.origin}/Client/Company/Reward`;
|
||||
});
|
||||
|
||||
// همگامسازی متن ورودی برای موبایل و دسکتاپ
|
||||
@@ -269,8 +300,13 @@ function ajaxPersonals() {
|
||||
var black = employee.black ? "blackSelect" : "";
|
||||
employeeOptionsHtml += `<option class="${black}" value="${employee.id}">${employee.employeeFullName}</option>`;
|
||||
});
|
||||
|
||||
$('#employeeSelectIndex').html(employeeOptionsHtml);
|
||||
$('#employeeSelectIndexMobile').html(employeeOptionsHtml);
|
||||
|
||||
const { showType, employeeId, startDate, endDate } = getSearchParamsFromUrl();
|
||||
isMobileInput ? $('#employeeSelectIndexMobile').val(employeeId).trigger('change') : $('#employeeSelectIndex').val(employeeId).trigger('change');
|
||||
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
@@ -292,12 +328,17 @@ function loadRewardList() {
|
||||
var pageIndex = Number($('#PageIndex').val());
|
||||
var html = '';
|
||||
|
||||
|
||||
const { showType, employeeId, startDate, endDate } = getSearchParamsFromUrl();
|
||||
|
||||
groupData = $("#group,#groupMobile").is(":checked") ? true : false;
|
||||
|
||||
var searchViewModel = {
|
||||
'PageIndex': pageIndex,
|
||||
'EmployeeId': $('#employeeSelectIndex').val(),
|
||||
'StartDate': $('#start-date').val(),
|
||||
'EndDate': $('#end-date').val(),
|
||||
'ShowAsGrouped':groupData,
|
||||
'EmployeeId': employeeId,
|
||||
'StartDate': startDate,
|
||||
'EndDate': endDate,
|
||||
'ShowAsGrouped': groupData,
|
||||
}
|
||||
|
||||
|
||||
@@ -614,14 +655,13 @@ function htmlLoadWithEmployeeDataByDate(loadRewardListData) {
|
||||
<div class="col-span-8 position-relative">`;
|
||||
|
||||
itemRewards.rewards.forEach(function (item) {
|
||||
|
||||
html += `<div class=" w-100">
|
||||
|
||||
<div class="Rtable-row align-items-center openAction" id="Employees">
|
||||
<div class="Rtable-cell width5">
|
||||
<label for="${n}" class="Rtable-cell--content prevent-select">
|
||||
<span class="d-flex justify-content-center align-items-center justify-content-center gap-2 spanCounter">
|
||||
<input id="${item.id}" type="checkbox" class="form-check-input foo" name="foo" value="${itemRewards.id}">
|
||||
<input id="${item.id}" type="checkbox" class="form-check-input foo" name="foo" value="${item.id}">
|
||||
${n}
|
||||
</span>
|
||||
</label>
|
||||
@@ -663,7 +703,7 @@ function htmlLoadWithEmployeeDataByDate(loadRewardListData) {
|
||||
|
||||
${editPermission ?
|
||||
`
|
||||
<button data-edit-id="${itemRewards.id}" class="btn-edit position-relative d-md-block d-none">
|
||||
<button data-edit-id="${item.id}" class="btn-edit position-relative d-md-block d-none">
|
||||
<svg width="20" height="20" viewBox="0 0 23 23" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12.6027 6.838L5.85304 13.5876C5.84201 13.5987 5.83107 13.6096 5.8202 13.6204C5.65773 13.7825 5.5139 13.9261 5.41254 14.1051C5.31117 14.2841 5.2621 14.4813 5.20667 14.704C5.20296 14.7189 5.19923 14.7339 5.19545 14.7491L4.5813 17.2057C4.57908 17.2145 4.57686 17.2234 4.57462 17.2323C4.53537 17.389 4.49347 17.5564 4.47972 17.6969C4.46458 17.8516 4.46811 18.1127 4.67752 18.3221L5.03035 17.9693L4.67752 18.3221C4.88693 18.5315 5.14799 18.535 5.30272 18.5199C5.44326 18.5062 5.6106 18.4643 5.76728 18.425C5.77622 18.4228 5.78512 18.4205 5.79398 18.4183L8.25057 17.8042C8.26569 17.8004 8.28069 17.7967 8.29558 17.793C8.51832 17.7375 8.71549 17.6885 8.89452 17.5871C9.07356 17.4857 9.21708 17.3419 9.37921 17.1794C9.39005 17.1686 9.40097 17.1576 9.412 17.1466L16.1616 10.397L16.1849 10.3737C16.4983 10.0603 16.7684 9.79025 16.9556 9.54492C17.1562 9.282 17.3081 8.98958 17.3081 8.6292C17.3081 8.26759 17.1541 7.97384 16.9522 7.71001C16.7633 7.46303 16.4905 7.1903 16.1731 6.87292L16.1499 6.84972L16.1267 6.82652C15.8093 6.5091 15.5366 6.23634 15.2896 6.04738C15.0258 5.84553 14.732 5.69156 14.3704 5.69156C14.01 5.69156 13.7176 5.84345 13.4547 6.04405C13.2094 6.23123 12.9393 6.5013 12.6259 6.81474L12.6027 6.838Z" stroke-width="1.5" stroke="#4DA9D1" />
|
||||
<path d="M11.9939 7.20397L14.8457 5.30273L17.6976 8.15459L15.7964 11.0064L11.9939 7.20397Z" fill="#4DA9D1" />
|
||||
@@ -689,7 +729,7 @@ function htmlLoadWithEmployeeDataByDate(loadRewardListData) {
|
||||
|
||||
${deletePermission ?
|
||||
`
|
||||
<button data-remove-id="${itemRewards.id}" type="button" class="btn-delete removeReward d-md-block d-none">
|
||||
<button data-remove-id="${item.id}" type="button" class="btn-delete removeReward d-md-block d-none">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 22 22" fill="none" stroke="currentColor">
|
||||
<path d="M8.70825 13.2915L8.70825 10.5415" stroke-width="1.5" stroke-linecap="round" />
|
||||
<path d="M13.2917 13.2915L13.2917 10.5415" stroke-width="1.5" stroke-linecap="round" />
|
||||
@@ -1290,3 +1330,58 @@ function removeAjax(id) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function paramsUrl(employeeId, startDate, endDate) {
|
||||
const params = new URLSearchParams();
|
||||
let hasAnyFilter = false
|
||||
|
||||
var isGroup = $("#group,#groupMobile").is(":checked") ? true : false;
|
||||
if (isGroup) {
|
||||
params.set("show-type", 'group');
|
||||
hasAnyFilter = true;
|
||||
} else {
|
||||
params.set("show-type", 'list');
|
||||
hasAnyFilter = true;
|
||||
}
|
||||
//const checkboxSelected = $('.dataType:checked').first().attr('id');
|
||||
//if (checkboxSelected === "group") {
|
||||
// params.set("show-type", checkboxSelected);
|
||||
// hasAnyFilter = true;
|
||||
//} else {
|
||||
// params.set("show-type", 'list');
|
||||
// hasAnyFilter = true;
|
||||
//}
|
||||
|
||||
if (startDate !== '') {
|
||||
params.set("start-date", startDate);
|
||||
hasAnyFilter = true;
|
||||
}
|
||||
|
||||
if (endDate !== '') {
|
||||
params.set("end-date", endDate);
|
||||
hasAnyFilter = true;
|
||||
}
|
||||
|
||||
if (employeeId !== "0") {
|
||||
params.set("employee-id", employeeId);
|
||||
hasAnyFilter = true;
|
||||
}
|
||||
|
||||
const newUrl = hasAnyFilter
|
||||
? `${window.location.origin}/Client/Company/Reward?${params.toString()}`
|
||||
: `${window.location.origin}/Client/Company/Reward`;
|
||||
|
||||
window.history.pushState({}, '', newUrl);
|
||||
}
|
||||
|
||||
function getSearchParamsFromUrl() {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
return {
|
||||
showType: urlParams.get("show-type") || "",
|
||||
startDate: urlParams.get("start-date") || "",
|
||||
endDate: urlParams.get("end-date") || "",
|
||||
employeeId: urlParams.get("employee-id") || "0"
|
||||
};
|
||||
}
|
||||
@@ -92,10 +92,15 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
updateDateInput(0);
|
||||
@@ -140,7 +145,97 @@ function ajaxPersonals() {
|
||||
}
|
||||
|
||||
|
||||
$('#createData').on('click', SaveDataAjax);
|
||||
$('#createData').on('click', CheckExistAjax);
|
||||
|
||||
function CheckExistAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
var employeeSelect = $('#employeeSelect').val();
|
||||
var Amount = $('#Amount ');
|
||||
var GrantDate = $('#GrantDate');
|
||||
|
||||
if (employeeSelect.length === 0) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا اسامی پرسنل را کلیک و مشخص نمائید');
|
||||
$('.select-alert').addClass('errored');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('.select-alert').removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Amount.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GrantDate.val()) {
|
||||
GrantDate.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
GrantDate.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: checkoutExistsAjaxUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
traditional: true,
|
||||
data: {
|
||||
grantDate: GrantDate.val(),
|
||||
employeeIds: employeeSelect
|
||||
},
|
||||
success: function (response) {
|
||||
//if (response.checkout)
|
||||
if (response.customizeCheckout || response.customizeCheckoutTemp) {
|
||||
swal({
|
||||
title: "آیا میخواهید ادامه دهید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
SaveDataAjax();
|
||||
} else {
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SaveDataAjax();
|
||||
}
|
||||
},
|
||||
error: function (err) {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function SaveDataAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
|
||||
@@ -1,4 +1,35 @@
|
||||
$(document).ready(function () {
|
||||
document.querySelectorAll('.scroll-container-amount').forEach(container => {
|
||||
let isDown = false;
|
||||
let startX;
|
||||
let scrollLeft;
|
||||
|
||||
container.addEventListener('mousedown', (e) => {
|
||||
isDown = true;
|
||||
startX = e.pageX - container.offsetLeft;
|
||||
scrollLeft = container.scrollLeft;
|
||||
container.style.cursor = "grabbing";
|
||||
});
|
||||
|
||||
container.addEventListener('mouseleave', () => {
|
||||
isDown = false;
|
||||
container.style.cursor = "grab";
|
||||
});
|
||||
|
||||
container.addEventListener('mouseup', () => {
|
||||
isDown = false;
|
||||
container.style.cursor = "grab";
|
||||
});
|
||||
|
||||
container.addEventListener('mousemove', (e) => {
|
||||
if (!isDown) return;
|
||||
e.preventDefault();
|
||||
const x = e.pageX - container.offsetLeft;
|
||||
const walk = (x - startX) * 2;
|
||||
container.scrollLeft = scrollLeft - walk;
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.form-control-number').on('keydown', function (e) {
|
||||
const allowedKeys = [
|
||||
'Backspace', 'Tab', 'Escape', 'Enter', 'ArrowLeft', 'ArrowRight',
|
||||
@@ -49,16 +80,126 @@
|
||||
});
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
ajaxPersonals();
|
||||
});
|
||||
|
||||
$('#createData').on('click', SaveDataAjax);
|
||||
|
||||
$('#createData').on('click', CheckExistAjax);
|
||||
|
||||
function CheckExistAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
var employeeSelect = $('#employeeSelectId').val();
|
||||
var Amount = $('#Amount ');
|
||||
var title = $('#Title ');
|
||||
var Description = $('#Description');
|
||||
var GrantDate = $('#GrantDate');
|
||||
|
||||
if (!title.val() || title.val() === " ") {
|
||||
title.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا عنوان پاداش را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
title.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Amount.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GrantDate.val()) {
|
||||
GrantDate.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
GrantDate.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Description.val()) {
|
||||
Description.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا علت توضیحات را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Description.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: checkoutExistsAjaxUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
traditional: true,
|
||||
data: {
|
||||
grantDate: GrantDate.val(),
|
||||
employeeIds: employeeSelect
|
||||
},
|
||||
success: function (response) {
|
||||
//if (response.checkout)
|
||||
if (response.customizeCheckout || response.customizeCheckoutTemp) {
|
||||
swal({
|
||||
title: "آیا میخواهید ادامه دهید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
SaveDataAjax();
|
||||
} else {
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SaveDataAjax();
|
||||
}
|
||||
},
|
||||
error: function (err) {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function SaveDataAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
@@ -82,7 +223,7 @@ function SaveDataAjax() {
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ پاداش را وارد نمائید');
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
|
||||
@@ -12,9 +12,15 @@
|
||||
// });
|
||||
|
||||
new Cleave('.dateInput', {
|
||||
date: true,
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
// new Cleave('.dateInput', {
|
||||
// date: true,
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
|
||||
loadEmployeeIsChangeAjax();
|
||||
});
|
||||
@@ -108,10 +114,15 @@ function employeeList() {
|
||||
|
||||
|
||||
$('.dateInput').each(function () {
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
new Cleave(this, {
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
|
||||
$(this).val(dateNow);
|
||||
});
|
||||
@@ -124,9 +135,14 @@ function employeeList() {
|
||||
}
|
||||
|
||||
$('#initialDateInput').on('input', function () {
|
||||
new Cleave('.dateInput', {
|
||||
date: true,
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
});
|
||||
new Cleave('.dateInput', {
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
// new Cleave('.dateInput', {
|
||||
// date: true,
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
$('.dateInput').val($(this).val());
|
||||
});
|
||||
@@ -468,10 +468,17 @@
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
// new Cleave(this, {
|
||||
// time: true,
|
||||
// timePattern: ['h', 'm']
|
||||
// });
|
||||
});
|
||||
|
||||
$("#StartHoures, #EndHours").on("keyup", validateTimeOrder);
|
||||
|
||||
@@ -21,12 +21,18 @@
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
$(".form-control-date").each(function () {
|
||||
@@ -35,12 +41,18 @@
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
@@ -173,19 +185,31 @@
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newStartDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newEndDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
@@ -657,19 +681,31 @@ function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newStartDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newEndDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
@@ -697,12 +733,18 @@ function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
$(".dateTime").each(function () {
|
||||
let element = $(this);
|
||||
@@ -787,19 +829,31 @@ function fetchAndDisplayRollCallData(employeeId, dateFa) {
|
||||
const value = convertPersianNumbersToEnglish($(this).val());
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newStartDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newEndDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
|
||||
@@ -11,12 +11,18 @@ $(document).ready(function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
@@ -160,19 +166,32 @@ $(document).ready(function () {
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newStartDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newEndDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
|
||||
@@ -1,4 +1,12 @@
|
||||
.scroll-container-amount {
|
||||
.modal-dialog-scrollable .modal-content {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.modal-dialog-scrollable .modal-body {
|
||||
overflow-y: visible;
|
||||
}
|
||||
|
||||
.scroll-container-amount {
|
||||
font-size: 12px;
|
||||
color: #4f4f4f;
|
||||
white-space: nowrap;
|
||||
@@ -94,4 +102,179 @@
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*select option*/
|
||||
|
||||
select {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.dropdown-select {
|
||||
background-image: linear-gradient( to bottom, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 100% );
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#40FFFFFF', endColorstr='#00FFFFFF', GradientType=0);
|
||||
background-color: #fff;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #DADADA;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
float: right;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
height: 35px;
|
||||
line-height: 35px;
|
||||
outline: none;
|
||||
padding-left: 18px;
|
||||
padding-right: 20px;
|
||||
position: relative;
|
||||
text-align: right !important;
|
||||
transition: all 0.2s ease-in-out;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
white-space: nowrap;
|
||||
width: auto;
|
||||
background-color:
|
||||
}
|
||||
|
||||
.dropdown-select:focus {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.dropdown-select:hover {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.dropdown-select:active,
|
||||
.dropdown-select.open {
|
||||
background-color: #fff !important;
|
||||
border-color: #bbb;
|
||||
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05) inset;
|
||||
}
|
||||
|
||||
.dropdown-select:after {
|
||||
height: 0;
|
||||
width: 0;
|
||||
border-left: 4px solid transparent;
|
||||
border-right: 4px solid transparent;
|
||||
border-top: 4px solid #777;
|
||||
-webkit-transform: origin(50% 20%);
|
||||
transform: origin(50% 20%);
|
||||
transition: all 0.125s ease-in-out;
|
||||
content: "";
|
||||
display: block;
|
||||
margin-top: -2px;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 50%;
|
||||
}
|
||||
|
||||
.dropdown-select.open:after {
|
||||
-webkit-transform: rotate(-180deg);
|
||||
transform: rotate(-180deg);
|
||||
}
|
||||
|
||||
.dropdown-select.open .list {
|
||||
-webkit-transform: scale(1);
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.dropdown-select.open .option {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.dropdown-select.wide {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dropdown-select.wide .list {
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
}
|
||||
|
||||
.dropdown-select .list {
|
||||
box-sizing: border-box;
|
||||
transition: all 0.15s cubic-bezier(0.25, 0, 0.25, 1.75), opacity 0.1s linear;
|
||||
-webkit-transform: scale(0.75);
|
||||
transform: scale(0.75);
|
||||
-webkit-transform-origin: 50% 0;
|
||||
transform-origin: 50% 0;
|
||||
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.09);
|
||||
background-color: #fff;
|
||||
border-radius: 6px;
|
||||
margin-top: 4px;
|
||||
padding: 3px 0;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
z-index: 999222222;
|
||||
max-height: 250px;
|
||||
overflow: auto;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.dropdown-select .list:hover .option:not(:hover) {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.dropdown-select .list ul {
|
||||
padding: 0;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.dropdown-select .option {
|
||||
cursor: default;
|
||||
font-weight: 400;
|
||||
outline: none;
|
||||
padding: 0 15px;
|
||||
text-align: right;
|
||||
transition: all 0.2s;
|
||||
list-style: none;
|
||||
border-radius: 6px;
|
||||
margin: 2px auto;
|
||||
height: 35px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dropdown-select .option:hover,
|
||||
.dropdown-select .option:focus {
|
||||
/* background-color: #f6f6f6 !important;*/
|
||||
background: linear-gradient(180deg, #41D1D1 0%, #2CD0D0 100%) !important;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.dropdown-select .option.selected {
|
||||
/* color: #12cbc4;*/
|
||||
background: linear-gradient(180deg, #41D1D1 0%, #2CD0D0 100%);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.dropdown-select .option.selected:focus {
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
.dropdown-select a {
|
||||
color: #aaa;
|
||||
text-decoration: none;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
.dropdown-select a:hover {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
dl, ol, ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
@@ -223,6 +223,10 @@
|
||||
width: 10% !important;
|
||||
}
|
||||
|
||||
.Rtable .Rtable-row .Rtable-cell .Rtable-cell--content > .numberIndex {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.radio-group {
|
||||
display: flex;
|
||||
|
||||
@@ -42,12 +42,18 @@ $(document).ready(function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
//******************** انتخاب همه ی چک باکس ها ********************
|
||||
@@ -185,27 +191,6 @@ $(document).on('click', '.btn-search-click, .btn-search-click-mobile', function
|
||||
return;
|
||||
}
|
||||
|
||||
if (((searchName.val() === "0") && ((searchStartDateTime === '' && searchEndDateTime === '')))) {
|
||||
if (isMobile) {
|
||||
$('#start-date-mobile').addClass("errored");
|
||||
$('#end-date-mobile').addClass("errored");
|
||||
} else {
|
||||
$('#start-date').addClass("errored");
|
||||
$('#end-date').addClass("errored");
|
||||
$('.select2.select2-container .select2-selection').addClass("errored");
|
||||
}
|
||||
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('برای جستجوی تاریخ، می بایست تاریخ شروع و پایان یا پرسنل را مشخص نمایید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('#start-date, #end-date, .select2.select2-container .select2-selection ,#start-date-mobile, #end-date-mobile').removeClass("errored");
|
||||
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('.btn-clear-filter').removeClass('disable');
|
||||
if (searchName.val() === "0" && searchStartDateTime === "" && searchEndDateTime === "") {
|
||||
$('.btn-clear-filter').addClass('disable');
|
||||
@@ -365,7 +350,7 @@ function loadSalaryAidList() {
|
||||
function htmlLoadSimpleListData(loadSalaryAidListData) {
|
||||
var html = '';
|
||||
//var pageIndex = Number($('#PageIndex').val());
|
||||
console.log(loadSalaryAidListData);
|
||||
//console.log(loadSalaryAidListData);
|
||||
if (loadSalaryAidListData.length > 0) {
|
||||
loadSalaryAidListData.forEach(function (item) {
|
||||
var n = pageIndexJs + 1;
|
||||
@@ -756,7 +741,7 @@ function htmlLoadWithEmployeeDataByFullname(loadSalaryAidListData) {
|
||||
|
||||
if (loadSalaryAidListData.length > 0) {
|
||||
loadSalaryAidListData.forEach(function (itemSalaryAids) {
|
||||
console.log(itemSalaryAids);
|
||||
//console.log(itemSalaryAids);
|
||||
n = 1;
|
||||
html += `
|
||||
<div class="salaryAid-grid-list personal-grid-row d-grid gap-2 grid-cols-12 w-100">
|
||||
@@ -942,10 +927,8 @@ function htmlLoadWithEmployeeMobileDataByFullname(loadSalaryAidListData) {
|
||||
var n = 1;
|
||||
if (loadSalaryAidListData) {
|
||||
loadSalaryAidListData.forEach(function (item) {
|
||||
console.log(item);
|
||||
|
||||
html += `
|
||||
<div></div>
|
||||
//console.log(item);
|
||||
html += `<div></div>
|
||||
<div class="Rtable-row align-items-center position-relative openAction">
|
||||
<div class="w-100 d-flex align-items-center justify-content-between">
|
||||
|
||||
@@ -1079,12 +1062,10 @@ function htmlLoadWithEmployeeMobileDataByDate(loadSalaryAidListData) {
|
||||
var n = 1;
|
||||
|
||||
if (loadSalaryAidListData) {
|
||||
console.log(loadSalaryAidListData)
|
||||
//console.log(loadSalaryAidListData)
|
||||
loadSalaryAidListData.forEach(function (item) {
|
||||
console.log(item);
|
||||
|
||||
html += `
|
||||
<div></div>
|
||||
//console.log(item);
|
||||
html += `<div></div>
|
||||
<div class="Rtable-row align-items-center position-relative openAction">
|
||||
<div class="w-100 d-flex align-items-center justify-content-between">
|
||||
|
||||
|
||||
@@ -90,17 +90,25 @@ $(document).ready(function () {
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
updateDateInput(0);
|
||||
|
||||
ajaxPersonals();
|
||||
ajaxYears();
|
||||
create_custom_dropdowns();
|
||||
});
|
||||
|
||||
function updateDateInput(daysToAdd) {
|
||||
@@ -120,8 +128,7 @@ function ajaxPersonals() {
|
||||
var employees = response.data;
|
||||
var employeeOptionsHtml = '<option value="" disabled>انتخاب پرسنل ...</option>';
|
||||
employees.forEach(function (employee) {
|
||||
var black = employee.black ? "blackSelect" : "";
|
||||
employeeOptionsHtml += `<option class="${black}" value="${employee.id}">${employee.employeeFullName}</option>`;
|
||||
employeeOptionsHtml += `<option value="${employee.id}">${employee.employeeFullName}</option>`;
|
||||
});
|
||||
$('#employeeSelect').html(employeeOptionsHtml);
|
||||
} else {
|
||||
@@ -139,7 +146,232 @@ function ajaxPersonals() {
|
||||
});
|
||||
}
|
||||
|
||||
$('#createData').on('click', SaveDataAjax);
|
||||
function ajaxYears() {
|
||||
$.ajax({
|
||||
url: yearlyListUrl,
|
||||
type: 'GET',
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
var data = response.data;
|
||||
var optionsHtml = ' <option value="0">سال</option>';
|
||||
data.forEach(function (item) {
|
||||
optionsHtml += `<option value="${item}">${item}</option>`;
|
||||
});
|
||||
$('#calculationYear').html(optionsHtml);
|
||||
|
||||
$('#calculationYear').next('.dropdown-select').remove();
|
||||
create_custom_dropdowns();
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function create_custom_dropdowns() {
|
||||
$('select').each(function (i, select) {
|
||||
if (!$(this).next().hasClass('dropdown-select')) {
|
||||
$(this).after('<div class="dropdown-select wide ' + ($(this).attr('class') || '') + '" tabindex="0"><span class="current"></span><div class="list"><ul></ul></div></div>');
|
||||
var dropdown = $(this).next();
|
||||
var options = $(select).find('option');
|
||||
var selected = $(this).find('option:selected');
|
||||
dropdown.find('.current').html(selected.data('display-text') || selected.text());
|
||||
options.each(function (j, o) {
|
||||
var display = $(o).data('display-text') || '';
|
||||
dropdown.find('ul').append('<li class="option ' + ($(o).is(':selected') ? 'selected' : '') + '" data-value="' + $(o).val() + '" data-display-text="' + display + '">' + $(o).text() + '</li>');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).off('click', '.dropdown-select').on('click', '.dropdown-select', function (event) {
|
||||
if ($(event.target).hasClass('dd-searchbox')) {
|
||||
return;
|
||||
}
|
||||
$('.dropdown-select').not($(this)).removeClass('open');
|
||||
$(this).toggleClass('open');
|
||||
if ($(this).hasClass('open')) {
|
||||
$(this).find('.option').attr('tabindex', 0);
|
||||
$(this).find('.selected').focus();
|
||||
} else {
|
||||
$(this).find('.option').removeAttr('tabindex');
|
||||
$(this).focus();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', function (event) {
|
||||
if ($(event.target).closest('.dropdown-select').length === 0) {
|
||||
$('.dropdown-select').removeClass('open');
|
||||
$('.dropdown-select .option').removeAttr('tabindex');
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
function filter() {
|
||||
var valThis = $('#txtSearchValue').val();
|
||||
$('.dropdown-select ul > li').each(function () {
|
||||
var text = $(this).text();
|
||||
(text.toLowerCase().indexOf(valThis.toLowerCase()) > -1) ? $(this).show() : $(this).hide();
|
||||
});
|
||||
};
|
||||
|
||||
$(document).on('click', '.dropdown-select .option', function (event) {
|
||||
$(this).closest('.list').find('.selected').removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
var text = $(this).data('display-text') || $(this).text();
|
||||
$(this).closest('.dropdown-select').find('.current').text(text);
|
||||
$(this).closest('.dropdown-select').prev('select').val($(this).data('value')).trigger('change');
|
||||
});
|
||||
|
||||
$(document).on('keydown', '.dropdown-select', function (event) {
|
||||
var focused_option = $($(this).find('.list .option:focus')[0] || $(this).find('.list .option.selected')[0]);
|
||||
if (event.keyCode === 13) {
|
||||
if ($(this).hasClass('open')) {
|
||||
focused_option.trigger('click');
|
||||
} else {
|
||||
$(this).trigger('click');
|
||||
}
|
||||
return false;
|
||||
// Down
|
||||
} else if (event.keyCode === 40) {
|
||||
if (!$(this).hasClass('open')) {
|
||||
$(this).trigger('click');
|
||||
} else {
|
||||
focused_option.next().focus();
|
||||
}
|
||||
return false;
|
||||
// Up
|
||||
} else if (event.keyCode === 38) {
|
||||
if (!$(this).hasClass('open')) {
|
||||
$(this).trigger('click');
|
||||
} else {
|
||||
var focused_option = $($(this).find('.list .option:focus')[0] || $(this).find('.list .option.selected')[0]);
|
||||
focused_option.prev().focus();
|
||||
}
|
||||
return false;
|
||||
// Esc
|
||||
} else if (event.keyCode === 27) {
|
||||
if ($(this).hasClass('open')) {
|
||||
$(this).trigger('click');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$('#createData').on('click', CheckExistAjax);
|
||||
|
||||
function CheckExistAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
var employeeSelect = $('#employeeSelect').val();
|
||||
var Amount = $('#Amount ');
|
||||
var SalaryDateTime = $('#SalaryDateTime');
|
||||
var calculationYear = $('#calculationYear');
|
||||
var calculationMonth = $('#calculationMonth');
|
||||
|
||||
if (employeeSelect.length === 0) {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا اسامی پرسنل را کلیک و مشخص نمائید');
|
||||
$('.select-alert').addClass('errored');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('.select-alert').removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Amount.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SalaryDateTime.val()) {
|
||||
SalaryDateTime.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
SalaryDateTime.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (calculationYear.val() === "0" || calculationMonth.val() === "0") {
|
||||
$('.calculationYear').addClass('errored');
|
||||
$('.calculationMonth').addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا سال و ماه را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('.calculationYear').removeClass('errored');
|
||||
$('.calculationMonth').removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: checkoutExistsAjaxUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
traditional: true,
|
||||
data: {
|
||||
calculationDate: `${calculationYear.val()}/${calculationMonth.val()}/01`,
|
||||
employeeIds: employeeSelect
|
||||
},
|
||||
success: function (response) {
|
||||
//if (response.checkout)
|
||||
if (response.customizeCheckout || response.customizeCheckoutTemp) {
|
||||
swal({
|
||||
title: "آیا میخواهید ادامه دهید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
SaveDataAjax();
|
||||
} else {
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SaveDataAjax();
|
||||
}
|
||||
},
|
||||
error: function (err) {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function SaveDataAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
@@ -147,7 +379,8 @@ function SaveDataAjax() {
|
||||
var employeeSelect = $('#employeeSelect').val();
|
||||
var Amount = $('#Amount ');
|
||||
var SalaryDateTime = $('#SalaryDateTime');
|
||||
var CalculationDateTime = $('#CalculationDateTime');
|
||||
var calculationYear = $('#calculationYear');
|
||||
var calculationMonth = $('#calculationMonth');
|
||||
|
||||
if (employeeSelect.length === 0) {
|
||||
$('.alert-msg').show();
|
||||
@@ -186,14 +419,16 @@ function SaveDataAjax() {
|
||||
}
|
||||
|
||||
|
||||
if (!CalculationDateTime.val()) {
|
||||
CalculationDateTime.addClass('errored');
|
||||
if (calculationYear.val() === "0" || calculationMonth.val() === "0") {
|
||||
$('.calculationYear').addClass('errored');
|
||||
$('.calculationMonth').addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ محاسبه را مشخص نمائید');
|
||||
$('.alert-msg p').text('لطفا سال و ماه را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
CalculationDateTime.removeClass('errored');
|
||||
$('.calculationYear').removeClass('errored');
|
||||
$('.calculationMonth').removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
@@ -219,7 +454,7 @@ function SaveDataAjax() {
|
||||
}, 1500);
|
||||
|
||||
if (urlPathname.indexOf('/Client/Company/SalaryAid') > -1) {
|
||||
$('#salaryAidListAjax').html('');
|
||||
$('#salaryaidListAjax').html('');
|
||||
$('#PageIndex').val(0);
|
||||
pageIndexJs = 0;
|
||||
loadSalaryAidList();
|
||||
|
||||
@@ -67,27 +67,160 @@ $(document).ready(function () {
|
||||
});
|
||||
|
||||
$(".form-control-date").each(function () {
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
|
||||
ajaxYears();
|
||||
create_custom_dropdowns();
|
||||
});
|
||||
|
||||
$('#createData').on('click', SaveDataAjax);
|
||||
function SaveDataAjax() {
|
||||
function ajaxYears() {
|
||||
$.ajax({
|
||||
url: yearlyListUrl,
|
||||
type: 'GET',
|
||||
success: function (response) {
|
||||
if (response.success) {
|
||||
var data = response.data;
|
||||
var optionsHtml = ' <option value="0">سال</option>';
|
||||
data.forEach(function (item) {
|
||||
optionsHtml += `<option value="${item}" ${item === year ? "selected" : ""}>${item}</option>`;
|
||||
});
|
||||
$('#calculationYear').html(optionsHtml);
|
||||
|
||||
$('#calculationYear').next('.dropdown-select').remove();
|
||||
create_custom_dropdowns();
|
||||
} else {
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text(response.message);
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
}, 3500);
|
||||
}
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function create_custom_dropdowns() {
|
||||
$('select').each(function (i, select) {
|
||||
if (!$(this).next().hasClass('dropdown-select')) {
|
||||
$(this).after('<div class="dropdown-select wide ' + ($(this).attr('class') || '') + '" tabindex="0"><span class="current"></span><div class="list"><ul></ul></div></div>');
|
||||
var dropdown = $(this).next();
|
||||
var options = $(select).find('option');
|
||||
var selected = $(this).find('option:selected');
|
||||
dropdown.find('.current').html(selected.data('display-text') || selected.text());
|
||||
options.each(function (j, o) {
|
||||
var display = $(o).data('display-text') || '';
|
||||
dropdown.find('ul').append('<li class="option ' + ($(o).is(':selected') ? 'selected' : '') + '" data-value="' + $(o).val() + '" data-display-text="' + display + '">' + $(o).text() + '</li>');
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
$(document).off('click', '.dropdown-select').on('click', '.dropdown-select', function (event) {
|
||||
if ($(event.target).hasClass('dd-searchbox')) {
|
||||
return;
|
||||
}
|
||||
$('.dropdown-select').not($(this)).removeClass('open');
|
||||
$(this).toggleClass('open');
|
||||
if ($(this).hasClass('open')) {
|
||||
$(this).find('.option').attr('tabindex', 0);
|
||||
$(this).find('.selected').focus();
|
||||
} else {
|
||||
$(this).find('.option').removeAttr('tabindex');
|
||||
$(this).focus();
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', function (event) {
|
||||
if ($(event.target).closest('.dropdown-select').length === 0) {
|
||||
$('.dropdown-select').removeClass('open');
|
||||
$('.dropdown-select .option').removeAttr('tabindex');
|
||||
}
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
function filter() {
|
||||
var valThis = $('#txtSearchValue').val();
|
||||
$('.dropdown-select ul > li').each(function () {
|
||||
var text = $(this).text();
|
||||
(text.toLowerCase().indexOf(valThis.toLowerCase()) > -1) ? $(this).show() : $(this).hide();
|
||||
});
|
||||
};
|
||||
|
||||
$(document).on('click', '.dropdown-select .option', function (event) {
|
||||
$(this).closest('.list').find('.selected').removeClass('selected');
|
||||
$(this).addClass('selected');
|
||||
var text = $(this).data('display-text') || $(this).text();
|
||||
$(this).closest('.dropdown-select').find('.current').text(text);
|
||||
$(this).closest('.dropdown-select').prev('select').val($(this).data('value')).trigger('change');
|
||||
});
|
||||
|
||||
$(document).on('keydown', '.dropdown-select', function (event) {
|
||||
var focused_option = $($(this).find('.list .option:focus')[0] || $(this).find('.list .option.selected')[0]);
|
||||
if (event.keyCode === 13) {
|
||||
if ($(this).hasClass('open')) {
|
||||
focused_option.trigger('click');
|
||||
} else {
|
||||
$(this).trigger('click');
|
||||
}
|
||||
return false;
|
||||
// Down
|
||||
} else if (event.keyCode === 40) {
|
||||
if (!$(this).hasClass('open')) {
|
||||
$(this).trigger('click');
|
||||
} else {
|
||||
focused_option.next().focus();
|
||||
}
|
||||
return false;
|
||||
// Up
|
||||
} else if (event.keyCode === 38) {
|
||||
if (!$(this).hasClass('open')) {
|
||||
$(this).trigger('click');
|
||||
} else {
|
||||
var focused_option = $($(this).find('.list .option:focus')[0] || $(this).find('.list .option.selected')[0]);
|
||||
focused_option.prev().focus();
|
||||
}
|
||||
return false;
|
||||
// Esc
|
||||
} else if (event.keyCode === 27) {
|
||||
if ($(this).hasClass('open')) {
|
||||
$(this).trigger('click');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
$('#createData').on('click', CheckExistAjax);
|
||||
|
||||
function CheckExistAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
var employeeSelect = $('#employeeSelectId').val();
|
||||
var Amount = $('#Amount ');
|
||||
var SalaryDateTime = $('#SalaryDateTime');
|
||||
var CalculationDateTime = $('#CalculationDateTime');
|
||||
var calculationYear = $('#calculationYear');
|
||||
var calculationMonth = $('#calculationMonth');
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ پاداش را وارد نمائید');
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
@@ -108,14 +241,110 @@ function SaveDataAjax() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CalculationDateTime.val()) {
|
||||
CalculationDateTime.addClass('errored');
|
||||
if (calculationYear.val() === "0" || calculationMonth.val() === "0") {
|
||||
$('.calculationYear').addClass('errored');
|
||||
$('.calculationMonth').addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ محاسبه را مشخص نمائید');
|
||||
$('.alert-msg p').text('لطفا سال و ماه را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
CalculationDateTime.removeClass('errored');
|
||||
$('.calculationYear').removeClass('errored');
|
||||
$('.calculationMonth').removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
var month = calculationMonth.val() < 10 ? calculationMonth.val().padStart(2, '0') : calculationMonth.val();
|
||||
var dateCalculate = `${calculationYear.val()}/${month}/01`;
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: checkoutExistsAjaxUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
traditional: true,
|
||||
data: {
|
||||
calculationDate: dateCalculate,
|
||||
employeeIds: employeeSelect
|
||||
},
|
||||
success: function (response) {
|
||||
//if (response.checkout)
|
||||
if (response.customizeCheckout || response.customizeCheckoutTemp) {
|
||||
swal({
|
||||
title: "آیا میخواهید ادامه دهید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
SaveDataAjax();
|
||||
} else {
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SaveDataAjax();
|
||||
}
|
||||
},
|
||||
error: function (err) {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function SaveDataAjax() {
|
||||
var loading = $('#createData .spinner-loading');
|
||||
|
||||
var Amount = $('#Amount ');
|
||||
var SalaryDateTime = $('#SalaryDateTime');
|
||||
var calculationYear = $('#calculationYear');
|
||||
var calculationMonth = $('#calculationMonth');
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا مبلغ را وارد نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
Amount.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SalaryDateTime.val()) {
|
||||
SalaryDateTime.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
SalaryDateTime.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (calculationYear.val() === "0" || calculationMonth.val() === "0") {
|
||||
$('.calculationYear').addClass('errored');
|
||||
$('.calculationMonth').addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا سال و ماه را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
$('.calculationYear').removeClass('errored');
|
||||
$('.calculationMonth').removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
@@ -139,7 +368,8 @@ function SaveDataAjax() {
|
||||
$('.alert-success-msg').hide();
|
||||
$('.alert-success-msg p').text('');
|
||||
}, 1500);
|
||||
|
||||
|
||||
$('#salaryaidEmployeeListAjax').html('');
|
||||
$('#salaryAidListAjax').html('');
|
||||
$('#PageIndex').val(0);
|
||||
pageIndexJs = 0;
|
||||
|
||||
@@ -131,11 +131,12 @@ function showAlertMessage(selector, message, timeout) {
|
||||
}
|
||||
|
||||
function loadErrorExcelDataAjax(data) {
|
||||
|
||||
|
||||
|
||||
var htmlTable = '';
|
||||
|
||||
if (data.errors.length > 0) {
|
||||
var month = data.rawData[0]?.calculationMonth < 10 ? data.rawData[0]?.calculationMonth.toString().padStart(2, '0') : data.rawData[0]?.calculationMonth.toString();
|
||||
var dateCalculate = `${data.rawData[0]?.calculationYear}/${month}/01`;
|
||||
|
||||
//let allRows = new Array(Math.max(data.rawData.length, data.errors.length)).fill(null);
|
||||
//let rowErrorsDataArray = data.rawData.filter(x => data.errors.some(e => e.row === x.row));
|
||||
|
||||
@@ -146,7 +147,7 @@ function loadErrorExcelDataAjax(data) {
|
||||
|
||||
<div class="Rtable-cell column-heading rowHeaderCustom text-center d-flex justify-content-between w-100 px-3">
|
||||
<div>تاریخ پرداخت ${data.rawData[0]?.salaryAidDateTime ?? ""}</div>
|
||||
<div>تاریخ محاسبه ${data.rawData[0]?.calculationDate ?? ""}</div>
|
||||
<div>تاریخ محاسبه ${data.rawData[0]?.calculationMonth ? dateCalculate : ""}</div>
|
||||
</div>
|
||||
<div class="lineHead w-100"></div>
|
||||
<div class="d-flex w-100 px-1 gap-2">
|
||||
@@ -225,7 +226,7 @@ function loadErrorExcelDataAjax(data) {
|
||||
|
||||
htmlTable += `<div class="Rtable-cell width1">
|
||||
<label class="Rtable-cell--content prevent-select">
|
||||
<span class="d-flex align-items-center justify-content-center gap-1">${index + 1}</span>
|
||||
<span class="d-flex align-items-center justify-content-center gap-1 numberIndex">${index + 1}</span>
|
||||
</label>
|
||||
</div>`;
|
||||
|
||||
@@ -393,12 +394,15 @@ function loadFinalExcelDataAjax(data) {
|
||||
if (data.rawData.length > 0) {
|
||||
const rowValidDataDuplicateExist = data.rawData.filter(x => x.duplicated);
|
||||
|
||||
var month = data.rawData[0]?.calculationMonth < 10 ? data.rawData[0]?.calculationMonth.toString().padStart(2, '0') : data.rawData[0]?.calculationMonth.toString();
|
||||
var dateCalculate = `${data.rawData[0]?.calculationYear}/${month}/01`;
|
||||
|
||||
htmlTable += `<div class="wrapper">
|
||||
<div class="excelValidTable Rtable Rtable--5cols Rtable--collapse rowCustom px-1">
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex flex-column w-100 sticky p-0">
|
||||
<div class="Rtable-cell column-heading rowHeaderCustom d-flex align-items-center ${rowValidDataDuplicateExist.length > 0 ? 'justify-content-between' : 'justify-content-center'} w-100 px-2">
|
||||
<div class="Rtable-cell column-heading rowHeaderCustom d-flex align-items-center justify-content-between w-100 px-2">
|
||||
<div>تاریخ پرداخت ${data.rawData[0].salaryAidDateTime}</div>
|
||||
<div>تاریخ محاسبه ${data.rawData[0]?.calculationDate ?? ""}</div>`;
|
||||
<div>تاریخ محاسبه ${dateCalculate ?? ""}</div>`;
|
||||
|
||||
|
||||
if (rowValidDataDuplicateExist.length > 0) {
|
||||
@@ -725,7 +729,72 @@ function checkInputsEnabled() {
|
||||
}
|
||||
|
||||
|
||||
$('#createData').click(function () {
|
||||
$('#createData').on('click', CheckExistAjax);
|
||||
|
||||
function CheckExistAjax() {
|
||||
var employeeSelectArray = [];
|
||||
|
||||
validDataArray.forEach(function(item) {
|
||||
employeeSelectArray.push(item.employeeId);
|
||||
});
|
||||
|
||||
if (!validDataArray) {
|
||||
showAlertMessage('.alert-msg', 'داده ای برای ارسال وجود ندارد.', 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
var month = validDataArray[0].calculationMonth < 10 ? validDataArray[0].calculationMonth.toString().padStart(2, '0') : validDataArray[0].calculationMonth.toString();
|
||||
var dateCalculate = `${validDataArray[0].calculationYear}/${month}/01`;
|
||||
|
||||
var loading = $("#createData").find('.spinner-loading').show();
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
$.ajax({
|
||||
async: false,
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
url: checkoutExistsAjaxUrl,
|
||||
headers: { "RequestVerificationToken": antiForgeryToken },
|
||||
traditional: true,
|
||||
data: {
|
||||
calculationDate: dateCalculate,
|
||||
employeeIds: employeeSelectArray
|
||||
},
|
||||
success: function (response) {
|
||||
//if (response.checkout)
|
||||
if (response.customizeCheckout || response.customizeCheckoutTemp) {
|
||||
swal({
|
||||
title: "آیا میخواهید ادامه دهید؟",
|
||||
text: "",
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#DD6B55",
|
||||
confirmButtonText: "بله",
|
||||
cancelButtonText: "خیر",
|
||||
closeOnConfirm: true,
|
||||
closeOnCancel: true
|
||||
}, function (isConfirm) {
|
||||
if (isConfirm) {
|
||||
SaveDataAjax();
|
||||
} else {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
SaveDataAjax();
|
||||
}
|
||||
},
|
||||
error: function (err) {
|
||||
loading.hide();
|
||||
$('#createData').removeClass('disable');
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function SaveDataAjax() {
|
||||
if (!validDataArray) {
|
||||
showAlertMessage('.alert-msg', 'داده ای برای ارسال وجود ندارد.', 3500);
|
||||
return;
|
||||
@@ -776,7 +845,7 @@ $('#createData').click(function () {
|
||||
$('#createData').removeClass('disable');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function downloadExcelTemplate(url) {
|
||||
$.ajax({
|
||||
@@ -801,8 +870,4 @@ function downloadExcelTemplate(url) {
|
||||
console.error('Error downloading file:', error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//$(#createData).click(function() {
|
||||
|
||||
//});
|
||||
}
|
||||
@@ -6,11 +6,18 @@ $(document).ready(function () {
|
||||
$('.btn-register').addClass('disable');
|
||||
|
||||
$(".form-control-date").each(function () {
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
// new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
// });
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
|
||||
@@ -9,12 +9,18 @@
|
||||
let value = convertPersianNumbersToEnglish(element.val());
|
||||
element.val(value);
|
||||
});
|
||||
|
||||
|
||||
new Cleave(this, {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(this, {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
});
|
||||
|
||||
$(".dateTime").each(function () {
|
||||
@@ -158,19 +164,32 @@
|
||||
$(this).val(value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
new Cleave(newStartDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newStartDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
new Cleave(newEndDateInput[0], {
|
||||
date: true,
|
||||
delimiter: '/',
|
||||
datePattern: ['Y', 'm', 'd']
|
||||
delimiters: ['/', '/'],
|
||||
blocks: [4, 2, 2],
|
||||
numericOnly: true
|
||||
});
|
||||
|
||||
//new Cleave(newEndDateInput[0], {
|
||||
// date: true,
|
||||
// delimiter: '/',
|
||||
// datePattern: ['Y', 'm', 'd']
|
||||
//});
|
||||
|
||||
|
||||
new Cleave(newStartTimeInput[0], {
|
||||
time: true,
|
||||
timePattern: ['h', 'm']
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user