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
|
||||
{
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.trdp");
|
||||
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptShortKp7.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 CitizenId = "";
|
||||
//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 CitizenId = "";
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile/kp7-short/{id}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -99,43 +99,153 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
var _res = await client.SendAsync(_req);
|
||||
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);
|
||||
}
|
||||
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 != "")
|
||||
// {
|
||||
// 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()
|
||||
var result = new
|
||||
{
|
||||
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);
|
||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||
//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;
|
||||
|
||||
var content = result.DocumentBytes;
|
||||
return File(content, "application/pdf", $"ประวัติการรับราชการอย่างย่อ_.pdf");
|
||||
//// if (profile.AvatarId != "")
|
||||
//// {
|
||||
//// 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)
|
||||
|
|
@ -162,23 +272,24 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page0.trdp");
|
||||
ReportPackager reportPackager0 = new ReportPackager();
|
||||
Telerik.Reporting.Report? report0 = null;
|
||||
using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
||||
{
|
||||
report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
||||
}
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.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 CitizenId = "";
|
||||
var FullName = "";
|
||||
var OcFullPath = "";
|
||||
|
||||
//var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page0.trdp");
|
||||
//ReportPackager reportPackager0 = new ReportPackager();
|
||||
//Telerik.Reporting.Report? report0 = null;
|
||||
//using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
||||
//{
|
||||
// report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
||||
//}
|
||||
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Page1.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 CitizenId = "";
|
||||
//var FullName = "";
|
||||
//var OcFullPath = "";
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile/kk1/{id}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -188,201 +299,237 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
var _res = await client.SendAsync(_req);
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
// 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()
|
||||
var result = new
|
||||
{
|
||||
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);
|
||||
RenderingResult result0 = reportProcessor0.RenderReport("PDF", instanceReportSource0, deviceInfo0);
|
||||
var content0 = result0.DocumentBytes;
|
||||
return Success(result);
|
||||
|
||||
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()
|
||||
{
|
||||
ReportDocument = report
|
||||
};
|
||||
//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;
|
||||
|
||||
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
|
||||
RenderingResult result = reportProcessor.RenderReport("PDF", instanceReportSource, deviceInfo);
|
||||
//var tblTraining = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblTraining"];
|
||||
//tblTraining.DataSource = org.result.Training;
|
||||
|
||||
// byte array waiting for merge pdf
|
||||
var content = result.DocumentBytes;
|
||||
//var tblDiscipline = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["tblDiscipline"];
|
||||
//tblDiscipline.DataSource = org.result.Discipline;
|
||||
|
||||
// // 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 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;
|
||||
|
||||
// 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();
|
||||
//// 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 { }
|
||||
//// }
|
||||
|
||||
//while (salary.Count < 60)
|
||||
//System.Collections.Hashtable deviceInfo0 = new System.Collections.Hashtable();
|
||||
//InstanceReportSource instanceReportSource0 = new InstanceReportSource()
|
||||
//{
|
||||
// salary.Add(new
|
||||
// {
|
||||
// SalaryDate = "",
|
||||
// Position = "",
|
||||
// PosNo = "",
|
||||
// Rank = "",
|
||||
// Salary = "",
|
||||
// RefAll = "",
|
||||
// PositionType = "",
|
||||
// PositionLevel = "",
|
||||
// PositionAmount = "",
|
||||
// FullName = profile2.FullName,
|
||||
// OcFullPath = profile2.OcFullPath
|
||||
// });
|
||||
// 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;
|
||||
|
||||
//// // 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();
|
||||
Telerik.Reporting.Report? report2 = null;
|
||||
using (var sourceStream = System.IO.File.OpenRead(rptFile2))
|
||||
{
|
||||
report2 = (Telerik.Reporting.Report)reportPackager.UnpackageDocument(sourceStream);
|
||||
}
|
||||
//// binding to table
|
||||
//var tblSalary = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["tblSalary"];
|
||||
//tblSalary.DataSource = salary;
|
||||
|
||||
report2.ReportParameters["FullName"].Value = FullName;
|
||||
report2.ReportParameters["OcFullPath"].Value = OcFullPath;
|
||||
//System.Collections.Hashtable deviceInfo2 = new System.Collections.Hashtable();
|
||||
|
||||
// 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
|
||||
};
|
||||
//InstanceReportSource instanceReportSource2 = new InstanceReportSource()
|
||||
//{
|
||||
// ReportDocument = report2
|
||||
//};
|
||||
|
||||
|
||||
ReportProcessor reportProcessor2 = new ReportProcessor(_configuration);
|
||||
RenderingResult result2 = reportProcessor2.RenderReport("PDF", instanceReportSource2, deviceInfo2);
|
||||
//ReportProcessor reportProcessor2 = new ReportProcessor(_configuration);
|
||||
//RenderingResult result2 = reportProcessor2.RenderReport("PDF", instanceReportSource2, deviceInfo2);
|
||||
|
||||
// byte array waiting for merge pdf
|
||||
var content2 = result2.DocumentBytes;
|
||||
//// 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);
|
||||
}
|
||||
}
|
||||
//// 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
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
// // 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();
|
||||
}
|
||||
// pdf.Close();
|
||||
// }
|
||||
|
||||
var fileContent = ms.ToArray();
|
||||
return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
||||
}
|
||||
// var fileContent = ms.ToArray();
|
||||
// return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -410,23 +557,23 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
{
|
||||
try
|
||||
{
|
||||
var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page0.trdp");
|
||||
ReportPackager reportPackager0 = new ReportPackager();
|
||||
Telerik.Reporting.Report? report0 = null;
|
||||
using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
||||
{
|
||||
report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
||||
}
|
||||
var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page1.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 CitizenId = "";
|
||||
var FullName = "";
|
||||
var OcFullPath = "";
|
||||
//var rptFile0 = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page0.trdp");
|
||||
//ReportPackager reportPackager0 = new ReportPackager();
|
||||
//Telerik.Reporting.Report? report0 = null;
|
||||
//using (var sourceStream0 = System.IO.File.OpenRead(rptFile0))
|
||||
//{
|
||||
// report0 = (Telerik.Reporting.Report)reportPackager0.UnpackageDocument(sourceStream0);
|
||||
//}
|
||||
//var rptFile = Path.Combine(_hostingEnvironment.ContentRootPath, "Report", "Profile", $"rptKK1_Emp_Page1.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 CitizenId = "";
|
||||
//var FullName = "";
|
||||
//var OcFullPath = "";
|
||||
var apiUrl = $"{_configuration["API"]}/org/profile-employee/kk1/{id}";
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -436,137 +583,173 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
var _res = await client.SendAsync(_req);
|
||||
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);
|
||||
}
|
||||
|
||||
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()
|
||||
var result = new
|
||||
{
|
||||
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)))
|
||||
template = "kk1-emp",
|
||||
reportName = "docx-report",
|
||||
data = new
|
||||
{
|
||||
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();
|
||||
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,
|
||||
}
|
||||
};
|
||||
|
||||
var fileContent = ms.ToArray();
|
||||
return File(fileContent, "application/pdf", $"กก_1_{CitizenId}.pdf");
|
||||
}
|
||||
return Success(result);
|
||||
|
||||
//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");
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue