แก้คำสั่งวินัย
This commit is contained in:
parent
6d7aebaeb5
commit
1c939f6ffc
5 changed files with 784 additions and 91 deletions
|
|
@ -1905,42 +1905,80 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#region " C-PM-19 "
|
||||
|
||||
private async Task<byte[]> GenerateCommandReportType19_Cover(Guid commandId, string exportType)
|
||||
private async Task<dynamic> GenerateCommandReportType19_Cover(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = await _repository.GetByIdAsync(commandId);
|
||||
if (command == null)
|
||||
// var command = await _repository.GetByIdAsync(commandId);
|
||||
// if (command == null)
|
||||
// {
|
||||
// throw new Exception(GlobalMessages.CommandNotFound);
|
||||
// }
|
||||
|
||||
// var data = await _commandReportRepository.GetCommandType19Async(commandId);
|
||||
|
||||
// var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งปลดออกจากราชการ.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 = data;
|
||||
|
||||
// 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;
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var data = await _commandReportRepository.GetCommandType19Async(commandId);
|
||||
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"37-คำสั่งปลดออกจากราชการ.trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
var command = new
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
No = raw_data.CommandNo.ToThaiNumber(),
|
||||
Year = 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,
|
||||
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
||||
Title = $"{raw_data.CommandSubject}",
|
||||
|
||||
report.DataSource = data;
|
||||
CaseFault = raw_data.CaseFault,
|
||||
FaultLevel = raw_data.FaultLevel,
|
||||
RefRaw = raw_data.RefRaw,
|
||||
Result = raw_data.Result,
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
|
||||
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
|
||||
Positionno = raw_data_profile == null ? "" : raw_data_profile.Positionno,
|
||||
Organizationname = raw_data_profile == null ? "" : raw_data_profile.Organizationname,
|
||||
Salary = raw_data_profile == null ? "" : raw_data_profile.Salary,
|
||||
};
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
|
||||
return content;
|
||||
return command;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -1952,42 +1990,80 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
|
||||
#region " C-PM-20 "
|
||||
|
||||
private async Task<byte[]> GenerateCommandReportType20_Cover(Guid commandId, string exportType)
|
||||
private async Task<dynamic> GenerateCommandReportType20_Cover(Guid commandId, string exportType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = await _repository.GetByIdAsync(commandId);
|
||||
if (command == null)
|
||||
// var command = await _repository.GetByIdAsync(commandId);
|
||||
// if (command == null)
|
||||
// {
|
||||
// throw new Exception(GlobalMessages.CommandNotFound);
|
||||
// }
|
||||
|
||||
// var data = await _commandReportRepository.GetCommandType20Async(commandId);
|
||||
|
||||
// var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"38-คำสั่งลงโทษไล่ข้าราชการออกจากราชการ.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 = data;
|
||||
|
||||
// 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;
|
||||
var raw_data = await _repository.GetByIdAsync(commandId);
|
||||
if (raw_data == null)
|
||||
{
|
||||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
}
|
||||
|
||||
var data = await _commandReportRepository.GetCommandType20Async(commandId);
|
||||
var raw_data_profile = await _commandReportRepository.GetCommandType25AttachmentAsync(commandId);
|
||||
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"38-คำสั่งลงโทษไล่ข้าราชการออกจากราชการ.trdp");
|
||||
|
||||
ReportPackager reportPackager = new ReportPackager();
|
||||
Telerik.Reporting.Report? report = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||
var command = new
|
||||
{
|
||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
No = raw_data.CommandNo.ToThaiNumber(),
|
||||
Year = 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,
|
||||
ReceiveOrganizationName = raw_data.ReceiveOrganizationName,
|
||||
Title = $"{raw_data.CommandSubject}",
|
||||
|
||||
report.DataSource = data;
|
||||
CaseFault = raw_data.CaseFault,
|
||||
FaultLevel = raw_data.FaultLevel,
|
||||
RefRaw = raw_data.RefRaw,
|
||||
Result = raw_data.Result,
|
||||
|
||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||
|
||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||
{
|
||||
ReportDocument = report
|
||||
Fullname = raw_data_profile == null ? "" : raw_data_profile.FullName,
|
||||
Positionname = raw_data_profile == null ? "" : raw_data_profile.Positionname,
|
||||
Positionno = raw_data_profile == null ? "" : raw_data_profile.Positionno,
|
||||
Organizationname = raw_data_profile == null ? "" : raw_data_profile.Organizationname,
|
||||
Salary = raw_data_profile == null ? "" : raw_data_profile.Salary,
|
||||
};
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport(exportType, instanceReportSource, deviceInfo);
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
|
||||
return content;
|
||||
return command;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -3756,7 +3832,6 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
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);
|
||||
|
|
@ -3764,7 +3839,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType19_Cover(id, exportType);
|
||||
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_005",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
@ -3799,7 +3891,6 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
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);
|
||||
|
|
@ -3807,7 +3898,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
throw new Exception(GlobalMessages.CommandNotFound);
|
||||
|
||||
var contentData = await GenerateCommandReportType20_Cover(id, exportType);
|
||||
return File(contentData, mimeType, $"command-{cmd.CommandNo}-{cmd.CommandYear.ToInteger().ToThaiYear()}.{exportType.Trim().ToLower()}");
|
||||
var data = new
|
||||
{
|
||||
template = "DP6_008",
|
||||
reportName = "docx-report",
|
||||
data = contentData
|
||||
};
|
||||
// var apiUrl = "https://report-server.frappet.synology.me/api/v1/report-template/docx";
|
||||
// using (var client = new HttpClient())
|
||||
// {
|
||||
// // client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
||||
// var req = new HttpRequestMessage(HttpMethod.Post, apiUrl);
|
||||
// // var res = await client.SendAsync(req);
|
||||
// var res = await client.PostAsJsonAsync(apiUrl, data);
|
||||
// var result = await res.Content.ReadAsStringAsync();
|
||||
// return Success(res);
|
||||
|
||||
// }
|
||||
return Success(data);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue