diff --git a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs index f9e95cbb..0bb4105a 100644 --- a/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs +++ b/BMA.EHR.Application/Repositories/Commands/CommandRepository.cs @@ -1948,6 +1948,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = oc == null ? Guid.Empty : oc.Id, + PositionId = position!.Id, PositionLevel = placementProfile.PositionLevel, PositionLineId = placementProfile.PositionLine!.Id, @@ -2228,6 +2229,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = oc == null ? Guid.Empty : oc.Id, + PositionId = position!.Id, + PositionLevel = placementProfile.PositionLevel, PositionLineId = placementProfile.PositionLine!.Id, PositionTypeId = placementProfile.PositionType!.Id, @@ -2265,6 +2268,28 @@ namespace BMA.EHR.Application.Repositories.Commands profile.Salaries.Add(salary); + // change profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id); + if (profilePosition == null) + { + profilePosition = new ProfilePosition + { + Profile = profile, + OrganizationPosition = placementProfile.OrganizationPosition, + IsActive = true, + IsPublished = true, + }; + _dbContext.Set().Add(profilePosition); + } + else + { + profilePosition.OrganizationPosition = placementProfile.OrganizationPosition; + //_dbContext.Attatch(profilePosition); + } + // update placementstatus placementProfile.PlacementStatus = "CONTAIN"; @@ -2481,6 +2506,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = oc == null ? Guid.Empty : oc.Id, + PositionId = position!.Id, + PositionLevel = placementProfile.PositionLevel, PositionLineId = placementProfile.PositionLine!.Id, PositionTypeId = placementProfile.PositionType!.Id, @@ -2518,6 +2545,28 @@ namespace BMA.EHR.Application.Repositories.Commands profile.Salaries.Add(salary); + // change profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id); + if (profilePosition == null) + { + profilePosition = new ProfilePosition + { + Profile = profile, + OrganizationPosition = placementProfile.OrganizationPosition, + IsActive = true, + IsPublished = true, + }; + _dbContext.Set().Add(profilePosition); + } + else + { + profilePosition.OrganizationPosition = placementProfile.OrganizationPosition; + //_dbContext.Attatch(profilePosition); + } + // update placementstatus placementProfile.PlacementStatus = "CONTAIN"; @@ -2711,6 +2760,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = oc == null ? Guid.Empty : oc.Id, + PositionId = position!.Id, + PositionLevel = placementProfile.PositionLevel, PositionLineId = placementProfile.PositionLine!.Id, PositionTypeId = placementProfile.PositionType!.Id, @@ -2748,6 +2799,28 @@ namespace BMA.EHR.Application.Repositories.Commands profile.Salaries.Add(salary); + // change profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id); + if (profilePosition == null) + { + profilePosition = new ProfilePosition + { + Profile = profile, + OrganizationPosition = placementProfile.OrganizationPosition, + IsActive = true, + IsPublished = true, + }; + _dbContext.Set().Add(profilePosition); + } + else + { + profilePosition.OrganizationPosition = placementProfile.OrganizationPosition; + //_dbContext.Attatch(profilePosition); + } + // update placementstatus placementProfile.Status = "DONE"; @@ -2941,6 +3014,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = oc == null ? Guid.Empty : oc.Id, + PositionId = position!.Id, + PositionLevel = placementProfile.PositionLevel, PositionLineId = placementProfile.PositionLine!.Id, PositionTypeId = placementProfile.PositionType!.Id, @@ -2978,6 +3053,28 @@ namespace BMA.EHR.Application.Repositories.Commands profile.Salaries.Add(salary); + // change profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id); + if (profilePosition == null) + { + profilePosition = new ProfilePosition + { + Profile = profile, + OrganizationPosition = placementProfile.OrganizationPosition, + IsActive = true, + IsPublished = true, + }; + _dbContext.Set().Add(profilePosition); + } + else + { + profilePosition.OrganizationPosition = placementProfile.OrganizationPosition; + //_dbContext.Attatch(profilePosition); + } + // update placementstatus placementProfile.Status = "DONE"; @@ -3171,6 +3268,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = oc == null ? Guid.Empty : oc.Id, + PositionId = position!.Id, + PositionLevel = placementProfile.PositionLevel, PositionLineId = placementProfile.PositionLine!.Id, PositionTypeId = placementProfile.PositionType!.Id, @@ -3208,6 +3307,28 @@ namespace BMA.EHR.Application.Repositories.Commands profile.Salaries.Add(salary); + // change profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == profile.Id); + if (profilePosition == null) + { + profilePosition = new ProfilePosition + { + Profile = profile, + OrganizationPosition = placementProfile.OrganizationPosition, + IsActive = true, + IsPublished = true, + }; + _dbContext.Set().Add(profilePosition); + } + else + { + profilePosition.OrganizationPosition = placementProfile.OrganizationPosition; + //_dbContext.Attatch(profilePosition); + } + // update placementstatus placementProfile.Status = "DONE"; @@ -3409,6 +3530,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, + PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, PositionTypeId = lastSarary.PositionTypeId, @@ -3446,6 +3569,16 @@ namespace BMA.EHR.Application.Repositories.Commands profile.Salaries.Add(salary); + // add profile position + var profilePosition = new ProfilePosition + { + Profile = profile, + OrganizationPosition = placementProfile.OrganizationPosition, + IsActive = true, + IsPublished = true, + }; + _dbContext.Set().Add(profilePosition); + // update placementstatus placementProfile.Status = "DONE"; @@ -3656,6 +3789,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, + PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, PositionTypeId = lastSarary.PositionTypeId, @@ -3693,6 +3828,16 @@ namespace BMA.EHR.Application.Repositories.Commands profile.Salaries.Add(salary); + // add profile position + var profilePosition = new ProfilePosition + { + Profile = profile, + OrganizationPosition = placementProfile.OrganizationPosition, + IsActive = true, + IsPublished = true, + }; + _dbContext.Set().Add(profilePosition); + // update placementstatus placementProfile.Status = "DONE"; @@ -3828,6 +3973,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -4003,6 +4149,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -4181,6 +4328,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -4219,6 +4367,14 @@ namespace BMA.EHR.Application.Repositories.Commands data.Salaries.Add(salary); + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == data.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + // update placementstatus //data.Status = "DONE"; @@ -4361,6 +4517,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -4399,6 +4556,14 @@ namespace BMA.EHR.Application.Repositories.Commands data.Profile.Salaries.Add(salary); + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == data.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + // update placementstatus //data.Status = "DONE"; @@ -4483,7 +4648,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-14 - คำสั่งให้โอนข้าราชการกรุงเทพมหานครสามัญ + /// C-PM-14 - คำสั่งรับโอนข้าราชการกรุงเทพมหานครสามัญ /// /// object ของรายการคำสั่ง /// @@ -4683,6 +4848,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = oc == null ? Guid.Empty : oc.Id, + PositionId = position!.Id, PositionLevel = placementProfile.PositionLevel, PositionLineId = placementProfile.PositionLine!.Id, @@ -4890,6 +5056,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, + PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, PositionTypeId = lastSarary.PositionTypeId, @@ -5069,6 +5237,8 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, + PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, PositionTypeId = lastSarary.PositionTypeId, @@ -5248,6 +5418,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -5286,6 +5457,14 @@ namespace BMA.EHR.Application.Repositories.Commands data.Profile.Salaries.Add(salary); + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + // update placementstatus data.Status = "DONE"; @@ -5428,6 +5607,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -5466,6 +5646,14 @@ namespace BMA.EHR.Application.Repositories.Commands data.Profile.Salaries.Add(salary); + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + // update placementstatus data.Status = "DONE"; @@ -5550,7 +5738,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-19 - คำสั่งให้ออกจากราชการ + /// C-PM-19 - คำสั่งปลดออกจากราชการ /// /// object ของรายการคำสั่ง /// @@ -5608,6 +5796,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -5646,6 +5835,14 @@ namespace BMA.EHR.Application.Repositories.Commands data.Profile.Salaries.Add(salary); + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + // update placementstatus data.Status = "DONE"; @@ -5730,7 +5927,7 @@ namespace BMA.EHR.Application.Repositories.Commands } /// - /// C-PM-20 - คำสั่งให้ออกจากราชการ + /// C-PM-20 - คำสั่งไล่ออกจากราชการ /// /// object ของรายการคำสั่ง /// @@ -5788,6 +5985,7 @@ namespace BMA.EHR.Application.Repositories.Commands OcId = lastSarary.OcId, + PositionId = lastSarary.PositionId, PositionLevel = lastSarary.PositionLevel, PositionLineId = lastSarary.PositionLineId, @@ -5826,6 +6024,14 @@ namespace BMA.EHR.Application.Repositories.Commands data.Profile.Salaries.Add(salary); + // remove profile position + var profilePosition = await _dbContext.Set() + .Include(x => x.Profile) + .Include(x => x.OrganizationPosition) + .FirstOrDefaultAsync(x => x.Profile!.Id == data.Profile.Id); + if (profilePosition != null) + _dbContext.Set().Remove(profilePosition); + // update placementstatus data.Status = "DONE"; diff --git a/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs index d1deb5a1..9838bb63 100644 --- a/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/RetireReportRepository.cs @@ -311,6 +311,84 @@ namespace BMA.EHR.Application.Repositories.Reports } #endregion + #region แบบฟอร์มหนังสือขอลาออกจากราชการ + public async Task GetResignByUser(Guid id) + { + var data = await _dbContext.Set().AsQueryable() + .Where(x => x.Id == id) + .Select(p => new + { + p.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, + ProfileId = p.Profile.Id, + p.Location, + p.SendDate, + p.ActiveDate, + p.Reason, + p.Status, + salary = p.AmountOld, + p.ApproveReason, + p.RejectReason, + p.IsActive, + p.CreatedAt, + p.PositionTypeOld, + p.PositionLevelOld, + p.PositionNumberOld, + p.OrganizationPositionOld, + p.OligarchReject, + p.OligarchApproveReason, + p.OligarchRejectReason, + p.OligarchRejectDate, + p.CommanderReject, + p.CommanderApproveReason, + p.CommanderRejectReason, + p.CommanderRejectDate, + p.RemarkHorizontal, + }) + .FirstOrDefaultAsync(); + if (data == null) + return null; + + var _data = new + { + data.Id, + data.ProfileId, + data.Prefix, + data.FirstName, + 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(), + data.Reason, + data.Status, + data.salary, + data.PositionTypeOld, + data.PositionLevelOld, + data.PositionNumberOld, + data.OrganizationPositionOld, + data.ApproveReason, + data.RejectReason, + data.IsActive, + data.CreatedAt, + data.OligarchReject, + data.OligarchApproveReason, + data.OligarchRejectReason, + OligarchRejectDate = string.IsNullOrEmpty(data.OligarchRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.OligarchRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(), + data.CommanderReject, + data.CommanderApproveReason, + data.CommanderRejectReason, + CommanderRejectDate = string.IsNullOrEmpty(data.CommanderRejectDate.ToString()) ? string.Empty : DateTime.Parse(data.CommanderRejectDate.ToString()).ToThaiFullDate().ToString().ToThaiNumber(), + data.RemarkHorizontal, + }; + + return _data; + } + #endregion + #endregion } } diff --git a/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj b/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj index 2a290dd6..47b75761 100644 --- a/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj +++ b/BMA.EHR.Report.Service/BMA.EHR.Report.Service.csproj @@ -340,6 +340,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest diff --git a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs index 4dbc1b5b..2d9cfbde 100644 --- a/BMA.EHR.Report.Service/Controllers/CommandReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/CommandReportController.cs @@ -143,7 +143,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -262,7 +262,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -381,7 +381,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -500,7 +500,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -620,7 +620,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -741,7 +741,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -860,7 +860,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -981,7 +981,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -1105,7 +1105,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -1399,7 +1399,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -1521,7 +1521,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -1640,7 +1640,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); @@ -1830,7 +1830,7 @@ namespace BMA.EHR.Report.Service.Controllers report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName; report.ReportParameters["CommandNo"].Value = command.CommandNo.ToThaiNumber(); report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(); - report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3().ToThaiNumber(); + report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate2().ToThaiNumber(); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); diff --git a/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs b/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs index 75ffc858..b2cd8ed4 100644 --- a/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/InsigniaReportController.cs @@ -1,9 +1,12 @@ using BMA.EHR.Application.Repositories.Reports; using BMA.EHR.Domain.Common; +using BMA.EHR.Domain.Extensions; using BMA.EHR.Domain.Models.Insignias; using DocumentFormat.OpenXml.Drawing; +using DocumentFormat.OpenXml.EMMA; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.FileProviders; using Swashbuckle.AspNetCore.Annotations; using Telerik.Reporting; using Telerik.Reporting.Processing; @@ -441,14 +444,14 @@ namespace BMA.EHR.Report.Service.Controllers report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); } report.ReportParameters["YearInsigniaPeriod"].Value = YearInsignalPeriod; - + var tbl1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; var _Khr6List = new List(); foreach (var _data in data) { _Khr6List.Add(new { - RowNo = _Khr6List.Count + 1, + RowNo = (_Khr6List.Count + 1).ToString().ToThaiNumber(), DepartmentName = _data.GetType().GetProperty("DepartmentName").GetValue(_data), G1Male = _data.GetType().GetProperty("G1Male").GetValue(_data), G1Female = _data.GetType().GetProperty("G1Female").GetValue(_data), @@ -493,6 +496,7 @@ namespace BMA.EHR.Report.Service.Controllers { try { + var data = await _repository.GetCoinReport(id); var YearInsignalPeriod = await _repository.GetYearInsigniaPeriod(id); var mimeType = ""; @@ -502,35 +506,54 @@ namespace BMA.EHR.Report.Service.Controllers case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break; case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; } + var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-1.trdp"); + var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-2.trdp"); - var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา.trdp"); ReportPackager reportPacker = new ReportPackager(); Telerik.Reporting.Report? report = null; + Telerik.Reporting.Report? report2 = null; + using (var sourceStream = System.IO.File.OpenRead(rptFile)) + using (var sourceStream2 = System.IO.File.OpenRead(rptFile2)) { report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); + report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); } - - report.ReportParameters["YearInsignalPeriod"].Value = YearInsignalPeriod; - - //var _Khr3List = new List(); - //int maxRows = 25; - //for (int i = 0; i < maxRows; i++) + string OCName = string.Empty; + //foreach (var info in data) //{ - // _Khr3List.Add(new - // { - // RowNo = i + 1, - // FullName = string.Empty - // }); + // OCName = info.GetType().GetProperty("OCName").GetValue(info); + // break; //} + report.ReportParameters["YearInsignalPeriod"].Value = YearInsignalPeriod; + report.ReportParameters["OCName"].Value = OCName; + var dataList = new List(data); + var detailList = new List(); - //var tbl1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - //tbl1.DataSource = _Khr3List; + var ChkInsigniaName = string.IsNullOrEmpty(dataList[0].GetType().GetProperty("InsigniaName").GetValue(dataList[0]))? string.Empty: dataList[0].GetType().GetProperty("InsigniaName").GetValue(dataList[0]); + for (int i = 0; i < dataList.Count; i++) + { + detailList.Add(new + { + row = detailList.Count+1, + Number = (detailList.Count+1).ToString().ToThaiNumber(), + InsigniaName = dataList[i].GetType().GetProperty("InsigniaName").GetValue(dataList[i]), + FullName = dataList[i].GetType().GetProperty("FullName").GetValue(dataList[i]), + InsigniaInitial = dataList[i].GetType().GetProperty("InsigniaInitial").GetValue(dataList[i]), + Male = dataList[i].GetType().GetProperty("Male").GetValue(dataList[i]), + Female = dataList[i].GetType().GetProperty("Female").GetValue(dataList[i]), + }); ; + } + report.DataSource = detailList; + + var reportBook = new ReportBook(); + reportBook.Reports.Add(report); + reportBook.Reports.Add(report2); System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); InstanceReportSource instanceReportSource = new InstanceReportSource() { - ReportDocument = report, + ReportDocument = reportBook, }; ReportProcessor reportProcessor = new ReportProcessor(_configuration); RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); diff --git a/BMA.EHR.Report.Service/Controllers/ResignReportController.cs b/BMA.EHR.Report.Service/Controllers/ResignReportController.cs index d5f434dc..c3d9086c 100644 --- a/BMA.EHR.Report.Service/Controllers/ResignReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/ResignReportController.cs @@ -25,7 +25,7 @@ namespace BMA.EHR.Report.Service.Controllers private readonly IWebHostEnvironment _hostingEnvironment; private readonly IConfiguration _configuration; - //private readonly ProbationReportRepository _repository; + private readonly RetireReportRepository _service; private readonly GenericReportGenerator _reportGenerator; @@ -33,12 +33,12 @@ namespace BMA.EHR.Report.Service.Controllers #region " Constuctor and Destructor " - public ResignReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, /*ProbationReportRepository repository,*/ GenericReportGenerator reportGenerator) + public ResignReportController(IWebHostEnvironment hostingEnvironment, IConfiguration configuration, RetireReportRepository service, GenericReportGenerator reportGenerator) { _hostingEnvironment = hostingEnvironment; _configuration = configuration; - //_repository = repository; + _service = service; _reportGenerator = reportGenerator; } @@ -57,11 +57,15 @@ namespace BMA.EHR.Report.Service.Controllers /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน [HttpGet("33/{exportType}/{id}")] - public IActionResult GetResign33ConvertReportAsync(Guid id, string exportType = "pdf") + public async Task> GetResign33ConvertReportAsync(string id= "08dbca15-bb57-4b2e-8435-69116599421b", string exportType = "pdf") { try { - + Guid ids = Guid.Parse(id); + var resign = await _service.GetResignByUser(ids); + if (resign == null) + return NotFound(); + var mimeType = ""; switch (exportType.Trim().ToLower()) { @@ -69,11 +73,38 @@ namespace BMA.EHR.Report.Service.Controllers case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break; case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; } + //var FullName = resign.GetType().GetProperty("FirstName").GetValue(resign); - var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"33-แบบฟอร์มหนังสือขอลาออกจากราชการ-1.trdp"); - var contentData = _reportGenerator.GenerateReport(rptFile, exportType); + var rptFile1 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"33-แบบฟอร์มหนังสือขอลาออกจากราชการ-1.trdp"); + var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"33-แบบฟอร์มหนังสือขอลาออกจากราชการ-2.trdp"); - return File(contentData, mimeType, $"resign.{exportType.Trim().ToLower()}"); + ReportPackager reportPacker = new ReportPackager(); + Telerik.Reporting.Report? report1 = null; + Telerik.Reporting.Report? report2 = null; + + using (var sourceStream1 = System.IO.File.OpenRead(rptFile1)) + using (var sourceStream2 = System.IO.File.OpenRead(rptFile2)) + + { + report1 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream1); + report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); + } + + report1.DataSource = resign; + + var reportBook = new ReportBook(); + reportBook.Reports.Add(report1); + reportBook.Reports.Add(report2); + + System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + InstanceReportSource instanceReportSource = new InstanceReportSource() + { + ReportDocument = reportBook, + }; + + ReportProcessor reportProcessor = new ReportProcessor(_configuration); + RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); + return File(result.DocumentBytes, mimeType, $"แบบฟอร์มหนังสือขอลาออกจากราชการ.{exportType.Trim().ToLower()}"); } catch diff --git a/BMA.EHR.Report.Service/Reports/13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-3.trdp b/BMA.EHR.Report.Service/Reports/13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-3.trdp index 44c02907..bb425d9c 100644 Binary files a/BMA.EHR.Report.Service/Reports/13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-3.trdp and b/BMA.EHR.Report.Service/Reports/13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-3.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-2.trdp b/BMA.EHR.Report.Service/Reports/14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-2.trdp index 596d1c87..f01fa1dd 100644 Binary files a/BMA.EHR.Report.Service/Reports/14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-2.trdp and b/BMA.EHR.Report.Service/Reports/14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-2.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-1.trdp b/BMA.EHR.Report.Service/Reports/16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-1.trdp index 6a5a3fdd..a51e7bff 100644 Binary files a/BMA.EHR.Report.Service/Reports/16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-1.trdp and b/BMA.EHR.Report.Service/Reports/16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-1.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-2.trdp b/BMA.EHR.Report.Service/Reports/17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-2.trdp index fdee5446..afe877d3 100644 Binary files a/BMA.EHR.Report.Service/Reports/17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-2.trdp and b/BMA.EHR.Report.Service/Reports/17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-2.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-1.trdp b/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-1.trdp index b2a8f419..d10297c4 100644 Binary files a/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-1.trdp and b/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-1.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-2.trdp b/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-2.trdp index 4508d179..55b1b1bb 100644 Binary files a/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-2.trdp and b/BMA.EHR.Report.Service/Reports/33-แบบฟอร์มหนังสือขอลาออกจากราชการ-2.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-1.trdp b/BMA.EHR.Report.Service/Reports/45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-1.trdp new file mode 100644 index 00000000..0cd16222 Binary files /dev/null and b/BMA.EHR.Report.Service/Reports/45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-1.trdp differ diff --git a/BMA.EHR.Report.Service/Reports/45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-2.trdp b/BMA.EHR.Report.Service/Reports/45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-2.trdp new file mode 100644 index 00000000..c446f6bc Binary files /dev/null and b/BMA.EHR.Report.Service/Reports/45-บัญชีแสดงรายชื่อผู้ขอพระราชทานเหรียญจักรพรรดิมาลา-2.trdp differ