972 lines
59 KiB
C#
972 lines
59 KiB
C#
using BMA.EHR.Application.Common.Interfaces;
|
|
using BMA.EHR.Application.Responses.Reports;
|
|
using BMA.EHR.Domain.Extensions;
|
|
using BMA.EHR.Domain.Models.Commands.Core;
|
|
using BMA.EHR.Domain.Models.HR;
|
|
using BMA.EHR.Domain.Models.OrganizationEmployee;
|
|
using BMA.EHR.Domain.Models.Placement;
|
|
using BMA.EHR.Domain.Models.Retirement;
|
|
using BMA.EHR.Domain.Shared;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace BMA.EHR.Application.Repositories.Commands
|
|
{
|
|
public class CommandReportRepository : GenericRepository<Guid, Command>
|
|
{
|
|
#region " Fields "
|
|
|
|
private readonly IApplicationDBContext _dbContext;
|
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
|
private readonly OrganizationCommonRepository _organizationCommonRepository;
|
|
private readonly UserProfileRepository _userProfileRepository;
|
|
|
|
#endregion
|
|
|
|
#region " Constructor and Destuctor "
|
|
|
|
public CommandReportRepository(IApplicationDBContext dbContext,
|
|
IHttpContextAccessor httpContextAccessor,
|
|
OrganizationCommonRepository organizationCommonRepository,
|
|
UserProfileRepository userProfileRepository) : base(dbContext, httpContextAccessor)
|
|
{
|
|
_dbContext = dbContext;
|
|
_httpContextAccessor = httpContextAccessor;
|
|
_organizationCommonRepository = organizationCommonRepository;
|
|
_userProfileRepository = userProfileRepository;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region " Properties "
|
|
|
|
protected Guid UserOrganizationId
|
|
{
|
|
get
|
|
{
|
|
if (UserId != null || UserId != "")
|
|
return _userProfileRepository.GetUserOCId(Guid.Parse(UserId!));
|
|
else
|
|
return Guid.Empty;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region " Methods "
|
|
|
|
public async Task<List<CommandType01Response>> GetCommandType01AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<PlacementProfile>()
|
|
.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)
|
|
on r.RefPlacementProfileId equals p.Id
|
|
orderby r.Sequence
|
|
select new CommandType01Response
|
|
{
|
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
Oc = _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(),
|
|
Salary = p.Amount == null ? "0" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
|
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.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()}"
|
|
}).ToList();
|
|
|
|
return report_data;
|
|
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType01Response>> GetCommandType02AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<PlacementProfile>()
|
|
.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)
|
|
on r.RefPlacementProfileId equals p.Id
|
|
orderby r.Sequence
|
|
select new CommandType01Response
|
|
{
|
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
Oc = _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(),
|
|
Salary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.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()}"
|
|
}).ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType03Response>> GetCommandType03AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<PlacementProfile>()
|
|
.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)
|
|
on r.CitizenId equals pf.CitizenId
|
|
orderby r.Sequence
|
|
select new CommandType03Response
|
|
{
|
|
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(),
|
|
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
NewOc = _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()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType03Response>> GetCommandType04AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<PlacementProfile>()
|
|
.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)
|
|
on r.CitizenId equals pf.CitizenId
|
|
orderby r.Sequence
|
|
select new CommandType03Response
|
|
{
|
|
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(),
|
|
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
NewOc = _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()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType03Response>> GetCommandType05_06AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
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)
|
|
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 CommandType03Response
|
|
{
|
|
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(),
|
|
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
NewOc = _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()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType03Response>> GetCommandType07AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
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)
|
|
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 CommandType03Response
|
|
{
|
|
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(),
|
|
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
NewOc = _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()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType03Response>> GetCommandType08AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
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.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
|
|
{
|
|
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(),
|
|
NewOc = p.OrganizationPosition == 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()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType03Response>> GetCommandType09AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
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.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
|
|
{
|
|
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(),
|
|
NewOc = p.OrganizationPosition == 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()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType11Response>> GetCommandType11Async(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.Select(r => new CommandType11Response
|
|
{
|
|
CommandNo = r.Command.CommandNo.ToThaiNumber(),
|
|
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
IssuerOrganizationName = r.Command.IssuerOrganizationName,
|
|
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
|
|
AuthorizedPosition = r.Command.AuthorizedPosition,
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
PlacementCommandIssuer = r.Command.PlacementCommandIssuer,
|
|
PlacementCommandNo = r.Command.PlacementCommandNo.ToThaiNumber(),
|
|
PlacementCommandDate = r.Command.PlacementCommandDate == null ? "" : r.Command.PlacementCommandDate.Value.ToThaiFullDate3().ToThaiNumber()
|
|
})
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
return raw_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType11Response>> GetCommandType12Async(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.Select(r => new CommandType11Response
|
|
{
|
|
CommandNo = r.Command.CommandNo.ToThaiNumber(),
|
|
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
IssuerOrganizationName = r.Command.IssuerOrganizationName,
|
|
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
|
|
AuthorizedPosition = r.Command.AuthorizedPosition,
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
PlacementCommandIssuer = r.Command.PlacementCommandIssuer,
|
|
PlacementCommandNo = r.Command.PlacementCommandNo.ToThaiNumber(),
|
|
PlacementCommandDate = r.Command.PlacementCommandDate == null ? "" : r.Command.PlacementCommandDate.Value.ToThaiFullDate3().ToThaiNumber()
|
|
})
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
return raw_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType13Response>> GetCommandType13AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
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(),
|
|
Salary = pf.Salaries == null || pf.Salaries.Count == 0 ? "" : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
ActiveDate = "",
|
|
ReceiveOrganizationName = r.Command!.ReceiveOrganizationName
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType03Response>> GetCommandType14AttachmentAsync(Guid id)
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
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)
|
|
on r.RefPlacementProfileId equals p.Id
|
|
orderby r.Sequence
|
|
select new CommandType03Response
|
|
{
|
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
OldOc = p.OrganizationPositionOld,
|
|
OldPositionName = p.OrganizationPositionOld,
|
|
OldPositionLevel = p.PositionLevelOld,
|
|
OldPositionType = p.PositionTypeOld,
|
|
OldPositionNumber = p.PositionNumberOld.ToThaiNumber(),
|
|
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
NewOc = _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()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
|
|
public async Task<List<CommandType15Response>> GetCommandType15AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<PlacementOfficer>()
|
|
.Include(p => p.Profile)
|
|
.ThenInclude(p => p.Position)
|
|
on r.RefPlacementProfileId equals p.Id
|
|
orderby r.Sequence
|
|
select new CommandType15Response
|
|
{
|
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
|
Organization = p.Organization,
|
|
StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate2().ToThaiNumber(),
|
|
EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiShortDate2().ToThaiNumber(),
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType17Response>> GetCommandType17AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<RetirementResign>()
|
|
.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 CommandType17Response
|
|
{
|
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
|
Organization = p.OrganizationPositionOld,
|
|
PositionLevel = p.PositionLevelOld,
|
|
PositionType = p.PositionTypeOld,
|
|
PositionNumber = p.PositionNumberOld.ToThaiNumber(),
|
|
ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiShortDate2().ToThaiNumber(),
|
|
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
Remark = p.Reason ?? ""
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType18Response>> GetCommandType18Async(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
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)
|
|
on r.RefPlacementProfileId equals p.Id
|
|
orderby r.Sequence
|
|
select new CommandType18Response
|
|
{
|
|
CommandNo = r.Command.CommandNo.ToThaiNumber(),
|
|
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
IssuerOrganizationName = r.Command.IssuerOrganizationName,
|
|
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
|
|
AuthorizedPosition = r.Command.AuthorizedPosition,
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
|
Organization = p.OrganizationPositionOld,
|
|
PositionLevel = p.PositionLevelOld,
|
|
PositionType = p.PositionTypeOld,
|
|
PositionNumber = p.PositionNumberOld.ToThaiNumber(),
|
|
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
Fault = r.Command.Fault,
|
|
GuiltyBasis = r.Command.GuiltyBasis,
|
|
ConclusionFireNo = r.Command!.ConclusionFireNo.ToThaiNumber(),
|
|
ConclusionFireDate = r.Command.ConclusionFireDate == null ? "" : r.Command.ConclusionFireDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
ConclusionFireResolution = r.Command.ConclusionFireResolution
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType18Response>> GetCommandType19Async(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<RetirementDischarge>()
|
|
.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
|
|
{
|
|
CommandNo = r.Command.CommandNo.ToThaiNumber(),
|
|
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
IssuerOrganizationName = r.Command.IssuerOrganizationName,
|
|
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
|
|
AuthorizedPosition = r.Command.AuthorizedPosition,
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
|
Organization = p.OrganizationPositionOld,
|
|
PositionLevel = p.PositionLevelOld,
|
|
PositionType = p.PositionTypeOld,
|
|
PositionNumber = p.PositionNumberOld.ToThaiNumber(),
|
|
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
Fault = r.Command.Fault,
|
|
GuiltyBasis = r.Command.GuiltyBasis,
|
|
ConclusionFireNo = r.Command!.ConclusionFireNo.ToThaiNumber(),
|
|
ConclusionFireDate = r.Command.ConclusionFireDate == null ? "" : r.Command.ConclusionFireDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
ConclusionFireResolution = r.Command.ConclusionFireResolution
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType18Response>> GetCommandType20Async(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<RetirementExpulsion>()
|
|
.Include(p => p.Profile)
|
|
.ThenInclude(p => p.Position)
|
|
.Include(p => p.Profile)
|
|
.ThenInclude(p => p.Salaries)
|
|
on r.RefPlacementProfileId equals p.Id
|
|
select new CommandType18Response
|
|
{
|
|
CommandNo = r.Command.CommandNo.ToThaiNumber(),
|
|
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
|
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
IssuerOrganizationName = r.Command.IssuerOrganizationName,
|
|
AuthorizedUserFullName = r.Command.AuthorizedUserFullName,
|
|
AuthorizedPosition = r.Command.AuthorizedPosition,
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
|
Organization = p.OrganizationPositionOld,
|
|
PositionLevel = p.PositionLevelOld,
|
|
PositionType = p.PositionTypeOld,
|
|
PositionNumber = p.PositionNumberOld.ToThaiNumber(),
|
|
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? "" : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
Fault = r.Command.Fault,
|
|
GuiltyBasis = r.Command.GuiltyBasis,
|
|
ConclusionFireNo = r.Command!.ConclusionFireNo.ToThaiNumber(),
|
|
ConclusionFireDate = r.Command.ConclusionFireDate == null ? "" : r.Command.ConclusionFireDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
|
ConclusionFireResolution = r.Command.ConclusionFireResolution
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
public async Task<List<CommandType21Response>> GetCommandType21AttachmentAsync(Guid id)
|
|
{
|
|
try
|
|
{
|
|
var raw_data = await _dbContext.Set<CommandReceiver>()
|
|
.Include(c => c.Command)
|
|
.Where(c => c.Command.Id == id)
|
|
.ToListAsync();
|
|
if (raw_data == null)
|
|
{
|
|
throw new Exception(GlobalMessages.CommandNotFound);
|
|
}
|
|
|
|
var report_data = (from r in raw_data
|
|
join p in _dbContext.Set<OrganizationEmployeeProfile>()
|
|
.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)
|
|
on r.RefPlacementProfileId equals p.Id
|
|
orderby r.Sequence
|
|
select new CommandType21Response
|
|
{
|
|
Seq = r.Sequence.ToString().ToThaiNumber(),
|
|
CitizenId = r.CitizenId,
|
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
|
Organization = p.Profile!.EmployeeOc,
|
|
PositionName = p.Profile.Position == null ? "" : p.Profile.Position.Name,
|
|
PositionLevel = p.Profile.PositionLevel == null ? "" : p.Profile.PositionLevel.Name,
|
|
PositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name,
|
|
PositionNumber = p.Profile.PosNo == null ? "" : p.Profile.PosNo.Name.ToThaiNumber(),
|
|
Salary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
|
RetireDate = p.Profile.BirthDate.CalculateRetireDate().ToThaiShortDate2().ToThaiNumber()
|
|
})
|
|
.ToList();
|
|
|
|
return report_data;
|
|
}
|
|
catch
|
|
{
|
|
throw;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|