Gen หน้าคำสั่ง
This commit is contained in:
parent
1404ba3be5
commit
cf966cd096
15 changed files with 817 additions and 33 deletions
|
|
@ -4,6 +4,7 @@ using BMA.EHR.Domain.Extensions;
|
|||
using BMA.EHR.Domain.Models.Commands.Core;
|
||||
using BMA.EHR.Domain.Models.HR;
|
||||
using BMA.EHR.Domain.Models.Placement;
|
||||
using BMA.EHR.Domain.Models.Retirement;
|
||||
using BMA.EHR.Domain.Shared;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
|
@ -345,6 +346,241 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
select new CommandType15Response
|
||||
{
|
||||
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.ToThaiFullDate3(),
|
||||
EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiFullDate3(),
|
||||
})
|
||||
.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
|
||||
select new CommandType17Response
|
||||
{
|
||||
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,
|
||||
ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiFullDate3(),
|
||||
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? 0 : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value,
|
||||
})
|
||||
.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
|
||||
select new CommandType18Response
|
||||
{
|
||||
CommandNo = r.Command.CommandNo,
|
||||
CommandYear = r.Command.CommandYear,
|
||||
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(),
|
||||
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,
|
||||
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? 0 : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value,
|
||||
Fault = r.Command.Fault,
|
||||
GuiltyBasis = r.Command.GuiltyBasis,
|
||||
ConclusionFireNo = r.Command!.ConclusionFireNo,
|
||||
ConclusionFireDate = r.Command.ConclusionFireDate == null ? "" : r.Command.ConclusionFireDate.Value.ToThaiFullDate3(),
|
||||
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
|
||||
select new CommandType18Response
|
||||
{
|
||||
CommandNo = r.Command.CommandNo,
|
||||
CommandYear = r.Command.CommandYear,
|
||||
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(),
|
||||
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,
|
||||
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? 0 : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value,
|
||||
Fault = r.Command.Fault,
|
||||
GuiltyBasis = r.Command.GuiltyBasis,
|
||||
ConclusionFireNo = r.Command!.ConclusionFireNo,
|
||||
ConclusionFireDate = r.Command.ConclusionFireDate == null ? "" : r.Command.ConclusionFireDate.Value.ToThaiFullDate3(),
|
||||
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,
|
||||
CommandYear = r.Command.CommandYear,
|
||||
CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(),
|
||||
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,
|
||||
Salary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? 0 : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value,
|
||||
Fault = r.Command.Fault,
|
||||
GuiltyBasis = r.Command.GuiltyBasis,
|
||||
ConclusionFireNo = r.Command!.ConclusionFireNo,
|
||||
ConclusionFireDate = r.Command.ConclusionFireDate == null ? "" : r.Command.ConclusionFireDate.Value.ToThaiFullDate3(),
|
||||
ConclusionFireResolution = r.Command.ConclusionFireResolution
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return report_data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
namespace BMA.EHR.Application.Responses.Reports
|
||||
{
|
||||
public class CommandType15Response
|
||||
{
|
||||
public string CitizenId { get; set; } = string.Empty;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
public string PositionName { get; set;} = string.Empty;
|
||||
|
||||
public string Organization { get; set;} = string.Empty;
|
||||
|
||||
public string StartDate { get; set; } = string.Empty;
|
||||
|
||||
public string EndDate { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
namespace BMA.EHR.Application.Responses.Reports
|
||||
{
|
||||
public class CommandType17Response
|
||||
{
|
||||
public string CitizenId { get; set; } = string.Empty;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
public string Organization { get; set; } = string.Empty;
|
||||
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
|
||||
public string PositionLevel { get; set; } = string.Empty;
|
||||
|
||||
public string PositionType { get; set; } = string.Empty;
|
||||
|
||||
public string PositionNumber { get; set; } = string.Empty;
|
||||
|
||||
public double Salary { get; set; } = 0;
|
||||
|
||||
public string ActiveDate { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
namespace BMA.EHR.Application.Responses.Reports
|
||||
{
|
||||
public class CommandType18Response
|
||||
{
|
||||
public string CommandNo { get; set; } = string.Empty;
|
||||
|
||||
public string CommandYear { get; set; } = string.Empty;
|
||||
|
||||
public string IssuerOrganizationName { get; set; } = string.Empty;
|
||||
|
||||
public string CommandAffectDate { get; set; } = string.Empty;
|
||||
|
||||
public string AuthorizedUserFullName { get; set; } = string.Empty;
|
||||
|
||||
public string AuthorizedPosition { get; set; } = string.Empty;
|
||||
|
||||
public string CitizenId { get; set; } = string.Empty;
|
||||
|
||||
public string FullName { get; set; } = string.Empty;
|
||||
|
||||
public string Organization { get; set; } = string.Empty;
|
||||
|
||||
public string PositionName { get; set; } = string.Empty;
|
||||
|
||||
public string PositionLevel { get; set; } = string.Empty;
|
||||
|
||||
public string PositionType { get; set; } = string.Empty;
|
||||
|
||||
public string PositionNumber { get; set; } = string.Empty;
|
||||
|
||||
public double Salary { get; set; } = 0;
|
||||
|
||||
public string Fault { get; set; } = string.Empty;
|
||||
|
||||
public string GuiltyBasis { get; set; } = string.Empty;
|
||||
|
||||
public string ConclusionFireNo { get; set; } = string.Empty;
|
||||
|
||||
public string ConclusionFireDate { get; set; } = string.Empty;
|
||||
|
||||
public string ConclusionFireResolution { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue