Merge branch 'develop'

This commit is contained in:
kittapath 2024-12-18 12:04:35 +07:00
commit 0afd9a2a8d
44 changed files with 62018 additions and 148 deletions

View file

@ -826,58 +826,72 @@ namespace BMA.EHR.Application.Repositories.Leaves.LeaveRequests
return res;
}
public async Task<List<GetSumApproveLeaveByRootDto>> GetSumApproveLeaveByRootAndRange(DateTime startDate, DateTime endDate, string type)
public async Task<List<GetSumApproveLeaveByRootDto>> GetSumApproveLeaveByRootAndRange(DateTime startDate, DateTime endDate, string type, string role, string nodeId, int node)
{
var data = await _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.Type)
.Where(x => x.ProfileType == type.Trim().ToUpper())
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
var _nodeId = Guid.Parse(nodeId);
var data = new List<LeaveRequest>();
if (role == "OWNER" || role == "CHILD")
{
data = await _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.Type)
.Where(x => x.ProfileType == type.Trim().ToUpper())
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
}
else
{
data = await _dbContext.Set<LeaveRequest>().AsQueryable()
.Include(x => x.Type)
.Where(x => x.ProfileType == type.Trim().ToUpper())
.Where(x => x.LeaveStartDate.Date >= startDate.Date && x.LeaveStartDate.Date <= endDate.Date)
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
.Where(x => node == 0 ? x.Child1Id == null : (node == 1 ? x.Child2Id == null : (node == 2 ? x.Child3Id == null : (node == 3 ? x.Child4Id == null : true))))
.Where(x => x.LeaveStatus == "APPROVE").ToListAsync();
}
var res = (from d in data
group d by new { d.Root, d.Child1, d.Child2, d.Child3, d.Child4, LeaveTypeId = d.Type.Id, LeaveTypeCode = d.Type.Code } into grp
group d by new { d.Root, d.Child1, d.Child2, d.Child3, d.Child4 } into grp
orderby grp.Key.Root, grp.Key.Child1, grp.Key.Child2, grp.Key.Child3, grp.Key.Child4
select new GetSumApproveLeaveByRootDto
{
Root = grp.Key.Root,
LeaveTypeId = grp.Key.LeaveTypeId,
LeaveTypeCode = grp.Key.LeaveTypeCode,
Root = $"{grp.Key.Root}{(!string.IsNullOrEmpty(grp.Key.Child1) ? "/" + grp.Key.Child1 : "")}{(!string.IsNullOrEmpty(grp.Key.Child2) ? "/" + grp.Key.Child2 : "")}{(!string.IsNullOrEmpty(grp.Key.Child3) ? "/" + grp.Key.Child3 : "")}{(!string.IsNullOrEmpty(grp.Key.Child4) ? "/" + grp.Key.Child4 : "")}",
SumLeaveDay = grp.Sum(x => x.LeaveTotal),
sickDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
maternityDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
wifeDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
personalDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
restDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
ordainDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
absentDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
studyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
agencyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
coupleDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
therapyDayCountMale = grp.Where(x => x.Gender == "ชาย" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
sickDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
maternityDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
wifeDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
personalDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
restDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
ordainDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
absentDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
studyDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
agencyDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
coupleDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
therapyDayCountMale = grp.Where(x => x.Gender == "ชาย").Sum(x => x.LeaveTotal),
sickDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
maternityDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
wifeDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
personalDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
restDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
ordainDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
absentDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
studyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
agencyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
coupleDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
therapyDayCountFemale = grp.Where(x => x.Gender == "หญิง" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
sickDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
maternityDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
wifeDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
personalDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
restDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
ordainDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
absentDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
studyDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
agencyDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
coupleDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
therapyDayCountFemale = grp.Where(x => x.Gender == "หญิง").Sum(x => x.LeaveTotal),
sickDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
maternityDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
wifeDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
personalDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
restDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
ordainDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
absentDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
studyDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
agencyDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
coupleDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
therapyDayCountNo = grp.Where(x => x.Gender == "ชาย" && x.Gender == "หญิง").Sum(x => x.LeaveTotal),
sickDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-001").Sum(x => x.LeaveTotal),
maternityDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-002").Sum(x => x.LeaveTotal),
wifeDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-003").Sum(x => x.LeaveTotal),
personalDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-004").Sum(x => x.LeaveTotal),
restDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-005").Sum(x => x.LeaveTotal),
ordainDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-006").Sum(x => x.LeaveTotal),
absentDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-007").Sum(x => x.LeaveTotal),
studyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-008").Sum(x => x.LeaveTotal),
agencyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-009").Sum(x => x.LeaveTotal),
coupleDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-010").Sum(x => x.LeaveTotal),
therapyDayCountNo = grp.Where(x => x.Gender != "ชาย" && x.Gender != "หญิง" && x.LeaveTypeCode == "LV-011").Sum(x => x.LeaveTotal),
})
.ToList();

View file

@ -139,12 +139,27 @@ namespace BMA.EHR.Application.Repositories.Leaves.TimeAttendants
return data;
}
public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type)
public async Task<List<ProcessUserTimeStamp>> GetTimestampByDateLateAsync(string type, string role, string nodeId, int node)
{
var data = await _dbContext.Set<ProcessUserTimeStamp>()
var _nodeId = Guid.Parse(nodeId);
var data = new List<ProcessUserTimeStamp>();
if (role == "OWNER" || role == "CHILD")
{
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
.Where(x => x.CheckInStatus == "LATE")
.Where(x => x.ProfileType == type.Trim().ToUpper())
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
.ToListAsync();
}
else
{
data = await _dbContext.Set<ProcessUserTimeStamp>().AsQueryable()
.Where(x => x.CheckInStatus == "LATE")
.Where(x => x.ProfileType == type.Trim().ToUpper())
.Where(x => node == 4 ? x.Child4Id == _nodeId : (node == 3 ? x.Child3Id == _nodeId : (node == 2 ? x.Child2Id == _nodeId : (node == 1 ? x.Child1Id == _nodeId : (node == 0 ? x.RootId == _nodeId : true)))))
.Where(x => node == 0 ? x.Child1Id == null : (node == 1 ? x.Child2Id == null : (node == 2 ? x.Child3Id == null : (node == 3 ? x.Child4Id == null : true))))
.ToListAsync();
}
return data;
}

View file

@ -4,10 +4,6 @@
{
public string Root { get; set; } = string.Empty;
public Guid LeaveTypeId { get; set; }
public string LeaveTypeCode { get; set; } = string.Empty;
public double SumLeaveDay { get; set; }
public double sickDayCountMale { get; set; }

View file

@ -171,7 +171,9 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
{
Id = x.Id,//id ข้อมูลเรื่องร้องเรียน
RespondentType = x.RespondentType,//ผู้ถูกร้องเรียน
Persons = x.DisciplineComplaint_Profiles.Select(p => new
Persons = x.DisciplineComplaint_Profiles
.OrderByDescending(p => p.CreatedAt)
.Select(p => new
{
Id = p.Id,
Idcard = p.CitizenId,
@ -207,6 +209,8 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
posTypeName = p.posTypeName,
posLevelId = p.posLevelId,
posLevelName = p.posLevelName,
profileType = p.profileType,
CreatedAt = p.CreatedAt
}),//รายการข้อมูลบุคลผู้ถูกร้องเรียน
Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
ConsideredAgency = x.ConsideredAgency,//หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง
@ -343,7 +347,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
posTypeName = item.posTypeName,
posLevelId = item.posLevelId,
posLevelName = item.posLevelName,
profileType = item.profileType,
Salary = item.salary,
PosNo = item.posNo,
Position = item.position,
@ -452,7 +456,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
posTypeName = item.posTypeName,
posLevelId = item.posLevelId,
posLevelName = item.posLevelName,
profileType = item.profileType,
PosNo = item.posNo,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
@ -625,7 +629,7 @@ namespace BMA.EHR.DisciplineComplaint.Service.Controllers
posTypeName = item.posTypeName,
posLevelId = item.posLevelId,
posLevelName = item.posLevelName,
profileType = item.profileType,
Salary = item.Salary,
PosNo = item.PosNo,
Position = item.Position,

View file

@ -480,7 +480,9 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
// Total = d.DisciplineDirector.DisciplineDisciplinary_DirectorInvestigates.Count(),
}).ToList(),
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Select(p => new
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates
.OrderByDescending(p => p.CreatedAt)
.Select(p => new
{
Id = p.Id,
Idcard = p.CitizenId,
@ -516,11 +518,13 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
posTypeName = p.posTypeName,
posLevelId = p.posLevelId,
posLevelName = p.posLevelName,
IsSend = p.IsReport,
IsSuspend = p.IsSuspend,
Status = p.Status,
StatusDiscard = p.StatusDiscard,
profileType = p.profileType,
CreatedAt = p.CreatedAt,
// Report = p.DisciplineReport_Profiles.Count() > 0 ? true : false,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
@ -775,7 +779,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
posTypeName = item.posTypeName,
posLevelId = item.posLevelId,
posLevelName = item.posLevelName,
profileType = item.profileType,
PosNo = item.posNo,
Status = isReport == null ? "NEW" : isReport.Status,
StatusDiscard = isReport == null ? "NEW" : isReport.StatusDiscard,
@ -1766,7 +1770,7 @@ namespace BMA.EHR.DisciplineDisciplinary.Service.Controllers
posTypeName = item.posTypeName,
posLevelId = item.posLevelId,
posLevelName = item.posLevelName,
profileType = item.profileType,
Salary = item.Salary,
PosNo = item.PosNo,
Position = item.Position,

View file

@ -313,7 +313,9 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
// Total = d.DisciplineDirector.DisciplineInvestigate_Directors.Count(),
}).ToList(),
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
Persons = x.DisciplineInvestigate_ProfileComplaints.Select(p => new
Persons = x.DisciplineInvestigate_ProfileComplaints
.OrderByDescending(p => p.CreatedAt)
.Select(p => new
{
Id = p.Id,
Idcard = p.CitizenId,
@ -349,9 +351,11 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
posTypeName = p.posTypeName,
posLevelId = p.posLevelId,
posLevelName = p.posLevelName,
IsSend = p.IsReport,
IsDisciplinary = p.IsDisciplinary,
profileType = p.profileType,
CreatedAt = p.CreatedAt,
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
OrganizationId = x.OrganizationId,//id หน่วยงานกรณี type เป็นหน่วยงาน
@ -545,7 +549,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
posTypeName = item.posTypeName,
posLevelId = item.posLevelId,
posLevelName = item.posLevelName,
profileType = item.profileType,
PosNo = item.posNo,
IsDisciplinary = isReport == null ? false : isReport.IsDisciplinary,
IsReport = isReport == null ? "NEW" : isReport.IsReport,
@ -705,7 +709,7 @@ namespace BMA.EHR.DisciplineInvestigate.Service.Controllers
posTypeName = item.posTypeName,
posLevelId = item.posLevelId,
posLevelName = item.posLevelName,
profileType = item.profileType,
Salary = item.Salary,
PosNo = item.PosNo,
Position = item.Position,

View file

@ -0,0 +1,99 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Discipline.Service.Requests;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Models.Discipline;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
// using BMA.EHR.Placement.Service.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
namespace BMA.EHR.DisciplineSuspend.Service.Controllers
{
[Route("api/v{version:apiVersion}/discipline/report")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("ระบบวินัยรายงาน")]
public class DisciplineReportController : BaseController
{
private readonly DisciplineDbContext _context;
private readonly MinIODisciplineService _documentService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly PermissionRepository _permission;
public DisciplineReportController(DisciplineDbContext context,
MinIODisciplineService documentService,
IHttpContextAccessor httpContextAccessor,
PermissionRepository permission)
{
// _repository = repository;
_context = context;
_documentService = documentService;
_httpContextAccessor = httpContextAccessor;
_permission = permission;
}
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
#endregion
/// <summary>
/// รายชื่อออกคำสั่งลงโทษ
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("{type}")]
public async Task<ActionResult<ResponseObject>> GetReportDiscipline([FromBody] DisciplineReportRequest req, string type)
{
// var data = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
// .Include(x => x.DisciplineDisciplinary)
// .Where(x => x.Id == d.id)
// .FirstOrDefaultAsync();
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
// var profile = new List<GetProfileByKeycloakIdRootDto>();
// if (type.Trim().ToUpper() == "OFFICER")
// {
// profile = await _userProfileRepository.GetProfileWithKeycloakAllOfficer(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD");
// }
// else
// {
// profile = await _userProfileRepository.GetProfileWithKeycloakAllEmployee(AccessToken, req.node, req.nodeId, jsonData["result"] == "OWNER" || jsonData["result"] == "CHILD");
// }
var result = new
{
template = "reportDiscipline",
reportName = "reportDiscipline",
data = new
{
year = req.year + 543,
data = new List<dynamic>()
}
};
return Success(result);
}
}
}

View file

@ -147,7 +147,9 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
IdInvestigate = x.DisciplineInvestigate.Id,//id ข้อมูลเรื่องสืบสวน
IdComplaint = x.DisciplineInvestigate.DisciplineComplaint.Id,//id ข้อมูลเรื่องร้องเรียน
RespondentType = x.RespondentType,//ผู้ถูกสืบสวน
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.IsReport == "NEW").Select(p => new
Persons = x.DisciplineDisciplinary_ProfileComplaintInvestigates.Where(x => x.IsReport == "NEW")
.OrderByDescending(p => p.CreatedAt)
.Select(p => new
{
Id = p.Id,
Idcard = p.CitizenId,
@ -184,6 +186,8 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
posLevelName = p.posLevelName,
Status = p.Status,
StatusDiscard = p.StatusDiscard,
profileType = p.profileType,
CreatedAt = p.CreatedAt
}),//รายการข้อมูลบุคลผู้ถูกสืบสวน
Organization = x.Organization,//id หน่วยงานกรณี type เป็นหน่วยงาน
OrganizationId = x.OrganizationId,//id หน่วยงานกรณี type เป็นหน่วยงาน

View file

@ -58,7 +58,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetDisciplineSuspend(int page = 1, int pageSize = 25, string keyword = "")
public async Task<ActionResult<ResponseObject>> GetDisciplineSuspend(int page = 1, int pageSize = 25, string keyword = "", string profileType = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_DISCIPLINE_SUSPENDED");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -67,18 +67,22 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data_search = (from x in _context.DisciplineReport_Profiles.Include(x => x.DisciplineDisciplinary)
where (x.CitizenId == null ? false : x.CitizenId.Contains(keyword)) ||
//(x.Prefix == null ? false : x.Prefix.Contains(keyword)) ||
//(x.FirstName == null ? false : x.FirstName.Contains(keyword)) ||
//(x.LastName == null ? false : x.LastName.Contains(keyword)) ||
((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) ||
(x.Organization == null ? false : x.Organization.Contains(keyword)) ||
(x.Position == null ? false : x.Position.Contains(keyword)) ||
(x.PosNo == null ? false : x.PosNo.Contains(keyword)) ||
//(x.posTypeName == null ? false : x.posTypeName.Contains(keyword)) ||
//(x.posLevelName == null ? false : x.posLevelName.Contains(keyword)) ||
((x.posTypeName ?? "") + " (" + (x.posLevelName ?? "") + ")").Contains(keyword) ||
(x.Title == null ? false : x.Title.Contains(keyword))
where
(
(x.CitizenId != null && x.CitizenId.Contains(keyword)) ||
((x.Prefix ?? "") + (x.FirstName ?? "") + " " + (x.LastName ?? "")).Contains(keyword) ||
(x.Organization != null && x.Organization.Contains(keyword)) ||
(x.Position != null && x.Position.Contains(keyword)) ||
(x.PosNo != null && x.PosNo.Contains(keyword)) ||
((x.posTypeName ?? "") + " (" + (x.posLevelName ?? "") + ")").Contains(keyword) ||
(x.Title != null && x.Title.Contains(keyword))
)
&&
(
string.IsNullOrEmpty(profileType) ||
(profileType.ToUpper() == "OFFICER" && x.profileType == "OFFICER") ||
(profileType.ToUpper() == "EMPLOYEE" && x.profileType == "EMPLOYEE")
)
select x).ToList();
var data = data_search
.Select(x => new
@ -110,7 +114,7 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
posTypeName = x.posTypeName,
posLevelId = x.posLevelId,
posLevelName = x.posLevelName,
Position = x.Position,
PosNo = x.PosNo,
PositionLevel = x.PositionLevel == null ? "" : x.PositionLevel,
@ -124,8 +128,11 @@ namespace BMA.EHR.DisciplineSuspend.Service.Controllers
OffenseDetails = x.DisciplineDisciplinary.OffenseDetails,//ลักษณะความผิด
DisciplinaryFaultLevel = x.DisciplineDisciplinary.DisciplinaryFaultLevel,//ระดับโทษความผิด
DisciplinaryCaseFault = x.DisciplineDisciplinary.DisciplinaryCaseFault,//กรณีความผิด
profileType = x.profileType,
CreatedAt = x.CreatedAt,
})
.OrderByDescending(x => x.CitizenId)
.OrderByDescending(x => x.CreatedAt)
.ThenByDescending(x => x.CitizenId)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();

View file

@ -56,5 +56,6 @@ namespace BMA.EHR.Discipline.Service.Requests
public string? posTypeName { get; set; }
public string? posLevelId { get; set; }
public string? posLevelName { get; set; }
public string? profileType { get; set; }
}
}

View file

@ -42,5 +42,6 @@ namespace BMA.EHR.Discipline.Service.Requests
public string? posTypeName { get; set; }
public string? posLevelId { get; set; }
public string? posLevelName { get; set; }
public string? profileType { get; set; }
}
}

View file

@ -42,5 +42,6 @@ namespace BMA.EHR.Discipline.Service.Requests
public string? posTypeName { get; set; }
public string? posLevelId { get; set; }
public string? posLevelName { get; set; }
public string? profileType { get; set; }
}
}

View file

@ -0,0 +1,24 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Discipline.Service.Requests
{
public class DisciplineReportRequest
{
public string nodeId { get; set; }
public int node { get; set; }
public int year { get; set; }
public string offenseDetail { get; set; }
public string disciplinaryFaultLevel { get; set; }
public string status { get; set; }
public string posType { get; set; }
public string posLevel { get; set; }
}
}

View file

@ -71,6 +71,10 @@ namespace BMA.EHR.Domain.Models.Discipline
public double? Salary { get; set; }
[Comment("รายการเก่า")]
public bool? IsAncestorDNA { get; set; } = false;
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
[Required, Comment("Id เรื่องร้องเรียน")]
public DisciplineComplaint DisciplineComplaint { get; set; }
}

View file

@ -83,6 +83,10 @@ namespace BMA.EHR.Domain.Models.Discipline
public string? IsSuspend { get; set; } = "NEW";
[Comment("รายการเก่า")]
public bool? IsAncestorDNA { get; set; } = false;
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
[Required, Comment("Id เรื่องสอบสวน")]
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
// public virtual List<DisciplineReport_Profile> DisciplineReport_Profiles { get; set; } = new List<DisciplineReport_Profile>();

View file

@ -75,6 +75,10 @@ namespace BMA.EHR.Domain.Models.Discipline
public bool? IsDisciplinary { get; set; } = false;
[Comment("รายการเก่า")]
public bool? IsAncestorDNA { get; set; } = false;
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
[Required, Comment("Id เรื่องสืบสวน")]
public DisciplineInvestigate DisciplineInvestigate { get; set; }
}

View file

@ -90,6 +90,10 @@ namespace BMA.EHR.Domain.Models.Discipline
public string? DisciplinaryFaultLevel { get; set; }
[Comment("กรณีความผิด")]
public string? DisciplinaryCaseFault { get; set; }
[Comment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")]
public string? profileType { get; set; }
[Required, Comment("Id เรื่องสอบสวน")]
public DisciplineDisciplinary DisciplineDisciplinary { get; set; }
// [Required, Comment("Id ผู้ถูกร้องเรียน")]

View file

@ -94,5 +94,8 @@ namespace BMA.EHR.Domain.Models.Placement
public string Status { get; set; } = "WAITTING";
[Comment("สถานะการใช้งาน")]
public bool IsActive { get; set; } = true;
[Comment("เลขที่คำสั่ง")]
public string? commandNo { get; set; }
}
}

View file

@ -19,6 +19,8 @@ namespace BMA.EHR.Domain.Models.Retirement
public DateTime? ActiveDate { get; set; }
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? Reason { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)")]
public string? Remark { get; set; } = string.Empty;
// [Comment("Id ผู้ลาออก")]
// public Profile Profile { get; set; }
[Comment("สังกัด")]

View file

@ -15,6 +15,8 @@ namespace BMA.EHR.Domain.Models.Retirement
public DateTime? ActiveDate { get; set; }
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? Reason { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)")]
public string? Remark { get; set; } = string.Empty;
[Comment("สังกัด")]
public string? OrganizationPositionOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]

View file

@ -19,6 +19,8 @@ namespace BMA.EHR.Domain.Models.Retirement
public DateTime? ActiveDate { get; set; }
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? Reason { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)")]
public string? Remark { get; set; } = string.Empty;
// [Comment("Id ผู้ลาออก")]
// public Profile Profile { get; set; }
[Comment("สังกัด")]

View file

@ -15,6 +15,8 @@ namespace BMA.EHR.Domain.Models.Retirement
public DateTime? ActiveDate { get; set; }
[Comment("เหตุผลที่ลาออกจากราชการ")]
public string? Reason { get; set; } = string.Empty;
[Comment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)")]
public string? Remark { get; set; } = string.Empty;
[Comment("สังกัด")]
public string? OrganizationPositionOld { get; set; }
[Comment("ข้อมูลหน่วยงานเดิม ตำแหน่งประเภท")]

View file

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableplacementofficeraddcommandno : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "commandNo",
table: "PlacementOfficers",
type: "longtext",
nullable: true,
comment: "เลขที่คำสั่ง")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "commandNo",
table: "PlacementOfficers");
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableresignaddremark : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "RetirementResigns",
type: "longtext",
nullable: true,
comment: "เหตุผลที่ลาออกจากราชการ(อื่นๆ)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "RetirementResignEmployees",
type: "longtext",
nullable: true,
comment: "เหตุผลที่ลาออกจากราชการ(อื่นๆ)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "RetirementResignEmployeeCancels",
type: "longtext",
nullable: true,
comment: "เหตุผลที่ลาออกจากราชการ(อื่นๆ)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Remark",
table: "RetirementResignCancels",
type: "longtext",
nullable: true,
comment: "เหตุผลที่ลาออกจากราชการ(อื่นๆ)")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Remark",
table: "RetirementResigns");
migrationBuilder.DropColumn(
name: "Remark",
table: "RetirementResignEmployees");
migrationBuilder.DropColumn(
name: "Remark",
table: "RetirementResignEmployeeCancels");
migrationBuilder.DropColumn(
name: "Remark",
table: "RetirementResignCancels");
}
}
}

View file

@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetabledisciplineaddprofiletype : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View file

@ -12082,6 +12082,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เลขบัตรประชาชน");
b.Property<string>("commandNo")
.HasColumnType("longtext")
.HasComment("เลขที่คำสั่ง");
b.Property<string>("firstName")
.HasColumnType("longtext")
.HasComment("ชื่อ");
@ -16040,6 +16044,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เหตุผลไม่อนุมัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)");
b.Property<string>("RemarkHorizontal")
.HasColumnType("longtext")
.HasComment("หมายเหตุแนวนอน");
@ -16320,6 +16328,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เหตุผลไม่อนุมัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)");
b.Property<string>("RemarkHorizontal")
.HasColumnType("longtext")
.HasComment("หมายเหตุแนวนอน");
@ -16733,6 +16745,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เหตุผลไม่อนุมัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)");
b.Property<string>("RemarkHorizontal")
.HasColumnType("longtext")
.HasComment("หมายเหตุแนวนอน");
@ -17013,6 +17029,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เหตุผลไม่อนุมัติ");
b.Property<string>("Remark")
.HasColumnType("longtext")
.HasComment("เหตุผลที่ลาออกจากราชการ(อื่นๆ)");
b.Property<string>("RemarkHorizontal")
.HasColumnType("longtext")
.HasComment("หมายเหตุแนวนอน");

View file

@ -0,0 +1,66 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class updatetabledisciplineaddprofiletype : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "profileType",
table: "DisciplineReport_Profiles",
type: "longtext",
nullable: true,
comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "profileType",
table: "DisciplineInvestigate_ProfileComplaints",
type: "longtext",
nullable: true,
comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "profileType",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
type: "longtext",
nullable: true,
comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "profileType",
table: "DisciplineComplaint_Profiles",
type: "longtext",
nullable: true,
comment: "สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "profileType",
table: "DisciplineReport_Profiles");
migrationBuilder.DropColumn(
name: "profileType",
table: "DisciplineInvestigate_ProfileComplaints");
migrationBuilder.DropColumn(
name: "profileType",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates");
migrationBuilder.DropColumn(
name: "profileType",
table: "DisciplineComplaint_Profiles");
}
}
}

View file

@ -652,6 +652,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("ชื่อประเภทตำแหน่ง");
b.Property<string>("profileType")
.HasColumnType("longtext")
.HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)");
b.Property<string>("root")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");
@ -1915,6 +1919,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("ชื่อประเภทตำแหน่ง");
b.Property<string>("profileType")
.HasColumnType("longtext")
.HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)");
b.Property<string>("root")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");
@ -2606,6 +2614,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("ชื่อประเภทตำแหน่ง");
b.Property<string>("profileType")
.HasColumnType("longtext")
.HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)");
b.Property<string>("root")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");
@ -2828,6 +2840,10 @@ namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
.HasColumnType("longtext")
.HasComment("ชื่อประเภทตำแหน่ง");
b.Property<string>("profileType")
.HasColumnType("longtext")
.HasComment("สถานภาพ (OFFICER->ข้าราชการ EMPLOYEE->ลูกจ้างประจำ)");
b.Property<string>("root")
.HasColumnType("longtext")
.HasComment("ชื่อหน่วยงาน root");

View file

@ -0,0 +1,304 @@
using BMA.EHR.Application.Repositories;
using BMA.EHR.Application.Repositories.MessageQueue;
using BMA.EHR.Application.Repositories.Reports;
using BMA.EHR.Application.Requests;
using BMA.EHR.Application.Responses.Insignias;
using BMA.EHR.Application.Responses.Organizations;
using BMA.EHR.Domain.Common;
using BMA.EHR.Domain.Extensions;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Shared;
using BMA.EHR.Infrastructure.Persistence;
using BMA.EHR.Insignia.Service.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OfficeOpenXml;
using RabbitMQ.Client;
using Swashbuckle.AspNetCore.Annotations;
using System.Security.Claims;
using System.Text;
namespace BMA.EHR.Insignia.Service.Controllers
{
[Route("api/v{version:apiVersion}/insignia/report")]
[ApiVersion("1.0")]
[ApiController]
[Produces("application/json")]
[Authorize]
[SwaggerTag("เครื่องราชรายงาน")]
public class InsigniaReportController : BaseController
{
private readonly ApplicationDBContext _context;
private readonly IWebHostEnvironment _hostingEnvironment;
private readonly IConfiguration _configuration;
private readonly InsigniaReportRepository _repository;
private readonly PermissionRepository _permission;
private readonly IHttpContextAccessor _httpContextAccessor;
/// <summary>
///
/// </summary>
/// <param name="context"></param>
/// <param name="documentService"></param>
/// <param name="repository"></param>
/// <param name="repositoryNoti"></param>
/// <param name="hostingEnvironment"></param>
/// <param name="httpContextAccessor"></param>
/// <param name="userProfileRepository"></param>
/// <param name="insigniaPeriodRepository"></param>
/// <param name="producer"></param>
public InsigniaReportController(ApplicationDBContext context,
IWebHostEnvironment hostingEnvironment,
IConfiguration configuration,
InsigniaReportRepository repository,
IHttpContextAccessor httpContextAccessor,
PermissionRepository permission)
{
_context = context;
_hostingEnvironment = hostingEnvironment;
_configuration = configuration;
_repository = repository;
_permission = permission;
_httpContextAccessor = httpContextAccessor;
}
#region " Properties "
private string? UserId => _httpContextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value;
private string? FullName => _httpContextAccessor?.HttpContext?.User?.FindFirst("name")?.Value;
private string? AccessToken => _httpContextAccessor?.HttpContext?.Request.Headers["Authorization"];
#endregion
#region
/// <summary>
/// บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา
/// </summary>
/// <param name="type">type </param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report1/{type}")]
public async Task<ActionResult<ResponseObject>> GetInsigniaReport1Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
{
try
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data = await _repository.GetCoinReport(req.roundId);
var yearInsignalPeriod = await _repository.GetYearInsigniaPeriod(req.roundId);
var dataResult = new List<dynamic>();
var dataList = new List<dynamic>(data);
var detailList = new List<dynamic>();
var check = 0;
var status = false;
for (int i = 0; i < dataList.Count; i++)
{
check++;
var gender = dataList[i].GetType().GetProperty("Gender").GetValue(dataList[i]);
detailList.Add(new
{
status = status,
row = detailList.Count + 1,
InsigniaName = dataList[i].GetType().GetProperty("InsigniaName").GetValue(dataList[i]),
FullName = dataList[i].GetType().GetProperty("FullName").GetValue(dataList[i]),
InsigniaInitial = dataList[i].GetType().GetProperty("InsigniaInitial").GetValue(dataList[i]),
Male = gender == "ชาย" ? 1 : 0,
Female = gender == "หญิง" ? 1 : 0,
});
if (check == 25)
{
status = true;
}
else if (check == 50)
{
status = false;
check = 0;
}
}
if (detailList.Count > 0)
{
var left = detailList.Where(x => x.status == false);
var right = detailList.Where(x => x.status == true);
var mergeList = new List<object>();
var InsigniaName = string.Empty;
var range = string.Empty;
var male = 0;
var female = 0;
var start = 0;
var stop = 0;
var colLeft = 0;
var colRight = 0;
for (int i = 0; i < detailList.Count / 2; i++)
{
if (InsigniaName != (string)left.ElementAt(i).GetType().GetProperty("InsigniaName").GetValue(left.ElementAt(i)))
{
InsigniaName = (string)left.ElementAt(i).GetType().GetProperty("InsigniaName").GetValue(left.ElementAt(i));
male = left.Count(x => x.Male == 1 && x.InsigniaName == InsigniaName) + right.Count(x => x.Male == 1 && x.InsigniaName == InsigniaName);
female = left.Count(x => x.Female == 1 && x.InsigniaName == InsigniaName) + right.Count(x => x.Female == 1 && x.InsigniaName == InsigniaName);
var countGroup = detailList.Count(x => x.InsigniaName == InsigniaName);
var countGroupTemp = detailList.Count(x => x.InsigniaName == InsigniaName && x.FullName == "");
start = i == 0 ? (mergeList.Count + 1) : (stop + 1);
stop = i == 0 ? (mergeList.Count) + (countGroup - countGroupTemp) : (countGroup - countGroupTemp) == 1 ? start : start + (countGroup - countGroupTemp);
range = countGroup - countGroupTemp != 1 ? $"{start} - {stop}" : $"{start}";
colLeft = start;
colRight = start + 25;
}
mergeList.Add(new
{
row = mergeList.Count + 1,
ColLeft = colLeft.ToString().ToThaiNumber(),
NameLeft = left.ElementAt(i).GetType().GetProperty("FullName").GetValue(left.ElementAt(i)),
ColRight = colRight.ToString().ToThaiNumber(),
NameRight = right.ElementAt(i).GetType().GetProperty("FullName").GetValue(right.ElementAt(i)),
InsigniaInitial = left.ElementAt(i).GetType().GetProperty("InsigniaInitial").GetValue(left.ElementAt(i)),
InsigniaName = left.ElementAt(i).GetType().GetProperty("InsigniaName").GetValue(left.ElementAt(i)),
Range = range.ToThaiNumber(),
Male = male.ToString().ToThaiNumber(),
Female = female.ToString().ToThaiNumber(),
});
if (mergeList.Count % 25 == 0)
{
colLeft = colRight;
colRight = colLeft + 25;
}
colLeft++;
colRight++;
}
dataResult = mergeList;
}
var result = new
{
template = "reportInsignia1",
reportName = "reportInsignia1",
data = new
{
yearInsignalPeriod,
data = dataResult,
}
};
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region
/// <summary>
/// บัญชีแสดงจำนวนชั้นตราเครื่องราชฯ
/// </summary>
/// <param name="type">type </param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report2/{type}")]
public async Task<ActionResult<ResponseObject>> GetInsigniaReport2Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
{
try
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var data = await _repository.GetSummaryCoinReport(req.roundId);
var summaryTotal = await _repository.GetSummaryTotalCoinReport(req.roundId);
var yearInsignalPeriod = await _repository.GetYearInsigniaPeriod(req.roundId);
var dataResult = new List<dynamic>();
foreach (var _data in data)
{
dataResult.Add(new
{
RowNo = (dataResult.Count + 1).ToString().ToThaiNumber(),
DepartmentName = _data.GetType().GetProperty("DepartmentName").GetValue(_data),
InsigniaInitial = _data.GetType().GetProperty("InsigniaInitial").GetValue(_data),
G1Male = _data.GetType().GetProperty("G1Male").GetValue(_data),
G1Female = _data.GetType().GetProperty("G1Female").GetValue(_data),
G2Male = _data.GetType().GetProperty("G2Male").GetValue(_data),
G2Female = _data.GetType().GetProperty("G2Female").GetValue(_data),
Remark = _data.GetType().GetProperty("Remark").GetValue(_data),
});
}
var result = new
{
template = "reportInsignia2",
reportName = "reportInsignia2",
data = new
{
yearInsignalPeriod,
summaryTotal,
data = dataResult,
}
};
return Success(result);
}
catch
{
throw;
}
}
#endregion
#region 5
/// <summary>
/// บัญชีระดับผลการประเมินผลการปฏิบัติราชการในรอบ 5 ปี
/// </summary>
/// <param name="type">type </param>
/// <returns></returns>
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("report3/{type}")]
public async Task<ActionResult<ResponseObject>> GetInsigniaReport3Async([FromBody] GetInsigniaDetailByNodeReportDto req, string type)
{
try
{
var getPermission = await _permission.GetPermissionAPIAsync("GET", "SYS_INSIGNIA_REPORT");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
if (jsonData["status"]?.ToString() != "200")
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
var result = new
{
template = "reportInsignia2",
reportName = "reportInsignia2",
data = new List<dynamic>()
};
return Success(result);
}
catch
{
throw;
}
}
#endregion
}
}

View file

@ -0,0 +1,10 @@
namespace BMA.EHR.Insignia.Service.Requests
{
public class GetInsigniaDetailByNodeReportDto
{
public Guid roundId { get; set; }
public int node { get; set; }
public string nodeId { get; set; }
}
}

View file

@ -425,26 +425,26 @@ namespace BMA.EHR.Leave.Service.Controllers
}
else
{
// ถ้า check-in + check-out ไปแล้ว
if (data.CheckIn.Date == DateTime.Now.Date)
{
return Error("คุณได้ทำการลงเวลาเข้าและออกเรียบร้อยแล้ว คุณจะสามารถลงเวลาได้อีกครั้งในวันถัดไป");
}
if (data.CheckOut != null)
{
ret = new CheckInResultDto
// ถ้า check-in + check-out ไปแล้ว
if (data.CheckOut.Value.Date == DateTime.Now.Date)
{
StartTimeMorning = duty == null ? "00:00" : duty.StartTimeMorning,
EndTimeMorning = duty == null ? "00:00" : duty.EndTimeMorning,
StartTimeAfternoon = duty == null ? "00:00" : duty.StartTimeAfternoon,
EndTimeAfternoon = duty == null ? "00:00" : duty.EndTimeAfternoon,
Description = duty == null ? "-" : duty.Description,
CheckInTime = null,
CheckInId = null,
};
return Error("คุณได้ทำการลงเวลาเข้าและออกเรียบร้อยแล้ว คุณจะสามารถลงเวลาได้อีกครั้งในวันถัดไป");
}
else
{
ret = new CheckInResultDto
{
StartTimeMorning = duty == null ? "00:00" : duty.StartTimeMorning,
EndTimeMorning = duty == null ? "00:00" : duty.EndTimeMorning,
StartTimeAfternoon = duty == null ? "00:00" : duty.StartTimeAfternoon,
EndTimeAfternoon = duty == null ? "00:00" : duty.EndTimeAfternoon,
Description = duty == null ? "-" : duty.Description,
CheckInTime = null,
CheckInId = null,
};
}
}
else
{

View file

@ -848,14 +848,11 @@ namespace BMA.EHR.Leave.Service.Controllers
var emp = new
{
no = count,
fullName = $"{p.Prefix}{p.FirstName} {p.LastName}",// _userProfileRepository.GetUserFullName(p.Keycloak ?? Guid.Empty, AccessToken),
fullName = $"{p.Prefix}{p.FirstName} {p.LastName}",
position = p.Position == null ? "" : p.Position,
//positionLevel = p.PosLevel == null ? "" : p.PosLevel,
//posNo = p.ProfileSalary == null ? "" : p.ProfileSalary.PosNo,
positionLevel = p.PositionLevel == null ? "" : p.PositionLevel,
posNo = p.PosNo == null ? "" : p.PosNo,
reason = "",
sickDayCount = sickDayCount,
maternityDayCount = maternityDayCount,
wifeDayCount = wifeDayCount,
@ -887,33 +884,31 @@ namespace BMA.EHR.Leave.Service.Controllers
count++;
}
var text = "";
var leaveTitleType = "";
if (req.Type.Trim().ToUpper() == "FULL")
{
text = "หนึ่งปี";
leaveTitleType = "หนึ่งปี";
}
else if (req.Type.Trim().ToUpper() == "HAFT")
{
text = "ครึ่งปี";
leaveTitleType = "ครึ่งปี";
}
else if (req.Type.Trim().ToUpper() == "MONTH")
{
text = "หนึ่งเดือน";
leaveTitleType = "หนึ่งเดือน";
}
var enddate = req.EndDate.Date == req.StartDate.Date ? "" : $" - {req.EndDate.Date.ToThaiShortDate().ToThaiNumber()}";
var result = new
{
template = "LeaveHalfYear-Officer",
reportName = "LeaveHalfYear-Officer",
template = "LeaveYear-Officer",
reportName = "LeaveYear-Officer",
data = new
{
leaveDateStart = req.StartDate.Date.ToThaiShortDate().ToThaiNumber(),
leaveDateEnd = req.EndDate.Date.ToThaiShortDate().ToThaiNumber(),
dateTimeStamp = $"ณ วันที่ {req.StartDate.Date.ToThaiShortDate().ToThaiNumber()}{enddate}",
dateTimeStamp = $"วันที่ {req.StartDate.Date.ToThaiShortDate().ToThaiNumber()}{enddate}",
organizationName = profile?.FirstOrDefault()?.Oc ?? "",
employees = employees,
headerText = type.Trim().ToUpper() == "OFFICER" ? "ข้าราชการสามัญ" : "ลูกจ้างประจำ",
text = text
leaveTitleType = leaveTitleType,
employees = employees,
}
};
@ -980,27 +975,22 @@ namespace BMA.EHR.Leave.Service.Controllers
var studyTotal = 0;
var workTotal = 0;
var seminarTotal = 0;
foreach (var dd in dateList)
{
foreach (var p in profile)
{
var keycloakUserId = p.Keycloak ?? Guid.Empty;
var timeStamps = await _processUserTimeStampRepository.GetTimestampByDateAsync(keycloakUserId, dd);
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}"; // _userProfileRepository.GetUserFullName(keycloakUserId, AccessToken);
var defaultRound = await _dutyTimeRepository.GetDefaultAsync();
if (defaultRound == null)
{
return Error("ไม่พบรอบการลงเวลา Default", StatusCodes.Status404NotFound);
}
//var userRound = await _dutyTimeRepository.GetByIdAsync(profile.DutyTimeId ?? Guid.Empty);
var effectiveDate = await _userDutyTimeRepository.GetLastEffectRound(p.Id);
var roundId = effectiveDate != null ? effectiveDate.DutyTimeId : Guid.Empty;
var userRound = await _dutyTimeRepository.GetByIdAsync(roundId);
@ -1067,7 +1057,6 @@ namespace BMA.EHR.Leave.Service.Controllers
else
remarkStr = "";
}
}
}
@ -1078,15 +1067,12 @@ namespace BMA.EHR.Leave.Service.Controllers
dutyTimeName = $"{duty.StartTimeMorning} - {duty.EndTimeAfternoon} น.",
checkInLocation = timeStamps == null ? "" : timeStamps.CheckInPOI,
checkInTime = timeStamps == null ? "" : $"{timeStamps.CheckIn.ToString("HH:mm")} น.",
checkOutLocation = timeStamps == null ? "" : timeStamps.CheckOutPOI ?? "",
checkOutTime = timeStamps == null ? "" :
timeStamps.CheckOut != null ?
$"{timeStamps.CheckOut.Value.ToString("HH:mm")} น." :
"",
//remark = timeStamps == null ? "ขาดราชการ" : "",
remark = remarkStr,
checkInDate = timeStamps == null ? dd.Date.ToThaiFullDate2().ToThaiNumber() : timeStamps.CheckIn.Date.ToThaiFullDate2().ToThaiNumber(),
checkedOutDate = timeStamps == null ? dd.Date.ToThaiFullDate2().ToThaiNumber() :
timeStamps.CheckOut != null ?
@ -1106,7 +1092,6 @@ namespace BMA.EHR.Leave.Service.Controllers
}
}
if (leaveReq != null)
{
switch (leaveReq.Type.Code.ToUpper())
@ -1122,20 +1107,18 @@ namespace BMA.EHR.Leave.Service.Controllers
studyTotal += 1;
break;
}
}
employees.Add(emp);
count++;
}
}
var enddate = req.EndDate.Date == req.StartDate.Date ? "" : $" - {req.EndDate.Date.ToThaiShortDate().ToThaiNumber()}";
var item = new
{
dateTimeStamp = $"ณ วันที่ {req.StartDate.Date.ToThaiShortDate().ToThaiNumber()}{enddate}",
organizationName = profile?.FirstOrDefault()?.Oc ?? "",
officerTotal = profile.Count,
workTotal = workTotal,
restTotal = restTotal,
@ -1149,9 +1132,9 @@ namespace BMA.EHR.Leave.Service.Controllers
var result = new
{
template = "TimeStamp-Day",
reportName = "TimeStamp-Day",
data = item
template = "TimeStamp",
reportName = "TimeStamp",
data = item,
};
return Success(result);
@ -1188,7 +1171,7 @@ namespace BMA.EHR.Leave.Service.Controllers
var employees = new List<dynamic>();
var count = 1;
var userTimeStamps = await _processUserTimeStampRepository.GetTimestampByDateLateAsync(type.Trim().ToUpper());
var userTimeStamps = await _processUserTimeStampRepository.GetTimestampByDateLateAsync(type.Trim().ToUpper(), jsonData["result"]?.ToString(), req.nodeId, req.node);
foreach (var p in userTimeStamps)
{
var fullName = $"{p.Prefix}{p.FirstName} {p.LastName}";
@ -1206,23 +1189,20 @@ namespace BMA.EHR.Leave.Service.Controllers
return Error("ไม่พบรอบการลงเวลา Default", StatusCodes.Status404NotFound);
}
}
DateTime? checkIn = p.CheckIn ?? null;
DateTime? checkOut = p.CheckOut ?? null;
var emp = new
{
no = count,
fullName = fullName,
dutyTimeName = $"{duty.StartTimeMorning} - {duty.EndTimeAfternoon} น.",
checkInLocation = p.CheckInPOI,
checkInTime = $"{p.CheckIn.ToString("HH:mm")} น.",
checkInTime = $"{checkIn?.ToString("HH:mm") ?? ""} น.",
checkOutLocation = p.CheckOutPOI ?? "",
checkOutTime = p.CheckOut != null ?
$"{p.CheckOut.Value.ToString("HH:mm")} น." :
"",
checkOutTime = $"{checkOut?.ToString("HH:mm") ?? ""} น.",
remark = "",
checkInDate = p.CheckIn.Date.ToThaiFullDate2().ToThaiNumber(),
checkedOutDate = p.CheckOut != null ?
p.CheckOut.Value.ToThaiFullDate2().ToThaiNumber() :
"",
checkInDate = checkIn?.ToThaiFullDate2()?.ToThaiNumber() ?? "",
checkedOutDate = checkOut?.ToThaiFullDate2()?.ToThaiNumber() ?? "",
};
employees.Add(emp);
count++;
@ -1232,14 +1212,14 @@ namespace BMA.EHR.Leave.Service.Controllers
var item = new
{
dateTimeStamp = $"ณ วันที่ {req.StartDate.Date.ToThaiShortDate().ToThaiNumber()}{enddate}",
// officerTotal = profile.Count,
organizationName = _userProfileRepository.GetOc(Guid.Parse(req.nodeId), req.node, AccessToken)?.Root ?? "",
employees = employees
};
var result = new
{
template = "TimeStamp-Day",
reportName = "TimeStamp-Day",
template = "late",
reportName = "late",
data = item
};
@ -1273,13 +1253,12 @@ namespace BMA.EHR.Leave.Service.Controllers
{
return Error(jsonData["message"]?.ToString(), StatusCodes.Status403Forbidden);
}
Console.WriteLine(jsonData["result"]);
var leaveDays = await _leaveRequestRepository.GetSumApproveLeaveByRootAndRange(req.StartDate, req.EndDate, type);
var leaveDays = await _leaveRequestRepository.GetSumApproveLeaveByRootAndRange(req.StartDate, req.EndDate, type, jsonData["result"]?.ToString(), req.nodeId, req.node);
var enddate = req.EndDate.Date == req.StartDate.Date ? "" : $" - {req.EndDate.Date.ToThaiShortDate().ToThaiNumber()}";
var result = new
{
template = "LeaveHalfYear-Officer",
reportName = "LeaveHalfYear-Officer",
template = "leave2",
reportName = "leave2",
data = new
{
dateTimeStamp = $"ณ วันที่ {req.StartDate.Date.ToThaiShortDate().ToThaiNumber()}{enddate}",

View file

@ -773,6 +773,8 @@ namespace BMA.EHR.Leave.Service.Controllers
var govAge = (profile?.DateStart?.Date ?? DateTime.Now.Date).DiffDay(DateTime.Now.Date);
var thisYear = DateTime.Now.Year;
var message = string.Empty;
if (profile == null)
{
return Error(GlobalMessages.DataNotFound, StatusCodes.Status404NotFound);
@ -823,15 +825,24 @@ namespace BMA.EHR.Leave.Service.Controllers
case "LV-001":
// fix issue : ระบบลา (ขรก.) >> ลาป่วย (กรณียื่นขอลาเกิน 120 วัน/ปี) #828
isLeave = (totalDay - (sumWorkDay + sumWeekend) + sumApproveLeave) <= 120;
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
//isLeave = true;
break;
case "LV-002":
// fix issue : ระบบลา (ขรก.) >> ลากิจส่วนตัว (กรณียื่นขอลาเกิน 45 วัน/ปี) #829
// fix issue : ระบบลา (ขรก.) >> ลากิจส่วนตัว (กรณีผู้เข้ารับราชการไม่เกิน 1 ปี ยื่นขอลาเกิน 15 วัน/ปี) #831
if (govAge <= 365)
{
isLeave = (totalDay - (sumWorkDay + sumWeekend) + sumApproveLeave) <= 15;
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
}
else
{
isLeave = (totalDay - (sumWorkDay + sumWeekend) + sumApproveLeave) <= 45;
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
}
//isLeave = true;
break;
case "LV-007":
@ -839,9 +850,11 @@ namespace BMA.EHR.Leave.Service.Controllers
break;
case "LV-003":
isLeave = totalDay <= 90;
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
break;
case "LV-004":
isLeave = (totalDay - (sumWorkDay + sumWeekend) + sumApproveLeave) <= 15;
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
break;
case "LV-005":
// fix issue : ระบบลา (ขรก.) >> ลาพักผ่อน (กรณีรับราชการไม่ถึง 6 เดือน) #838
@ -849,31 +862,55 @@ namespace BMA.EHR.Leave.Service.Controllers
var leavePrevYearRemain = 10 - (leavePrevYear == null ? 0 : leavePrevYear.SumLeaveDay); // หายอดวันลาที่เหลือของปีก่อน
if (govAge >= 180)
if (govAge >= 3650) // ถ้าอายุราชการเกิน 10 ปี ได้บวกเพิ่มอีก 10 วัน
if (govAge >= 3650)
{
// ถ้าอายุราชการเกิน 10 ปี ได้บวกเพิ่มอีก 10 วัน
isLeave = (totalDay - (sumWorkDay + sumWeekend) + sumApproveLeave) <= (20 + leavePrevYearRemain);
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
}
else
{
isLeave = (totalDay - (sumWorkDay + sumWeekend) + sumApproveLeave) <= (10 + leavePrevYearRemain);
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
}
else
{
isLeave = false;
if (!isLeave) message = "อายุราชการน้อยกว่า 6 เดือนหรือ 180 วัน";
}
break;
case "LV-006":
// fix issue : ระบบลา(ขรก.) >> ลาอุปสมบทหรือการลาประกอบพิธีฮัจย์ฯ(กรณีรับราชการน้อยกว่า 1 ปี) #840
if (govAge < 365)
{
isLeave = false;
if (!isLeave) message = "อายุราชการน้อยกว่า 1 ปีหรือ 365 วัน";
}
else
{
// fix issue : ระบบลา (ขรก.) >> ลาอุปสมบทหรือการลาประกอบพิธีฮัจย์ฯ (ยื่นขอลาได้มากกว่า 1 ครั้ง) #841
var prevLeave = _context.Set<LeaveRequest>().Where(x => x.LeaveTypeCode == "LV-006").Where(x => x.LeaveStatus == "APPROVE").Count();
if (prevLeave > 0)
{
isLeave = false;
if (!isLeave) message = "ไม่สามารถขอลาได้ เนื้่องจากเคยยื่นขอลาไปแล้ว";
}
else
{
isLeave = totalDay <= 120;
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
}
}
break;
case "LV-008":
case "LV-009":
isLeave = govAge >= 365;
if (!isLeave) message = "อายุราชการน้อยกว่า 1 ปีหรือ 365 วัน";
break;
case "LV-010":
int yy, mm, dd;
@ -933,10 +970,12 @@ namespace BMA.EHR.Leave.Service.Controllers
var maxEnd = new DateTime(yy, mm, dd);
isLeave = req.EndLeaveDate.Date <= maxEnd;
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
break;
case "LV-011":
//isLeave = totalDay <= 360;
isLeave = totalDay <= 365; // fix issue : 847 เปลี่ยนเป็นเช็คว่าเกิน 365 วันหรีอไม่
if (!isLeave) message = "จำนวนวันลาเกินที่กำหนด";
break;
}
@ -947,7 +986,8 @@ namespace BMA.EHR.Leave.Service.Controllers
IsLeave = !isBetween ? isLeave : false,
SumDateWork = sumWorkDay,
TotalDate = totalDay,
SumDateHoliday = sumWeekend
SumDateHoliday = sumWeekend,
Message = message,
};
return Success(result);

View file

@ -9,5 +9,7 @@
public double TotalDate { get; set; } = 0;
public double SumDateHoliday { get; set; } = 0;
public string Message { get; set; } = string.Empty;
}
}

View file

@ -5,7 +5,7 @@ namespace BMA.EHR.Leave.Service.DTOs.Reports
public DateTime StartDate { get; set; } = DateTime.MinValue;
public DateTime EndDate { get; set; } = DateTime.MinValue;
public string? Type { get; set; } = string.Empty;
public int? node { get; set; }
public string? nodeId { get; set; } = string.Empty;
public int node { get; set; }
public string nodeId { get; set; }
}
}

View file

@ -252,6 +252,7 @@ namespace BMA.EHR.Placement.Service.Controllers
p.Organization,
p.OrganizationPositionOld,
p.IsActive,
p.commandNo
})
.ToListAsync();
@ -697,7 +698,12 @@ namespace BMA.EHR.Placement.Service.Controllers
var _result = await _res.Content.ReadAsStringAsync();
if (_res.IsSuccessStatusCode)
{
data.ForEach(profile => profile.Status = "DONE");
//data.ForEach(profile => profile.Status = "DONE");
foreach (var profile in data)
{
profile.Status = "DONE";
profile.commandNo = resultData.Count > 0 ? resultData[0].refCommandNo : null;
}
await _context.SaveChangesAsync();
}
}

View file

@ -149,6 +149,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
@ -197,6 +198,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
@ -241,6 +243,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.PositionTypeOld,
@ -292,6 +295,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.PositionTypeOld,
@ -362,6 +366,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
@ -453,6 +458,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.Remark,
data.Status,
data.salary,
data.PositionTypeOld,
@ -540,6 +546,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
@ -619,6 +626,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.Remark,
data.Status,
data.salary,
data.PositionTypeOld,
@ -716,6 +724,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
@ -795,6 +804,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.Remark,
data.Status,
data.salary,
data.PositionTypeOld,
@ -881,6 +891,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
SendDate = DateTime.Now,
ActiveDate = req.ActiveDate,
Reason = req.Reason,
Remark = req.Remark,
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
@ -1018,6 +1029,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.Location = req.Location;
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
updated.Remark = req.Remark;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
@ -1050,6 +1062,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.Location = req.Location;
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
updated.Remark = req.Remark;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
@ -1168,6 +1181,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
SendDate = updated.SendDate,
ActiveDate = updated.ActiveDate,
Reason = updated.Reason,
Remark = updated.Remark,
OrganizationPositionOld = updated.OrganizationPositionOld,
PositionTypeOld = updated.PositionTypeOld,
PositionLevelOld = updated.PositionLevelOld,

View file

@ -93,6 +93,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
@ -141,6 +142,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.ApproveReason,
p.RejectReason,
p.CancelReason,
@ -185,6 +187,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.PositionTypeOld,
@ -306,6 +309,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
@ -397,6 +401,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.Remark,
data.Status,
data.salary,
data.PositionTypeOld,
@ -484,6 +489,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
@ -563,6 +569,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.Remark,
data.Status,
data.salary,
data.PositionTypeOld,
@ -660,6 +667,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.SendDate,
p.ActiveDate,
p.Reason,
p.Remark,
p.Status,
salary = p.AmountOld,
p.ApproveReason,
@ -739,6 +747,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.SendDate,
data.ActiveDate,
data.Reason,
data.Remark,
data.Status,
data.salary,
data.PositionTypeOld,
@ -825,6 +834,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
SendDate = DateTime.Now,
ActiveDate = req.ActiveDate,
Reason = req.Reason,
Remark = req.Remark,
// AmountOld = profile.Salaries.Count() == 0 ? null : profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount,
// PositionLevelOld = profile.PositionLevel == null ? null : profile.PositionLevel.Name,
// PositionTypeOld = profile.PositionType == null ? null : profile.PositionType.Name,
@ -962,6 +972,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.Location = req.Location;
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
updated.Remark = req.Remark;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
@ -994,6 +1005,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
updated.Location = req.Location;
updated.ActiveDate = req.ActiveDate;
updated.Reason = req.Reason;
updated.Remark = req.Remark;
updated.OrganizationPositionOld = req.OrganizationPositionOld;
updated.RemarkHorizontal = req.RemarkHorizontal;
updated.PositionTypeOld = req.PositionTypeOld;
@ -1112,6 +1124,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
SendDate = updated.SendDate,
ActiveDate = updated.ActiveDate,
Reason = updated.Reason,
Remark = updated.Remark,
OrganizationPositionOld = updated.OrganizationPositionOld,
PositionTypeOld = updated.PositionTypeOld,
PositionLevelOld = updated.PositionLevelOld,

View file

@ -9,6 +9,7 @@ namespace BMA.EHR.Retirement.Service.Requests
// public DateTime? SendDate { get; set; }
public DateTime? ActiveDate { get; set; }
public string? Reason { get; set; }
public string? Remark { get; set; }
public string? OrganizationPositionOld { get; set; }
public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; }

View file

@ -9,6 +9,7 @@ namespace BMA.EHR.Retirement.Service.Requests
// public DateTime? SendDate { get; set; }
public DateTime? ActiveDate { get; set; }
public string? Reason { get; set; }
public string? Remark { get; set; }
public string? OrganizationPositionOld { get; set; }
public string? PositionTypeOld { get; set; }
public string? PositionLevelOld { get; set; }