ออกคำสั่งเงินเดือน

This commit is contained in:
Kittapath 2024-04-26 10:18:59 +07:00
parent b89c3301e3
commit 66c97a162b
14 changed files with 53814 additions and 1 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,20 @@
namespace BMA.EHR.Application.Responses
{
public class PassSalaryResponse
{
// public bool successful { get; set; }
public List<SalaryDataResponse> result { get; set; } = new();
}
public class SalaryDataResponse
{
public Guid id { get; set; } = Guid.Empty;
public string citizenId { get; set; } = string.Empty;
public string prefix { get; set; } = string.Empty;
public string firstName { get; set; } = string.Empty;
public string lastName { get; set; } = string.Empty;
public Guid? profileId { get; set; } = Guid.Empty;
// public Guid? commandId { get; set; } = Guid.Empty;
}
}

View file

@ -408,6 +408,66 @@ namespace BMA.EHR.Command.Service.Controllers
else
return Success(new { result = "N" });
}
case "C-PM-33":
{
if (command.CommandNo != "" &&
command.CommandYear != null &&
command.CommandExcecuteDate != null &&
cover != null)
{
return Success(new { result = "Y" });
}
else
return Success(new { result = "N" });
}
case "C-PM-34":
{
if (command.CommandNo != "" &&
command.CommandYear != null &&
command.CommandExcecuteDate != null &&
cover != null)
{
return Success(new { result = "Y" });
}
else
return Success(new { result = "N" });
}
case "C-PM-35":
{
if (command.CommandNo != "" &&
command.CommandYear != null &&
command.CommandExcecuteDate != null &&
cover != null)
{
return Success(new { result = "Y" });
}
else
return Success(new { result = "N" });
}
case "C-PM-36":
{
if (command.CommandNo != "" &&
command.CommandYear != null &&
command.CommandExcecuteDate != null &&
cover != null)
{
return Success(new { result = "Y" });
}
else
return Success(new { result = "N" });
}
case "C-PM-37":
{
if (command.CommandNo != "" &&
command.CommandYear != null &&
command.CommandExcecuteDate != null &&
cover != null)
{
return Success(new { result = "Y" });
}
else
return Success(new { result = "N" });
}
default:
{
if (command.CommandNo != "" &&
@ -648,6 +708,10 @@ namespace BMA.EHR.Command.Service.Controllers
Result = data.Result,
RefRaw = data.RefRaw,
ComplaintId = data.ComplaintId,
SalaryPeriodId = data.SalaryPeriodId,
SalaryPeriod = data.SalaryPeriod,
Year = data.Year,
};
return Success(result);
@ -3897,6 +3961,531 @@ namespace BMA.EHR.Command.Service.Controllers
#endregion
#region " C-PM-33 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-33
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-33/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType33Async([FromBody] CreateCommandGroup15Request req)
{
try
{
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var inserted = new Domain.Models.Commands.Core.Command
{
CommandNo = req.orderNo,
CommandYear = req.orderYear.ToString(),
CommandSubject = req.orderTitle,
CommandTypeId = req.orderTypeValue,
IssuerOrganizationId = req.orderBy,
IssuerOrganizationName = req.orderByOrganizationName,
AuthorizedUserFullName = req.signatoryBy,
AuthorizedPosition = req.signatoryPosition,
CommandAffectDate = req.orderDate,
OwnerGovId = OcId,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
SalaryPeriodId = req.salaryPeriodId,
SalaryPeriod = req.salaryPeriod,
Year = req.year,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-33
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-33/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType33Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
{
try
{
var order = await _repository.GetByIdAsync(orderId);
if (order == null)
throw new Exception(GlobalMessages.CommandNotFound);
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
order.CommandNo = req.orderNo;
order.CommandYear = req.orderYear.ToString();
order.CommandSubject = req.orderTitle;
order.CommandType = commandType!;
order.IssuerOrganizationId = req.orderBy;
order.IssuerOrganizationName = req.orderByOrganizationName;
order.AuthorizedUserFullName = req.signatoryBy;
order.AuthorizedPosition = req.signatoryPosition;
order.CommandStatus = status!;
order.CommandAffectDate = req.orderDate;
order.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
order.SalaryPeriodId = req.salaryPeriodId;
order.SalaryPeriod = req.salaryPeriod;
order.Year = req.year;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-34 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-34
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-34/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType34Async([FromBody] CreateCommandGroup15Request req)
{
try
{
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var inserted = new Domain.Models.Commands.Core.Command
{
CommandNo = req.orderNo,
CommandYear = req.orderYear.ToString(),
CommandSubject = req.orderTitle,
CommandTypeId = req.orderTypeValue,
IssuerOrganizationId = req.orderBy,
IssuerOrganizationName = req.orderByOrganizationName,
AuthorizedUserFullName = req.signatoryBy,
AuthorizedPosition = req.signatoryPosition,
CommandAffectDate = req.orderDate,
OwnerGovId = OcId,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
SalaryPeriodId = req.salaryPeriodId,
SalaryPeriod = req.salaryPeriod,
Year = req.year,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-34
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-34/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType34Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
{
try
{
var order = await _repository.GetByIdAsync(orderId);
if (order == null)
throw new Exception(GlobalMessages.CommandNotFound);
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
order.CommandNo = req.orderNo;
order.CommandYear = req.orderYear.ToString();
order.CommandSubject = req.orderTitle;
order.CommandType = commandType!;
order.IssuerOrganizationId = req.orderBy;
order.IssuerOrganizationName = req.orderByOrganizationName;
order.AuthorizedUserFullName = req.signatoryBy;
order.AuthorizedPosition = req.signatoryPosition;
order.CommandStatus = status!;
order.CommandAffectDate = req.orderDate;
order.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
order.SalaryPeriodId = req.salaryPeriodId;
order.SalaryPeriod = req.salaryPeriod;
order.Year = req.year;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-35 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-35
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-35/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType35Async([FromBody] CreateCommandGroup15Request req)
{
try
{
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var inserted = new Domain.Models.Commands.Core.Command
{
CommandNo = req.orderNo,
CommandYear = req.orderYear.ToString(),
CommandSubject = req.orderTitle,
CommandTypeId = req.orderTypeValue,
IssuerOrganizationId = req.orderBy,
IssuerOrganizationName = req.orderByOrganizationName,
AuthorizedUserFullName = req.signatoryBy,
AuthorizedPosition = req.signatoryPosition,
CommandAffectDate = req.orderDate,
OwnerGovId = OcId,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
SalaryPeriodId = req.salaryPeriodId,
SalaryPeriod = req.salaryPeriod,
Year = req.year,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-35
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-35/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType35Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
{
try
{
var order = await _repository.GetByIdAsync(orderId);
if (order == null)
throw new Exception(GlobalMessages.CommandNotFound);
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
order.CommandNo = req.orderNo;
order.CommandYear = req.orderYear.ToString();
order.CommandSubject = req.orderTitle;
order.CommandType = commandType!;
order.IssuerOrganizationId = req.orderBy;
order.IssuerOrganizationName = req.orderByOrganizationName;
order.AuthorizedUserFullName = req.signatoryBy;
order.AuthorizedPosition = req.signatoryPosition;
order.CommandStatus = status!;
order.CommandAffectDate = req.orderDate;
order.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
order.SalaryPeriodId = req.salaryPeriodId;
order.SalaryPeriod = req.salaryPeriod;
order.Year = req.year;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-36 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-36
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-36/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType36Async([FromBody] CreateCommandGroup15Request req)
{
try
{
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var inserted = new Domain.Models.Commands.Core.Command
{
CommandNo = req.orderNo,
CommandYear = req.orderYear.ToString(),
CommandSubject = req.orderTitle,
CommandTypeId = req.orderTypeValue,
IssuerOrganizationId = req.orderBy,
IssuerOrganizationName = req.orderByOrganizationName,
AuthorizedUserFullName = req.signatoryBy,
AuthorizedPosition = req.signatoryPosition,
CommandAffectDate = req.orderDate,
OwnerGovId = OcId,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
SalaryPeriodId = req.salaryPeriodId,
SalaryPeriod = req.salaryPeriod,
Year = req.year,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-36
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-36/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType36Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
{
try
{
var order = await _repository.GetByIdAsync(orderId);
if (order == null)
throw new Exception(GlobalMessages.CommandNotFound);
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
order.CommandNo = req.orderNo;
order.CommandYear = req.orderYear.ToString();
order.CommandSubject = req.orderTitle;
order.CommandType = commandType!;
order.IssuerOrganizationId = req.orderBy;
order.IssuerOrganizationName = req.orderByOrganizationName;
order.AuthorizedUserFullName = req.signatoryBy;
order.AuthorizedPosition = req.signatoryPosition;
order.CommandStatus = status!;
order.CommandAffectDate = req.orderDate;
order.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
order.SalaryPeriodId = req.salaryPeriodId;
order.SalaryPeriod = req.salaryPeriod;
order.Year = req.year;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-37 "
/// <summary>
/// PM7-22 : สร้างข้อมูลรายละเอียดการออกคำสั่ง C-PM-37
/// </summary>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("c-pm-37/detail")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostType37Async([FromBody] CreateCommandGroup15Request req)
{
try
{
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var inserted = new Domain.Models.Commands.Core.Command
{
CommandNo = req.orderNo,
CommandYear = req.orderYear.ToString(),
CommandSubject = req.orderTitle,
CommandTypeId = req.orderTypeValue,
IssuerOrganizationId = req.orderBy,
IssuerOrganizationName = req.orderByOrganizationName,
AuthorizedUserFullName = req.signatoryBy,
AuthorizedPosition = req.signatoryPosition,
CommandAffectDate = req.orderDate,
OwnerGovId = OcId,
CaseFault = req.caseFault,
FaultLevel = req.faultLevel,
RefRaw = req.refRaw,
Result = req.result,
SalaryPeriodId = req.salaryPeriodId,
SalaryPeriod = req.salaryPeriod,
Year = req.year,
};
var result = await _repository.AddAsync(inserted);
return Success(result);
}
catch
{
throw;
}
}
/// <summary>
/// PM7-23 : แก้ไขข้อมูลรายละเอียดการออกคำสั่ง C-PM-37
/// </summary>
/// <param name="orderId">Record Id ของคำสั่ง</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPut("c-pm-37/detail/{orderId}")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PutType37Async(Guid orderId, [FromBody] CreateCommandGroup15Request req)
{
try
{
var order = await _repository.GetByIdAsync(orderId);
if (order == null)
throw new Exception(GlobalMessages.CommandNotFound);
var commandType = await _commandTypeRepository.GetByIdAsync(req.orderTypeValue);
var status = await _commandStatusRepository.GetByIdAsync(order.CommandStatusId);
order.CommandNo = req.orderNo;
order.CommandYear = req.orderYear.ToString();
order.CommandSubject = req.orderTitle;
order.CommandType = commandType!;
order.IssuerOrganizationId = req.orderBy;
order.IssuerOrganizationName = req.orderByOrganizationName;
order.AuthorizedUserFullName = req.signatoryBy;
order.AuthorizedPosition = req.signatoryPosition;
order.CommandStatus = status!;
order.CommandAffectDate = req.orderDate;
order.CaseFault = req.caseFault;
order.FaultLevel = req.faultLevel;
order.RefRaw = req.refRaw;
order.Result = req.result;
order.SalaryPeriodId = req.salaryPeriodId;
order.SalaryPeriod = req.salaryPeriod;
order.Year = req.year;
var result = await _repository.UpdateAsync(order);
return Success(result);
}
catch
{
throw;
}
}
#endregion
#endregion
/// <summary>

View file

@ -0,0 +1,22 @@
namespace BMA.EHR.Command.Service.Requests
{
public class CreateCommandGroup15Request
{
public string? caseFault { get; set; }
public string? faultLevel { get; set; }
public string? refRaw { get; set; }
public string? result { get; set; }
public Guid orderBy { get; set; }
public string orderByOrganizationName { get; set; } = string.Empty;
public DateTime orderDate { get; set; }
public string orderTitle { get; set; } = string.Empty;
public string orderNo { get; set; } = string.Empty;
public Guid orderTypeValue { get; set; }
public int orderYear { get; set; }
public string signatoryBy { get; set; } = string.Empty;
public string signatoryPosition { get; set; } = string.Empty;
public Guid salaryPeriodId { get; set; }
public string year { get; set; }
public string salaryPeriod { get; set; }
}
}

View file

@ -14,7 +14,7 @@
"AllowedHosts": "*",
"ConnectionStrings": {
//"DefaultConnection": "User Id=sys;Password=P@ssw0rd;DBA Privilege=SYSDBA;Data Source=localhost:1521/ORCLCDB",
"DefaultConnection": "server=192.168.1.9;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
"DefaultConnection": "server=192.168.1.80;user=root;password=adminVM123;port=3306;database=bma_ehr_demo;Convert Zero Datetime=True;Allow User Variables=true;Pooling=True;"
},
"Jwt": {
"Key": "HP-FnQMUj9msHMSD3T9HtdEnphAKoCJLEl85CIqROFI",

View file

@ -217,6 +217,18 @@ namespace BMA.EHR.Domain.Models.Commands.Core
[Comment("Id เรื่องร้องเรียน")]
public Guid? ComplaintId { get; set; }
#endregion
#region " C-PM-33 - C-PM-32 "
[Comment("Id เรื่องเงินเดือน")]
public Guid? SalaryPeriodId { get; set; }
[MaxLength(4), Comment("ปีรอบเงินเดือน")]
public string? Year { get; set; }
[Comment("รอบเงินเดือน")]
public string? SalaryPeriod { get; set; }
#endregion
public virtual List<CommandDocument> Documents { get; set; } = new();

View file

@ -0,0 +1,31 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetablecommandaddRefDisciplineId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "SalaryPeriodId",
table: "Commands",
type: "char(36)",
nullable: true,
comment: "Id เรื่องเงินเดือน",
collation: "ascii_general_ci");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SalaryPeriodId",
table: "Commands");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetablecommandaddyear : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Year",
table: "Commands",
type: "varchar(4)",
maxLength: 4,
nullable: true,
comment: "ปีรอบเงินเดือน")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Year",
table: "Commands");
}
}
}

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetablecommandaddsalaryPeriod : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "SalaryPeriod",
table: "Commands",
type: "longtext",
nullable: true,
comment: "รอบเงินเดือน")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "SalaryPeriod",
table: "Commands");
}
}
}

View file

@ -283,6 +283,14 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ผลดำเนินการพิจารณา");
b.Property<string>("SalaryPeriod")
.HasColumnType("longtext")
.HasComment("รอบเงินเดือน");
b.Property<Guid?>("SalaryPeriodId")
.HasColumnType("char(36)")
.HasComment("Id เรื่องเงินเดือน");
b.Property<string>("SourceOrganizationName")
.HasColumnType("longtext")
.HasComment("หน่วยงานต้นสังกัด ก่อนรับราชการทหาร");
@ -291,6 +299,11 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("ส่วนราชการที่ให้โอน");
b.Property<string>("Year")
.HasMaxLength(4)
.HasColumnType("varchar(4)")
.HasComment("ปีรอบเงินเดือน");
b.HasKey("Id");
b.HasIndex("CommandStatusId");

View file

@ -2499,6 +2499,8 @@ namespace BMA.EHR.Report.Service.Controllers
var command = new
{
No = raw_data.CommandNo.ToThaiNumber(),
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
CommandNo = raw_data.CommandNo.ToThaiNumber(),
Year = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
Issuerorganizationname = raw_data.IssuerOrganizationName,
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
@ -2539,6 +2541,67 @@ namespace BMA.EHR.Report.Service.Controllers
}
}
#endregion
#region " C-PM-33 "
private async Task<dynamic> GenerateCommandReportType33_Cover(Guid commandId, string exportType)
{
try
{
var raw_data = await _repository.GetByIdAsync(commandId);
if (raw_data == null)
{
throw new Exception(GlobalMessages.CommandNotFound);
}
// var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
var command = new
{
No = raw_data.CommandNo.ToThaiNumber(),
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
CommandNo = raw_data.CommandNo.ToThaiNumber(),
Year = raw_data.Year.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
YearOld = (raw_data.Year.ToInteger() - 1).ToThaiYear().ToString().ToThaiNumber(),
IssuerOrganizationName = raw_data.IssuerOrganizationName,
ConclusionRegisterNo = raw_data.ConclusionRegisterNo == null ? "" : raw_data.ConclusionRegisterNo.ToThaiNumber(),
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
ConclusionResultNo = raw_data.ConclusionResultNo == null ? "" : raw_data.ConclusionResultNo.ToThaiNumber(),
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
PositionList = "",
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
AuthorizedPosition = raw_data.AuthorizedPosition,
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
Title = $"{raw_data.CommandSubject}",
CaseFault = raw_data.CaseFault == null ? "" : raw_data.CaseFault.ToThaiNumber(),
FaultLevel = raw_data.FaultLevel == null ? "" : raw_data.FaultLevel.ToThaiNumber(),
RefRaw = raw_data.RefRaw == null ? "" : raw_data.RefRaw.ToThaiNumber(),
Result = raw_data.Result == null ? "" : raw_data.Result.ToThaiNumber(),
// Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
// Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
// Positionno = raw_data_profile == null || raw_data_profile.Positionno == null ? "" : raw_data_profile.Positionno.ToThaiNumber(),
// Organizationname = raw_data_profile == null || raw_data_profile.Organizationname == null ? "" : raw_data_profile.Organizationname.ToThaiNumber(),
// Salary = raw_data_profile == null || raw_data_profile.Salary == null ? "" : raw_data_profile.Salary.ToThaiNumber(),
OrderDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
SignatoryBy = raw_data.AuthorizedUserFullName,
SignatoryPosition = raw_data.AuthorizedPosition,
CreatedAt = raw_data.CreatedAt.ToThaiFullDate3().ToThaiNumber(),
};
return command;
}
catch
{
throw;
}
}
#endregion
#endregion
@ -4654,7 +4717,236 @@ namespace BMA.EHR.Report.Service.Controllers
}
}
#endregion
#region " C-PM-33 คำสั่งยุติเรื่อง "
/// <summary>
/// คำสั่ง C-PM-33 คำสั่งยุติเรื่อง
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-33/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType33CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
var data = new
{
template = cmd.SalaryPeriod == "APR" ? "gov1-07" : "gov2-08",
reportName = "docx-report",
data = contentData
};
return Success(data);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-34 คำสั่งยุติเรื่อง "
/// <summary>
/// คำสั่ง C-PM-34 คำสั่งยุติเรื่อง
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-34/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType34CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
var data = new
{
template = cmd.SalaryPeriod == "APR" ? "gov1-08" : "gov2-09",
reportName = "docx-report",
data = contentData
};
return Success(data);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-35 คำสั่งยุติเรื่อง "
/// <summary>
/// คำสั่ง C-PM-35 คำสั่งยุติเรื่อง
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-35/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType35CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
var data = new
{
template = "gov2-07",
reportName = "docx-report",
data = contentData
};
return Success(data);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-36 คำสั่งยุติเรื่อง "
/// <summary>
/// คำสั่ง C-PM-36 คำสั่งยุติเรื่อง
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-36/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType36CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
var data = new
{
template = cmd.SalaryPeriod == "APR" ? "emp1-11" : "emp2-12",
reportName = "docx-report",
data = contentData
};
return Success(data);
}
catch
{
throw;
}
}
#endregion
#region " C-PM-37 คำสั่งยุติเรื่อง "
/// <summary>
/// คำสั่ง C-PM-37 คำสั่งยุติเรื่อง
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("c-pm-37/cover/{exportType}/{id}")]
[AllowAnonymous]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> GetCommandType37CoverReport(Guid id, string exportType = "pdf")
{
try
{
var mimeType = "";
switch (exportType.Trim().ToLower())
{
case "pdf": mimeType = "application/pdf"; break;
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
}
var cmd = await _repository.GetByIdAsync(id);
if (cmd == null)
throw new Exception(GlobalMessages.CommandNotFound);
var contentData = await GenerateCommandReportType33_Cover(id, exportType);
var data = new
{
template = cmd.SalaryPeriod == "APR" ? "emp1-14" : "emp2-16",
reportName = "docx-report",
data = contentData
};
return Success(data);
}
catch
{
throw;
}
}
#endregion
#endregion
}
}