Add Calculation date to salaryAid
This commit is contained in:
@@ -4,14 +4,19 @@ namespace Company.Domain.CustomizeCheckoutAgg.ValueObjects;
|
||||
|
||||
public class CustomizeCheckoutSalaryAid
|
||||
{
|
||||
public CustomizeCheckoutSalaryAid(string amount, DateTime salaryAidDateTime, string salaryAidDateTimeFa)
|
||||
public CustomizeCheckoutSalaryAid(string amount, DateTime salaryAidDateTime, string salaryAidDateTimeFa, DateTime calculationDateTime, string calculationDateTimeFa)
|
||||
{
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidDateTime;
|
||||
SalaryAidDateTimeFa = salaryAidDateTimeFa;
|
||||
CalculationDateTime = calculationDateTime;
|
||||
CalculationDateTimeFa = calculationDateTimeFa;
|
||||
}
|
||||
|
||||
public string Amount { get; private set; }
|
||||
public DateTime SalaryAidDateTime { get; private set; }
|
||||
public string SalaryAidDateTimeFa { get; private set; }
|
||||
|
||||
public DateTime CalculationDateTime { get; private set; }
|
||||
public string CalculationDateTimeFa { get; private set; }
|
||||
}
|
||||
@@ -4,14 +4,20 @@ namespace Company.Domain.CustomizeCheckoutTempAgg.ValueObjects;
|
||||
|
||||
public class CustomizeCheckoutTempSalaryAid
|
||||
{
|
||||
public CustomizeCheckoutTempSalaryAid(string amount, DateTime salaryAidDateTime, string salaryAidDateTimeFa)
|
||||
public CustomizeCheckoutTempSalaryAid(string amount, DateTime salaryAidDateTime, string salaryAidDateTimeFa,
|
||||
DateTime calculationDateTime, string calculationDateTimeFa)
|
||||
{
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidDateTime;
|
||||
SalaryAidDateTimeFa = salaryAidDateTimeFa;
|
||||
CalculationDateTime = calculationDateTime;
|
||||
CalculationDateTimeFa = calculationDateTimeFa;
|
||||
}
|
||||
|
||||
public string Amount { get; private set; }
|
||||
public DateTime SalaryAidDateTime { get; private set; }
|
||||
public string SalaryAidDateTimeFa { get; private set; }
|
||||
|
||||
public DateTime CalculationDateTime { get; private set; }
|
||||
public string CalculationDateTimeFa { get; private set; }
|
||||
}
|
||||
@@ -11,20 +11,27 @@ public class SalaryAid:EntityBase
|
||||
{
|
||||
|
||||
}
|
||||
public SalaryAid(long employeeId, long workshopId, double amount, DateTime salaryAidDateTime, long createdByAccountId, UserType createdByUserType)
|
||||
public SalaryAid(long employeeId, long workshopId, double amount, DateTime salaryAidDateTime, long createdByAccountId, UserType createdByUserType, DateTime calculationDate)
|
||||
{
|
||||
EmployeeId = employeeId;
|
||||
WorkshopId = workshopId;
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidDateTime;
|
||||
CalculationDate = calculationDate;
|
||||
CreatedByUserType = createdByUserType;
|
||||
CreatedByAccountId = createdByAccountId;
|
||||
}
|
||||
|
||||
public long EmployeeId { get; private set; }
|
||||
public long WorkshopId { get; private set; }
|
||||
public double Amount { get; private set; }
|
||||
/// <summary>
|
||||
/// تاریخ پرداخت
|
||||
/// </summary>
|
||||
public DateTime SalaryAidDateTime { get; private set; }
|
||||
/// <summary>
|
||||
/// تاریخ محاسبه
|
||||
/// </summary>
|
||||
public DateTime CalculationDate { get; private set; }
|
||||
|
||||
|
||||
public long CreatedByAccountId { get; private set; }
|
||||
@@ -36,11 +43,12 @@ public class SalaryAid:EntityBase
|
||||
public UserType LastModifiedByUserType { get; private set; }
|
||||
|
||||
|
||||
public void Edit(double amount, DateTime salaryAidTime, long modifiedByAccountId, UserType modifiedByUserType)
|
||||
public void Edit(double amount, DateTime salaryAidTime, long modifiedByAccountId, UserType modifiedByUserType, DateTime calculationDate)
|
||||
{
|
||||
Amount = amount;
|
||||
SalaryAidDateTime = salaryAidTime;
|
||||
LastModifiedByAccountId = modifiedByAccountId;
|
||||
LastModifiedByUserType = modifiedByUserType;
|
||||
CalculationDate = calculationDate;
|
||||
}
|
||||
}
|
||||
@@ -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, int Row, bool Duplicated);
|
||||
public record SalaryAidImportData(long EmployeeId, long WorkshopId, string FullName, double Amount, string AccountNumber, string NationalCode, string SalaryAidDateTime,string CalculationDate, int Row, bool Duplicated);
|
||||
|
||||
public class ExcelValidation<T>
|
||||
{
|
||||
@@ -84,24 +84,37 @@ public class SalaryAidImportExcel
|
||||
worksheet.Cells[2, 2].Text != "کد ملی" ||
|
||||
worksheet.Cells[2, 3].Text != "شماره حساب" ||
|
||||
worksheet.Cells[2, 4].Text != "مبلغ قابل پرداخت" ||
|
||||
worksheet.Cells[1, 1].Text != "تاریخ پرداخت")
|
||||
worksheet.Cells[1, 3].Text != "تاریخ پرداخت" ||
|
||||
worksheet.Cells[1, 1].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;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(salaryDateFa))
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("لطفا در سلول زرد رنگ تاریخ پرداخت را وارد کنید", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
return result;
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(calculationDate))
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("لطفا در سلول آبی رنگ تاریخ محاسبه را وارد کنید", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
return result;
|
||||
}
|
||||
|
||||
if (salaryDateFa.TryToGeorgianDateTime(out var salaryDateTime) == false)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("تاریخ وارد شده نامعتبر است", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
}
|
||||
|
||||
if (calculationDate.TryToGeorgianDateTime(out var calculationDateTime) == false)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("تاریخ محاسبه وارد شده نامعتبر است", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
}
|
||||
|
||||
if (salaryDateTime > DateTime.Now)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("تاریخ پرداخت مساعده می بایست تاریخ امروز یا قبل تر باشد", 0, SalaryAidExcelColumns.None.ToString()));
|
||||
@@ -127,11 +140,11 @@ public class SalaryAidImportExcel
|
||||
if (!double.TryParse(amountText, out double amount) || amount <= 0)
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError("مبلغ خالی یا نامعتبر است", row, SalaryAidExcelColumns.Amount.ToString()));
|
||||
|
||||
}
|
||||
result.RawData.Add(new SalaryAidImportData(0, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, row, false));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fullName))
|
||||
}
|
||||
result.RawData.Add(new SalaryAidImportData(0, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationDate,row, false));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fullName))
|
||||
{
|
||||
result.Errors.Add(new SalaryAidImportExcelError(" نام و نام خانوادگی خالی است", row, SalaryAidExcelColumns.FullName.ToString()));
|
||||
|
||||
@@ -213,16 +226,16 @@ public class SalaryAidImportExcel
|
||||
{
|
||||
// TODO MAHAN: Vafa Add this Code! Please Check it!
|
||||
|
||||
result.RawData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, row, true));
|
||||
continue;
|
||||
result.RawData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationDate, row, true));
|
||||
continue;
|
||||
}
|
||||
result.ValidData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, row, false));
|
||||
result.ValidData.Add(new SalaryAidImportData(employee.id, workshopId, fullName, amount, accountNumber, nationalCode, salaryDateFa, calculationDate, row, false));
|
||||
}
|
||||
|
||||
result.RawData = result.RawData.GroupBy(x => x.Row).Select(x => new SalaryAidImportData(x.First().EmployeeId,
|
||||
x.First().WorkshopId, x.First().FullName,
|
||||
x.First().Amount, x.First().AccountNumber, x.First().NationalCode, x.First().SalaryAidDateTime, x.Key,
|
||||
x.Any(s => s.Duplicated))).ToList();
|
||||
x.First().WorkshopId, x.First().FullName,
|
||||
x.First().Amount, x.First().AccountNumber, x.First().NationalCode, x.First().SalaryAidDateTime, x.First().CalculationDate,x.Key,
|
||||
x.Any(s => s.Duplicated))).ToList();
|
||||
|
||||
|
||||
//result.Errors.GroupBy(x => x.Row).Select(x => new
|
||||
|
||||
@@ -4,9 +4,10 @@ namespace CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
public class CreateSalaryAidViewModel
|
||||
{
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string SalaryDateTime { get; set; }
|
||||
public List<long> EmployeeIds { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public string SalaryDateTime { get; set; }
|
||||
public string CalculationDateTime { get; set; }
|
||||
public string NationalCode { get; set; }
|
||||
}
|
||||
@@ -4,17 +4,21 @@ namespace CompanyManagment.App.Contracts.SalaryAid;
|
||||
|
||||
public class SalaryAidViewModel
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public long Id { get; set; }
|
||||
public long EmployeeId { get; set; }
|
||||
public string Amount { get; set; }
|
||||
public double AmountDouble { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string CreationDate { get; set; }
|
||||
public string SalaryAidDateTimeFa { get; set; }
|
||||
public DateTime SalaryAidDateTimeGe { get; set; }
|
||||
public long WorkshopId { get; set; }
|
||||
public string CreationDate { get; set; }
|
||||
public string SalaryAidDateTimeFa { get; set; }
|
||||
public DateTime SalaryAidDateTimeGe { get; set; }
|
||||
public string CalculationDateTimeFa { get; set; }
|
||||
public DateTime CalculationDateTimeGe { get; set; }
|
||||
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string PersonnelCode { get; set; }
|
||||
|
||||
|
||||
public string EmployeeFullName { get; set; }
|
||||
public string PersonnelCode { get; set; }
|
||||
public string MonthFa { get; set; }
|
||||
public string YearFa { get; set; }
|
||||
}
|
||||
@@ -97,7 +97,7 @@ namespace CompanyManagment.Application
|
||||
new CustomizeCheckoutLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive,x.RemainingAmount,x.LoanAmount)).ToList();
|
||||
|
||||
var salaryAids = result.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
|
||||
|
||||
var regularShift = result.EmployeeSettingsShifts.Select(x =>
|
||||
@@ -154,7 +154,7 @@ namespace CompanyManagment.Application
|
||||
new CustomizeCheckoutLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive,x.RemainingAmount, x.LoanAmount)).ToList();
|
||||
|
||||
var salaryAids = computations.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
|
||||
var regularShift = computations.EmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeCheckoutRegularShift(x.StartTime, x.EndTime, x.Placement)).ToList();
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace CompanyManagment.Application
|
||||
new CustomizeCheckoutTempLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount,x.LoanAmount)).ToList();
|
||||
|
||||
var salaryAids = result.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
|
||||
var regularShift = result.EmployeeSettingsShifts.Select(x =>
|
||||
new CustomizeCheckoutRegularShift(x.StartTime, x.EndTime, x.Placement)).ToList();
|
||||
@@ -136,7 +136,7 @@ namespace CompanyManagment.Application
|
||||
new CustomizeCheckoutTempLoanInstallments(x.Amount, x.Month, x.Year, x.IsActive, x.RemainingAmount,x.LoanAmount)).ToList();
|
||||
|
||||
var salaryAids = computations.SalaryAidViewModels.Select(x =>
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa)).ToList();
|
||||
new CustomizeCheckoutTempSalaryAid(x.Amount, x.SalaryAidDateTimeGe, x.SalaryAidDateTimeFa, x.CalculationDateTimeGe, x.CalculationDateTimeFa)).ToList();
|
||||
|
||||
var contract = contracts.Where(x => x.IsActiveString == "true").FirstOrDefault(x => x.EmployeeId == employeeId);
|
||||
|
||||
|
||||
@@ -53,19 +53,24 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (!command.CalculationDateTime.TryToGeorgianDateTime(out var calculationDateTime))
|
||||
{
|
||||
return op.Failed("تاریخ محاسبه وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (startDate > DateTime.Now)
|
||||
{
|
||||
return op.Failed("تاریخ پرداخت مساعده می بایست تاریخ امروز یا قبل تر باشد");
|
||||
|
||||
}
|
||||
|
||||
if (command.Amount.Length > 15)
|
||||
{
|
||||
return op.Failed("مبلغ وارد شده معتبر نیست");
|
||||
}
|
||||
|
||||
var month = Convert.ToInt32(command.SalaryDateTime.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.SalaryDateTime.Substring(0, 4));
|
||||
|
||||
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))
|
||||
{
|
||||
@@ -81,7 +86,7 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
foreach (var employeeId in command.EmployeeIds)
|
||||
{
|
||||
|
||||
var entity = new SalaryAid(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), startDate,userId,userType);
|
||||
var entity = new SalaryAid(employeeId, command.WorkshopId, command.Amount.MoneyToDouble(), startDate,userId,userType,calculationDateTime);
|
||||
_salaryAidRepository.Create(entity);
|
||||
|
||||
}
|
||||
@@ -98,6 +103,11 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (!command.CalculationDateTime.TryToGeorgianDateTime(out var calculationDateTime))
|
||||
{
|
||||
return op.Failed("تاریخ محاسبه وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (startDate > DateTime.Now)
|
||||
{
|
||||
return op.Failed("تاریخ پرداخت مساعده می بایست تاریخ امروز یا قبل تر باشد");
|
||||
@@ -111,8 +121,8 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
if (entity == null)
|
||||
return op.Failed("چنین مساعده ای وجود ندارد");
|
||||
|
||||
var month = Convert.ToInt32(command.SalaryDateTime.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.SalaryDateTime.Substring(0, 4));
|
||||
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("شما نمیتوانید برای پرسنلی در تاریخی که برای فیش حقوقی صادر شده است مساعده ای دهید");
|
||||
@@ -124,7 +134,7 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
}
|
||||
var (userId, userType) = _authHelper.GetUserTypeWithId();
|
||||
|
||||
entity.Edit(Tools.MoneyToDouble(command.Amount),startDate,userId,userType);
|
||||
entity.Edit(Tools.MoneyToDouble(command.Amount),startDate,userId,userType,calculationDateTime);
|
||||
_salaryAidRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
@@ -136,8 +146,8 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
if (entity == null)
|
||||
return op.Failed("این آیتم وجود ندارد");
|
||||
|
||||
var month = Convert.ToInt32(entity.SalaryAidDateTime.ToFarsi().Substring(5, 2));
|
||||
var year = Convert.ToInt32(entity.SalaryAidDateTime.ToFarsi().Substring(0, 4));
|
||||
var month = Convert.ToInt32(entity.CalculationDate.ToFarsi().Substring(5, 2));
|
||||
var year = Convert.ToInt32(entity.CalculationDate.ToFarsi().Substring(0, 4));
|
||||
|
||||
if (_customizeCheckoutRepository.Exists(x => x.WorkshopId == entity.WorkshopId && entity.EmployeeId == x.EmployeeId && x.YearInt == year && x.MonthInt == month))
|
||||
return op.Failed("این پرسنل در این تاریخ دارای فیش حقوقی است");
|
||||
@@ -175,6 +185,11 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
return op.Failed("تاریخ وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (!command.CalculationDateTime.TryToGeorgianDateTime(out var calculationDateTime))
|
||||
{
|
||||
return op.Failed("تاریخ محاسبه وارد شده نامعتبر است");
|
||||
}
|
||||
|
||||
if (startDate > DateTime.Now)
|
||||
{
|
||||
return op.Failed("تاریخ پرداخت مساعده می بایست تاریخ امروز یا قبل تر باشد");
|
||||
@@ -185,8 +200,8 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
return op.Failed("مبلغ وارد شده معتبر نیست");
|
||||
}
|
||||
|
||||
var month = Convert.ToInt32(command.SalaryDateTime.Substring(5, 2));
|
||||
var year = Convert.ToInt32(command.SalaryDateTime.Substring(0, 4));
|
||||
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))
|
||||
@@ -203,7 +218,7 @@ public class SalaryAidApplication : ISalaryAidApplication
|
||||
id = employee.id;
|
||||
}
|
||||
|
||||
var entity = new SalaryAid(id, command.WorkshopId, command.Amount.MoneyToDouble(), startDate, userId, userType);
|
||||
var entity = new SalaryAid(id, command.WorkshopId, command.Amount.MoneyToDouble(), startDate, userId, userType,calculationDateTime);
|
||||
await _salaryAidRepository.CreateAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,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 =>
|
||||
|
||||
@@ -84,6 +84,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 =>
|
||||
|
||||
9410
CompanyManagment.EFCore/Migrations/20250427155240_add salaryAid calculation date.Designer.cs
generated
Normal file
9410
CompanyManagment.EFCore/Migrations/20250427155240_add salaryAid calculation date.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addsalaryAidcalculationdate : 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));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDate",
|
||||
table: "SalaryAids");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace CompanyManagment.EFCore.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class addsalaryAidcalculationdatetocustomizecheckouts : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
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<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);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTime",
|
||||
table: "CustomizeCheckoutTempSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTimeFa",
|
||||
table: "CustomizeCheckoutTempSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTime",
|
||||
table: "CustomizeCheckoutSalaryAid");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CalculationDateTimeFa",
|
||||
table: "CustomizeCheckoutSalaryAid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4653,6 +4653,9 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
b.Property<double>("Amount")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<DateTime>("CalculationDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<long>("CreatedByAccountId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
@@ -6347,6 +6350,13 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b1.Property<DateTime>("CalculationDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b1.Property<string>("CalculationDateTimeFa")
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
|
||||
b1.Property<DateTime>("SalaryAidDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
@@ -6622,6 +6632,13 @@ namespace CompanyManagment.EFCore.Migrations
|
||||
.HasMaxLength(25)
|
||||
.HasColumnType("nvarchar(25)");
|
||||
|
||||
b1.Property<DateTime>("CalculationDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b1.Property<string>("CalculationDateTimeFa")
|
||||
.HasMaxLength(15)
|
||||
.HasColumnType("nvarchar(15)");
|
||||
|
||||
b1.Property<DateTime>("SalaryAidDateTime")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
|
||||
@@ -2086,6 +2086,8 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
CalculationDateTimeGe = x.CalculationDate,
|
||||
CalculationDateTimeFa = x.CalculationDate.ToFarsi(),
|
||||
}).ToList();
|
||||
double salaryAidDeduction = salaryAidViewModel.Sum(x => x.AmountDouble);
|
||||
|
||||
@@ -2640,6 +2642,9 @@ CreateWorkingHoursTemp command, bool holidayWorking)
|
||||
AmountDouble = x.Amount,
|
||||
SalaryAidDateTimeFa = x.SalaryAidDateTime.ToFarsi(),
|
||||
SalaryAidDateTimeGe = x.SalaryAidDateTime,
|
||||
CalculationDateTimeGe = x.CalculationDate,
|
||||
CalculationDateTimeFa = x.CalculationDate.ToFarsi(),
|
||||
|
||||
}).ToList();
|
||||
double salaryAidDeduction = salaryAidViewModel.Sum(x => x.AmountDouble);
|
||||
|
||||
|
||||
@@ -72,7 +72,8 @@ public class SalaryAidRepository : RepositoryBase<long, SalaryAid>, ISalaryAidRe
|
||||
WorkshopId = entity.WorkshopId,
|
||||
EmployeeId = entity.EmployeeId,
|
||||
Amount = entity.Amount.ToMoney(),
|
||||
SalaryDateTime = entity.SalaryAidDateTime.ToFarsi()
|
||||
SalaryDateTime = entity.SalaryAidDateTime.ToFarsi(),
|
||||
CalculationDateTime = entity.CalculationDate.ToFarsi()
|
||||
};
|
||||
|
||||
res.EmployeeFullName = _companyContext.Employees.Find(entity.EmployeeId)?.FullName;
|
||||
|
||||
@@ -164,7 +164,8 @@ namespace ServiceHost.Areas.Client.Pages.Company.SalaryAid
|
||||
Amount = x.Amount.ToMoney(),
|
||||
EmployeeIds = [x.EmployeeId],
|
||||
SalaryDateTime = x.SalaryAidDateTime,
|
||||
NationalCode = x.NationalCode
|
||||
NationalCode = x.NationalCode,
|
||||
CalculationDateTime = x.CalculationDate
|
||||
}).ToList();
|
||||
OperationResult result = await _salaryAidApplication.CreateRange(commands);
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
}
|
||||
|
||||
<form role="form" method="post" name="create-form" id="create-form" autocomplete="off">
|
||||
|
||||
<div class="modal-content">
|
||||
<div class="modal-header pb-0 d-flex align-items-center justify-content-center text-center">
|
||||
<button type="button" class="btn-close position-absolute text-start" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
@@ -33,13 +32,17 @@
|
||||
</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">
|
||||
<span class="spanTitleText">تاریخ</span>
|
||||
<input class="form-control form-control-date text-center dateTime" asp-for="@Model.SalaryDateTime" placeholder="تاریخ را وارد نمائید" style="direction: ltr" />
|
||||
<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>
|
||||
@@ -65,6 +68,7 @@
|
||||
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script src="~/assetsclient/js/site.js?ver=@clientVersion"></script>
|
||||
<script src="~/assetsclient/libs/jalaali-js/jalaali.js"></script>
|
||||
<script src="~/admintheme/js/jquery.mask_1.14.16.min.js"></script>
|
||||
|
||||
@@ -31,14 +31,18 @@
|
||||
</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">
|
||||
<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>
|
||||
|
||||
@@ -147,6 +147,7 @@ function SaveDataAjax() {
|
||||
var employeeSelect = $('#employeeSelect').val();
|
||||
var Amount = $('#Amount ');
|
||||
var SalaryDateTime = $('#SalaryDateTime');
|
||||
var CalculationDateTime = $('#CalculationDateTime');
|
||||
|
||||
if (employeeSelect.length === 0) {
|
||||
$('.alert-msg').show();
|
||||
@@ -184,6 +185,19 @@ function SaveDataAjax() {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!CalculationDateTime.val()) {
|
||||
CalculationDateTime.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ محاسبه را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
CalculationDateTime.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
var data = $('#create-form').serialize();
|
||||
|
||||
@@ -82,6 +82,7 @@ function SaveDataAjax() {
|
||||
|
||||
var Amount = $('#Amount ');
|
||||
var SalaryDateTime = $('#SalaryDateTime');
|
||||
var CalculationDateTime = $('#CalculationDateTime');
|
||||
|
||||
if (!Amount.val() || Amount.val() === "0") {
|
||||
Amount.addClass('errored');
|
||||
@@ -106,6 +107,18 @@ function SaveDataAjax() {
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CalculationDateTime.val()) {
|
||||
CalculationDateTime.addClass('errored');
|
||||
$('.alert-msg').show();
|
||||
$('.alert-msg p').text('لطفا تاریخ محاسبه را مشخص نمائید');
|
||||
setTimeout(function () {
|
||||
$('.alert-msg').hide();
|
||||
$('.alert-msg p').text('');
|
||||
CalculationDateTime.removeClass('errored');
|
||||
}, 3500);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#createData').addClass('disable');
|
||||
|
||||
|
||||
@@ -144,7 +144,10 @@ function loadErrorExcelDataAjax(data) {
|
||||
<div class="excelTable Rtable Rtable--5cols Rtable--collapse rowCustom px-1">
|
||||
<div class="Rtable-row Rtable-row--head align-items-center d-flex flex-column w-100 error-header sticky p-0">
|
||||
|
||||
<div class="Rtable-cell column-heading rowHeaderCustom text-center justify-content-center w-100 px-1">تاریخ ${data.rawData[0]?.salaryAidDateTime ?? ""}</div>
|
||||
<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>
|
||||
<div class="lineHead w-100"></div>
|
||||
<div class="d-flex w-100 px-1 gap-2">
|
||||
<div class="Rtable-cell column-heading rowHeaderCustom width1">
|
||||
@@ -394,7 +397,8 @@ function loadFinalExcelDataAjax(data) {
|
||||
<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>تاریخ ${data.rawData[0].salaryAidDateTime}</div>`;
|
||||
<div>تاریخ پرداخت ${data.rawData[0].salaryAidDateTime}</div>
|
||||
<div>تاریخ محاسبه ${data.rawData[0]?.calculationDate ?? ""}</div>`;
|
||||
|
||||
|
||||
if (rowValidDataDuplicateExist.length > 0) {
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user