ออกคำสั่ง 22 24
This commit is contained in:
parent
cbabad68a9
commit
9c36f95fe2
9 changed files with 634 additions and 42 deletions
|
|
@ -1089,7 +1089,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
public async Task<List<CommandType21Response>> GetCommandType22AttachmentAsync(Guid id)
|
||||
public async Task<List<CommandType22Response>> GetCommandType22AttachmentAsync(Guid id)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -1124,19 +1124,21 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType21Response
|
||||
select new CommandType22Response
|
||||
{
|
||||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||
CitizenId = r.CitizenId.ToThaiNumber(),
|
||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
Organization = p.OrgEmployee == null || p.OrgEmployee!.OrganizationAgency == null || p.OrgEmployee!.OrganizationAgency!.OrganizationOrganization == null ? "" : p.OrgEmployee!.OrganizationAgency!.OrganizationOrganization!.Name,
|
||||
PositionName = p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name.ToThaiNumber(),
|
||||
PositionLevel = p.OrgEmployee.OrganizationPositionEmployeeLevels == null ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.First().PositionEmployeeLevel.Name.ToThaiNumber(),
|
||||
PositionType = p.Profile.PositionType == null ? "" : p.Profile.PositionType.Name.ToThaiNumber(),
|
||||
PositionNumber = p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
||||
Salary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
RetireDate = p.Profile.BirthDate.CalculateRetireDate().ToThaiFullDate3().ToThaiNumber(),
|
||||
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber()
|
||||
Organization = p.OrganizationPositionOld,
|
||||
OldPositionName = p.OrganizationPositionOld,
|
||||
OldPositionLevel = p.PositionLevelOld,
|
||||
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||
NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
||||
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
||||
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
Reason = p.Reason == null ? "-" : p.Reason,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
|
@ -1196,13 +1198,74 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
Organization = p.OrganizationPositionOld ?? "",
|
||||
PositionName = p.Profile.PositionEmployeePosition == null ? "" : p.Profile.PositionEmployeePosition.Name.ToThaiNumber(),
|
||||
PositionLevel = p.PositionLevelOld == null ? "" :p.PositionLevelOld.ToThaiNumber(),
|
||||
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld.ToThaiNumber(),
|
||||
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld.ToThaiNumber(),
|
||||
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
|
||||
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
RetireDate = p.ActiveDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
|
||||
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return report_data;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<CommandType22Response>> GetCommandType24AttachmentAsync(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.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.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationAgency)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
//.Include(x => x.OrgEmployee)
|
||||
//.ThenInclude(x => x.PosNo)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
on r.RefPlacementProfileId equals p.Id
|
||||
orderby r.Sequence
|
||||
select new CommandType22Response
|
||||
{
|
||||
Seq = r.Sequence.ToString().ToThaiNumber(),
|
||||
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||
Organization = p.OrganizationPositionOld,
|
||||
OldPositionName = p.OrganizationPositionOld,
|
||||
OldPositionLevel = p.PositionLevelOld,
|
||||
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
|
||||
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
// NewOc = p.OrganizationPosition == null || p.OrganizationPosition!.Organization == null ? "" : _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||
NewPositionName = p.OrgEmployee == null || p.OrgEmployee.PositionEmployeePosition == null ? "" : p.OrgEmployee.PositionEmployeePosition.Name,
|
||||
NewPositionLevel = p.OrgEmployee == null || p.OrgEmployee.OrganizationPositionEmployeeLevels == null || p.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? "" : p.OrgEmployee.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel.Name,
|
||||
NewPositionNumber = p.OrgEmployee == null || p.OrgEmployee.PosNo == null ? "" : p.OrgEmployee.PosNo.ToThaiNumber(),
|
||||
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
|
||||
Reason = p.Reason == null ? "-" : p.Reason,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
|
|
|
|||
|
|
@ -1734,6 +1734,9 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
case "C-PM-23":
|
||||
await ExecuteCommand23Async(command);
|
||||
break;
|
||||
case "C-PM-24":
|
||||
await ExecuteCommand24Async(command);
|
||||
break;
|
||||
default: throw new Exception(GlobalMessages.MethodForCommandTypeNotImplement);
|
||||
}
|
||||
|
||||
|
|
@ -6378,7 +6381,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-22 - คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ
|
||||
/// C-PM-22 - คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
|
|
@ -6404,7 +6407,6 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
|
||||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
// TODO: รอมอสเข้ามา Query แล้วแก้ไขข้อมูลทะเบียนประวัติ
|
||||
var data = await _dbContext.Set<PlacementAppointment>()
|
||||
.Include(x => x.PositionEmployeeLine)
|
||||
.Include(x => x.PositionEmployeePosition)
|
||||
|
|
@ -6415,19 +6417,32 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
.ThenInclude(x => x.PositionEmployeeLine)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationShortName)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.PositionEmployeeLine)
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
data.Profile.EmployeeClass = "perm"; // ลจ ประจำ
|
||||
data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
|
||||
data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
|
||||
// data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
|
||||
// data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
|
||||
data.Profile.PositionEmployeePosition = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeePosition;
|
||||
// data.Profile.PositionEmployeePositionSide = data.OrgEmployee == null ? null : data.OrgEmployee!.po;
|
||||
data.Profile.PositionEmployeeLevel = data.OrgEmployee == null || data.OrgEmployee.OrganizationPositionEmployeeLevels == null || data.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? null : data.OrgEmployee!.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel;
|
||||
// data.Profile.PositionEmployeeGroup = data.OrgEmployee == null ? null : data.OrgEmployee!.gr;
|
||||
data.Profile.PositionEmployeeLine = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeeLine;
|
||||
data.Profile.OrganizationShortNameId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Id;
|
||||
data.Profile.OrganizationShortName = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Name;
|
||||
data.Profile.OrganizationOrganizationId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Id;
|
||||
|
|
@ -6449,7 +6464,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
PositionSalaryAmount = recv.PositionSalaryAmount,
|
||||
MouthSalaryAmount = recv.MouthSalaryAmount,
|
||||
SalaryClass = "",
|
||||
SalaryRef = "คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
SalaryRef = "คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
//OcId = lastSarary.OcId,
|
||||
//PositionLevel = lastSarary.PositionLevel,
|
||||
//PositionLineId = lastSarary.PositionLineId,
|
||||
|
|
@ -6460,10 +6475,10 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
CommandTypeName = command.CommandType.Name,
|
||||
//PositionEmployeeGroupId = null,
|
||||
//PositionEmployeeLevelId = null,
|
||||
//PositionEmployeePositionId = null,
|
||||
PositionEmployeeLevelId = data.Profile.PositionEmployeeLevel == null ? null : data.Profile.PositionEmployeeLevel.Id,
|
||||
PositionEmployeePositionId = data.Profile.PositionEmployeePosition == null ? null : data.Profile.PositionEmployeePosition.Id,
|
||||
//PositionEmployeePositionSideId = null,
|
||||
//PosNoEmployee = "",
|
||||
PosNoEmployee = data.Profile.PosNoEmployee,
|
||||
////PositionPathSideId = lastSarary.PositionPathSideId == null,
|
||||
//PositionExecutiveId = lastSarary.PositionExecutiveId,
|
||||
////PositionExecutiveSideId = lastSarary.PositionExecutiveSideId,
|
||||
|
|
@ -6483,7 +6498,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
|
||||
|
||||
|
|
@ -6520,7 +6535,7 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
|
|
@ -6532,14 +6547,14 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างชั่วคราวเป็นลูกจ้างประจำ คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
|
|
@ -6740,6 +6755,201 @@ namespace BMA.EHR.Application.Repositories.Commands
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// C-PM-24 - คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
||||
/// </summary>
|
||||
/// <param name="command">object ของรายการคำสั่ง</param>
|
||||
/// <returns></returns>
|
||||
private async Task ExecuteCommand24Async(Command command)
|
||||
{
|
||||
try
|
||||
{
|
||||
// create command payload
|
||||
var payload_attach = command.Documents
|
||||
.Select(x => new PayloadAttachment
|
||||
{
|
||||
name = x.Category == "cover" ? "สำเนาคำสั่ง" : "สำเนาเอกสารแนบท้าย",
|
||||
url = $"{_configuration["API"]}/order/download/attachment/{x.Document.Id}"
|
||||
})
|
||||
.ToList();
|
||||
|
||||
var payload = new CommandPayload()
|
||||
{
|
||||
attachments = payload_attach
|
||||
};
|
||||
|
||||
var payload_str = JsonConvert.SerializeObject(payload);
|
||||
|
||||
foreach (var recv in command.Receivers)
|
||||
{
|
||||
var data = await _dbContext.Set<PlacementAppointment>()
|
||||
.Include(x => x.PositionEmployeeLine)
|
||||
.Include(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Salaries)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeeLine)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationShortName)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationOrganization)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.OrganizationPositionEmployeeLevels)
|
||||
.ThenInclude(x => x.PositionEmployeeLevel)
|
||||
.Include(x => x.OrgEmployee)
|
||||
.ThenInclude(x => x.PositionEmployeeLine)
|
||||
.FirstOrDefaultAsync(x => x.Id == recv.RefPlacementProfileId);
|
||||
|
||||
if (data == null)
|
||||
throw new Exception(GlobalMessages.DataNotFound);
|
||||
// data.Profile.PositionEmployeeLine = data.PositionEmployeeLine;
|
||||
// data.Profile.PositionEmployeePosition = data.PositionEmployeePosition;
|
||||
data.Profile.PositionEmployeePosition = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeePosition;
|
||||
// data.Profile.PositionEmployeePositionSide = data.OrgEmployee == null ? null : data.OrgEmployee!.po;
|
||||
data.Profile.PositionEmployeeLevel = data.OrgEmployee == null || data.OrgEmployee.OrganizationPositionEmployeeLevels == null || data.OrgEmployee.OrganizationPositionEmployeeLevels.Count() == 0 ? null : data.OrgEmployee!.OrganizationPositionEmployeeLevels.FirstOrDefault().PositionEmployeeLevel;
|
||||
// data.Profile.PositionEmployeeGroup = data.OrgEmployee == null ? null : data.OrgEmployee!.gr;
|
||||
data.Profile.PositionEmployeeLine = data.OrgEmployee == null ? null : data.OrgEmployee!.PositionEmployeeLine;
|
||||
data.Profile.OrganizationShortNameId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Id;
|
||||
data.Profile.OrganizationShortName = data.OrgEmployee == null || data.OrgEmployee!.OrganizationShortName == null ? null : data.OrgEmployee!.OrganizationShortName!.Name;
|
||||
data.Profile.OrganizationOrganizationId = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Id;
|
||||
data.Profile.OrganizationOrganization = data.OrgEmployee == null || data.OrgEmployee!.OrganizationOrganization == null ? null : data.OrgEmployee!.OrganizationOrganization!.Name;
|
||||
data.Profile.PosNoEmployee = data.OrgEmployee == null ? null : data.OrgEmployee!.PosNo;
|
||||
data.Profile.OcId = data.OrgEmployee == null || data.OrgEmployee!.Organization == null ? null : data.OrgEmployee!.Organization!.Id;
|
||||
data.Profile.Oc = data.OrgEmployee == null || data.OrgEmployee!.Organization == null ? null : _organizationCommonRepository.GetOrganizationNameFullPath(data.OrgEmployee!.Organization!.Id, false, false, "/");
|
||||
|
||||
var lastSarary = data.Profile.Salaries.OrderByDescending(x => x.Order).FirstOrDefault();
|
||||
var order = 1;
|
||||
if (lastSarary != null && lastSarary.Order != null)
|
||||
order = lastSarary.Order.Value + 1;
|
||||
|
||||
var salary = new ProfileSalary
|
||||
{
|
||||
Order = order,
|
||||
Date = command.CommandAffectDate,
|
||||
Amount = recv.Amount,
|
||||
PositionSalaryAmount = recv.PositionSalaryAmount,
|
||||
MouthSalaryAmount = recv.MouthSalaryAmount,
|
||||
SalaryClass = "",
|
||||
SalaryRef = "คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่ง" + command.IssuerOrganizationName + "ที่ " + $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate!.Value.ToThaiFullDate3()}",
|
||||
//OcId = lastSarary.OcId,
|
||||
//PositionLevel = lastSarary.PositionLevel,
|
||||
//PositionLineId = lastSarary.PositionLineId,
|
||||
//PositionTypeId = lastSarary.PositionTypeId,
|
||||
//OrganizationShortNameId = lastSarary.OrganizationShortNameId,
|
||||
//PosNoId = lastSarary.PosNoId,
|
||||
CommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
RefCommandNo = $"{command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()}",
|
||||
CommandTypeName = command.CommandType.Name,
|
||||
//PositionEmployeeGroupId = null,
|
||||
PositionEmployeeLevelId = data.Profile.PositionEmployeeLevel == null ? null : data.Profile.PositionEmployeeLevel.Id,
|
||||
PositionEmployeePositionId = data.Profile.PositionEmployeePosition == null ? null : data.Profile.PositionEmployeePosition.Id,
|
||||
//PositionEmployeePositionSideId = null,
|
||||
PosNoEmployee = data.Profile.PosNoEmployee,
|
||||
////PositionPathSideId = lastSarary.PositionPathSideId == null,
|
||||
//PositionExecutiveId = lastSarary.PositionExecutiveId,
|
||||
////PositionExecutiveSideId = lastSarary.PositionExecutiveSideId,
|
||||
IsActive = true,
|
||||
CreatedAt = DateTime.Now,
|
||||
CreatedFullName = FullName ?? "System Administrator",
|
||||
CreatedUserId = UserId ?? "",
|
||||
LastUpdatedAt = DateTime.Now,
|
||||
LastUpdateFullName = FullName ?? "System Administrator",
|
||||
LastUpdateUserId = UserId ?? "",
|
||||
};
|
||||
data.Profile.Salaries.Add(salary);
|
||||
// update placementstatus
|
||||
data.Status = "DONE";
|
||||
await _dbContext.SaveChangesAsync();
|
||||
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
|
||||
|
||||
// รอเอาข้อมูลที่ได้มาส่ง inbox noti ให้ผู้รับคำสั่ง
|
||||
|
||||
//var inbox = new Inbox
|
||||
//{
|
||||
// Subject = $"คุณได้รับคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// Body = $"คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// ReceiverUserId = data.Profile.Id,
|
||||
// Payload = payload_str,
|
||||
//};
|
||||
//_dbContext.Set<Inbox>().Add(inbox);
|
||||
|
||||
//var noti = new Notification
|
||||
//{
|
||||
// Body = $"คุณได้รับคำสั่งจ้างและแต่งตั้งลูกจ้างประจำ เลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
// ReceiverUserId = data.Profile.Id,
|
||||
// Type = "LINK",
|
||||
// Payload = payload_str,
|
||||
//};
|
||||
//_dbContext.Set<Notification>().Add(noti);
|
||||
//await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
// send cc noti inbox
|
||||
foreach (var cc in command.Deployments)
|
||||
{
|
||||
var pf = await _dbContext.Set<Profile>().FirstOrDefaultAsync(x => x.CitizenId == cc.CitizenId);
|
||||
if (pf != null)
|
||||
{
|
||||
if (cc.IsSendInbox)
|
||||
{
|
||||
var inbox = new Inbox
|
||||
{
|
||||
Subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Inbox>().Add(inbox);
|
||||
}
|
||||
|
||||
if (cc.IsSendMail)
|
||||
{
|
||||
// TODO: ต้องเปลี่ยนเป็น Email จริงนะ ตอนนี้ Hardcode อยู่
|
||||
// Send noti inbox and email
|
||||
var subject = $"คุณได้รับสำเนาคำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
var body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}";
|
||||
_emailSenderService.SendMail(subject, body, "dev@frappet.com");
|
||||
}
|
||||
|
||||
|
||||
var noti = new Notification
|
||||
{
|
||||
Body = $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) คำสั่งเลขที่ {command.CommandNo}/{command.CommandYear.ToInteger().ToThaiYear()} ลงวันที่ {command.CommandExcecuteDate.Value.ToThaiFullDate3()}",
|
||||
ReceiverUserId = pf.Id,
|
||||
Type = "LINK",
|
||||
Payload = payload_str,
|
||||
};
|
||||
_dbContext.Set<Notification>().Add(noti);
|
||||
}
|
||||
}
|
||||
|
||||
// change command status
|
||||
var cmdStatus = await _dbContext.Set<CommandStatus>().FirstOrDefaultAsync(x => x.Sequence == 5);
|
||||
command.CommandStatusId = cmdStatus!.Id;
|
||||
|
||||
await _dbContext.SaveChangesAsync();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " Regenerate Json File "
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
namespace BMA.EHR.Application.Responses.Reports
|
||||
{
|
||||
public class CommandType22Response
|
||||
{
|
||||
public string? Seq { 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? OldPositionName { get; set; } = string.Empty;
|
||||
public string? OldPositionLevel { get; set; } = string.Empty;
|
||||
public string? OldPositionNumber { get; set; } = string.Empty;
|
||||
public string? OldSalary { get; set; } = "";
|
||||
// public string NewOc { get; set; } = string.Empty;
|
||||
public string? NewPositionName { get; set; } = string.Empty;
|
||||
public string? NewPositionLevel { get; set; } = string.Empty;
|
||||
public string? NewPositionNumber { get; set; } = string.Empty;
|
||||
public string? NewSalary { get; set; } = "";
|
||||
public string? Reason { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -116,7 +116,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
|
||||
return Success();
|
||||
}
|
||||
catch(Exception ex)
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Error(ex);
|
||||
}
|
||||
|
|
@ -289,6 +289,7 @@ namespace BMA.EHR.Command.Service.Controllers
|
|||
else
|
||||
return Success(new { result = "N" });
|
||||
}
|
||||
case "C-PM-24":
|
||||
default:
|
||||
{
|
||||
if (command.CommandNo != "" &&
|
||||
|
|
|
|||
|
|
@ -664,6 +664,18 @@
|
|||
<None Update="Reports\ผลสอบคัดเลือกรายบุคคล.trdp">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน).trdp">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)-แนบท้าย.trdp">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย).trdp">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Reports\คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)-แนบท้าย.trdp">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -2091,22 +2091,21 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
// ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
PositionList = "",
|
||||
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
// PositionList = "",
|
||||
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||
// ConclusionReturnNo = raw_data.ConclusionReturnNo.ToThaiNumber(),
|
||||
// ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
||||
};
|
||||
|
||||
|
||||
var receiver = await _commandReportRepository.GetCommandType22AttachmentAsync(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"20-คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ.trdp");
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน).trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
|
|
@ -2117,10 +2116,6 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
report.DataSource = command;
|
||||
|
||||
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
|
||||
|
||||
tblData.DataSource = receiver;
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
if (exportType == "docx")
|
||||
deviceInfo["OutputFormat"] = "DOCX";
|
||||
|
|
@ -2144,6 +2139,56 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
private async Task<byte[]> GenerateCommandReportType22_Attachment(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = await _repository.GetByIdAsync(commandId);
|
||||
if (command == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var data = await _commandReportRepository.GetCommandType22AttachmentAsync(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)-แนบท้าย.trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
|
||||
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
||||
|
||||
tblData.DataSource = data;
|
||||
|
||||
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.ToThaiFullDate2().ToThaiNumber();
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
};
|
||||
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
|
||||
return content;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region " C-PM-23 "
|
||||
|
|
@ -2221,6 +2266,126 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-24 "
|
||||
|
||||
private async Task<byte[]> GenerateCommandReportType24_Cover(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
//var recvId = raw_data.Receivers.Select(x => x.RefPlacementProfileId).ToList();
|
||||
//var positionList = string.Empty;
|
||||
|
||||
var command = new
|
||||
{
|
||||
CommandNo = raw_data.CommandNo.ToThaiNumber(),
|
||||
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
|
||||
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||
ConclusionRegisterNo = raw_data.ConclusionRegisterNo.ToThaiNumber(),
|
||||
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
// ConclusionResultNo = raw_data.ConclusionResultNo.ToThaiNumber(),
|
||||
// ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
// PositionList = "",
|
||||
Count = raw_data.Receivers.Count.ToString().ToThaiNumber(),
|
||||
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||
// ConclusionReturnNo = raw_data.ConclusionReturnNo.ToThaiNumber(),
|
||||
// ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3().ToThaiNumber(),
|
||||
Subject = $"เรื่อง {raw_data.CommandSubject}",
|
||||
};
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย).trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
|
||||
report.DataSource = command;
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
if (exportType == "docx")
|
||||
deviceInfo["OutputFormat"] = "DOCX";
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
};
|
||||
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport(exportType.ToUpper(), instanceReportSource, deviceInfo);
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
|
||||
return content;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task<byte[]> GenerateCommandReportType24_Attachment(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = await _repository.GetByIdAsync(commandId);
|
||||
if (command == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var data = await _commandReportRepository.GetCommandType24AttachmentAsync(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)-แนบท้าย.trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
|
||||
var tblData = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblData"];
|
||||
|
||||
tblData.DataSource = data;
|
||||
|
||||
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.ToThaiFullDate2().ToThaiNumber();
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
};
|
||||
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
|
||||
return content;
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-01 คำสั่งบรรจุและแต่งตั้ง: สำหรับผู้สอบแข่งขันได้ "
|
||||
|
|
@ -3639,10 +3804,10 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-22 คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ "
|
||||
#region " C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน) "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-22 คำสั่งจ้างและแต่งตั้งลูกจ้างประจำ
|
||||
/// คำสั่ง C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
|
|
@ -3655,7 +3820,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType22CoverReportAsync(Guid id, string exportType = "pdf")
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType22CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -3680,6 +3845,45 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// เอกสารแนบท้าย C-PM-22 คำสั่งแต่งตั้งลูกจ้างประจำ(ปรับระดับชั้นงาน)
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-22/attachment/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType22AttachmentReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
|
||||
var contentData = await GenerateCommandReportType22_Attachment(id, exportType);
|
||||
return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-23 คำสั่งให้ลูกจ้างออกจากราชการ "
|
||||
|
|
@ -3725,6 +3929,88 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#endregion
|
||||
|
||||
#region " C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย) "
|
||||
|
||||
/// <summary>
|
||||
/// คำสั่ง C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-24/cover/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType24CoverReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType24_Cover(id, exportType);
|
||||
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// เอกสารแนบท้าย C-PM-24 คำสั่งแต่งตั้งลูกจ้างประจำ(ย้าย)
|
||||
/// </summary>
|
||||
/// <param name="id">Record Id ของคำสั่ง</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||
[HttpGet("c-pm-24/attachment/{exportType}/{id}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||
public async Task<ActionResult<ResponseObject>> GetCommandType24AttachmentReport(Guid id, string exportType = "pdf")
|
||||
{
|
||||
try
|
||||
{
|
||||
var cmd = await _repository.GetByIdAsync(id);
|
||||
if (cmd == null)
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var mimeType = "";
|
||||
switch (exportType.Trim().ToLower())
|
||||
{
|
||||
case "pdf": mimeType = "application/pdf"; break;
|
||||
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
|
||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||
}
|
||||
|
||||
var contentData = await GenerateCommandReportType24_Attachment(id, exportType);
|
||||
return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue