fix report kk1/kp7
This commit is contained in:
parent
7bfa5b00d6
commit
a9eb8d993c
3 changed files with 686 additions and 357 deletions
|
|
@ -81,15 +81,15 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.trdp");
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.trdp");
|
||||||
|
|
||||||
ReportPackager reportPackager = new ReportPackager();
|
//ReportPackager reportPackager = new ReportPackager();
|
||||||
Telerik.Reporting.Report? report = null;
|
//Telerik.Reporting.Report? report = null;
|
||||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
{
|
//{
|
||||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
}
|
//}
|
||||||
var CitizenId = "";
|
//var CitizenId = "";
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/kp7-short/{id}";
|
var apiUrl = $"{_configuration["API"]}/org/profile/kp7-short/{id}";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
|
|
@ -99,43 +99,153 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var org = JsonConvert.DeserializeObject<kp7ShortRequest>(_result);
|
var data = JsonConvert.DeserializeObject<kp7ShortRequest>(_result);
|
||||||
|
|
||||||
if (org == null || org.result == null)
|
if (data == null || data.result == null)
|
||||||
{
|
{
|
||||||
return Error("ไม่พบข้อมูลนี้ในระบบ", 404);
|
return Error("ไม่พบข้อมูลนี้ในระบบ", 404);
|
||||||
}
|
}
|
||||||
report.DataSource = org.result;
|
|
||||||
CitizenId = org.result.CitizenId;
|
|
||||||
var tblEducation = (Telerik.Reporting.Table)report.Items["groupHeaderSection"].Items["tblEducation"];
|
|
||||||
tblEducation.DataSource = org.result.Education;
|
|
||||||
// report.DataSource = data;
|
|
||||||
|
|
||||||
// if (profile.AvatarId != "")
|
var result = new
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// // Get avatar Image
|
|
||||||
// var picContent = (await _minioService.DownloadFileAsync(Guid.Parse("00000000-0000-0000-0000-000000000000"))).FileContent;
|
|
||||||
// var pictureBox = (Telerik.Reporting.PictureBox)report.Items["groupHeaderSection"].Items["picAvatar"];
|
|
||||||
// pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
|
||||||
// }
|
|
||||||
// catch { }
|
|
||||||
// }
|
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
||||||
{
|
{
|
||||||
ReportDocument = report
|
template = "kp7",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
FullName = data.result.Prefix != null && data.result.FirstName != null && data.result.LastName != null
|
||||||
|
? $"{data.result.Prefix}{data.result.FirstName} {data.result.LastName}" : "-",
|
||||||
|
Prefix = data.result.Prefix != null ? data.result.Prefix : "-",
|
||||||
|
FirstName = data.result.FirstName != null ? data.result.FirstName : "-",
|
||||||
|
LastName = data.result.LastName != null ? data.result.LastName : "-",
|
||||||
|
CitizenId = data.result.CitizenId != null ? data.result.CitizenId : "-",
|
||||||
|
DateOfBirth = data.result.DateOfBirth != null ? data.result.DateOfBirth : "-",
|
||||||
|
DateRetire = data.result.DateRetire != null ? data.result.DateRetire : "-",
|
||||||
|
SalaryAmount = data.result.SalaryAmount != null ? data.result.SalaryAmount : "-",
|
||||||
|
RegistrationAddress = data.result.RegistrationAddress != null ? data.result.RegistrationAddress : "-",
|
||||||
|
SalaryDate = data.result.SalaryDate != null ? data.result.SalaryDate : "-",
|
||||||
|
PositionName = data.result.PositionName != null ? data.result.PositionName : "-",
|
||||||
|
AppointText = data.result.AppointText != null ? data.result.AppointText : "-",
|
||||||
|
OcFullPath = data.result.OcFullPath != null ? data.result.OcFullPath : "-",
|
||||||
|
Educations = data.result.Education != null && data.result.Education.Count > 0
|
||||||
|
? data.result.Education
|
||||||
|
: new List<Educations> {
|
||||||
|
new Educations {
|
||||||
|
Institute = "-",
|
||||||
|
Date = "-",
|
||||||
|
Degree = "-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return Success(result);
|
||||||
|
|
||||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
//report.DataSource = org.result;
|
||||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
//CitizenId = org.result.CitizenId;
|
||||||
|
//var tblEducation = (Telerik.Reporting.Table)report.Items["groupHeaderSection"].Items["tblEducation"];
|
||||||
|
//tblEducation.DataSource = org.result.Education;
|
||||||
|
//// report.DataSource = data;
|
||||||
|
|
||||||
var content = result.DocumentBytes;
|
//// if (profile.AvatarId != "")
|
||||||
return File(content, "application/pdf", $"ประวัติการรับราชการอย่างย่อ_.pdf");
|
//// {
|
||||||
|
//// try
|
||||||
|
//// {
|
||||||
|
//// // Get avatar Image
|
||||||
|
//// var picContent = (await _minioService.DownloadFileAsync(Guid.Parse("00000000-0000-0000-0000-000000000000"))).FileContent;
|
||||||
|
//// var pictureBox = (Telerik.Reporting.PictureBox)report.Items["groupHeaderSection"].Items["picAvatar"];
|
||||||
|
//// pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
||||||
|
//// }
|
||||||
|
//// catch { }
|
||||||
|
//// }
|
||||||
|
|
||||||
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
//{
|
||||||
|
// ReportDocument = report
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
|
//RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||||
|
|
||||||
|
//var content = result.DocumentBytes;
|
||||||
|
//return File(content, "application/pdf", $"ประวัติการรับราชการอย่างย่อ_.pdf");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Error(ex, "ไม่สามารถแสดงผลรายงานได้!!!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// แสดงประวัติการรับราชการแบบย่อ (ลูกจ้างประจำ)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">รหัสข้อมูลข้าราชการ</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อแสดงรายงานสำเร็จ</response>
|
||||||
|
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
|
||||||
|
[HttpGet("kp7-short-employee/{id:length(36)}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> GetKp7EmpShortReport(Guid id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var apiUrl = $"{_configuration["API"]}/org/profile-employee/kp7-short/{id}";
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
|
||||||
|
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
|
||||||
|
var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
|
||||||
|
var _res = await client.SendAsync(_req);
|
||||||
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
var data = JsonConvert.DeserializeObject<kp7ShortRequest>(_result);
|
||||||
|
|
||||||
|
if (data == null || data.result == null)
|
||||||
|
{
|
||||||
|
return Error("ไม่พบข้อมูลนี้ในระบบ", 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
template = "kp7",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
FullName = data.result.Prefix != null && data.result.FirstName != null && data.result.LastName != null
|
||||||
|
? $"{data.result.Prefix}{data.result.FirstName} {data.result.LastName}" : "-",
|
||||||
|
Prefix = data.result.Prefix != null ? data.result.Prefix : "-",
|
||||||
|
FirstName = data.result.FirstName != null ? data.result.FirstName : "-",
|
||||||
|
LastName = data.result.LastName != null ? data.result.LastName : "-",
|
||||||
|
CitizenId = data.result.CitizenId != null ? data.result.CitizenId : "-",
|
||||||
|
DateOfBirth = data.result.DateOfBirth != null ? data.result.DateOfBirth : "-",
|
||||||
|
DateRetire = data.result.DateRetire != null ? data.result.DateRetire : "-",
|
||||||
|
SalaryAmount = data.result.SalaryAmount != null ? data.result.SalaryAmount : "-",
|
||||||
|
RegistrationAddress = data.result.RegistrationAddress != null ? data.result.RegistrationAddress : "-",
|
||||||
|
SalaryDate = data.result.SalaryDate != null ? data.result.SalaryDate : "-",
|
||||||
|
PositionName = data.result.PositionName != null ? data.result.PositionName : "-",
|
||||||
|
AppointText = data.result.AppointText != null ? data.result.AppointText : "-",
|
||||||
|
OcFullPath = data.result.OcFullPath != null ? data.result.OcFullPath : "-",
|
||||||
|
Educations = data.result.Education != null && data.result.Education.Count > 0
|
||||||
|
? data.result.Education
|
||||||
|
: new List<Educations> {
|
||||||
|
new Educations {
|
||||||
|
Institute = "-",
|
||||||
|
Date = "-",
|
||||||
|
Degree = "-",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return Success(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|
@ -162,23 +272,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page0.trdp");
|
|
||||||
ReportPackager reportPackager0 = new ReportPackager();
|
//var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page0.trdp");
|
||||||
Telerik.Reporting.Report? report0 = null;
|
//ReportPackager reportPackager0 = new ReportPackager();
|
||||||
using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
//Telerik.Reporting.Report? report0 = null;
|
||||||
{
|
//using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
||||||
report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
//{
|
||||||
}
|
// report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.trdp");
|
//}
|
||||||
ReportPackager reportPackager = new ReportPackager();
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.trdp");
|
||||||
Telerik.Reporting.Report? report = null;
|
//ReportPackager reportPackager = new ReportPackager();
|
||||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
//Telerik.Reporting.Report? report = null;
|
||||||
{
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
//{
|
||||||
}
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
var CitizenId = "";
|
//}
|
||||||
var FullName = "";
|
//var CitizenId = "";
|
||||||
var OcFullPath = "";
|
//var FullName = "";
|
||||||
|
//var OcFullPath = "";
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile/kk1/{id}";
|
var apiUrl = $"{_configuration["API"]}/org/profile/kk1/{id}";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
|
|
@ -188,201 +299,237 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
var data = JsonConvert.DeserializeObject<kk1Responses>(_result);
|
||||||
|
|
||||||
if (org == null || org.result == null)
|
if (data == null || data.Result == null)
|
||||||
{
|
{
|
||||||
return Error("ไม่พบข้อมูลนี้ในระบบ", 404);
|
return Error("ไม่พบข้อมูลนี้ในระบบ", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
report0.DataSource = org.result.Profile;
|
var result = new
|
||||||
var tblInsignia = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblInsignia"];
|
|
||||||
tblInsignia.DataSource = org.result.Insignia;
|
|
||||||
|
|
||||||
var tblLeave = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblLeave"];
|
|
||||||
tblLeave.DataSource = org.result.Leave;
|
|
||||||
|
|
||||||
report.DataSource = org.result.Profile;
|
|
||||||
// binding to table
|
|
||||||
var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"];
|
|
||||||
tblCertificate.DataSource = org.result.Cert;
|
|
||||||
|
|
||||||
var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"];
|
|
||||||
tblTraining.DataSource = org.result.Training;
|
|
||||||
|
|
||||||
var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"];
|
|
||||||
tblDiscipline.DataSource = org.result.Discipline;
|
|
||||||
|
|
||||||
var tblEducation = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblEducation"];
|
|
||||||
tblEducation.DataSource = org.result.Education;
|
|
||||||
var salary = org.result.Salary;
|
|
||||||
CitizenId = org.result.Profile[0].CitizenId;
|
|
||||||
FullName = org.result.Profile[0].FullName;
|
|
||||||
OcFullPath = org.result.Profile[0].OcFullPath;
|
|
||||||
|
|
||||||
// if (profile.First().AvatarId != "")
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// // Get avatar Image
|
|
||||||
// var picContent = (await _minioService.DownloadFileAsync(Guid.Parse(profile.First().AvatarId))).FileContent;
|
|
||||||
// var pictureBox = (Telerik.Reporting.PictureBox)report.Items["pageFooterSection1"].Items["picAvatar"];
|
|
||||||
// pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
|
||||||
// }
|
|
||||||
// catch { }
|
|
||||||
// }
|
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo0 = new System.Collections.Hashtable();
|
|
||||||
InstanceReportSource instanceReportSource0 = new InstanceReportSource()
|
|
||||||
{
|
{
|
||||||
ReportDocument = report0
|
template = "kk1",
|
||||||
|
reportName = "docx-report",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
FullName = data.Result.Profile.Count > 0 ? $"{data.Result.Profile[0].Prefix}{data.Result.Profile[0].FirstName} {data.Result.Profile[0].LastName}" : "-",
|
||||||
|
Prefix = data.Result.Profile.Count > 0 ? data.Result.Profile[0].Prefix : "-",
|
||||||
|
FirstName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].FirstName : "-",
|
||||||
|
LastName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].LastName : "-",
|
||||||
|
OcFullPath = data.Result.Profile.Count > 0 ? data.Result.Profile[0].OcFullPath : "-",
|
||||||
|
BirthDate = data.Result.Profile.Count > 0 ? data.Result.Profile[0].BirthDate : "-",
|
||||||
|
RetireDate = data.Result.Profile.Count > 0 ? data.Result.Profile[0].RetireDate : "-",
|
||||||
|
AppointDate = data.Result.Profile.Count > 0 ? data.Result.Profile[0].AppointDate : "-",
|
||||||
|
CitizenId = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CitizenId : "-",
|
||||||
|
FatherFullName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].FatherFullName : "-",
|
||||||
|
MotherFullName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].MotherFullName : "-",
|
||||||
|
CoupleFullName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CoupleFullName : "-",
|
||||||
|
CoupleLastNameOld = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CoupleLastNameOld : "-",
|
||||||
|
CurrentAddress = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentAddress : "-",
|
||||||
|
CurrentSubDistrict = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentSubDistrict : "-",
|
||||||
|
CurrentDistrict = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentDistrict : "-",
|
||||||
|
CurrentProvince = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentProvince : "-",
|
||||||
|
Telephone = data.Result.Profile.Count > 0 ? data.Result.Profile[0].Telephone : "-",
|
||||||
|
Insignias = data.Result.Insignia,
|
||||||
|
Leaves = data.Result.Leave,
|
||||||
|
Certs = data.Result.Cert,
|
||||||
|
Trainings = data.Result.Training,
|
||||||
|
Disciplines = data.Result.Discipline,
|
||||||
|
Educations = data.Result.Education,
|
||||||
|
Salarys = data.Result.Salary,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ReportProcessor reportProcessor0 = new ReportProcessor(_configuration);
|
return Success(result);
|
||||||
RenderingResult result0 = reportProcessor0.RenderReport("PDF", instanceReportSource0, deviceInfo0);
|
|
||||||
var content0 = result0.DocumentBytes;
|
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
//report0.DataSource = org.result.Profile;
|
||||||
|
//var tblInsignia = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblInsignia"];
|
||||||
|
//tblInsignia.DataSource = org.result.Insignia;
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
//var tblLeave = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblLeave"];
|
||||||
{
|
//tblLeave.DataSource = org.result.Leave;
|
||||||
ReportDocument = report
|
|
||||||
};
|
|
||||||
|
|
||||||
|
//report.DataSource = org.result.Profile;
|
||||||
|
//// binding to table
|
||||||
|
//var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"];
|
||||||
|
//tblCertificate.DataSource = org.result.Cert;
|
||||||
|
|
||||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
//var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"];
|
||||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
//tblTraining.DataSource = org.result.Training;
|
||||||
|
|
||||||
// byte array waiting for merge pdf
|
//var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"];
|
||||||
var content = result.DocumentBytes;
|
//tblDiscipline.DataSource = org.result.Discipline;
|
||||||
|
|
||||||
// // page2
|
//var tblEducation = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblEducation"];
|
||||||
// var profile2 = (from p in _context.Profiles
|
//tblEducation.DataSource = org.result.Education;
|
||||||
// join pf in _context.Prefixes on p.PrefixId equals pf.Id
|
//var salary = org.result.Salary;
|
||||||
// where p.Id == id
|
//CitizenId = org.result.Profile[0].CitizenId;
|
||||||
// select new
|
//FullName = org.result.Profile[0].FullName;
|
||||||
// {
|
//OcFullPath = org.result.Profile[0].OcFullPath;
|
||||||
// FullName = $"{pf.Name}{p.FirstName} {p.LastName}",
|
|
||||||
// OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
|
||||||
// }).FirstOrDefault();
|
|
||||||
|
|
||||||
// var salary = (from s in _context.ProfileSalaries
|
//// if (profile.First().AvatarId != "")
|
||||||
// .Include(x => x.PositionLevel)
|
//// {
|
||||||
// join pos in _context.PositionPaths.AsQueryable()
|
//// try
|
||||||
// on s.PositionId equals pos.Id
|
//// {
|
||||||
// join pos_no in _context.PositionNumbers on s.PosNoId equals pos_no.Id
|
//// // Get avatar Image
|
||||||
// // join pos_lv in _context.PositionLevels on s.PositionLevelId equals pos_lv.Id
|
//// var picContent = (await _minioService.DownloadFileAsync(Guid.Parse(profile.First().AvatarId))).FileContent;
|
||||||
// join pos_type in _context.PositionTypes on s.PositionTypeId equals pos_type.Id
|
//// var pictureBox = (Telerik.Reporting.PictureBox)report.Items["pageFooterSection1"].Items["picAvatar"];
|
||||||
// where s.Profile.Id == id
|
//// pictureBox.Value = Image.FromStream(new MemoryStream(picContent));
|
||||||
// orderby s.Date.Value
|
//// }
|
||||||
// select new
|
//// catch { }
|
||||||
// {
|
//// }
|
||||||
// SalaryDate = s.Date == null ? "" : s.Date == new DateTime(1, 1, 1) ? "" : s.Date.Value.ToThaiShortDate(),
|
|
||||||
// Position = $"{pos.Name} ประเภท{pos_type.Name} ระดับ{s.PositionLevel.Name}",
|
|
||||||
// PosNo = pos_no.Name,
|
|
||||||
// Rank = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
|
||||||
// Salary = s.Amount == null ? "" : s.Amount == 0 ? "-" : s.Amount.ToString().ToInteger().ToNumericText(),
|
|
||||||
// RefAll = s.SalaryRef,
|
|
||||||
// PositionType = pos_type.Name,
|
|
||||||
// PositionLevel = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
|
||||||
// PositionAmount = s.PositionSalaryAmount == null ? "" : s.PositionSalaryAmount.Value == 0 ? "-" : s.PositionSalaryAmount.Value.ToString().ToInteger().ToNumericText(),
|
|
||||||
// FullName = profile2.FullName,
|
|
||||||
// OcFullPath = profile2.OcFullPath
|
|
||||||
// }).ToList();
|
|
||||||
|
|
||||||
//while (salary.Count < 60)
|
//System.Collections.Hashtable deviceInfo0 = new System.Collections.Hashtable();
|
||||||
|
//InstanceReportSource instanceReportSource0 = new InstanceReportSource()
|
||||||
//{
|
//{
|
||||||
// salary.Add(new
|
// ReportDocument = report0
|
||||||
// {
|
//};
|
||||||
// SalaryDate = "",
|
|
||||||
// Position = "",
|
//ReportProcessor reportProcessor0 = new ReportProcessor(_configuration);
|
||||||
// PosNo = "",
|
//RenderingResult result0 = reportProcessor0.RenderReport("PDF", instanceReportSource0, deviceInfo0);
|
||||||
// Rank = "",
|
//var content0 = result0.DocumentBytes;
|
||||||
// Salary = "",
|
|
||||||
// RefAll = "",
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
// PositionType = "",
|
|
||||||
// PositionLevel = "",
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
// PositionAmount = "",
|
//{
|
||||||
// FullName = profile2.FullName,
|
// ReportDocument = report
|
||||||
// OcFullPath = profile2.OcFullPath
|
//};
|
||||||
// });
|
|
||||||
|
|
||||||
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
|
//RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||||
|
|
||||||
|
//// byte array waiting for merge pdf
|
||||||
|
//var content = result.DocumentBytes;
|
||||||
|
|
||||||
|
//// // page2
|
||||||
|
//// var profile2 = (from p in _context.Profiles
|
||||||
|
//// join pf in _context.Prefixes on p.PrefixId equals pf.Id
|
||||||
|
//// where p.Id == id
|
||||||
|
//// select new
|
||||||
|
//// {
|
||||||
|
//// FullName = $"{pf.Name}{p.FirstName} {p.LastName}",
|
||||||
|
//// OcFullPath = _profileService.GetOrganizationNameFullPath(p.OcId.Value, false, false),
|
||||||
|
//// }).FirstOrDefault();
|
||||||
|
|
||||||
|
//// var salary = (from s in _context.ProfileSalaries
|
||||||
|
//// .Include(x => x.PositionLevel)
|
||||||
|
//// join pos in _context.PositionPaths.AsQueryable()
|
||||||
|
//// on s.PositionId equals pos.Id
|
||||||
|
//// join pos_no in _context.PositionNumbers on s.PosNoId equals pos_no.Id
|
||||||
|
//// // join pos_lv in _context.PositionLevels on s.PositionLevelId equals pos_lv.Id
|
||||||
|
//// join pos_type in _context.PositionTypes on s.PositionTypeId equals pos_type.Id
|
||||||
|
//// where s.Profile.Id == id
|
||||||
|
//// orderby s.Date.Value
|
||||||
|
//// select new
|
||||||
|
//// {
|
||||||
|
//// SalaryDate = s.Date == null ? "" : s.Date == new DateTime(1, 1, 1) ? "" : s.Date.Value.ToThaiShortDate(),
|
||||||
|
//// Position = $"{pos.Name} ประเภท{pos_type.Name} ระดับ{s.PositionLevel.Name}",
|
||||||
|
//// PosNo = pos_no.Name,
|
||||||
|
//// Rank = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
||||||
|
//// Salary = s.Amount == null ? "" : s.Amount == 0 ? "-" : s.Amount.ToString().ToInteger().ToNumericText(),
|
||||||
|
//// RefAll = s.SalaryRef,
|
||||||
|
//// PositionType = pos_type.Name,
|
||||||
|
//// PositionLevel = s.PositionLevel == null ? null : s.PositionLevel.Name,
|
||||||
|
//// PositionAmount = s.PositionSalaryAmount == null ? "" : s.PositionSalaryAmount.Value == 0 ? "-" : s.PositionSalaryAmount.Value.ToString().ToInteger().ToNumericText(),
|
||||||
|
//// FullName = profile2.FullName,
|
||||||
|
//// OcFullPath = profile2.OcFullPath
|
||||||
|
//// }).ToList();
|
||||||
|
|
||||||
|
////while (salary.Count < 60)
|
||||||
|
////{
|
||||||
|
//// salary.Add(new
|
||||||
|
//// {
|
||||||
|
//// SalaryDate = "",
|
||||||
|
//// Position = "",
|
||||||
|
//// PosNo = "",
|
||||||
|
//// Rank = "",
|
||||||
|
//// Salary = "",
|
||||||
|
//// RefAll = "",
|
||||||
|
//// PositionType = "",
|
||||||
|
//// PositionLevel = "",
|
||||||
|
//// PositionAmount = "",
|
||||||
|
//// FullName = profile2.FullName,
|
||||||
|
//// OcFullPath = profile2.OcFullPath
|
||||||
|
//// });
|
||||||
|
////}
|
||||||
|
|
||||||
|
//var rptFile2 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page2.trdp");
|
||||||
|
|
||||||
|
//ReportPackager reportPackager2 = new ReportPackager();
|
||||||
|
//Telerik.Reporting.Report? report2 = null;
|
||||||
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile2))
|
||||||
|
//{
|
||||||
|
// report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
var rptFile2 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page2.trdp");
|
//report2.ReportParameters["FullName"].Value = FullName;
|
||||||
|
//report2.ReportParameters["OcFullPath"].Value = OcFullPath;
|
||||||
|
|
||||||
ReportPackager reportPackager2 = new ReportPackager();
|
//// binding to table
|
||||||
Telerik.Reporting.Report? report2 = null;
|
//var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"];
|
||||||
using (var sourceStream = System.IO.File.OpenRead(rptFile2))
|
//tblSalary.DataSource = salary;
|
||||||
{
|
|
||||||
report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
report2.ReportParameters["FullName"].Value = FullName;
|
//System.Collections.Hashtable deviceInfo2 = new System.Collections.Hashtable();
|
||||||
report2.ReportParameters["OcFullPath"].Value = OcFullPath;
|
|
||||||
|
|
||||||
// binding to table
|
//InstanceReportSource instanceReportSource2 = new InstanceReportSource()
|
||||||
var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"];
|
//{
|
||||||
tblSalary.DataSource = salary;
|
// ReportDocument = report2
|
||||||
|
//};
|
||||||
System.Collections.Hashtable deviceInfo2 = new System.Collections.Hashtable();
|
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource2 = new InstanceReportSource()
|
|
||||||
{
|
|
||||||
ReportDocument = report2
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ReportProcessor reportProcessor2 = new ReportProcessor(_configuration);
|
//ReportProcessor reportProcessor2 = new ReportProcessor(_configuration);
|
||||||
RenderingResult result2 = reportProcessor2.RenderReport("PDF", instanceReportSource2, deviceInfo2);
|
//RenderingResult result2 = reportProcessor2.RenderReport("PDF", instanceReportSource2, deviceInfo2);
|
||||||
|
|
||||||
// byte array waiting for merge pdf
|
//// byte array waiting for merge pdf
|
||||||
var content2 = result2.DocumentBytes;
|
//var content2 = result2.DocumentBytes;
|
||||||
|
|
||||||
// merge pdf
|
//// merge pdf
|
||||||
using (MemoryStream ms = new MemoryStream())
|
//using (MemoryStream ms = new MemoryStream())
|
||||||
{
|
//{
|
||||||
using (PdfDocument pdf = new PdfDocument(new PdfWriter(ms).SetSmartMode(true)))
|
// using (PdfDocument pdf = new PdfDocument(new PdfWriter(ms).SetSmartMode(true)))
|
||||||
{
|
// {
|
||||||
using (MemoryStream memoryStream = new MemoryStream(content0))
|
// using (MemoryStream memoryStream = new MemoryStream(content0))
|
||||||
{
|
// {
|
||||||
using (PdfReader reader = new PdfReader(memoryStream))
|
// using (PdfReader reader = new PdfReader(memoryStream))
|
||||||
{
|
// {
|
||||||
PdfDocument srcDoc = new PdfDocument(reader);
|
// PdfDocument srcDoc = new PdfDocument(reader);
|
||||||
srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
// srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Create reader from bytes
|
// // Create reader from bytes
|
||||||
using (MemoryStream memoryStream = new MemoryStream(content))
|
// using (MemoryStream memoryStream = new MemoryStream(content))
|
||||||
{
|
// {
|
||||||
// Create reader from bytes
|
// // Create reader from bytes
|
||||||
using (PdfReader reader = new PdfReader(memoryStream))
|
// using (PdfReader reader = new PdfReader(memoryStream))
|
||||||
{
|
// {
|
||||||
PdfDocument srcDoc = new PdfDocument(reader);
|
// PdfDocument srcDoc = new PdfDocument(reader);
|
||||||
srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
// srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// Create reader from bytes
|
// // Create reader from bytes
|
||||||
if (content2 != null)
|
// if (content2 != null)
|
||||||
{
|
// {
|
||||||
using (MemoryStream memoryStream = new MemoryStream(content2))
|
// using (MemoryStream memoryStream = new MemoryStream(content2))
|
||||||
{
|
// {
|
||||||
// Create reader from bytes
|
// // Create reader from bytes
|
||||||
using (PdfReader reader = new PdfReader(memoryStream))
|
// using (PdfReader reader = new PdfReader(memoryStream))
|
||||||
{
|
// {
|
||||||
PdfDocument srcDoc = new PdfDocument(reader);
|
// PdfDocument srcDoc = new PdfDocument(reader);
|
||||||
srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
// srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
pdf.Close();
|
// pdf.Close();
|
||||||
}
|
// }
|
||||||
|
|
||||||
var fileContent = ms.ToArray();
|
// var fileContent = ms.ToArray();
|
||||||
return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
// return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
||||||
}
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -410,23 +557,23 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page0.trdp");
|
//var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page0.trdp");
|
||||||
ReportPackager reportPackager0 = new ReportPackager();
|
//ReportPackager reportPackager0 = new ReportPackager();
|
||||||
Telerik.Reporting.Report? report0 = null;
|
//Telerik.Reporting.Report? report0 = null;
|
||||||
using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
//using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
||||||
{
|
//{
|
||||||
report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
// report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
||||||
}
|
//}
|
||||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page1.trdp");
|
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page1.trdp");
|
||||||
ReportPackager reportPackager = new ReportPackager();
|
//ReportPackager reportPackager = new ReportPackager();
|
||||||
Telerik.Reporting.Report? report = null;
|
//Telerik.Reporting.Report? report = null;
|
||||||
using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile))
|
||||||
{
|
//{
|
||||||
report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
// report = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
}
|
//}
|
||||||
var CitizenId = "";
|
//var CitizenId = "";
|
||||||
var FullName = "";
|
//var FullName = "";
|
||||||
var OcFullPath = "";
|
//var OcFullPath = "";
|
||||||
var apiUrl = $"{_configuration["API"]}/org/profile-employee/kk1/{id}";
|
var apiUrl = $"{_configuration["API"]}/org/profile-employee/kk1/{id}";
|
||||||
using (var client = new HttpClient())
|
using (var client = new HttpClient())
|
||||||
{
|
{
|
||||||
|
|
@ -436,137 +583,173 @@ namespace BMA.EHR.Report.Service.Controllers
|
||||||
var _res = await client.SendAsync(_req);
|
var _res = await client.SendAsync(_req);
|
||||||
var _result = await _res.Content.ReadAsStringAsync();
|
var _result = await _res.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
var org = JsonConvert.DeserializeObject<dynamic>(_result);
|
var data = JsonConvert.DeserializeObject<kk1Responses>(_result);
|
||||||
|
|
||||||
if (org == null || org.result == null)
|
if (data == null || data.Result == null)
|
||||||
{
|
{
|
||||||
return Error("ไม่พบข้อมูลนี้ในระบบ", 404);
|
return Error("ไม่พบข้อมูลนี้ในระบบ", 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
report0.DataSource = org.result.Profile;
|
var result = new
|
||||||
var tblInsignia = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblInsignia"];
|
|
||||||
tblInsignia.DataSource = org.result.Insignia;
|
|
||||||
|
|
||||||
var tblLeave = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblLeave"];
|
|
||||||
tblLeave.DataSource = org.result.Leave;
|
|
||||||
|
|
||||||
report.DataSource = org.result.Profile;
|
|
||||||
// binding to table
|
|
||||||
var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"];
|
|
||||||
tblCertificate.DataSource = org.result.Cert;
|
|
||||||
|
|
||||||
var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"];
|
|
||||||
tblTraining.DataSource = org.result.Training;
|
|
||||||
|
|
||||||
var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"];
|
|
||||||
tblDiscipline.DataSource = org.result.Discipline;
|
|
||||||
|
|
||||||
var tblEducation = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblEducation"];
|
|
||||||
tblEducation.DataSource = org.result.Education;
|
|
||||||
var salary = org.result.Salary;
|
|
||||||
CitizenId = org.result.Profile[0].CitizenId;
|
|
||||||
FullName = org.result.Profile[0].FullName;
|
|
||||||
OcFullPath = org.result.Profile[0].OcFullPath;
|
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo0 = new System.Collections.Hashtable();
|
|
||||||
InstanceReportSource instanceReportSource0 = new InstanceReportSource()
|
|
||||||
{
|
{
|
||||||
ReportDocument = report0
|
template = "kk1-emp",
|
||||||
};
|
reportName = "docx-report",
|
||||||
|
data = new
|
||||||
ReportProcessor reportProcessor0 = new ReportProcessor(_configuration);
|
|
||||||
RenderingResult result0 = reportProcessor0.RenderReport("PDF", instanceReportSource0, deviceInfo0);
|
|
||||||
var content0 = result0.DocumentBytes;
|
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource = new InstanceReportSource()
|
|
||||||
{
|
|
||||||
ReportDocument = report
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
|
||||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
|
||||||
|
|
||||||
// byte array waiting for merge pdf
|
|
||||||
var content = result.DocumentBytes;
|
|
||||||
|
|
||||||
var rptFile2 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page2.trdp");
|
|
||||||
|
|
||||||
ReportPackager reportPackager2 = new ReportPackager();
|
|
||||||
Telerik.Reporting.Report? report2 = null;
|
|
||||||
using (var sourceStream = System.IO.File.OpenRead(rptFile2))
|
|
||||||
{
|
|
||||||
report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
|
||||||
}
|
|
||||||
|
|
||||||
report2.ReportParameters["FullName"].Value = FullName;
|
|
||||||
report2.ReportParameters["OcFullPath"].Value = OcFullPath;
|
|
||||||
|
|
||||||
// binding to table
|
|
||||||
var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"];
|
|
||||||
tblSalary.DataSource = salary;
|
|
||||||
|
|
||||||
System.Collections.Hashtable deviceInfo2 = new System.Collections.Hashtable();
|
|
||||||
|
|
||||||
InstanceReportSource instanceReportSource2 = new InstanceReportSource()
|
|
||||||
{
|
|
||||||
ReportDocument = report2
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
ReportProcessor reportProcessor2 = new ReportProcessor(_configuration);
|
|
||||||
RenderingResult result2 = reportProcessor2.RenderReport("PDF", instanceReportSource2, deviceInfo2);
|
|
||||||
|
|
||||||
// byte array waiting for merge pdf
|
|
||||||
var content2 = result2.DocumentBytes;
|
|
||||||
|
|
||||||
// merge pdf
|
|
||||||
using (MemoryStream ms = new MemoryStream())
|
|
||||||
{
|
|
||||||
using (PdfDocument pdf = new PdfDocument(new PdfWriter(ms).SetSmartMode(true)))
|
|
||||||
{
|
{
|
||||||
using (MemoryStream memoryStream = new MemoryStream(content0))
|
FullName = data.Result.Profile.Count > 0 ? $"{data.Result.Profile[0].Prefix}{data.Result.Profile[0].FirstName} {data.Result.Profile[0].LastName}" : "-",
|
||||||
{
|
Prefix = data.Result.Profile.Count > 0 ? data.Result.Profile[0].Prefix : "-",
|
||||||
using (PdfReader reader = new PdfReader(memoryStream))
|
FirstName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].FirstName : "-",
|
||||||
{
|
LastName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].LastName : "-",
|
||||||
PdfDocument srcDoc = new PdfDocument(reader);
|
OcFullPath = data.Result.Profile.Count > 0 ? data.Result.Profile[0].OcFullPath : "-",
|
||||||
srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
BirthDate = data.Result.Profile.Count > 0 ? data.Result.Profile[0].BirthDate : "-",
|
||||||
}
|
RetireDate = data.Result.Profile.Count > 0 ? data.Result.Profile[0].RetireDate : "-",
|
||||||
}
|
AppointDate = data.Result.Profile.Count > 0 ? data.Result.Profile[0].AppointDate : "-",
|
||||||
|
CitizenId = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CitizenId : "-",
|
||||||
// Create reader from bytes
|
FatherFullName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].FatherFullName : "-",
|
||||||
using (MemoryStream memoryStream = new MemoryStream(content))
|
MotherFullName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].MotherFullName : "-",
|
||||||
{
|
CoupleFullName = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CoupleFullName : "-",
|
||||||
// Create reader from bytes
|
CoupleLastNameOld = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CoupleLastNameOld : "-",
|
||||||
using (PdfReader reader = new PdfReader(memoryStream))
|
CurrentAddress = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentAddress : "-",
|
||||||
{
|
CurrentSubDistrict = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentSubDistrict : "-",
|
||||||
PdfDocument srcDoc = new PdfDocument(reader);
|
CurrentDistrict = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentDistrict : "-",
|
||||||
srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
CurrentProvince = data.Result.Profile.Count > 0 ? data.Result.Profile[0].CurrentProvince : "-",
|
||||||
}
|
Telephone = data.Result.Profile.Count > 0 ? data.Result.Profile[0].Telephone : "-",
|
||||||
}
|
Insignias = data.Result.Insignia,
|
||||||
|
Leaves = data.Result.Leave,
|
||||||
// Create reader from bytes
|
Certs = data.Result.Cert,
|
||||||
if (content2 != null)
|
Trainings = data.Result.Training,
|
||||||
{
|
Disciplines = data.Result.Discipline,
|
||||||
using (MemoryStream memoryStream = new MemoryStream(content2))
|
Educations = data.Result.Education,
|
||||||
{
|
Salarys = data.Result.Salary,
|
||||||
// Create reader from bytes
|
|
||||||
using (PdfReader reader = new PdfReader(memoryStream))
|
|
||||||
{
|
|
||||||
PdfDocument srcDoc = new PdfDocument(reader);
|
|
||||||
srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pdf.Close();
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
var fileContent = ms.ToArray();
|
return Success(result);
|
||||||
return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
|
||||||
}
|
//report0.DataSource = org.result.Profile;
|
||||||
|
//var tblInsignia = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblInsignia"];
|
||||||
|
//tblInsignia.DataSource = org.result.Insignia;
|
||||||
|
|
||||||
|
//var tblLeave = (Telerik.Reporting.Table)report0.Items["detailSection1"].Items["tblLeave"];
|
||||||
|
//tblLeave.DataSource = org.result.Leave;
|
||||||
|
|
||||||
|
//report.DataSource = org.result.Profile;
|
||||||
|
//// binding to table
|
||||||
|
//var tblCertificate = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblCertificate"];
|
||||||
|
//tblCertificate.DataSource = org.result.Cert;
|
||||||
|
|
||||||
|
//var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"];
|
||||||
|
//tblTraining.DataSource = org.result.Training;
|
||||||
|
|
||||||
|
//var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"];
|
||||||
|
//tblDiscipline.DataSource = org.result.Discipline;
|
||||||
|
|
||||||
|
//var tblEducation = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblEducation"];
|
||||||
|
//tblEducation.DataSource = org.result.Education;
|
||||||
|
//var salary = org.result.Salary;
|
||||||
|
//CitizenId = org.result.Profile[0].CitizenId;
|
||||||
|
//FullName = org.result.Profile[0].FullName;
|
||||||
|
//OcFullPath = org.result.Profile[0].OcFullPath;
|
||||||
|
|
||||||
|
//System.Collections.Hashtable deviceInfo0 = new System.Collections.Hashtable();
|
||||||
|
//InstanceReportSource instanceReportSource0 = new InstanceReportSource()
|
||||||
|
//{
|
||||||
|
// ReportDocument = report0
|
||||||
|
//};
|
||||||
|
|
||||||
|
//ReportProcessor reportProcessor0 = new ReportProcessor(_configuration);
|
||||||
|
//RenderingResult result0 = reportProcessor0.RenderReport("PDF", instanceReportSource0, deviceInfo0);
|
||||||
|
//var content0 = result0.DocumentBytes;
|
||||||
|
|
||||||
|
//System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
|
||||||
|
|
||||||
|
//InstanceReportSource instanceReportSource = new InstanceReportSource()
|
||||||
|
//{
|
||||||
|
// ReportDocument = report
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
//ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||||
|
//RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||||
|
|
||||||
|
//// byte array waiting for merge pdf
|
||||||
|
//var content = result.DocumentBytes;
|
||||||
|
|
||||||
|
//var rptFile2 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page2.trdp");
|
||||||
|
|
||||||
|
//ReportPackager reportPackager2 = new ReportPackager();
|
||||||
|
//Telerik.Reporting.Report? report2 = null;
|
||||||
|
//using (var sourceStream = System.IO.File.OpenRead(rptFile2))
|
||||||
|
//{
|
||||||
|
// report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//report2.ReportParameters["FullName"].Value = FullName;
|
||||||
|
//report2.ReportParameters["OcFullPath"].Value = OcFullPath;
|
||||||
|
|
||||||
|
//// binding to table
|
||||||
|
//var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"];
|
||||||
|
//tblSalary.DataSource = salary;
|
||||||
|
|
||||||
|
//System.Collections.Hashtable deviceInfo2 = new System.Collections.Hashtable();
|
||||||
|
|
||||||
|
//InstanceReportSource instanceReportSource2 = new InstanceReportSource()
|
||||||
|
//{
|
||||||
|
// ReportDocument = report2
|
||||||
|
//};
|
||||||
|
|
||||||
|
|
||||||
|
//ReportProcessor reportProcessor2 = new ReportProcessor(_configuration);
|
||||||
|
//RenderingResult result2 = reportProcessor2.RenderReport("PDF", instanceReportSource2, deviceInfo2);
|
||||||
|
|
||||||
|
//// byte array waiting for merge pdf
|
||||||
|
//var content2 = result2.DocumentBytes;
|
||||||
|
|
||||||
|
//// merge pdf
|
||||||
|
//using (MemoryStream ms = new MemoryStream())
|
||||||
|
//{
|
||||||
|
// using (PdfDocument pdf = new PdfDocument(new PdfWriter(ms).SetSmartMode(true)))
|
||||||
|
// {
|
||||||
|
// using (MemoryStream memoryStream = new MemoryStream(content0))
|
||||||
|
// {
|
||||||
|
// using (PdfReader reader = new PdfReader(memoryStream))
|
||||||
|
// {
|
||||||
|
// PdfDocument srcDoc = new PdfDocument(reader);
|
||||||
|
// srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Create reader from bytes
|
||||||
|
// using (MemoryStream memoryStream = new MemoryStream(content))
|
||||||
|
// {
|
||||||
|
// // Create reader from bytes
|
||||||
|
// using (PdfReader reader = new PdfReader(memoryStream))
|
||||||
|
// {
|
||||||
|
// PdfDocument srcDoc = new PdfDocument(reader);
|
||||||
|
// srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // Create reader from bytes
|
||||||
|
// if (content2 != null)
|
||||||
|
// {
|
||||||
|
// using (MemoryStream memoryStream = new MemoryStream(content2))
|
||||||
|
// {
|
||||||
|
// // Create reader from bytes
|
||||||
|
// using (PdfReader reader = new PdfReader(memoryStream))
|
||||||
|
// {
|
||||||
|
// PdfDocument srcDoc = new PdfDocument(reader);
|
||||||
|
// srcDoc.CopyPagesTo(1, srcDoc.GetNumberOfPages(), pdf);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
// pdf.Close();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var fileContent = ms.ToArray();
|
||||||
|
// return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
||||||
|
//}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
139
Responses/kk1Responses.cs
Normal file
139
Responses/kk1Responses.cs
Normal file
|
|
@ -0,0 +1,139 @@
|
||||||
|
using BMA.EHR.MetaData.Service.Models;
|
||||||
|
using BMA.EHR.Recurit.Exam.Service.Models;
|
||||||
|
using DnsClient;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using System.Runtime.ConstrainedExecution;
|
||||||
|
|
||||||
|
namespace BMA.EHR.Report.Service.Responses
|
||||||
|
{
|
||||||
|
public class kk1Responses
|
||||||
|
{
|
||||||
|
public string Status { get; set; }
|
||||||
|
public string Message { get; set; }
|
||||||
|
public Data Result { get; set; }
|
||||||
|
|
||||||
|
public class Data
|
||||||
|
{
|
||||||
|
public List<Profile> Profile { get; set; }
|
||||||
|
public List<Insignia> Insignia { get; set; }
|
||||||
|
public List<Leave> Leave { get; set; }
|
||||||
|
public List<Cert> Cert { get; set; }
|
||||||
|
public List<Training> Training { get; set; }
|
||||||
|
public List<Discipline> Discipline { get; set; }
|
||||||
|
public List<Education> Education { get; set; }
|
||||||
|
public List<Salaries> Salary { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Profile
|
||||||
|
{
|
||||||
|
public string? CitizenId { get; set; }
|
||||||
|
public string? Prefix { get; set; }
|
||||||
|
public string? FirstName { get; set; }
|
||||||
|
public string? LastName { get; set; }
|
||||||
|
public string? FullName { get; set; }
|
||||||
|
public string? BirthDay { get; set; }
|
||||||
|
public string? BirthDayText { get; set; }
|
||||||
|
public string? BirthMonth { get; set; }
|
||||||
|
public string? BirthYear { get; set; }
|
||||||
|
public string? BirthYearText { get; set; }
|
||||||
|
public string? Address { get; set; }
|
||||||
|
public string? District { get; set; }
|
||||||
|
public string? Area { get; set; }
|
||||||
|
public string? Province { get; set; }
|
||||||
|
public string? Telephone { get; set; }
|
||||||
|
public string? CoupleLastNameOld { get; set; }
|
||||||
|
public string? CouplePrefix { get; set; }
|
||||||
|
public string? CoupleFullName { get; set; }
|
||||||
|
public string? FatherPrefix { get; set; }
|
||||||
|
public string? FatherFullName { get; set; }
|
||||||
|
public string? MotherPrefix { get; set; }
|
||||||
|
public string? MotherFullName { get; set; }
|
||||||
|
public string? OcFullPath { get; set; }
|
||||||
|
public string? Division { get; set; }
|
||||||
|
public string? Institute { get; set; }
|
||||||
|
public string? StartDate { get; set; }
|
||||||
|
public string? AppointDate { get; set; }
|
||||||
|
public string? BirthDate { get; set; }
|
||||||
|
public string? RetireDate { get; set; }
|
||||||
|
public string? CurrentAddress { get; set; }
|
||||||
|
public string? CurrentSubDistrict { get; set; }
|
||||||
|
public string? CurrentDistrict { get; set; }
|
||||||
|
public string? CurrentProvince { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Insignia
|
||||||
|
{
|
||||||
|
public string? ReceiveDate { get; set; }
|
||||||
|
public string? InsigniaName { get; set; }
|
||||||
|
public string? InsigniaShortName { get; set; }
|
||||||
|
public string? InsigniaTypeName { get; set; }
|
||||||
|
public string? No { get; set; }
|
||||||
|
public string? Issue { get; set; }
|
||||||
|
public string? VolumeNo { get; set; }
|
||||||
|
public string? Volume { get; set; }
|
||||||
|
public string? Section { get; set; }
|
||||||
|
public string? Page { get; set; }
|
||||||
|
public string? RefCommandDate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Leave
|
||||||
|
{
|
||||||
|
public string? LeaveTypeName { get; set; }
|
||||||
|
public string? DateLeaveStart { get; set; }
|
||||||
|
public string? LeaveDays { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Cert
|
||||||
|
{
|
||||||
|
public string? CertificateType { get; set; }
|
||||||
|
public string? Issuer { get; set; }
|
||||||
|
public string? CertificateNo { get; set; }
|
||||||
|
public string? IssueDate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Training
|
||||||
|
{
|
||||||
|
public string? Institute { get; set; }
|
||||||
|
public string? Start { get; set; }
|
||||||
|
public string? End { get; set; }
|
||||||
|
public string? Date { get; set; }
|
||||||
|
public string? Level { get; set; }
|
||||||
|
public string? Degree { get; set; }
|
||||||
|
public string? Field { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Discipline
|
||||||
|
{
|
||||||
|
public string? DisciplineYear { get; set; }
|
||||||
|
public string? DisciplineDetail { get; set; }
|
||||||
|
public string? RefNo { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Education
|
||||||
|
{
|
||||||
|
public string? Institute { get; set; }
|
||||||
|
public string? Start { get; set; }
|
||||||
|
public string? End { get; set; }
|
||||||
|
public string? Date { get; set; }
|
||||||
|
public string? Level { get; set; }
|
||||||
|
public string? Degree { get; set; }
|
||||||
|
public string? Field { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Salaries
|
||||||
|
{
|
||||||
|
public string? SalaryDate { get; set; }
|
||||||
|
public string? Position { get; set; }
|
||||||
|
public string? PosNo { get; set; }
|
||||||
|
public string? Salary { get; set; }
|
||||||
|
public string? Rank { get; set; }
|
||||||
|
public string? RefAll { get; set; }
|
||||||
|
public string? PositionLevel { get; set; }
|
||||||
|
public string? PositionType { get; set; }
|
||||||
|
public string? PositionAmount { get; set; }
|
||||||
|
public string? FullName { get; set; }
|
||||||
|
public string? OcFullPath { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,10 +16,17 @@ namespace BMA.EHR.Report.Service.Responses
|
||||||
public string? DateRetire { get; set; }
|
public string? DateRetire { get; set; }
|
||||||
public string? RegistrationAddress { get; set; }
|
public string? RegistrationAddress { get; set; }
|
||||||
public string? SalaryAmount { get; set; }
|
public string? SalaryAmount { get; set; }
|
||||||
public List<dynamic> Education { get; set; }
|
public List<Educations> Education { get; set; }
|
||||||
public string? AppointText { get; set; }
|
public string? AppointText { get; set; }
|
||||||
public string? SalaryDate { get; set; }
|
public string? SalaryDate { get; set; }
|
||||||
public string? PositionName { get; set; }
|
public string? PositionName { get; set; }
|
||||||
public string? OcFullPath { get; set; }
|
public string? OcFullPath { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Educations
|
||||||
|
{
|
||||||
|
public string? Institute { get; set; }
|
||||||
|
public string? Date { get; set; }
|
||||||
|
public string? Degree { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue