แก้ออกคำสั่ง

This commit is contained in:
Kittapath 2024-06-14 17:26:15 +07:00
parent ee2aa136b9
commit 6c09c68c5c
33 changed files with 18908 additions and 626 deletions

View file

@ -72,12 +72,12 @@ namespace BMA.EHR.Application.Repositories.Commands
join p in _dbContext.Set<PlacementProfile>()
.Include(x => x.PlacementEducations)
.Include(x => x.Placement)
.Include(x => x.OrganizationPosition)
.ThenInclude(x => x.Organization)
.Include(x => x.PositionPath)
.Include(x => x.PositionLevel)
.Include(x => x.PositionNumber)
.Include(x => x.PositionType)
// .Include(x => x.OrganizationPosition)
// .ThenInclude(x => x.Organization)
// .Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
// .Include(x => x.PositionNumber)
// .Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType01Response
@ -87,13 +87,18 @@ namespace BMA.EHR.Application.Repositories.Commands
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Oc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
PositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
PositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
PositionType = p.PositionType == null ? "" : p.PositionType.Name,
PositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
PositionType = p.posTypeName == null ? "" : p.posTypeName,
PositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
Salary = p.Amount == null ? "0" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
RemarkHorizontal = p.RemarkHorizontal,
@ -141,13 +146,18 @@ namespace BMA.EHR.Application.Repositories.Commands
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Oc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
PositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
PositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
PositionType = p.PositionType == null ? "" : p.PositionType.Name,
PositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
PositionType = p.posTypeName == null ? "" : p.posTypeName,
PositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
Salary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
ExamNumber = p.ExamNumber == null ? "" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
RemarkHorizontal = p.RemarkHorizontal,
@ -207,13 +217,18 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
RemarkHorizontal = p.RemarkHorizontal,
RemarkVertical = p.RemarkVertical,
})
@ -271,13 +286,18 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber()
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
})
.ToList();
@ -327,7 +347,7 @@ namespace BMA.EHR.Application.Repositories.Commands
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationOld == null ? "" : p.OrganizationOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
@ -397,7 +417,7 @@ namespace BMA.EHR.Application.Repositories.Commands
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationOld == null ? "" : p.OrganizationOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
@ -442,49 +462,29 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<RetirementOther>()
// .Include(x => x.Profile)
// .ThenInclude(x => x.Salaries)
// .Include(x => x.Profile)
// .ThenInclude(x => x.Position)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PositionLevel)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PositionType)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PosNo)
// .Include(x => x.Profile)
// .ThenInclude(x => x.Educations)
// .Include(x => x.OrganizationPosition)
// .ThenInclude(x => x.Organization)
// .Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
// .Include(x => x.PositionNumber)
// .Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response
{
// Education = p.Profile.Educations == null || p.Profile.Educations.Count == 0 ? "" :
// p.Profile.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
// OldOc = p.Profile.Oc == null ? "" : p.Profile.Oc.Replace("/", " "),
// OldPositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
// OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
// OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
// OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
// LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToList();
@ -512,49 +512,29 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<RetirementOther>()
// .Include(x => x.Profile)
// .ThenInclude(x => x.Salaries)
// .Include(x => x.Profile)
// .ThenInclude(x => x.Position)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PositionLevel)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PositionType)
// .Include(x => x.Profile)
// .ThenInclude(x => x.PosNo)
// .Include(x => x.Profile)
// .ThenInclude(x => x.Educations)
// .Include(x => x.OrganizationPosition)
// .ThenInclude(x => x.Organization)
// .Include(x => x.PositionPath)
// .Include(x => x.PositionLevel)
// .Include(x => x.PositionNumber)
// .Include(x => x.PositionType)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType03Response
{
// Education = p.Profile.Educations == null || p.Profile.Educations.Count == 0 ? "" :
// p.Profile.Educations.OrderByDescending(x => x.StartDate).FirstOrDefault().Degree,
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
// OldOc = p.Profile.Oc == null ? "" : p.Profile.Oc.Replace("/", " "),
// OldPositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
// OldPositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
// OldPositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
// OldPositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
// OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
// LeaveDate = p.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
@ -656,24 +636,17 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementTransfer>()
on r.RefPlacementProfileId equals p.Id
join pf in _dbContext.Set<Profile>()
.Include(x => x.Position)
.Include(x => x.PositionLevel)
.Include(x => x.PositionType)
.Include(x => x.PosNo)
.Include(x => x.Salaries)
on r.CitizenId equals pf.CitizenId
orderby r.Sequence
select new CommandType13Response
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
PositionName = pf.Position == null ? "" : pf.Position.Name,
PositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
PositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
PositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
PositionName = p.PositionOld == null ? "" : p.PositionOld,
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld,
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
//Salary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiShortDate2().ToThaiNumber(),
@ -723,11 +696,16 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionType = p.PositionTypeOld ?? "",
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
// NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
// NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name,
// NewPositionType = p.PositionType == null ? "" : p.PositionType.Name,
// NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name.ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,47 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Application.Responses
{
public class OrgRequest
{
public OrgRequestData result { get; set; } = new();
}
public class OrgRequestData
{
public string? profileId { get; set; }
public string? prefix { get; set; }
public string? firstName { get; set; }
public string? lastName { get; set; }
public string? citizenId { get; set; }
public string? root { get; set; }
public string? rootId { get; set; }
public string? rootShortName { get; set; }
public string? child1 { get; set; }
public string? child1Id { get; set; }
public string? child1ShortName { get; set; }
public string? child2 { get; set; }
public string? child2Id { get; set; }
public string? child2ShortName { get; set; }
public string? child3 { get; set; }
public string? child3Id { get; set; }
public string? child3ShortName { get; set; }
public string? child4 { get; set; }
public string? child4Id { get; set; }
public string? child4ShortName { get; set; }
public string? node { get; set; }
public string? nodeId { get; set; }
public string? nodeShortName { get; set; }
public int? posMasterNo { get; set; }
public string? position { get; set; }
public string? posTypeId { get; set; }
public string? posTypeName { get; set; }
public int? posTypeRank { get; set; }
public string? posLevelId { get; set; }
public string? posLevelName { get; set; }
public int? posLevelRank { get; set; }
public string? posExecutiveId { get; set; }
public string? posExecutiveName { get; set; }
public string? posNo { get; set; }
}
}

View file

@ -11,7 +11,7 @@
{
public Guid id { get; set; } = Guid.Empty;
public string citizenId { get; set; } = string.Empty;
public string prefix { 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 string? profileId { get; set; } = string.Empty;

View file

@ -4569,7 +4569,7 @@ namespace BMA.EHR.Command.Service.Controllers
PersonalId = r.Id,
Sequence = r.Sequence,
IdCard = r.CitizenId,
Name = $"{r.FirstName!} {r.LastName!}",
Name = $"{r.Prefix}{r.FirstName} {r.LastName}",
SelectStatus = r.RefPlacementProfileId == null ? false : (existed.FirstOrDefault(x => x.RefPlacementProfileId!.Value == r.RefPlacementProfileId!.Value) != null),
Education = "" // ยังหาไม่เจอว่าอยุ่ field ไหน
}).ToList();

View file

@ -43,6 +43,8 @@ namespace BMA.EHR.Domain.Models.Retirement
public DateTime? PositionDate { get; set; }
[Comment("วันที่พ้นจากราชการทหาร")]
public DateTime? MilitaryDate { get; set; }
[Comment("วันที่ออกราชการเมื่อ")]
public DateTime? LeaveDate { get; set; }
[Comment("profile Id")]

View file

@ -0,0 +1,75 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableRetirementOtheraddleavedate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ProfileLeaves_Profiles_ProfileId",
table: "ProfileLeaves");
migrationBuilder.AddColumn<DateTime>(
name: "LeaveDate",
table: "RetirementOthers",
type: "datetime(6)",
nullable: true,
comment: "วันที่ออกราชการเมื่อ");
migrationBuilder.AlterColumn<Guid>(
name: "ProfileId",
table: "ProfileLeaves",
type: "char(36)",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_ProfileLeaves_Profiles_ProfileId",
table: "ProfileLeaves",
column: "ProfileId",
principalTable: "Profiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ProfileLeaves_Profiles_ProfileId",
table: "ProfileLeaves");
migrationBuilder.DropColumn(
name: "LeaveDate",
table: "RetirementOthers");
migrationBuilder.AlterColumn<Guid>(
name: "ProfileId",
table: "ProfileLeaves",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddForeignKey(
name: "FK_ProfileLeaves_Profiles_ProfileId",
table: "ProfileLeaves",
column: "ProfileId",
principalTable: "Profiles",
principalColumn: "Id");
}
}
}

View file

@ -4174,7 +4174,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("double")
.HasComment("ลาครั้งที่");
b.Property<Guid?>("ProfileId")
b.Property<Guid>("ProfileId")
.HasColumnType("char(36)");
b.Property<string>("Reason")
@ -14423,6 +14423,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<DateTime?>("LeaveDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ออกราชการเมื่อ");
b.Property<DateTime?>("MilitaryDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่พ้นจากราชการทหาร");
@ -16432,16 +16436,16 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileLeave", b =>
{
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", null)
.WithMany("Leaves")
.HasForeignKey("ProfileId");
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.HR.TypeLeave", "TypeLeave")
.WithMany()
.HasForeignKey("TypeLeaveId");
b.Navigation("Profile");
b.Navigation("TypeLeave");
});

View file

@ -533,7 +533,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.orgRevisionId = req.orgRevisionId;
uppdated.positionId = req.positionId;
uppdated.posMasterNo = req.posMasterNo;
uppdated.position = req.position;
uppdated.position = req.positionName;
uppdated.positionField = req.positionField;
uppdated.posTypeId = req.posTypeId;
uppdated.posTypeName = req.posTypeName;

View file

@ -529,7 +529,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.orgRevisionId = req.orgRevisionId;
uppdated.positionId = req.positionId;
uppdated.posMasterNo = req.posMasterNo;
uppdated.position = req.position;
uppdated.position = req.positionName;
uppdated.positionField = req.positionField;
uppdated.posTypeId = req.posTypeId;
uppdated.posTypeName = req.posTypeName;

View file

@ -135,6 +135,132 @@ namespace BMA.EHR.Placement.Service.Controllers
}
}
/// <summary>
/// list รายการช่วยราชการของ Keycloak
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("keycloak")]
public async Task<ActionResult<ResponseObject>> GetListByKeycloak()
{
var apiUrl = $"{_configuration["API"]}org/profile/keycloak/position";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
var placementOfficers = await _context.PlacementOfficers.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => x.Status == "DONE")
.Where(x => x.profileId == org.result.profileId)
.Select(p => new
{
p.Id,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Reason,
p.Status,
p.DateStart,
p.DateEnd,
p.Organization,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
return Success(placementOfficers);
}
}
/// <summary>
/// list รายการช่วยราชการของ ProfileId
/// </summary>
/// <returns></returns>
/// <response code="200"></response>
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("profileId/{id}")]
public async Task<ActionResult<ResponseObject>> GetListByProfileId(string id)
{
var placementOfficers = await _context.PlacementOfficers.AsQueryable()
.OrderByDescending(x => x.CreatedAt)
.Where(x => x.Status == "DONE")
.Where(x => x.profileId == id)
.Select(p => new
{
p.Id,
p.prefix,
p.firstName,
p.lastName,
p.rootOld,
p.rootOldId,
p.rootShortNameOld,
p.child1Old,
p.child1OldId,
p.child1ShortNameOld,
p.child2Old,
p.child2OldId,
p.child2ShortNameOld,
p.child3Old,
p.child3OldId,
p.child3ShortNameOld,
p.child4Old,
p.child4OldId,
p.child4ShortNameOld,
p.PositionOld,
p.posMasterNoOld,
p.posTypeOldId,
p.posTypeNameOld,
p.posLevelOldId,
p.posLevelNameOld,
p.CreatedAt,
p.Reason,
p.Status,
p.DateStart,
p.DateEnd,
p.Organization,
p.OrganizationPositionOld,
p.IsActive,
})
.ToListAsync();
return Success(placementOfficers);
}
/// <summary>
/// get รายละเอียดช่วยราชการเจ้าหน้าที่
/// </summary>

View file

@ -633,7 +633,7 @@ namespace BMA.EHR.Placement.Service.Controllers
uppdated.orgRevisionId = req.orgRevisionId;
uppdated.positionId = req.positionId;
uppdated.posMasterNo = req.posMasterNo;
uppdated.position = req.position;
uppdated.position = req.positionName;
uppdated.positionField = req.positionField;
uppdated.posTypeId = req.posTypeId;
uppdated.posTypeName = req.posTypeName;

View file

@ -22,7 +22,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string? orgRevisionId { get; set; }
public int? posMasterNo { get; set; }
public string? positionId { get; set; }
public string? position { get; set; }
public string? positionName { get; set; }
public string? positionField { get; set; }
public string? posTypeId { get; set; }
public string? posTypeName { get; set; }

View file

@ -22,7 +22,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string? orgRevisionId { get; set; }
public int? posMasterNo { get; set; }
public string? positionId { get; set; }
public string? position { get; set; }
public string? positionName { get; set; }
public string? positionField { get; set; }
public string? posTypeId { get; set; }
public string? posTypeName { get; set; }

View file

@ -22,7 +22,7 @@ namespace BMA.EHR.Placement.Service.Requests
public string? orgRevisionId { get; set; }
public int? posMasterNo { get; set; }
public string? positionId { get; set; }
public string? position { get; set; }
public string? positionName { get; set; }
public string? positionField { get; set; }
public string? posTypeId { get; set; }
public string? posTypeName { get; set; }

View file

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Telerik.Reporting;
using Telerik.Reporting.Processing;
using System.Text.RegularExpressions;
namespace BMA.EHR.Report.Service.Controllers
{
@ -158,10 +159,12 @@ namespace BMA.EHR.Report.Service.Controllers
dynamic knowledges = probation.GetType().GetProperty("Knowledge").GetValue(probation);
foreach (var knowledge in knowledges)
{
string output = Regex.Replace(knowledge.description, "<.*?>", string.Empty);
output = output.Replace("&nbsp;", " ");
_knowledgeList.Add(new
{
Title = knowledge.title,
Description =knowledge.description
Description = output
});
}
var tblKnowledges = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table3"];
@ -171,11 +174,13 @@ namespace BMA.EHR.Report.Service.Controllers
dynamic competencys = probation.GetType().GetProperty("Competency").GetValue(probation);
foreach (var competency in competencys)
{
string output = Regex.Replace(competency.description, "<.*?>", string.Empty);
output = output.Replace("&nbsp;", " ");
_competencysList.Add(new
{
Id = competency.id,
Title = competency.title,
Description = competency.description
Description = output
});
}
var tblCompetencys = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table4"];

View file

@ -90,7 +90,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
@ -286,7 +286,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
return Error("ไม่พบหน่วยงานของผู้ใช้งานคนนี้", 404);
@ -320,6 +320,23 @@ namespace BMA.EHR.Retirement.Service.Controllers
}
await _context.RetirementDeceaseds.AddAsync(retirementDeceased);
await _context.SaveChangesAsync();
var _baseAPI = _configuration["API"];
var _apiUrl = $"{_baseAPI}/org/profile/leave/{req.ProfileId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
var _req = new HttpRequestMessage(HttpMethod.Post, _apiUrl);
var _res = await client.PostAsJsonAsync(_apiUrl, new
{
isLeave = true,
leaveReason = "ถึงแก่กรรม",
leaveDate = req.Date,
});
var _result = await _res.Content.ReadAsStringAsync();
}
var _doc = new Domain.Models.Documents.Document();
if (Request.Form.Files != null && Request.Form.Files.Count != 0)
{
@ -384,15 +401,15 @@ namespace BMA.EHR.Retirement.Service.Controllers
// {
retirementDeceased.RetirementDeceasedNotis.Add(new RetirementDeceasedNoti
{
CitizenId = retirementDeceased.citizenId,
Prefix = retirementDeceased.prefix,
FirstName = retirementDeceased.firstName,
LastName = retirementDeceased.lastName,
CitizenId = retirementDeceased.citizenId == null ? "" : retirementDeceased.citizenId,
Prefix = retirementDeceased.prefix == null ? "" : retirementDeceased.prefix,
FirstName = retirementDeceased.firstName == null ? "" : retirementDeceased.firstName,
LastName = retirementDeceased.lastName == null ? "" : retirementDeceased.lastName,
IsSendMail = true,
IsSendInbox = true,
IsSendNotification = true,
// OrganizationName = retirementDeceased.OrganizationName,
PositionName = retirementDeceased.position,
PositionName = retirementDeceased.position == null ? "" : retirementDeceased.position,
profileId = req.ProfileId,
CreatedFullName = FullName ?? "System Administrator",
CreatedUserId = UserId ?? "",
@ -557,7 +574,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
var _res = await client.SendAsync(_req);
var _result = await _res.Content.ReadAsStringAsync();
var org = JsonConvert.DeserializeObject<OrgRequest>(_result);
var org = JsonConvert.DeserializeObject<Requests.OrgRequest>(_result);
if (org == null || org.result == null)
continue;

View file

@ -343,6 +343,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
retirementOther.posLevelOldId = org.result.posLevelId;
retirementOther.posLevelNameOld = org.result.posLevelName;
retirementOther.LeaveDate = org.result.leaveDate;
retirementOther.PositionOld = org.result.position;
retirementOther.PositionLevelOld = org.result.posLevelName;
retirementOther.PositionTypeOld = org.result.posTypeName;

View file

@ -269,6 +269,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
p.posLevelOldId,
p.posLevelNameOld,
p.IsNoDebt,
p.IsNoBurden,
p.IsDiscipline,
// Avatar = p.Profile.Avatar == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Avatar.Id,
RetirementResignDocs = p.RetirementResignDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
// RetirementResignDebtDocs = p.RetirementResignDebtDocs.Where(d => d.Document != null).Select(d => new { d.Document.Id, d.Document.FileName }),
@ -356,6 +358,8 @@ namespace BMA.EHR.Retirement.Service.Controllers
data.posLevelOldId,
data.posLevelNameOld,
data.IsNoDebt,
data.IsNoBurden,
data.IsDiscipline,
// Avatar = data.Avatar == Guid.Parse("00000000-0000-0000-0000-000000000000") ? null : await _documentService.ImagesPath(data.Avatar),
Docs = retirementResignDocs,
// DocDebts = retirementResignDebtDocs,

View file

@ -43,5 +43,6 @@ namespace BMA.EHR.Retirement.Service.Requests
public string? posExecutiveId { get; set; }
public string? posExecutiveName { get; set; }
public string? posNo { get; set; }
public DateTime? leaveDate { get; set; }
}
}