Add BeginningLeaveCount and BeginningLeaveDays to LeaveBeginnings table

- Altered LeaveDays column to update its comment.
- Added BeginningLeaveCount column to track the number of leave occurrences.
- Added BeginningLeaveDays column to store the total days of leave carried over.
This commit is contained in:
Suphonchai Phoonsawat 2026-02-11 09:44:18 +07:00
parent 05ec0cccce
commit 682c88c2db
4 changed files with 1795 additions and 2 deletions

View file

@ -24,7 +24,7 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
[Required, Comment("ปีงบประมาณ")]
public int LeaveYear { get; set; } = 0;
[Required, Comment("จำนวนวันลายกมา")]
[Required, Comment("จำนวนวันลาทั้งหมด")]
public double LeaveDays { get; set; } = 0.0;
[Required, Comment("จำนวนวันลาที่ใช้ไป")]
@ -42,5 +42,11 @@ namespace BMA.EHR.Domain.Models.Leave.Requests
public Guid? Child3DnaId { get; set; }
public Guid? Child4DnaId { get; set; }
[Required, Comment("จำนวนวันลายกมา")]
public double BeginningLeaveDays { get; set; } = 0.0;
[Comment("จำนวนครั้งที่ลายกมา")]
public int BeginningLeaveCount { get; set; } = 0;
}
}

View file

@ -0,0 +1,62 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
{
/// <inheritdoc />
public partial class AddBeginningLeaveandLeaveCounttoLeaveBeginning : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "LeaveDays",
table: "LeaveBeginnings",
type: "double",
nullable: false,
comment: "จำนวนวันลาทั้งหมด",
oldClrType: typeof(double),
oldType: "double",
oldComment: "จำนวนวันลายกมา");
migrationBuilder.AddColumn<int>(
name: "BeginningLeaveCount",
table: "LeaveBeginnings",
type: "int",
nullable: false,
defaultValue: 0,
comment: "จำนวนครั้งที่ลายกมา");
migrationBuilder.AddColumn<double>(
name: "BeginningLeaveDays",
table: "LeaveBeginnings",
type: "double",
nullable: false,
defaultValue: 0.0,
comment: "จำนวนวันลายกมา");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BeginningLeaveCount",
table: "LeaveBeginnings");
migrationBuilder.DropColumn(
name: "BeginningLeaveDays",
table: "LeaveBeginnings");
migrationBuilder.AlterColumn<double>(
name: "LeaveDays",
table: "LeaveBeginnings",
type: "double",
nullable: false,
comment: "จำนวนวันลายกมา",
oldClrType: typeof(double),
oldType: "double",
oldComment: "จำนวนวันลาทั้งหมด");
}
}
}

View file

@ -128,6 +128,14 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<int>("BeginningLeaveCount")
.HasColumnType("int")
.HasComment("จำนวนครั้งที่ลายกมา");
b.Property<double>("BeginningLeaveDays")
.HasColumnType("double")
.HasComment("จำนวนวันลายกมา");
b.Property<Guid?>("Child1DnaId")
.HasColumnType("char(36)");
@ -190,7 +198,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
b.Property<double>("LeaveDays")
.HasColumnType("double")
.HasComment("จำนวนวันลายกมา");
.HasComment("จำนวนวันลาทั้งหมด");
b.Property<double>("LeaveDaysUsed")
.HasColumnType("double")