diff --git a/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs index e9e73368..2d833fb6 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs @@ -57,7 +57,7 @@ namespace BMA.EHR.Application.Repositories.Commands #region " Methods " - public async Task> GetCommandType01AttachmentAsync(Guid id) + public async Task> GetCommandType01AttachmentAsync(Guid id) { try { @@ -70,18 +70,33 @@ namespace BMA.EHR.Application.Repositories.Commands throw new Exception(GlobalMessages.CommandNotFound); } - var ret = new List(); + var report_data = (from r in raw_data + join p in _dbContext.Set() + .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 + select new CommandType01Response + { + 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, + Salary = p.Amount == null ? 0 : p.Amount.Value, + AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3(), + ExamNumber = p.ExamNumber == null ? 0 : p.ExamNumber.Value, + PlacementName = $"{p.Placement.Name} ครั้งที่ {p.Placement.Round}/{p.Placement.Year.ToThaiYear()}" + }).ToList(); - foreach (var c in raw_data) - { - ret.Add(new - { - FullName = $"{c.Prefix}{c.FirstName} {c.LastName}", - PositionName = "" - }); - } - - return ret; + return report_data; + } catch { @@ -89,7 +104,7 @@ namespace BMA.EHR.Application.Repositories.Commands } } - public async Task> GetCommandType02AttachmentAsync(Guid id) + public async Task> GetCommandType02AttachmentAsync(Guid id) { try { @@ -102,18 +117,32 @@ namespace BMA.EHR.Application.Repositories.Commands throw new Exception(GlobalMessages.CommandNotFound); } - var ret = new List(); + var report_data = (from r in raw_data + join p in _dbContext.Set() + .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 + select new CommandType01Response + { + 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, + Salary = p.Amount == null ? 0 : p.Amount.Value, + AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3(), + ExamNumber = p.ExamNumber == null ? 0 : p.ExamNumber.Value, + PlacementName = $"{p.Placement.Name} ครั้งที่ {p.Placement.Round}/{p.Placement.Year.ToThaiYear()}" + }).ToList(); - foreach (var c in raw_data) - { - ret.Add(new - { - FullName = $"{c.Prefix}{c.FirstName} {c.LastName}", - PositionName = "" - }); - } - - return ret; + return report_data; } catch { @@ -306,7 +335,7 @@ namespace BMA.EHR.Application.Repositories.Commands } var report_data = (from r in raw_data - join p in _dbContext.Set() + join p in _dbContext.Set() .Include(x => x.OrganizationPosition) .ThenInclude(x => x.Organization) .Include(x => x.PositionPath) @@ -364,6 +393,17 @@ namespace BMA.EHR.Application.Repositories.Commands var report_data = (from r in raw_data join p in _dbContext.Set() + .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) @@ -371,24 +411,17 @@ namespace BMA.EHR.Application.Repositories.Commands .Include(x => x.PositionNumber) .Include(x => x.PositionType) on r.RefPlacementProfileId equals p.Id - join pf in _dbContext.Set() - .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 select new CommandType03Response { 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, - OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? 0 : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value, - NewOc = _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"), + 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, + OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? 0 : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value, + 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, @@ -421,6 +454,17 @@ namespace BMA.EHR.Application.Repositories.Commands var report_data = (from r in raw_data join p in _dbContext.Set() + .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) @@ -428,24 +472,17 @@ namespace BMA.EHR.Application.Repositories.Commands .Include(x => x.PositionNumber) .Include(x => x.PositionType) on r.RefPlacementProfileId equals p.Id - join pf in _dbContext.Set() - .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 select new CommandType03Response { 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, - OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? 0 : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value, - NewOc = _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"), + 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, + OldSalary = p.Profile.Salaries == null || p.Profile.Salaries.Count == 0 ? 0 : p.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value, + 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, @@ -473,7 +510,7 @@ namespace BMA.EHR.Application.Repositories.Commands .Select(r => new CommandType11Response { CommandNo = r.Command.CommandNo, - CommandYear = r.Command.CommandYear, + CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString(), CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(), IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, @@ -508,7 +545,7 @@ namespace BMA.EHR.Application.Repositories.Commands .Select(r => new CommandType11Response { CommandNo = r.Command.CommandNo, - CommandYear = r.Command.CommandYear, + CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString(), CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(), IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, @@ -724,7 +761,7 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType18Response { CommandNo = r.Command.CommandNo, - CommandYear = r.Command.CommandYear, + CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString(), CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(), IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, @@ -776,7 +813,7 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType18Response { CommandNo = r.Command.CommandNo, - CommandYear = r.Command.CommandYear, + CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString(), CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(), IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, @@ -828,7 +865,7 @@ namespace BMA.EHR.Application.Repositories.Commands select new CommandType18Response { CommandNo = r.Command.CommandNo, - CommandYear = r.Command.CommandYear, + CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString(), CommandAffectDate = r.Command.CommandAffectDate == null ? "" : r.Command.CommandAffectDate.Value.ToThaiFullDate3(), IssuerOrganizationName = r.Command.IssuerOrganizationName, AuthorizedUserFullName = r.Command.AuthorizedUserFullName, diff --git a/BMA.EHR.Application/Responses/Reports/CommandType01Response.cs b/BMA.EHR.Application/Responses/Reports/CommandType01Response.cs new file mode 100644 index 00000000..4ff30558 --- /dev/null +++ b/BMA.EHR.Application/Responses/Reports/CommandType01Response.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BMA.EHR.Application.Responses.Reports +{ + public class CommandType01Response + { + public string CitizenId { get; set; } = string.Empty; + + public string FullName { get; set; } = string.Empty; + + public string Oc { 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 AppointDate { get; set; } = string.Empty; + + public int ExamNumber { get; set; } = 0; + + public string PlacementName { get; set;} = string.Empty; + } +} diff --git a/BMA.EHR.Command.Service/Controllers/OrderController.cs b/BMA.EHR.Command.Service/Controllers/OrderController.cs index 8b0810d7..2a8342b6 100644 --- a/BMA.EHR.Command.Service/Controllers/OrderController.cs +++ b/BMA.EHR.Command.Service/Controllers/OrderController.cs @@ -2747,7 +2747,7 @@ namespace BMA.EHR.Command.Service.Controllers case "C-PM-01": case "C-PM-02": case "C-PM-03": - case "c-PM-04": + case "C-PM-04": { foreach (var r in receivers) { diff --git a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs index e051449c..ee36ce0c 100644 --- a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs @@ -836,7 +836,7 @@ namespace BMA.EHR.Report.Service.Controllers throw new Exception(GlobalMessages.CommandNotFound); } - var data = await _commandReportRepository.GetCommandType05_06AttachmentAsync(commandId); + var data = await _commandReportRepository.GetCommandType07AttachmentAsync(commandId); var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"07-แนบท้ายคำสั่งย้าย.trdp"); diff --git a/BMA.EHR.Report.Service/Reports/01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-2.trdp b/BMA.EHR.Report.Service/Reports/01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-2.trdp index b6e4d7eb..ec4c6aa2 100644 Binary files a/BMA.EHR.Report.Service/Reports/01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-2.trdp and b/BMA.EHR.Report.Service/Reports/01-คำสั่งบรรจุและแต่งตั้งผู้สอบแข่งขันได้-2.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-4.trdp b/BMA.EHR.Report.Service/Reports/02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-4.trdp index fd8e1952..c2447037 100644 Binary files a/BMA.EHR.Report.Service/Reports/02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-4.trdp and b/BMA.EHR.Report.Service/Reports/02-คำสั่งบรรจุและแต่งตั้งผู้ได้รับคัดเลือก-4.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/07-คำสั่งย้าย.trdp.bak b/BMA.EHR.Report.Service/Reports/07-คำสั่งย้าย.trdp.bak new file mode 100644 index 00000000..115ac5bf Binary files /dev/null and b/BMA.EHR.Report.Service/Reports/07-คำสั่งย้าย.trdp.bak differ diff --git a/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp b/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp index 9938d1b3..7b344c75 100644 Binary files a/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp and b/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.trdp b/BMA.EHR.Report.Service/Reports/09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.trdp index 443b6a1d..be273f93 100644 Binary files a/BMA.EHR.Report.Service/Reports/09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.trdp and b/BMA.EHR.Report.Service/Reports/09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.trdp differ