diff --git a/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs index 518d95dc..fa1330dc 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandReportRepository.cs @@ -306,7 +306,7 @@ namespace BMA.EHR.Application.Repositories.Commands NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name, NewPositionType = p.PositionType == null ? "" : p.PositionType.Name, NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name, - NewSalary = p.Amount == null ? 0 : p.Amount.Value, + NewSalary = r.Amount == null ? 0 : r.Amount.Value, AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3() }) .ToList(); @@ -363,7 +363,7 @@ namespace BMA.EHR.Application.Repositories.Commands NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name, NewPositionType = p.PositionType == null ? "" : p.PositionType.Name, NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name, - NewSalary = p.Amount == null ? 0 : p.Amount.Value, + NewSalary = r.Amount == null ? 0 : r.Amount.Value, AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3() }) .ToList(); @@ -485,7 +485,7 @@ namespace BMA.EHR.Application.Repositories.Commands NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name, NewPositionType = p.PositionType == null ? "" : p.PositionType.Name, NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name, - NewSalary = p.Amount == null ? 0 : p.Amount.Value, + NewSalary = r.Amount == null ? 0 : r.Amount.Value, AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3() }) .ToList(); @@ -649,7 +649,7 @@ namespace BMA.EHR.Application.Repositories.Commands NewPositionLevel = p.PositionLevel == null ? "" : p.PositionLevel.Name, NewPositionType = p.PositionType == null ? "" : p.PositionType.Name, NewPositionNumber = p.PositionNumber == null ? "" : p.PositionNumber.Name, - NewSalary = p.Amount == null ? 0 : p.Amount.Value, + NewSalary = r.Amount == null ? 0 : r.Amount.Value, AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3() }) .ToList(); diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index ae4fe0c8..680ca810 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -5897,6 +5897,19 @@ namespace BMA.EHR.Application.Repositories.Commands #region " Override " public override async Task GetByIdAsync(Guid id) + { + return await _dbContext.Set() + .Include(x => x.Placement) + .Include(x => x.CommandType) + //.Include(x => x.Documents) + //.ThenInclude(x => x.Document) //--REmove + .Include(x => x.Receivers) + .Include(x => x.CommandStatus) + .FirstOrDefaultAsync(x => x.Id == id); + + } + + public async Task GetByIdWithPlacementAsync(Guid id) { return await _dbContext.Set() .Include(x => x.Placement) @@ -5906,7 +5919,6 @@ namespace BMA.EHR.Application.Repositories.Commands .Include(x => x.Receivers) .Include(x => x.CommandStatus) .FirstOrDefaultAsync(x => x.Id == id); - } public override async Task> GetAllAsync() @@ -5975,14 +5987,35 @@ namespace BMA.EHR.Application.Repositories.Commands { try { - var command = await _dbContext.Set() - .Include(x => x.Receivers) + Command command = null; + + var c = await _dbContext.Set() .Include(x => x.CommandType) .FirstOrDefaultAsync(x => x.Id == id); - if (command == null) + if (c == null) throw new Exception(GlobalMessages.CommandNotFound); + switch (c.CommandType.CommandCode.ToUpper()) + { + case "C-PM-01": + case "C-PM-02": + case "C-PM-03": + case "C-PM-04": + command = await _dbContext.Set() + .Include(x => x.Placement) + .Include(x => x.Receivers) + .Include(x => x.CommandType) + .FirstOrDefaultAsync(x => x.Id == id); + break; + default: + command = await _dbContext.Set() + .Include(x => x.Receivers) + .Include(x => x.CommandType) + .FirstOrDefaultAsync(x => x.Id == id); + break; + } + var ap = (await GetReceiverForByCommndTypeAsync(command, token)).Where(x => selected.Contains(x.RefPlacementProfileId!.Value)); //var appointPeople = await _dbContext.Set() @@ -6511,21 +6544,25 @@ namespace BMA.EHR.Application.Repositories.Commands var profile = await _dbContext.Set() .Include(x => x.Salaries) .FirstOrDefaultAsync(p => p.CitizenId == cmdReceiver.CitizenId); - Double SalaryAmount = 0; - Double PositionSalaryAmount = 0; - Double MonthSalaryAmount = 0; + double? SalaryAmount = 0; + double? PositionSalaryAmount = 0; + double? MonthSalaryAmount = 0; + if (profile != null && profile.Salaries.Count() > 0) { - SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0; - PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0; - MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0; + SalaryAmount = cmdReceiver.Amount == null ? profile.Salaries == null ? 0 : + profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value : 0 : 0; + PositionSalaryAmount = cmdReceiver.PositionSalaryAmount == null ? profile.Salaries == null ? 0 : + profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount != null ? profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().PositionSalaryAmount.Value : 0 : 0; + MonthSalaryAmount = cmdReceiver.MouthSalaryAmount == null ? profile.Salaries == null ? 0 : + profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount != null ?profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().MouthSalaryAmount.Value : 0 : 0; } return new PlacementSalaryResponse { - SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount, - PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount, - MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount, + SalaryAmount = cmdReceiver.Amount != null ? cmdReceiver.Amount.Value : SalaryAmount ?? 0, + PositionSalaryAmount = cmdReceiver.PositionSalaryAmount != null ? cmdReceiver.PositionSalaryAmount.Value : PositionSalaryAmount ?? 0, + MonthSalaryAmount = cmdReceiver.MouthSalaryAmount != null ? cmdReceiver.MouthSalaryAmount.Value : MonthSalaryAmount ?? 0, }; } catch diff --git a/BMA.EHR.Report.Service/Reports/05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp b/BMA.EHR.Report.Service/Reports/05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp index 64bb8ecd..ee8f5182 100644 Binary files a/BMA.EHR.Report.Service/Reports/05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp and b/BMA.EHR.Report.Service/Reports/05-06-แนบท้ายคำสั่งแต่งตั้ง-คำสั่งเลื่อน.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/07-แนบท้ายคำสั่งย้าย.trdp b/BMA.EHR.Report.Service/Reports/07-แนบท้ายคำสั่งย้าย.trdp index 4df0b1b0..af965190 100644 Binary files a/BMA.EHR.Report.Service/Reports/07-แนบท้ายคำสั่งย้าย.trdp and b/BMA.EHR.Report.Service/Reports/07-แนบท้ายคำสั่งย้าย.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp b/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp index 77015e39..47ef598c 100644 Binary files a/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp and b/BMA.EHR.Report.Service/Reports/08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-2.trdp b/BMA.EHR.Report.Service/Reports/27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-2.trdp index db274c35..48b05202 100644 Binary files a/BMA.EHR.Report.Service/Reports/27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-2.trdp and b/BMA.EHR.Report.Service/Reports/27-คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ-2.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.trdp b/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.trdp index 6a572a25..e305824f 100644 Binary files a/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.trdp and b/BMA.EHR.Report.Service/Reports/28-คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ5-10.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/37-คำสั่งให้ออกจากราชการ.trdp b/BMA.EHR.Report.Service/Reports/37-คำสั่งให้ออกจากราชการ.trdp index 105de038..181a1b2d 100644 Binary files a/BMA.EHR.Report.Service/Reports/37-คำสั่งให้ออกจากราชการ.trdp and b/BMA.EHR.Report.Service/Reports/37-คำสั่งให้ออกจากราชการ.trdp differ