Merge branch 'develop' into work

This commit is contained in:
Kittapath 2023-10-12 23:13:33 +07:00
commit 8e2ae7c6a5
9 changed files with 39 additions and 260 deletions

View file

@ -282,6 +282,11 @@ namespace BMA.EHR.Application.Repositories.Reports
ChairmanName = string.IsNullOrEmpty(evaluate_assign.data.chairman.name) ? string.Empty : evaluate_assign.data.chairman.name,
ChairmanPosition = string.IsNullOrEmpty(evaluate_assign.data.chairman.Position) ? string.Empty : evaluate_assign.data.chairman.Position,
ChairmanDate = string.IsNullOrEmpty(evaluate_assign.data.evaluate.chairman_dated.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.chairman_dated.ToThaiFullDate().ToString().ToThaiNumber(),
Name = evaluate_assign.data.experimentee.name,
RoundNo = evaluate_assign.data.assign.round_no.ToString().ToThaiNumber(),
DateStart = string.IsNullOrEmpty(evaluate_assign.data.assign.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : DateTime.Parse(evaluate_assign.data.assign.date_start).ToThaiFullDate().ToString().ToThaiNumber(),
DateFinish = string.IsNullOrEmpty(evaluate_assign.data.assign.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : DateTime.Parse(evaluate_assign.data.assign.date_finish).ToThaiFullDate().ToString().ToThaiNumber(),
};
}
else

View file

@ -228,7 +228,7 @@ namespace BMA.EHR.Report.Service.Controllers
}
#endregion
#region 14-
#region 14,15-
/// <summary>
/// 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา
/// </summary>
@ -500,166 +500,6 @@ namespace BMA.EHR.Report.Service.Controllers
}
#endregion
#region 15- ()
///// <summary>
///// 15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา
///// </summary>
///// <param name="id">id </param>
///// <param name="exportType">pdf, docx หรือ xlsx</param>
///// <returns></returns>
///// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
///// <response code="401">ไม่ได้ Login เข้าระบบ</response>
///// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
//[HttpGet("15/{exportType}/{id}")]
//public async Task<ActionResult<ResponseObject>> GetProbation15ConvertReportAsync(Guid id, string exportType = "pdf")
//{
// try
// {
// string authorizationHeader = Request.Headers["Authorization"];
// string token = string.Empty;
// if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
// {
// token = authorizationHeader.Substring("Bearer ".Length).Trim();
// var evaluateRecord = await _repository.GetEvaluateRecordAsync(id, token);
// if (evaluateRecord != null)
// {
// var mimeType = "";
// switch (exportType.Trim().ToLower())
// {
// case "pdf": mimeType = "application/pdf"; break;
// case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
// case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
// }
// var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-1.trdp");
// var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-2.trdp");
// ReportPackager reportPacker = new ReportPackager();
// Telerik.Reporting.Report? report = null;
// Telerik.Reporting.Report? report2 = null;
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
// using (var sourceStream2 = System.IO.File.OpenRead(rptFile2))
// {
// report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
// report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2);
// }
// report.ReportParameters["Name"].Value = evaluateRecord.GetType().GetProperty("Name").GetValue(evaluateRecord);
// report.ReportParameters["Position"].Value = evaluateRecord.GetType().GetProperty("Position").GetValue(evaluateRecord);
// report.ReportParameters["ExperimenteeName"].Value = evaluateRecord.GetType().GetProperty("ExperimenteeName").GetValue(evaluateRecord);
// report.ReportParameters["ExperimenteePosition"].Value = evaluateRecord.GetType().GetProperty("ExperimenteePosition").GetValue(evaluateRecord);
// report.ReportParameters["Department"].Value = evaluateRecord.GetType().GetProperty("Department").GetValue(evaluateRecord);
// report.ReportParameters["OrganizationOrganization"].Value = evaluateRecord.GetType().GetProperty("OrganizationOrganization").GetValue(evaluateRecord);
// report.ReportParameters["Oc"].Value = evaluateRecord.GetType().GetProperty("Oc").GetValue(evaluateRecord);
// report.ReportParameters["DateStart"].Value = evaluateRecord.GetType().GetProperty("DateStart").GetValue(evaluateRecord);
// report.ReportParameters["DateFinish"].Value = evaluateRecord.GetType().GetProperty("DateFinish").GetValue(evaluateRecord);
// report.ReportParameters["AchievementStrengthDesc1"].Value = evaluateRecord.GetType().GetProperty("AchievementStrengthDesc1").GetValue(evaluateRecord);
// report.ReportParameters["AchievementStrengthDesc2"].Value = evaluateRecord.GetType().GetProperty("AchievementStrengthDesc2").GetValue(evaluateRecord);
// report.ReportParameters["AchievementStrengthDesc3"].Value = evaluateRecord.GetType().GetProperty("AchievementStrengthDesc3").GetValue(evaluateRecord);
// report.ReportParameters["AchievementImproveDesc1"].Value = evaluateRecord.GetType().GetProperty("AchievementImproveDesc1").GetValue(evaluateRecord);
// report.ReportParameters["AchievementImproveDesc2"].Value = evaluateRecord.GetType().GetProperty("AchievementImproveDesc2").GetValue(evaluateRecord);
// report.ReportParameters["AchievementImproveDesc3"].Value = evaluateRecord.GetType().GetProperty("AchievementImproveDesc3").GetValue(evaluateRecord);
// report2.ReportParameters["BehaviorStrengthDesc1"].Value = evaluateRecord.GetType().GetProperty("BehaviorStrengthDesc1").GetValue(evaluateRecord);
// report2.ReportParameters["BehaviorStrengthDesc2"].Value = evaluateRecord.GetType().GetProperty("BehaviorStrengthDesc2").GetValue(evaluateRecord);
// report2.ReportParameters["BehaviorStrengthDesc3"].Value = evaluateRecord.GetType().GetProperty("BehaviorStrengthDesc3").GetValue(evaluateRecord);
// report2.ReportParameters["BehaviorImproveDesc1"].Value = evaluateRecord.GetType().GetProperty("BehaviorImproveDesc1").GetValue(evaluateRecord);
// report2.ReportParameters["BehaviorImproveDesc2"].Value = evaluateRecord.GetType().GetProperty("BehaviorImproveDesc2").GetValue(evaluateRecord);
// report2.ReportParameters["BehaviorImproveDesc3"].Value = evaluateRecord.GetType().GetProperty("BehaviorImproveDesc3").GetValue(evaluateRecord);
// report2.ReportParameters["Name"].Value = evaluateRecord.GetType().GetProperty("Name").GetValue(evaluateRecord);
// report2.ReportParameters["Position"].Value = evaluateRecord.GetType().GetProperty("Position").GetValue(evaluateRecord);
// report2.ReportParameters["MentorDate"].Value = evaluateRecord.GetType().GetProperty("MentorDate").GetValue(evaluateRecord);
// var _evaluateslist = new List<dynamic>();
// dynamic evaluates = evaluateRecord.GetType().GetProperty("Evaluates").GetValue(evaluateRecord);
// foreach (var evaluate in evaluates)
// {
// string Evaluate_expect_desc = string.Empty;
// string Evaluate_output_desc = string.Empty;
// int Evaluate_expect_level = 0;
// int Evaluate_output_level = 0;
// string Check_expect1 = string.Empty;
// string Check_expect2 = string.Empty;
// string Check_expect3 = string.Empty;
// string Check_expect4 = string.Empty;
// string Check_expect5 = string.Empty;
// string Check_output1 = string.Empty;
// string Check_output2 = string.Empty;
// string Check_output3 = string.Empty;
// string Check_output4 = string.Empty;
// string Check_output5 = string.Empty;
// var achievements = evaluate.achievements;
// foreach (var achievement in achievements)
// {
// Evaluate_expect_desc = achievement.evaluate_expect_desc;
// Evaluate_output_desc = achievement.evaluate_output_desc;
// Evaluate_expect_level = achievement.evaluate_expect_level;
// Evaluate_output_level = achievement.evaluate_output_level;
// }
// _evaluateslist.Add(new
// {
// No = evaluate.no,
// Date_start = evaluate.date_start,
// Date_finish = evaluate.date_finish,
// Evaluate_expect_desc = $" - {Evaluate_expect_desc}",
// Evaluate_output_desc = $" - {Evaluate_output_desc}",
// Check_expect1 = Evaluate_expect_level == 1 ? "/" : string.Empty,
// Check_expect2 = Evaluate_expect_level == 2 ? "/" : string.Empty,
// Check_expect3 = Evaluate_expect_level == 3 ? "/" : string.Empty,
// Check_expect4 = Evaluate_expect_level == 4 ? "/" : string.Empty,
// Check_expect5 = Evaluate_expect_level == 5 ? "/" : string.Empty,
// Check_output1 = Evaluate_output_level == 1 ? "/" : string.Empty,
// Check_output2 = Evaluate_output_level == 2 ? "/" : string.Empty,
// Check_output3 = Evaluate_output_level == 3 ? "/" : string.Empty,
// Check_output4 = Evaluate_output_level == 4 ? "/" : string.Empty,
// Check_output5 = Evaluate_output_level == 5 ? "/" : string.Empty,
// ApplyLevel = evaluate.apply_level,
// AchievementStrengthDesc = evaluate.achievement_strength_desc,
// AchievementImproveDesc = evaluate.achievement_improve_desc,
// });
// }
// var tblEvaluate_1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"];
// tblEvaluate_1.DataSource = _evaluateslist;
// var tblEvaluate_2 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"];
// tblEvaluate_2.DataSource = _evaluateslist;
// var reportBook = new ReportBook();
// reportBook.Reports.Add(report);
// reportBook.Reports.Add(report2);
// System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
// InstanceReportSource instanceReportSource = new InstanceReportSource()
// {
// ReportDocument = reportBook,
// };
// ReportProcessor reportProcessor = new ReportProcessor(_configuration);
// RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
// var content = result.DocumentBytes;
// return File(content, mimeType, $"แบบบันทึกผล(สำหรับผู้บังคับบัญชา).{exportType.Trim().ToLower()}");
// }
// else
// {
// return NotFound();
// }
// }
// else
// {
// return Unauthorized();
// }
// }
// catch
// {
// throw;
// }
//}
#endregion
#region 16-
/// <summary>
/// 16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา
@ -1123,89 +963,7 @@ namespace BMA.EHR.Report.Service.Controllers
}
#endregion
#region 18- ()
///// <summary>
///// 18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน
///// </summary>
///// <param name="id">assign_id </param>
///// <param name="exportType">pdf, docx หรือ xlsx</param>
///// <returns></returns>
///// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
///// <response code="401">ไม่ได้ Login เข้าระบบ</response>
///// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
//[HttpGet("18/{exportType}/{id}")]
//public async Task<ActionResult<ResponseObject>> GetProbation18ConvertReportAsync(string id="9e8ec043-9f18-4f9a-bcde-3d11c909df19", string exportType = "pdf")
//{
// try
// {
// Guid Id = Guid.Parse(id);
// string authorizationHeader = Request.Headers["Authorization"];
// string token = string.Empty;
// if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer "))
// {
// token = authorizationHeader.Substring("Bearer ".Length).Trim();
// var evaluateAssign = await _repository.GetEvaluateResultAssignAsync(Id, token);
// if (evaluateAssign != null)
// {
// var mimeType = "";
// switch (exportType.Trim().ToLower())
// {
// case "pdf": mimeType = "application/pdf"; break;
// case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
// case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
// }
// var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน-1.trdp");
// ReportPackager reportPacker = new ReportPackager();
// Telerik.Reporting.Report? report = null;
// //Telerik.Reporting.Report? report2 = null;
// using (var sourceStream = System.IO.File.OpenRead(rptFile))
// //using (var sourceStream2 = System.IO.File.OpenRead(rptFile2))
// {
// report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
// //report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2);
// }
// report.ReportParameters["Name"].Value = evaluateAssign.GetType().GetProperty("Name").GetValue(evaluateAssign);
// var reportBook = new ReportBook();
// reportBook.Reports.Add(report);
// //reportBook.Reports.Add(report2);
// System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
// InstanceReportSource instanceReportSource = new InstanceReportSource()
// {
// ReportDocument = reportBook,
// };
// ReportProcessor reportProcessor = new ReportProcessor(_configuration);
// RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);
// var content = result.DocumentBytes;
// return File(content, mimeType, $"แบบรายงานการประเมินผล(สำหรับประธาน).{exportType.Trim().ToLower()}");
// }
// else
// {
// return NotFound();
// }
// }
// else
// {
// return Unauthorized();
// }
// }
// catch
// {
// throw;
// }
//}
#endregion
#region 19-
#region 18,19-
/// <summary>
/// 19-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา
/// </summary>
@ -1237,29 +995,45 @@ namespace BMA.EHR.Report.Service.Controllers
case "docx": mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break;
case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break;
}
var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"19-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ กรณีขยายเวลา.trdp");
var rptFile1 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน-1.trdp");
var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"19-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ กรณีขยายเวลา.trdp");
ReportPackager reportPacker = new ReportPackager();
Telerik.Reporting.Report? report = null;
using (var sourceStream = System.IO.File.OpenRead(rptFile))
Telerik.Reporting.Report? report1 = null;
Telerik.Reporting.Report? report2 = null;
using (var sourceStream1 = System.IO.File.OpenRead(rptFile1))
using (var sourceStream2 = System.IO.File.OpenRead(rptFile2))
{
report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream);
report1 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream1);
report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2);
}
report.ReportParameters["EvaluateDateStart"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateAssign);
report.ReportParameters["EvaluateDateFinish"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateAssign);
report.ReportParameters["Reson"].Value = evaluateAssign.GetType().GetProperty("Reson").GetValue(evaluateAssign);
report.ReportParameters["DevelopComplete"].Value = evaluateAssign.GetType().GetProperty("DevelopComplete").GetValue(evaluateAssign);
report.ReportParameters["PassResult"].Value = evaluateAssign.GetType().GetProperty("PassResult").GetValue(evaluateAssign);
report.ReportParameters["ExpandMonth"].Value = evaluateAssign.GetType().GetProperty("ExpandMonth").GetValue(evaluateAssign);
report.ReportParameters["ChairmanName"].Value = evaluateAssign.GetType().GetProperty("ChairmanName").GetValue(evaluateAssign);
report.ReportParameters["ChairmanPosition"].Value = evaluateAssign.GetType().GetProperty("ChairmanPosition").GetValue(evaluateAssign);
report.ReportParameters["ChairmanDate"].Value = evaluateAssign.GetType().GetProperty("ChairmanDate").GetValue(evaluateAssign);
//สำหรับประธาน
if((evaluateAssign.GetType().GetProperty("ExpandMonth").GetValue(evaluateAssign)).ToString() == "")
{
report1.DataSource = evaluateAssign;
System.Collections.Hashtable deviceInfo_ = new System.Collections.Hashtable();
InstanceReportSource instanceReportSource_ = new InstanceReportSource()
{
ReportDocument = report1,
};
ReportProcessor reportProcessor_ = new ReportProcessor(_configuration);
RenderingResult result_ = reportProcessor_.RenderReport($"{exportType}", instanceReportSource_, deviceInfo_);
return File(result_.DocumentBytes, mimeType, $"แบบรายงานการประเมินผล.{exportType.Trim().ToLower()}");
}
//กรณีขยายเวลา (ใช้รูปแบบเดิม)
report2.ReportParameters["EvaluateDateStart"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateAssign);
report2.ReportParameters["EvaluateDateFinish"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateAssign);
report2.ReportParameters["Reson"].Value = evaluateAssign.GetType().GetProperty("Reson").GetValue(evaluateAssign);
report2.ReportParameters["DevelopComplete"].Value = evaluateAssign.GetType().GetProperty("DevelopComplete").GetValue(evaluateAssign);
report2.ReportParameters["PassResult"].Value = evaluateAssign.GetType().GetProperty("PassResult").GetValue(evaluateAssign);
report2.ReportParameters["ExpandMonth"].Value = evaluateAssign.GetType().GetProperty("ExpandMonth").GetValue(evaluateAssign);
report2.ReportParameters["ChairmanName"].Value = evaluateAssign.GetType().GetProperty("ChairmanName").GetValue(evaluateAssign);
report2.ReportParameters["ChairmanPosition"].Value = evaluateAssign.GetType().GetProperty("ChairmanPosition").GetValue(evaluateAssign);
report2.ReportParameters["ChairmanDate"].Value = evaluateAssign.GetType().GetProperty("ChairmanDate").GetValue(evaluateAssign);
System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
InstanceReportSource instanceReportSource = new InstanceReportSource()
{
ReportDocument = report,
ReportDocument = report2,
};
ReportProcessor reportProcessor = new ReportProcessor(_configuration);
RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo);