แก้ระบบบรรจุผูกโครงสร้างใหม่

This commit is contained in:
Kittapath 2024-05-02 09:31:38 +07:00
parent 57164f5d45
commit 18d75f4b04
37 changed files with 79295 additions and 3904 deletions

View file

@ -304,21 +304,21 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementAppointment>()
.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
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)
.Include(x => x.Educations)
on r.CitizenId equals pf.CitizenId
// 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)
// .Include(x => x.Educations)
// on r.CitizenId equals pf.CitizenId
orderby r.Sequence
select new CommandType03Response
{
@ -328,19 +328,19 @@ namespace BMA.EHR.Application.Repositories.Commands
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
OldPositionName = pf.Position == null ? "" : pf.Position.Name,
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
// OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
// OldPositionName = pf.Position == null ? "" : pf.Position.Name,
// OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
// 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(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date.Value.ToThaiShortDate2().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 = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Date.Value.ToThaiShortDate2().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 = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
@ -370,21 +370,21 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementAppointment>()
.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
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)
.Include(x => x.Educations)
on r.CitizenId equals pf.CitizenId
// 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)
// .Include(x => x.Educations)
// on r.CitizenId equals pf.CitizenId
orderby r.Sequence
select new CommandType03Response
{
@ -394,18 +394,18 @@ namespace BMA.EHR.Application.Repositories.Commands
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
OldPositionName = pf.Position == null ? "" : pf.Position.Name,
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name.ToThaiNumber(),
// OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
// OldPositionName = pf.Position == null ? "" : pf.Position.Name,
// OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
// 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(),
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.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 = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
@ -435,24 +435,24 @@ 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)
// .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
@ -463,21 +463,21 @@ namespace BMA.EHR.Application.Repositories.Commands
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(),
// 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(),
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.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 = 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.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToList();
@ -505,24 +505,24 @@ 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)
// .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
@ -533,21 +533,21 @@ namespace BMA.EHR.Application.Repositories.Commands
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(),
// 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(),
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.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 = 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.Profile.LeaveDate == null ? "" : p.Profile.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
@ -696,12 +696,12 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementReceive>()
.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 CommandType03Response
@ -716,11 +716,11 @@ 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.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 = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
@ -745,8 +745,8 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementOfficer>()
.Include(p => p.Profile)
.ThenInclude(p => p.Position)
//.Include(p => p.Profile)
//.ThenInclude(p => p.Position)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType15Response
@ -786,12 +786,12 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementRepatriation>()
.Include(p => p.Profile)
.ThenInclude(p => p.Position)
.Include(p => p.Profile)
.ThenInclude(p => p.Salaries)
.Include(p => p.Profile)
.ThenInclude(p => p.Prefix)
//.Include(p => p.Profile)
//.ThenInclude(p => p.Position)
//.Include(p => p.Profile)
//.ThenInclude(p => p.Salaries)
//.Include(p => p.Profile)
//.ThenInclude(p => p.Prefix)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType16Response
@ -807,7 +807,7 @@ namespace BMA.EHR.Application.Repositories.Commands
r.Command.GovAidCommandDate.Value.ToThaiFullDate3().ToThaiNumber(),
StartDate = p.Date == null ? "" : p.Date.Value.ToThaiFullDate3().ToThaiNumber(),
ActiveDate = p.DateRepatriation == null ? "" : p.DateRepatriation.Value.ToThaiFullDate3().ToThaiNumber(),
FullName = $"{p.Profile.Prefix!.Name}{p.Profile.FirstName!} {p.Profile.LastName!}",
FullName = $"{p.prefix}{p.firstName!} {p.lastName!}",
Subject = $"เรื่อง {r.Command.CommandSubject}",
})
.ToList();
@ -882,10 +882,10 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<RetirementOut>()
.Include(p => p.Profile)
.ThenInclude(p => p.Position)
.Include(p => p.Profile)
.ThenInclude(p => p.Salaries)
// .Include(p => p.Profile)
// .ThenInclude(p => p.Position)
// .Include(p => p.Profile)
// .ThenInclude(p => p.Salaries)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType18Response
@ -898,7 +898,7 @@ namespace BMA.EHR.Application.Repositories.Commands
AuthorizedPosition = r.Command.AuthorizedPosition,
CitizenId = r.CitizenId,
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
// PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
@ -1104,24 +1104,24 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementAppointment>()
.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.OrgEmployee)
.ThenInclude(x => x.OrganizationAgency)
.ThenInclude(x => x.OrganizationOrganization)
//.Include(x => x.OrgEmployee)
//.ThenInclude(x => x.PosNo)
.Include(x => x.OrgEmployee)
.ThenInclude(x => x.PositionEmployeePosition)
.Include(x => x.OrgEmployee)
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
.ThenInclude(x => x.PositionEmployeeLevel)
// .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.OrgEmployee)
// .ThenInclude(x => x.OrganizationAgency)
// .ThenInclude(x => x.OrganizationOrganization)
// //.Include(x => x.OrgEmployee)
// //.ThenInclude(x => x.PosNo)
// .Include(x => x.OrgEmployee)
// .ThenInclude(x => x.PositionEmployeePosition)
// .Include(x => x.OrgEmployee)
// .ThenInclude(x => x.OrganizationPositionEmployeeLevels)
// .ThenInclude(x => x.PositionEmployeeLevel)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType22Response
@ -1134,9 +1134,9 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionNumber = p.PositionNumberOld == null ? 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.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
// NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
// NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
// NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
@ -1231,24 +1231,24 @@ namespace BMA.EHR.Application.Repositories.Commands
var report_data = (from r in raw_data
join p in _dbContext.Set<PlacementAppointment>()
.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.OrgEmployee)
.ThenInclude(x => x.OrganizationAgency)
.ThenInclude(x => x.OrganizationOrganization)
//.Include(x => x.OrgEmployee)
//.ThenInclude(x => x.PosNo)
.Include(x => x.OrgEmployee)
.ThenInclude(x => x.PositionEmployeePosition)
.Include(x => x.OrgEmployee)
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
.ThenInclude(x => x.PositionEmployeeLevel)
// .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.OrgEmployee)
// .ThenInclude(x => x.OrganizationAgency)
// .ThenInclude(x => x.OrganizationOrganization)
// //.Include(x => x.OrgEmployee)
// //.ThenInclude(x => x.PosNo)
// .Include(x => x.OrgEmployee)
// .ThenInclude(x => x.PositionEmployeePosition)
// .Include(x => x.OrgEmployee)
// .ThenInclude(x => x.OrganizationPositionEmployeeLevels)
// .ThenInclude(x => x.PositionEmployeeLevel)
on r.RefPlacementProfileId equals p.Id
orderby r.Sequence
select new CommandType22Response
@ -1261,9 +1261,9 @@ namespace BMA.EHR.Application.Repositories.Commands
OldPositionNumber = p.PositionNumberOld == null ? 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.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
// NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
// NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
// NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})

File diff suppressed because it is too large Load diff

View file

@ -189,23 +189,41 @@ namespace BMA.EHR.Application.Repositories.Reports
.Select(p => new
{
p.Id,
ProfileId = p.Profile.Id,
Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
p.Profile.FirstName,
p.Profile.LastName,
Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
p.Profile.PositionLine,
p.Profile.PositionLineId,
PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
p.Profile.PositionExecutive,
p.Profile.PositionExecutiveId,
Organization = p.Profile.Oc,
OrganizationId = p.Profile.OcId,
p.prefix,
p.profileId,
p.firstName,
p.lastName,
p.root,
p.rootShortName,
p.child1,
p.child1ShortName,
p.child2,
p.child2ShortName,
p.child3,
p.child3ShortName,
p.child4,
p.child4ShortName,
p.posMasterNo,
p.posLevelName,
p.posTypeName,
// ProfileId = p.Profile.Id,
// Prefix = p.Profile.Prefix == null ? null : p.Profile.Prefix.Name,
// PrefixId = p.Profile.Prefix == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Prefix.Id,
// p.Profile.FirstName,
// p.Profile.LastName,
// Position = p.Profile.Position == null ? null : p.Profile.Position.Name,
// PositionId = p.Profile.Position == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.Position.Id,
// PositionType = p.Profile.PositionType == null ? null : p.Profile.PositionType.Name,
// PositionTypeId = p.Profile.PositionType == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionType.Id,
// p.Profile.PositionLine,
// p.Profile.PositionLineId,
// PositionLevel = p.Profile.PositionLevel == null ? null : p.Profile.PositionLevel.Name,
// PositionLevelId = p.Profile.PositionLevel == null ? Guid.Parse("00000000-0000-0000-0000-000000000000") : p.Profile.PositionLevel.Id,
// p.Profile.PositionExecutive,
// p.Profile.PositionExecutiveId,
// Organization = p.Profile.Oc,
// OrganizationId = p.Profile.OcId,
p.Number,
p.Date,
p.Location,
@ -216,29 +234,34 @@ namespace BMA.EHR.Application.Repositories.Reports
if (data == null)
return null;
string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
string FirstName = string.IsNullOrEmpty(data.FirstName.ToString()) ? string.Empty : data.FirstName.ToString();
string LastName = string.IsNullOrEmpty(data.LastName.ToString()) ? string.Empty : data.LastName.ToString();
string FullName = $"{Prefix} {FirstName} {LastName}";
// string Prefix = string.IsNullOrEmpty(data.Prefix.ToString()) ? string.Empty : data.Prefix.ToString();
// string FirstName = string.IsNullOrEmpty(data.FirstName.ToString()) ? string.Empty : data.FirstName.ToString();
// string LastName = string.IsNullOrEmpty(data.LastName.ToString()) ? string.Empty : data.LastName.ToString();
// string FullName = $"{Prefix} {FirstName} {LastName}";
string Date = string.IsNullOrEmpty(data.Date.ToString()) ? "วันที่ - เดือน - พ.ศ. -" : DateTime.Parse(data.Date.ToString()).ToThaiFullDate().ToString().ToThaiNumber();
string CurrentDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).ToThaiFullDate().ToString().ToThaiNumber();
return new
{
FullName,
FullName = $"{data.prefix} {data.firstName} {data.lastName}",
Date,
CurrentDate,
data.Position,
data.PositionExecutive,
data.PositionType,
data.PositionLine,
data.PositionLevel,
data.Organization,
data.PositionId,
data.PositionExecutiveId,
data.PositionTypeId,
data.PositionLineId,
data.PositionLevelId,
data.OrganizationId,
data.profileId,
data.prefix,
data.firstName,
data.lastName,
data.root,
data.rootShortName,
data.child1,
data.child1ShortName,
data.child2,
data.child2ShortName,
data.child3,
data.child3ShortName,
data.child4,
data.child4ShortName,
data.posMasterNo,
data.posLevelName,
data.posTypeName,
data.Number,
data.Location,
data.Reason,
@ -250,7 +273,7 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task<dynamic> GetHeadRetirementDeceasedAsync(Guid id)
{
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
.Include(x => x.Profile)
// .Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
var oc = "";
@ -264,28 +287,28 @@ namespace BMA.EHR.Application.Repositories.Reports
Send = "หัวหน้าสำนักงาน ก.ก.",
};
if (data.Profile.OcId != null)
{
var organization = await _dbContext.Set<OrganizationEntity>().AsQueryable()
.Where(x => x.Id == data.Profile.OcId)
.FirstOrDefaultAsync();
if (organization != null)
{
var organizationAgency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
.Where(x => x.Id == organization.OrganizationAgencyId)
.FirstOrDefaultAsync();
if (organizationAgency != null)
{
var agency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
.Where(x => x.Id == organizationAgency.Id)
.FirstOrDefaultAsync();
if (agency != null)
{
oc = agency.OrganizationOrganization?.Name;
}
}
}
}
// if (data.Profile.OcId != null)
// {
// var organization = await _dbContext.Set<OrganizationEntity>().AsQueryable()
// .Where(x => x.Id == data.Profile.OcId)
// .FirstOrDefaultAsync();
// if (organization != null)
// {
// var organizationAgency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
// .Where(x => x.Id == organization.OrganizationAgencyId)
// .FirstOrDefaultAsync();
// if (organizationAgency != null)
// {
// var agency = await _dbContext.Set<OrganizationEntity>().AsQueryable()
// .Where(x => x.Id == organizationAgency.Id)
// .FirstOrDefaultAsync();
// if (agency != null)
// {
// oc = agency.OrganizationOrganization?.Name;
// }
// }
// }
// }
return new
{
@ -302,7 +325,7 @@ namespace BMA.EHR.Application.Repositories.Reports
public async Task UploadFileRetirementDeceasedAsync(Guid id, Domain.Models.Documents.Document file)
{
var data = await _dbContext.Set<RetirementDeceased>().AsQueryable()
.Include(x => x.Profile)
// .Include(x => x.Profile)
.Where(x => x.Id == id)
.FirstOrDefaultAsync();
if (data != null)
@ -361,8 +384,8 @@ namespace BMA.EHR.Application.Repositories.Reports
data.LastName,
data.Location,
FullName = $"{data.Prefix}{data.FirstName} {data.LastName}",
SendDate = string.IsNullOrEmpty(data.SendDate.ToString())? string.Empty : DateTime.Parse(data.SendDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
ActiveDate = string.IsNullOrEmpty(data.ActiveDate.ToString())? string.Empty : DateTime.Parse(data.ActiveDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
SendDate = string.IsNullOrEmpty(data.SendDate.ToString()) ? string.Empty : DateTime.Parse(data.SendDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
ActiveDate = string.IsNullOrEmpty(data.ActiveDate.ToString()) ? string.Empty : DateTime.Parse(data.ActiveDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
data.Reason,
data.Status,
data.salary,
@ -376,7 +399,7 @@ namespace BMA.EHR.Application.Repositories.Reports
data.CreatedAt,
data.OligarchReject,
data.OligarchApproveReason,
data.OligarchRejectReason,
data.OligarchRejectReason,
OligarchRejectDate = string.IsNullOrEmpty(data.OligarchRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.OligarchRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(),
data.CommanderReject,
data.CommanderApproveReason,

View file

@ -70,16 +70,16 @@ namespace BMA.EHR.Application.Repositories
public async Task NotifyOut()
{
var cronjobNotis = await _dbContext.Set<RetirementOut>()
.Include(x => x.Profile)
.ThenInclude(x => x.Prefix)
//.Include(x => x.Profile)
//.ThenInclude(x => x.Prefix)
.Where(x => x.Date != null && x.Date.Value.Date == DateTime.Now.Date)
.AsQueryable()
.ToListAsync();
foreach (var cronjobNoti in cronjobNotis)
{
cronjobNoti.Profile.IsLeave = true;
cronjobNoti.Profile.LeaveReason = "LAYOFF";
cronjobNoti.Profile.LeaveDate = DateTime.Now;
//cronjobNoti.Profile.IsLeave = true;
//cronjobNoti.Profile.LeaveReason = "LAYOFF";
//cronjobNoti.Profile.LeaveDate = DateTime.Now;
// await _repositoryNoti.PushNotificationAsync(
// Guid.Parse("08db721d-ada0-4e64-89d3-7584a893d8b8"),
// $"แจ้งเตือนการปลดออกของ {cronjobNoti.Profile.Prefix?.Name}{cronjobNoti.Profile.FirstName} {cronjobNoti.Profile.LastName}",