feat: add employee mandatory hours to checkout model and database

This commit is contained in:
MahanCh
2025-08-25 10:33:43 +03:30
parent 5e7bfe0634
commit ec2defab69
6 changed files with 10263 additions and 4 deletions

View File

@@ -30,7 +30,7 @@ public class Checkout : EntityBase
string overNightWorkValue, string fridayWorkValue, string rotatingShifValue, string absenceValue,
string totalDayOfLeaveCompute, string totalDayOfYearsCompute, string totalDayOfBunosesCompute,
ICollection<CheckoutLoanInstallment> loanInstallments,
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall)
ICollection<CheckoutSalaryAid> salaryAids,CheckoutRollCall checkoutRollCall,TimeSpan employeeMandatoryHours)
{
EmployeeFullName = employeeFullName;
FathersName = fathersName;
@@ -90,8 +90,10 @@ public class Checkout : EntityBase
LoanInstallments = loanInstallments;
SalaryAids = salaryAids;
CheckoutRollCall = checkoutRollCall;
EmployeeMandatoryHours = employeeMandatoryHours;
}
public string EmployeeFullName { get; private set; }
public string IsActiveString { get; private set; }
public string Signature { get; private set; }
@@ -198,6 +200,11 @@ public class Checkout : EntityBase
/// </summary>
public bool HasAmountConflict { get; private set; }
/// <summary>
/// ساعت موظفی پرسنل در ماه
/// </summary>
public TimeSpan EmployeeMandatoryHours { get; set; }
#region valueObjects
public ICollection<CheckoutLoanInstallment> LoanInstallments { get; set; } = [];

View File

@@ -345,8 +345,7 @@ public class CheckoutApplication : ICheckoutApplication
{
command.Signature = "0";
}
var checkout = new Checkout(command.EmployeeFullName, command.FathersName, command.NationalCode
, command.DateOfBirth, command.EmployeeId, command.WorkshopName, command.WorkshopId, command.ContractNo, command.ContractStartGr, command.ContractEndGr, month, year,
@@ -354,7 +353,7 @@ public class CheckoutApplication : ICheckoutApplication
, command.OvertimePay, command.NightworkPay, command.FridayPay, 0, command.ShiftPay, familyAllowance, bunos, years, command.LeavePay, insuranceDeduction, 0, command.InstallmentDeduction, command.SalaryAidDeduction, command.AbsenceDeduction, sumOfWorkingDays,
command.ArchiveCode, command.PersonnelCode, totalClaims, totalDeductions, totalPayment, command.Signature, marriedAllowance, command.LeaveCheckout, command.CreditLeaves, command.AbsencePeriod, command.AverageHoursPerDay, command.HasRollCall, command.OverTimeWorkValue, command.OverNightWorkValue
, command.FridayWorkValue, command.RotatingShiftValue, command.AbsenceValue, command.TotalDayOfLeaveCompute, command.TotalDayOfYearsCompute, command.TotalDayOfBunosesCompute,
loanInstallments, salaryAids,checkoutRollCall);
loanInstallments, salaryAids,checkoutRollCall,command.EmployeeMandatoryHours);
_checkoutRepository.CreateCkeckout(checkout).GetAwaiter().GetResult();
//_checkoutRepository.SaveChanges();

View File

@@ -51,6 +51,7 @@ class CheckoutMapping : IEntityTypeConfiguration<Checkout>
builder.Property(x => x.TotalDayOfYearsCompute).HasMaxLength(10);
builder.Property(x => x.TotalDayOfBunosesCompute).HasMaxLength(10);
builder.Property(x => x.EmployeeMandatoryHours).HasTimeSpanConversion();
builder.HasOne(x => x.Workshop)
.WithMany(x => x.Checkouts)
.HasForeignKey(x => x.WorkshopId);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addemployeemandatorytocheckout : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "EmployeeMandatoryHours",
table: "Checkouts",
type: "nvarchar(30)",
maxLength: 30,
nullable: false,
defaultValue: "");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "EmployeeMandatoryHours",
table: "Checkouts");
}
}
}

View File

@@ -293,6 +293,11 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<long>("EmployeeId")
.HasColumnType("bigint");
b.Property<string>("EmployeeMandatoryHours")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("nvarchar(30)");
b.Property<double>("FamilyAllowance")
.HasColumnType("float");