Add Some Report
This commit is contained in:
parent
cf966cd096
commit
55a0f5c6ed
8 changed files with 465 additions and 20 deletions
|
|
@ -346,6 +346,120 @@ namespace BMA.EHR.Application.Repositories.Commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<CommandType03Response>> GetCommandType08AttachmentAsync(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<RetirementOther>()
|
||||||
|
.Include(x => x.OrganizationPosition)
|
||||||
|
.ThenInclude(x => x.Organization)
|
||||||
|
.Include(x => x.PositionPath)
|
||||||
|
.Include(x => x.PositionLevel)
|
||||||
|
.Include(x => x.PositionNumber)
|
||||||
|
.Include(x => x.PositionType)
|
||||||
|
on r.RefPlacementProfileId equals p.Id
|
||||||
|
join pf in _dbContext.Set<Profile>()
|
||||||
|
.Include(x => x.Position)
|
||||||
|
.Include(x => x.PositionLevel)
|
||||||
|
.Include(x => x.PositionType)
|
||||||
|
.Include(x => x.PosNo)
|
||||||
|
.Include(x => x.Salaries)
|
||||||
|
on r.CitizenId equals pf.CitizenId
|
||||||
|
select new CommandType03Response
|
||||||
|
{
|
||||||
|
CitizenId = r.CitizenId,
|
||||||
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
|
||||||
|
OldPositionName = pf.Position == null ? "" : pf.Position.Name,
|
||||||
|
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
|
||||||
|
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
|
||||||
|
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name,
|
||||||
|
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? 0 : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value,
|
||||||
|
NewOc = _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
|
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
||||||
|
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,
|
||||||
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return report_data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<List<CommandType03Response>> GetCommandType09AttachmentAsync(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<RetirementOther>()
|
||||||
|
.Include(x => x.OrganizationPosition)
|
||||||
|
.ThenInclude(x => x.Organization)
|
||||||
|
.Include(x => x.PositionPath)
|
||||||
|
.Include(x => x.PositionLevel)
|
||||||
|
.Include(x => x.PositionNumber)
|
||||||
|
.Include(x => x.PositionType)
|
||||||
|
on r.RefPlacementProfileId equals p.Id
|
||||||
|
join pf in _dbContext.Set<Profile>()
|
||||||
|
.Include(x => x.Position)
|
||||||
|
.Include(x => x.PositionLevel)
|
||||||
|
.Include(x => x.PositionType)
|
||||||
|
.Include(x => x.PosNo)
|
||||||
|
.Include(x => x.Salaries)
|
||||||
|
on r.CitizenId equals pf.CitizenId
|
||||||
|
select new CommandType03Response
|
||||||
|
{
|
||||||
|
CitizenId = r.CitizenId,
|
||||||
|
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
|
||||||
|
OldOc = pf.Oc == null ? "" : pf.Oc.Replace("/", " "),
|
||||||
|
OldPositionName = pf.Position == null ? "" : pf.Position.Name,
|
||||||
|
OldPositionLevel = pf.PositionLevel == null ? "" : pf.PositionLevel.Name,
|
||||||
|
OldPositionType = pf.PositionType == null ? "" : pf.PositionType.Name,
|
||||||
|
OldPositionNumber = pf.PosNo == null ? "" : pf.PosNo.Name,
|
||||||
|
OldSalary = pf.Salaries == null || pf.Salaries.Count == 0 ? 0 : pf.Salaries.OrderByDescending(x => x.Order).FirstOrDefault().Amount.Value,
|
||||||
|
NewOc = _organizationCommonRepository.GetOrganizationNameFullPath(p.OrganizationPosition!.Organization!.Id, false, false, "/"),
|
||||||
|
NewPositionName = p.PositionPath == null ? "" : p.PositionPath!.Name,
|
||||||
|
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,
|
||||||
|
AppointDate = p.RecruitDate == null ? "" : p.RecruitDate.Value.ToThaiFullDate3()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return report_data;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<CommandType15Response>> GetCommandType15AttachmentAsync(Guid id)
|
public async Task<List<CommandType15Response>> GetCommandType15AttachmentAsync(Guid id)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
||||||
|
|
@ -875,6 +875,327 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region " C-PM-08 "
|
||||||
|
|
||||||
|
private async Task<byte[]> GenerateCommandReportType08_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,
|
||||||
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString(),
|
||||||
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||||
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo,
|
||||||
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3(),
|
||||||
|
ConclusionResultNo = raw_data.ConclusionResultNo,
|
||||||
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3(),
|
||||||
|
PositionList = "",
|
||||||
|
Count = raw_data.Receivers.Count,
|
||||||
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3(),
|
||||||
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||||
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||||
|
ConclusionReturnNo = raw_data.ConclusionReturnNo,
|
||||||
|
ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3(),
|
||||||
|
};
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.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[]> GenerateCommandReportType08_Attachment(Guid commandId, string exportType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var command = await _repository.GetByIdAsync(commandId);
|
||||||
|
if (command == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _commandReportRepository.GetCommandType08AttachmentAsync(commandId);
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.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["table1"];
|
||||||
|
|
||||||
|
tblData.DataSource = data;
|
||||||
|
|
||||||
|
report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
||||||
|
report.ReportParameters["CommandNo"].Value = command.CommandNo;
|
||||||
|
report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString();
|
||||||
|
report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3();
|
||||||
|
|
||||||
|
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-09 "
|
||||||
|
|
||||||
|
private async Task<byte[]> GenerateCommandReportType09_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,
|
||||||
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString(),
|
||||||
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||||
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo,
|
||||||
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3(),
|
||||||
|
ConclusionResultNo = raw_data.ConclusionResultNo,
|
||||||
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3(),
|
||||||
|
PositionList = "",
|
||||||
|
Count = raw_data.Receivers.Count,
|
||||||
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3(),
|
||||||
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||||
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||||
|
ConclusionReturnNo = raw_data.ConclusionReturnNo,
|
||||||
|
ConclusionReturnDate = raw_data.ConclusionReturnDate == null ? "" : raw_data.ConclusionReturnDate.Value.ToThaiFullDate3(),
|
||||||
|
SourceOrganizationName = raw_data.SourceOrganizationName,
|
||||||
|
MilitaryCommandNo = raw_data.MilitaryCommandNo,
|
||||||
|
MilitaryCommanDate = raw_data.MilitaryCommanDate == null ? "" : raw_data.MilitaryCommanDate.Value.ToThaiFullDate3()
|
||||||
|
};
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.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[]> GenerateCommandReportType09_Attachment(Guid commandId, string exportType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var command = await _repository.GetByIdAsync(commandId);
|
||||||
|
if (command == null)
|
||||||
|
{
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = await _commandReportRepository.GetCommandType09AttachmentAsync(commandId);
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-8.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["table1"];
|
||||||
|
|
||||||
|
tblData.DataSource = data;
|
||||||
|
|
||||||
|
report.ReportParameters["IssuerOrganizationName"].Value = command.IssuerOrganizationName;
|
||||||
|
report.ReportParameters["CommandNo"].Value = command.CommandNo;
|
||||||
|
report.ReportParameters["CommandYear"].Value = command.CommandYear.ToInteger().ToThaiYear().ToString();
|
||||||
|
report.ReportParameters["CommandExecuteDate"].Value = command.CommandExcecuteDate == null ? "" : command.CommandExcecuteDate.Value.ToThaiFullDate3();
|
||||||
|
|
||||||
|
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-10 "
|
||||||
|
|
||||||
|
private async Task<byte[]> GenerateCommandReportType10_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,
|
||||||
|
CommandYear = raw_data.CommandYear.ToInteger().ToThaiYear().ToString(),
|
||||||
|
IssuerOrganizationName = raw_data.IssuerOrganizationName,
|
||||||
|
ConclusionRegisterNo = raw_data.ConclusionRegisterNo,
|
||||||
|
ConclusionRegisterDate = raw_data.ConclusionRegisterDate == null ? "" : raw_data.ConclusionRegisterDate.Value.ToThaiFullDate3(),
|
||||||
|
ConclusionResultNo = raw_data.ConclusionResultNo,
|
||||||
|
ConclusionResultDate = raw_data.ConclusionResultDate == null ? "" : raw_data.ConclusionResultDate.Value.ToThaiFullDate3(),
|
||||||
|
PositionList = "",
|
||||||
|
Count = raw_data.Receivers.Count,
|
||||||
|
CommandAffectDate = raw_data.CommandAffectDate == null ? "" : raw_data.CommandAffectDate.Value.ToThaiFullDate3(),
|
||||||
|
AuthorizedUserFullName = raw_data.AuthorizedUserFullName,
|
||||||
|
AuthorizedPosition = raw_data.AuthorizedPosition,
|
||||||
|
|
||||||
|
PlacementCommandIssuer = raw_data.PlacementCommandIssuer,
|
||||||
|
PlacementCommandNo = raw_data.PlacementCommandNo,
|
||||||
|
PlacementCommandDate = raw_data.PlacementCommandDate == null ? "" : raw_data.PlacementCommandDate.Value.ToThaiFullDate3(),
|
||||||
|
PlacementPositionName = raw_data.PlacementPositionName,
|
||||||
|
PlacementOrganizationName = raw_data.PlacementOrganizationName,
|
||||||
|
ProbationStartDate = raw_data.ProbationStartDate == null ? "" : raw_data.ProbationStartDate.Value.ToThaiFullDate3(),
|
||||||
|
ProbationEndDate = raw_data.ProbationEndDate == null ? "" : raw_data.ProbationEndDate.Value.ToThaiFullDate3(),
|
||||||
|
ChairManFullName = raw_data.ChairManFullName,
|
||||||
|
Member1FullName = raw_data.Member1FullName,
|
||||||
|
Member2FullName = raw_data.Member2FullName,
|
||||||
|
};
|
||||||
|
|
||||||
|
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"10-แต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region " C-PM-15 "
|
#region " C-PM-15 "
|
||||||
|
|
||||||
private async Task<byte[]> GenerateCommandReportType15_Cover(Guid commandId, string exportType)
|
private async Task<byte[]> GenerateCommandReportType15_Cover(Guid commandId, string exportType)
|
||||||
|
|
@ -1923,7 +2244,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult GetCommandType08CoverReport(Guid id, string exportType = "pdf")
|
public async Task<ActionResult<ResponseObject>> GetCommandType08CoverReportAsync(Guid id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -1935,10 +2256,12 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-5.trdp");
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
return File(contentData, mimeType, $"command.{exportType.Trim().ToLower()}");
|
var contentData = await GenerateCommandReportType08_Cover(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -1960,7 +2283,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult GetCommandType08AttachmentReport(Guid id, string exportType = "pdf")
|
public async Task<ActionResult<ResponseObject>> GetCommandType08AttachmentReportAsync(Guid id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -1972,10 +2295,12 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"08-คำสั่งบรรจุและแต่งตั้งข้าราชการฯกลับเข้ารับราชการ-6.trdp");
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
return File(contentData, mimeType, $"command-attachment.{exportType.Trim().ToLower()}");
|
var contentData = await GenerateCommandReportType08_Attachment(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -2001,7 +2326,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult GetCommandType09CoverReport(Guid id, string exportType = "pdf")
|
public async Task<ActionResult<ResponseObject>> GetCommandType09CoverReportAsync(Guid id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -2013,10 +2338,12 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-7.trdp");
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
return File(contentData, mimeType, $"command.{exportType.Trim().ToLower()}");
|
var contentData = await GenerateCommandReportType09_Cover(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -2038,7 +2365,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult GetCommandType09AttachmentReport(Guid id, string exportType = "pdf")
|
public async Task<ActionResult<ResponseObject>> GetCommandType09AttachmentReportAsync(Guid id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -2050,10 +2377,12 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"09-คำสั่งบรรจุและแต่งตั้งผู้ออกไปรับราชการทหารกลับเข้ารับราชการ-8.trdp");
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
return File(contentData, mimeType, $"command-attachment.{exportType.Trim().ToLower()}");
|
var contentData = await GenerateCommandReportType09_Attachment(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-attachment-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
@ -2079,7 +2408,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
public IActionResult GetCommandType10CoverReport(Guid id, string exportType = "pdf")
|
public async Task<ActionResult<ResponseObject>> GetCommandType10CoverReportAsync(Guid id, string exportType = "pdf")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -2091,10 +2420,12 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"10-แต่งตั้งคณะกรรมการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ.trdp");
|
var cmd = await _repository.GetByIdAsync(id);
|
||||||
var contentData = _reportGenerator.GenerateReport(rptFile, exportType);
|
if (cmd == null)
|
||||||
|
throw new Exception(GlobalMessages.CommandNotFound);
|
||||||
|
|
||||||
return File(contentData, mimeType, $"command.{exportType.Trim().ToLower()}");
|
var contentData = await GenerateCommandReportType10_Cover(id, exportType);
|
||||||
|
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue