diff --git a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs index bd584cfd..78c77ff3 100644 --- a/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs +++ b/BMA.EHR.Application/Repositories/Reports/ProbationReportRepository.cs @@ -9,6 +9,9 @@ using System.Net.Http.Headers; using Newtonsoft.Json; using System.Globalization; using Microsoft.Extensions.Configuration; +using System.Linq; +using static BMA.EHR.Application.Responses.ProbationAssignResponse; +using System.Text.RegularExpressions; namespace BMA.EHR.Application.Repositories.Reports { @@ -40,7 +43,7 @@ namespace BMA.EHR.Application.Repositories.Reports #region " Methods " - #region แบบมอบหมายงาน ฯ + #region 13 แบบมอบหมายงาน ฯ public async Task GetProbationAssignAsync(Guid assign_id, string token) { var api_url = $"{_configuration["APIPROBATION"]}/assign/probation-assign?assign_id={assign_id}"; @@ -55,32 +58,63 @@ namespace BMA.EHR.Application.Repositories.Reports if (probation_assign.data != null) { + var jobs = probation_assign.data.jobs.Select(x => new + { + id = string.IsNullOrEmpty(x.id.ToString()) ? string.Empty : x.id.ToString().ToThaiNumber(), + activity_desc = string.IsNullOrEmpty(x.activity_desc) ? string.Empty : x.activity_desc.ToThaiNumber(), + goal_desc = string.IsNullOrEmpty(x.goal_desc) ? string.Empty : x.goal_desc.ToThaiNumber(), + }).ToList(); + + var knowledges = probation_assign.data.knowledges.Select(x => new + { + id = string.IsNullOrEmpty(x.id.ToString()) ? string.Empty : x.id.ToString().ToThaiNumber(), + title = string.IsNullOrEmpty(x.title) ? string.Empty : x.title.ToThaiNumber(), + description = string.IsNullOrEmpty(x.description) ? string.Empty : x.description.ToThaiNumber(), + }).ToList(); + + var competencys = probation_assign.data.competencys.Select(x => new + { + name = string.IsNullOrEmpty(x.name) ? string.Empty : x.name.ToThaiNumber(), + level = string.IsNullOrEmpty(x.level) ? string.Empty : x.level.ToThaiNumber(), + description = string.IsNullOrEmpty(x.description) + ? string.Empty + : (Regex.Replace(x.description, "<.*?>", string.Empty)).Replace(" ", " ").ToString().ToThaiNumber(), + }).ToList(); + + var outputs = probation_assign.data.outputs.Select(x => new + { + id = string.IsNullOrEmpty(x.id.ToString()) ? string.Empty : x.id.ToString().ToThaiNumber(), + indicator_desc = string.IsNullOrEmpty(x.indicator_desc) ? string.Empty : x.indicator_desc.ToThaiNumber(), + output_desc = string.IsNullOrEmpty(x.output_desc) ? string.Empty : x.output_desc.ToThaiNumber(), + }).ToList(); + + return new { - Name = string.IsNullOrEmpty(probation_assign.data.profile.name) ? string.Empty : probation_assign.data.profile.name, - Position = string.IsNullOrEmpty(probation_assign.data.profile.Position) ? string.Empty : probation_assign.data.profile.Position, - Department = string.IsNullOrEmpty(probation_assign.data.profile.Department) ? string.Empty : probation_assign.data.profile.Department, - OrganizationOrganization = string.IsNullOrEmpty(probation_assign.data.profile.OrganizationOrganization) ? string.Empty : probation_assign.data.profile.OrganizationOrganization, - Oc = string.IsNullOrEmpty(probation_assign.data.profile.Oc) ? string.Empty : probation_assign.data.profile.Oc, - DateStart = string.IsNullOrEmpty(probation_assign.data.assign.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : probation_assign.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), - DateFinish = string.IsNullOrEmpty(probation_assign.data.assign.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : probation_assign.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), - NameMentor1 = string.IsNullOrEmpty(probation_assign.data.mentors[0].name) ? string.Empty : probation_assign.data.mentors[0].name, - DateMentor1 = string.IsNullOrEmpty(probation_assign.data.mentors[0].dated.ToString()) ? "วันที่ เดือน พ.ศ." : probation_assign.data.mentors[0].dated.ToThaiFullDate().ToString().ToThaiNumber(), - PositionMentor1 = string.IsNullOrEmpty(probation_assign.data.mentors[0].Position) ? string.Empty : probation_assign.data.mentors[0].Position, - NameMentor2 = probation_assign.data.mentors.Count > 1 ? probation_assign.data.mentors[1].name : string.Empty, - DateMentor2 = probation_assign.data.mentors.Count > 1 ? probation_assign.data.mentors[1].dated.ToThaiFullDate().ToString().ToThaiNumber() : "วันที่ เดือน พ.ศ.", - PositionMentor2 = probation_assign.data.mentors.Count > 1 ? probation_assign.data.mentors[1].Position : string.Empty, - NameCommander = string.IsNullOrEmpty(probation_assign.data.commander.name) ? string.Empty : probation_assign.data.commander.name, - DateCommander = string.IsNullOrEmpty(probation_assign.data.commander.dated.ToString()) ? "วันที่ เดือน พ.ศ." : probation_assign.data.commander.dated.ToThaiFullDate().ToString().ToThaiNumber(), - PositionCommander = string.IsNullOrEmpty(probation_assign.data.commander.Position) ? string.Empty : probation_assign.data.commander.Position, - Jobs = probation_assign.data.jobs.ToList(), - Knowledge = probation_assign.data.knowledges.ToList(), - Competency = probation_assign.data.competencys.ToList(), - Outputs = probation_assign.data.outputs.ToList(), - OtherDesc = string.IsNullOrEmpty(probation_assign.data.assign.other_desc) ? string.Empty : probation_assign.data.assign.other_desc, - Other4Desc = string.IsNullOrEmpty(probation_assign.data.assign.other4_desc) ? string.Empty : probation_assign.data.assign.other4_desc, - Other5No1Desc = string.IsNullOrEmpty(probation_assign.data.assign.other5_no1_desc) ? string.Empty : probation_assign.data.assign.other5_no1_desc, - Other5No2Desc = string.IsNullOrEmpty(probation_assign.data.assign.other5_no2_desc) ? string.Empty : probation_assign.data.assign.other5_no2_desc, + Name = string.IsNullOrEmpty(probation_assign.data.profile.name) ? "-" : probation_assign.data.profile.name, + Position = string.IsNullOrEmpty(probation_assign.data.profile.Position) ? "-" : probation_assign.data.profile.Position, + Department = string.IsNullOrEmpty(probation_assign.data.profile.Department) ? "-" : probation_assign.data.profile.Department, + OrganizationOrganization = string.IsNullOrEmpty(probation_assign.data.profile.OrganizationOrganization) ? "-" : probation_assign.data.profile.OrganizationOrganization, + Oc = string.IsNullOrEmpty(probation_assign.data.profile.Oc) ? "-" : probation_assign.data.profile.Oc, + DateStart = string.IsNullOrEmpty(probation_assign.data.assign.date_start.ToString()) ? "-" : probation_assign.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + DateFinish = string.IsNullOrEmpty(probation_assign.data.assign.date_finish.ToString()) ? "-" : probation_assign.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), + NameMentor1 = probation_assign.data.mentors.Count > 0 ? probation_assign.data.mentors[0].name : "-", + DateMentor1 = probation_assign.data.mentors.Count > 0 ? probation_assign.data.mentors[0].dated.ToThaiFullDate().ToString().ToThaiNumber() : "-", + PositionMentor1 = probation_assign.data.mentors.Count > 0 ? probation_assign.data.mentors[0].Position : "-", + NameMentor2 = probation_assign.data.mentors.Count > 1 ? probation_assign.data.mentors[1].name : "-", + DateMentor2 = probation_assign.data.mentors.Count > 1 ? probation_assign.data.mentors[1].dated.ToThaiFullDate().ToString().ToThaiNumber() : "-", + PositionMentor2 = probation_assign.data.mentors.Count > 1 ? probation_assign.data.mentors[1].Position : "-", + NameCommander = string.IsNullOrEmpty(probation_assign.data.commander.name) ? "-" : probation_assign.data.commander.name, + DateCommander = string.IsNullOrEmpty(probation_assign.data.commander.dated.ToString()) ? "-" : probation_assign.data.commander.dated.ToThaiFullDate().ToString().ToThaiNumber(), + PositionCommander = string.IsNullOrEmpty(probation_assign.data.commander.Position) ? "-" : probation_assign.data.commander.Position, + Jobs = jobs, + Knowledges = knowledges, + Competencys = competencys, + Outputs = outputs, + OtherDesc = string.IsNullOrEmpty(probation_assign.data.assign.other_desc) ? "-" : probation_assign.data.assign.other_desc, + Other4Desc = string.IsNullOrEmpty(probation_assign.data.assign.other4_desc) ? "-" : probation_assign.data.assign.other4_desc, + Other5No1Desc = string.IsNullOrEmpty(probation_assign.data.assign.other5_no1_desc) ? "-" : probation_assign.data.assign.other5_no1_desc, + Other5No2Desc = string.IsNullOrEmpty(probation_assign.data.assign.other5_no2_desc) ? "-" : probation_assign.data.assign.other5_no2_desc, }; } else @@ -91,8 +125,8 @@ namespace BMA.EHR.Application.Repositories.Reports } #endregion - #region แบบบันทึกผล (ผู้ดูแล, ผู้บังคับบัญชา) - public async Task GetEvaluateRecordAsync(Guid assign_id, string token) + #region 14 - 15 แบบบันทึกผล (ผู้ดูแล และ ผู้บังคับบัญชา) + public async Task GetEvaluateRecord14_15Async(Guid assign_id, string token) { var api_url = $"{_configuration["APIPROBATION"]}/report/form-record?id={assign_id}"; EvaluateRecordAssignResponse evaluate_record; @@ -106,29 +140,274 @@ namespace BMA.EHR.Application.Repositories.Reports if (evaluate_record.data != null) { - evaluate_record.data.evaluate.orientation = evaluate_record.data.evaluate.orientation == "1" ? "(/) ดำเนินการแล้ว ( ) ยังไม่ได้ดำเนินการ" : "( ) ดำเนินการแล้ว (/) ยังไม่ได้ดำเนินการ"; - evaluate_record.data.evaluate.self_learning = evaluate_record.data.evaluate.self_learning == "1" ? "(/) ดำเนินการแล้ว ( ) ยังไม่ได้ดำเนินการ" : "( ) ดำเนินการแล้ว (/) ยังไม่ได้ดำเนินการ"; - evaluate_record.data.evaluate.training_seminar = evaluate_record.data.evaluate.training_seminar == "1" ? "(/) ดำเนินการแล้ว ( ) ยังไม่ได้ดำเนินการ" : "( ) ดำเนินการแล้ว (/) ยังไม่ได้ดำเนินการ"; - evaluate_record.data.evaluate.other_training = evaluate_record.data.evaluate.other_training == "1" ? "(/) ดำเนินการแล้ว ( ) ยังไม่ได้ดำเนินการ" : "( ) ดำเนินการแล้ว (/) ยังไม่ได้ดำเนินการ"; + var orientation = evaluate_record.data.evaluate.orientation == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; + var self_learning = evaluate_record.data.evaluate.self_learning == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; + var training_seminar = evaluate_record.data.evaluate.training_seminar == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; + var other_training = evaluate_record.data.evaluate.other_training == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; + var expects = evaluate_record.data.evaluate != null && evaluate_record.data.evaluate.achievements.Count > 0 + ? new { + col1 = evaluate_record.data.evaluate.achievements[0].evaluate_expect_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.achievements[0].evaluate_expect_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.achievements[0].evaluate_expect_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.achievements[0].evaluate_expect_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.achievements[0].evaluate_expect_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var outputs = evaluate_record.data.evaluate != null && evaluate_record.data.evaluate.achievements.Count > 0 + ? new + { + col1 = evaluate_record.data.evaluate.achievements[0].evaluate_output_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.achievements[0].evaluate_output_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.achievements[0].evaluate_output_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.achievements[0].evaluate_output_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.achievements[0].evaluate_output_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var knows = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.knowledge_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.knowledge_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.knowledge_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.knowledge_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.knowledge_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var skills = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.skill_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.skill_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.skill_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.skill_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.skill_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var competencys = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.competency_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.competency_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.competency_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.competency_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.competency_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var learns = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.learn_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.learn_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.learn_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.learn_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.learn_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var applys = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.apply_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.apply_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.apply_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.apply_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.apply_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var achievementOthers = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.achievement_other_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.achievement_other_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.achievement_other_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.achievement_other_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.achievement_other_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var conducts1 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.conduct1_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.conduct1_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.conduct1_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.conduct1_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.conduct1_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var conducts2 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.conduct2_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.conduct2_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.conduct2_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.conduct2_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.conduct2_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var conducts3 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.conduct3_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.conduct3_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.conduct3_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.conduct3_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.conduct3_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var conducts4 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.conduct4_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.conduct4_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.conduct4_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.conduct4_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.conduct4_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var morals1 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.moral1_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.moral1_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.moral1_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.moral1_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.moral1_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var morals2 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.moral2_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.moral2_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.moral2_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.moral2_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.moral2_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var morals3 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.moral3_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.moral3_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.moral3_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.moral3_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.moral3_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var disciplines1 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.discipline1_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.discipline1_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.discipline1_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.discipline1_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.discipline1_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var disciplines2 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.discipline2_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.discipline2_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.discipline2_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.discipline2_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.discipline2_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var disciplines3 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.discipline3_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.discipline3_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.discipline3_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.discipline3_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.discipline3_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var disciplines4 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.discipline4_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.discipline4_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.discipline4_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.discipline4_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.discipline4_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + var disciplines5 = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.discipline5_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.discipline5_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.discipline5_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.discipline5_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.discipline5_level.col5 == "/" ? "✓" : string.Empty, + } + : null; + + var behaviorOthers = evaluate_record.data.evaluate != null + ? new + { + col1 = evaluate_record.data.evaluate.behavior_other_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_record.data.evaluate.behavior_other_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_record.data.evaluate.behavior_other_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_record.data.evaluate.behavior_other_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_record.data.evaluate.behavior_other_level.col5 == "/" ? "✓" : string.Empty, + } + : null; return new { DirectorName = string.IsNullOrEmpty(evaluate_record.data.director.name) ? string.Empty : evaluate_record.data.director.name, DirectorPosition = string.IsNullOrEmpty(evaluate_record.data.director.Position) ? string.Empty : evaluate_record.data.director.Position, - DirectorDated = string.IsNullOrEmpty(evaluate_record.data.evaluate.sign_dated.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_record.data.evaluate.sign_dated.ToThaiFullDate().ToString().ToThaiNumber(), + DirectorDated = string.IsNullOrEmpty(evaluate_record.data.evaluate.sign_dated.ToString()) ? "-" : evaluate_record.data.evaluate.sign_dated.ToThaiFullDate().ToString().ToThaiNumber(), Name = string.IsNullOrEmpty(evaluate_record.data.experimentee.name) ? string.Empty : evaluate_record.data.experimentee.name, Position = string.IsNullOrEmpty(evaluate_record.data.experimentee.Position) ? string.Empty : evaluate_record.data.experimentee.Position, Department = string.IsNullOrEmpty(evaluate_record.data.experimentee.Department) ? string.Empty : evaluate_record.data.experimentee.Department, - Organizationorganization = string.IsNullOrEmpty(evaluate_record.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_record.data.experimentee.OrganizationOrganization, + Organization= string.IsNullOrEmpty(evaluate_record.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_record.data.experimentee.OrganizationOrganization, Oc = string.IsNullOrEmpty(evaluate_record.data.experimentee.Oc) ? string.Empty : evaluate_record.data.experimentee.Oc, - DateStart = string.IsNullOrEmpty(evaluate_record.data.assign.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_record.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), - DateFinish = string.IsNullOrEmpty(evaluate_record.data.assign.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_record.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), + DateStart = string.IsNullOrEmpty(evaluate_record.data.assign.date_start.ToString()) ? "-" : evaluate_record.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + DateFinish = string.IsNullOrEmpty(evaluate_record.data.assign.date_finish.ToString()) ? "-" : evaluate_record.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), No = evaluate_record.data.evaluate.no = string.IsNullOrEmpty(evaluate_record.data.evaluate.no) ? string.Empty : evaluate_record.data.evaluate.no.ToThaiNumber(), EvaluateDateStart = string.IsNullOrEmpty(evaluate_record.data.evaluate.date_start.ToString()) ? string.Empty : evaluate_record.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), EvaluateDateFinish = string.IsNullOrEmpty(evaluate_record.data.evaluate.date_finish.ToString()) ? string.Empty : evaluate_record.data.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), - Achievements = evaluate_record.data.evaluate.achievements, Role = evaluate_record.data.evaluate.role == "mentor" ? "ผู้ดูแลการทดลองปฏิบัติหน้าที่ราชการ" : "ผู้บังคับบัญชา", - Evaluate = evaluate_record.data.evaluate, + Expects = expects, + ExpectDesc = evaluate_record.data.evaluate != null && evaluate_record.data.evaluate.achievements.Count > 0 + ? evaluate_record.data.evaluate.achievements[0].evaluate_expect_desc + : string.Empty, + Outputs = outputs, + OutputDesc = evaluate_record.data.evaluate != null && evaluate_record.data.evaluate.achievements.Count > 0 + ? evaluate_record.data.evaluate.achievements[0].evaluate_output_desc + : string.Empty, + AchievementOtherDesc = evaluate_record.data.evaluate.achievement_other_desc, + AchievementStrengthDesc = evaluate_record.data.evaluate.achievement_strength_desc, + AchievementImproveDesc = evaluate_record.data.evaluate.achievement_improve_desc, + BehaviorOtherDesc = evaluate_record.data.evaluate.behavior_other_desc, + BehaviorStrengthDesc = evaluate_record.data.evaluate.behavior_strength_desc, + BehaviorImproveDesc = evaluate_record.data.evaluate.behavior_improve_desc, + Knows = knows, + Skills = skills, + Competencys = competencys, + Learns =learns, + Applys = applys, + AchievementOthers = achievementOthers, + Conducts1 = conducts1, + Conducts2 = conducts2, + Conducts3 = conducts3, + Conducts4 = conducts4, + Morals1 = morals1, + Morals2 = morals2, + Morals3 = morals3, + Disciplines1 = disciplines1, + Disciplines2 = disciplines2, + Disciplines3 = disciplines3, + Disciplines4 = disciplines4, + Disciplines5 = disciplines5, + BehaviorOthers = behaviorOthers, + Orientation = orientation, + SelfLearning = self_learning, + TrainingSeminar = training_seminar, + OtherTraining = other_training, }; } else @@ -139,7 +418,7 @@ namespace BMA.EHR.Application.Repositories.Reports } #endregion - #region แบบประเมินผล(ผู้บังคับบัญชา) + #region 16 แบบประเมินผล (ผู้บังคับบัญชา) public async Task GetEvaluateAssignAsync(Guid id, string token) { var api_url = $"{_configuration["APIPROBATION"]}/report/evaluate-commander?id={id}"; @@ -154,29 +433,187 @@ namespace BMA.EHR.Application.Repositories.Reports if (evaluate_assign.data != null) { - evaluate_assign.data.evaluate.orientation = evaluate_assign.data.evaluate.orientation == "1" ? "[/] ดำเนินการแล้ว [ ] ยังไม่ได้ดำเนินการ" : "[ ] ดำเนินการแล้ว [/] ยังไม่ได้ดำเนินการ"; - evaluate_assign.data.evaluate.self_learning = evaluate_assign.data.evaluate.self_learning == "1" ? "[/] ดำเนินการแล้ว [ ] ยังไม่ได้ดำเนินการ" : "[ ] ดำเนินการแล้ว [/] ยังไม่ได้ดำเนินการ"; - evaluate_assign.data.evaluate.training_seminar = evaluate_assign.data.evaluate.training_seminar == "1" ? "[/] ดำเนินการแล้ว [ ] ยังไม่ได้ดำเนินการ" : "[ ] ดำเนินการแล้ว [/] ยังไม่ได้ดำเนินการ"; - evaluate_assign.data.evaluate.other_training = evaluate_assign.data.evaluate.other_training == "1" ? "[/] ดำเนินการแล้ว [ ] ยังไม่ได้ดำเนินการ" : "[ ] ดำเนินการแล้ว [/] ยังไม่ได้ดำเนินการ"; + var knows = new { + col1 = evaluate_assign.data.evaluate.knowledge_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.knowledge_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.knowledge_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.knowledge_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.knowledge_level.col5 == "/" ? "✓" : string.Empty, + }; + var skills = new + { + col1 = evaluate_assign.data.evaluate.skill_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.skill_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.skill_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.skill_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.skill_level.col5 == "/" ? "✓" : string.Empty, + }; + var competencys = new + { + col1 = evaluate_assign.data.evaluate.competency_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.competency_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.competency_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.competency_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.competency_level.col5 == "/" ? "✓" : string.Empty, + }; + var learns = new + { + col1 = evaluate_assign.data.evaluate.learn_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.learn_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.learn_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.learn_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.learn_level.col5 == "/" ? "✓" : string.Empty, + }; + var applys = new + { + col1 = evaluate_assign.data.evaluate.apply_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.apply_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.apply_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.apply_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.apply_level.col5 == "/" ? "✓" : string.Empty, + }; + var success = new + { + col1 = evaluate_assign.data.evaluate.success_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.success_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.success_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.success_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.success_level.col5 == "/" ? "✓" : string.Empty, + }; + var achievementOthers = new + { + col1 = evaluate_assign.data.evaluate.achievement_other_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.achievement_other_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.achievement_other_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.achievement_other_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.achievement_other_level.col5 == "/" ? "✓" : string.Empty, + }; + + var conducts = new + { + col1_1 = evaluate_assign.data.evaluate.conduct1_level.col1 == "/" ? "✓" : string.Empty, + col2_1 = evaluate_assign.data.evaluate.conduct1_level.col2 == "/" ? "✓" : string.Empty, + col3_1 = evaluate_assign.data.evaluate.conduct1_level.col3 == "/" ? "✓" : string.Empty, + col4_1 = evaluate_assign.data.evaluate.conduct1_level.col4 == "/" ? "✓" : string.Empty, + col5_1 = evaluate_assign.data.evaluate.conduct1_level.col5 == "/" ? "✓" : string.Empty, + + col1_2 = evaluate_assign.data.evaluate.conduct2_level.col1 == "/" ? "✓" : string.Empty, + col2_2 = evaluate_assign.data.evaluate.conduct2_level.col2 == "/" ? "✓" : string.Empty, + col3_2 = evaluate_assign.data.evaluate.conduct2_level.col3 == "/" ? "✓" : string.Empty, + col4_2 = evaluate_assign.data.evaluate.conduct2_level.col4 == "/" ? "✓" : string.Empty, + col5_2 = evaluate_assign.data.evaluate.conduct2_level.col5 == "/" ? "✓" : string.Empty, + + col1_3 = evaluate_assign.data.evaluate.conduct3_level.col1 == "/" ? "✓" : string.Empty, + col2_3 = evaluate_assign.data.evaluate.conduct3_level.col2 == "/" ? "✓" : string.Empty, + col3_3 = evaluate_assign.data.evaluate.conduct3_level.col3 == "/" ? "✓" : string.Empty, + col4_3 = evaluate_assign.data.evaluate.conduct3_level.col4 == "/" ? "✓" : string.Empty, + col5_3 = evaluate_assign.data.evaluate.conduct3_level.col5 == "/" ? "✓" : string.Empty, + + col1_4 = evaluate_assign.data.evaluate.conduct4_level.col1 == "/" ? "✓" : string.Empty, + col2_4 = evaluate_assign.data.evaluate.conduct4_level.col2 == "/" ? "✓" : string.Empty, + col3_4 = evaluate_assign.data.evaluate.conduct4_level.col3 == "/" ? "✓" : string.Empty, + col4_4 = evaluate_assign.data.evaluate.conduct4_level.col4 == "/" ? "✓" : string.Empty, + col5_4 = evaluate_assign.data.evaluate.conduct4_level.col5 == "/" ? "✓" : string.Empty, + }; + var morals = new + { + col1_1 = evaluate_assign.data.evaluate.moral1_level.col1 == "/" ? "✓" : string.Empty, + col2_1 = evaluate_assign.data.evaluate.moral1_level.col2 == "/" ? "✓" : string.Empty, + col3_1 = evaluate_assign.data.evaluate.moral1_level.col3 == "/" ? "✓" : string.Empty, + col4_1 = evaluate_assign.data.evaluate.moral1_level.col4 == "/" ? "✓" : string.Empty, + col5_1 = evaluate_assign.data.evaluate.moral1_level.col5 == "/" ? "✓" : string.Empty, + + col1_2 = evaluate_assign.data.evaluate.moral2_level.col1 == "/" ? "✓" : string.Empty, + col2_2 = evaluate_assign.data.evaluate.moral2_level.col2 == "/" ? "✓" : string.Empty, + col3_2 = evaluate_assign.data.evaluate.moral2_level.col3 == "/" ? "✓" : string.Empty, + col4_2 = evaluate_assign.data.evaluate.moral2_level.col4 == "/" ? "✓" : string.Empty, + col5_2 = evaluate_assign.data.evaluate.moral2_level.col5 == "/" ? "✓" : string.Empty, + + col1_3 = evaluate_assign.data.evaluate.moral3_level.col1 == "/" ? "✓" : string.Empty, + col2_3 = evaluate_assign.data.evaluate.moral3_level.col2 == "/" ? "✓" : string.Empty, + col3_3 = evaluate_assign.data.evaluate.moral3_level.col3 == "/" ? "✓" : string.Empty, + col4_3 = evaluate_assign.data.evaluate.moral3_level.col4 == "/" ? "✓" : string.Empty, + col5_3 = evaluate_assign.data.evaluate.moral3_level.col5 == "/" ? "✓" : string.Empty, + }; + var disciplines = new + { + col1_1 = evaluate_assign.data.evaluate.discipline1_level.col1 == "/" ? "✓" : string.Empty, + col2_1 = evaluate_assign.data.evaluate.discipline1_level.col2 == "/" ? "✓" : string.Empty, + col3_1 = evaluate_assign.data.evaluate.discipline1_level.col3 == "/" ? "✓" : string.Empty, + col4_1 = evaluate_assign.data.evaluate.discipline1_level.col4 == "/" ? "✓" : string.Empty, + col5_1 = evaluate_assign.data.evaluate.discipline1_level.col5 == "/" ? "✓" : string.Empty, + + col1_2 = evaluate_assign.data.evaluate.discipline2_level.col1 == "/" ? "✓" : string.Empty, + col2_2 = evaluate_assign.data.evaluate.discipline2_level.col2 == "/" ? "✓" : string.Empty, + col3_2 = evaluate_assign.data.evaluate.discipline2_level.col3 == "/" ? "✓" : string.Empty, + col4_2 = evaluate_assign.data.evaluate.discipline2_level.col4 == "/" ? "✓" : string.Empty, + col5_2 = evaluate_assign.data.evaluate.discipline2_level.col5 == "/" ? "✓" : string.Empty, + + col1_3 = evaluate_assign.data.evaluate.discipline3_level.col1 == "/" ? "✓" : string.Empty, + col2_3 = evaluate_assign.data.evaluate.discipline3_level.col2 == "/" ? "✓" : string.Empty, + col3_3 = evaluate_assign.data.evaluate.discipline3_level.col3 == "/" ? "✓" : string.Empty, + col4_3 = evaluate_assign.data.evaluate.discipline3_level.col4 == "/" ? "✓" : string.Empty, + col5_3 = evaluate_assign.data.evaluate.discipline3_level.col5 == "/" ? "✓" : string.Empty, + + col1_4 = evaluate_assign.data.evaluate.discipline4_level.col1 == "/" ? "✓" : string.Empty, + col2_4 = evaluate_assign.data.evaluate.discipline4_level.col2 == "/" ? "✓" : string.Empty, + col3_4 = evaluate_assign.data.evaluate.discipline4_level.col3 == "/" ? "✓" : string.Empty, + col4_4 = evaluate_assign.data.evaluate.discipline4_level.col4 == "/" ? "✓" : string.Empty, + col5_4 = evaluate_assign.data.evaluate.discipline4_level.col5 == "/" ? "✓" : string.Empty, + + col1_5 = evaluate_assign.data.evaluate.discipline5_level.col1 == "/" ? "✓" : string.Empty, + col2_5 = evaluate_assign.data.evaluate.discipline5_level.col2 == "/" ? "✓" : string.Empty, + col3_5 = evaluate_assign.data.evaluate.discipline5_level.col3 == "/" ? "✓" : string.Empty, + col4_5 = evaluate_assign.data.evaluate.discipline5_level.col4 == "/" ? "✓" : string.Empty, + col5_5 = evaluate_assign.data.evaluate.discipline5_level.col5 == "/" ? "✓" : string.Empty, + }; + var behaviorOthers = new + { + col1 = evaluate_assign.data.evaluate.behavior_other_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.behavior_other_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.behavior_other_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.behavior_other_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.behavior_other_level.col5 == "/" ? "✓" : string.Empty, + }; + + var orientation = evaluate_assign.data.evaluate.orientation = evaluate_assign.data.evaluate.orientation == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; + var self_learning = evaluate_assign.data.evaluate.self_learning = evaluate_assign.data.evaluate.self_learning == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; + var training_seminar = evaluate_assign.data.evaluate.training_seminar = evaluate_assign.data.evaluate.training_seminar == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; + var other_training = evaluate_assign.data.evaluate.other_training = evaluate_assign.data.evaluate.other_training == "1" ? "🗹 ดำเนินการแล้ว ☐ ยังไม่ได้ดำเนินการ" : "☐ ดำเนินการแล้ว 🗹 ยังไม่ได้ดำเนินการ"; return new { No = string.IsNullOrEmpty(evaluate_assign.data.evaluate.no.ToString()) ? string.Empty : evaluate_assign.data.evaluate.no.ToString().ToThaiNumber(), - EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), - EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), + EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "-" : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.data.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), Name = string.IsNullOrEmpty(evaluate_assign.data.experimentee.name) ? string.Empty : evaluate_assign.data.experimentee.name, Position = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Position) ? string.Empty : evaluate_assign.data.experimentee.Position, Department = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Department) ? string.Empty : evaluate_assign.data.experimentee.Department, - OrganizationOrganization = string.IsNullOrEmpty(evaluate_assign.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.data.experimentee.OrganizationOrganization, + Organization = string.IsNullOrEmpty(evaluate_assign.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.data.experimentee.OrganizationOrganization, Oc = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Oc) ? string.Empty : evaluate_assign.data.experimentee.Oc, - DateStart = string.IsNullOrEmpty(evaluate_assign.data.assign.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), - DateFinish = string.IsNullOrEmpty(evaluate_assign.data.assign.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), + DateStart = string.IsNullOrEmpty(evaluate_assign.data.assign.date_start.ToString()) ? "-" : evaluate_assign.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + DateFinish = string.IsNullOrEmpty(evaluate_assign.data.assign.date_finish.ToString()) ? "-" : evaluate_assign.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), CommanderName = string.IsNullOrEmpty(evaluate_assign.data.commander.name) ? string.Empty : evaluate_assign.data.commander.name, CommanderPosition = string.IsNullOrEmpty(evaluate_assign.data.commander.Position) ? string.Empty : evaluate_assign.data.commander.Position, - CommanderDated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.sign_dated.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.sign_dated.ToThaiFullDate().ToString().ToThaiNumber(), + CommanderDated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.sign_dated.ToString()) ? "-" : evaluate_assign.data.evaluate.sign_dated.ToThaiFullDate().ToString().ToThaiNumber(), BehaviorStrengthDesc = evaluate_assign.data.evaluate.behavior_strength_desc, BehaviorImproveDesc = evaluate_assign.data.evaluate.behavior_improve_desc, - Evaluate = evaluate_assign.data.evaluate, - + Knows = knows, + Skills = skills, + Competencys = competencys, + Learns = learns, + Applys = applys, + Success = success, + AchievementOthers = achievementOthers, + AchievementOtherDesc = evaluate_assign.data.evaluate.achievement_other_desc, + Conducts = conducts, + Morals = morals, + Disciplines = disciplines, + BehaviorOthers = behaviorOthers, + BehaviorOtherDesc = evaluate_assign.data.evaluate.behavior_other_desc, + Orientation = orientation, + SelfLearning = self_learning, + TrainingSeminar = training_seminar, + OtherTraining = other_training }; } else @@ -187,7 +624,7 @@ namespace BMA.EHR.Application.Repositories.Reports } #endregion - #region แบบประเมินผล(คณะกรรมการ) + #region 17 แบบประเมินผล (คณะกรรมการ) public async Task GetEvaluateChairmanAssignAsync(Guid id, string token) { var api_url = $"{_configuration["APIPROBATION"]}/report/evaluate-chairman?id={id}"; @@ -202,46 +639,231 @@ namespace BMA.EHR.Application.Repositories.Reports if (evaluate_assign.data != null) { - evaluate_assign.data.evaluate.achievement_score = evaluate_assign.data.evaluate.achievement_score.ToThaiNumber(); - evaluate_assign.data.evaluate.behavior_score = evaluate_assign.data.evaluate.behavior_score.ToThaiNumber(); - evaluate_assign.data.evaluate.sum_score = evaluate_assign.data.evaluate.sum_score.ToThaiNumber(); - evaluate_assign.data.evaluate.achievement_percent = evaluate_assign.data.evaluate.achievement_percent.ToThaiNumber(); - evaluate_assign.data.evaluate.behavior_percent = evaluate_assign.data.evaluate.behavior_percent.ToThaiNumber(); - evaluate_assign.data.evaluate.sum_percent = evaluate_assign.data.evaluate.sum_percent.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_orientation_score = evaluate_assign.data.evaluate.develop_orientation_score.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_self_learning_score = evaluate_assign.data.evaluate.develop_self_learning_score.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_training_seminar_score = evaluate_assign.data.evaluate.develop_training_seminar_score.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_other_training_score = evaluate_assign.data.evaluate.develop_other_training_score.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_total_score = evaluate_assign.data.evaluate.develop_total_score.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_orientation_percent = evaluate_assign.data.evaluate.develop_orientation_percent.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_self_learning_percent = evaluate_assign.data.evaluate.develop_self_learning_percent.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_training_seminar_percent = evaluate_assign.data.evaluate.develop_training_seminar_percent.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_other_training_percent = evaluate_assign.data.evaluate.develop_other_training_percent.ToThaiNumber(); - evaluate_assign.data.evaluate.develop_total_percent = evaluate_assign.data.evaluate.develop_total_percent.ToThaiNumber(); + var knowledge_level = new + { + col1 = evaluate_assign.data.evaluate.knowledge_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.knowledge_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.knowledge_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.knowledge_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.knowledge_level.col5 == "/" ? "✓" : string.Empty, + }; + var apply_level = new + { + col1 = evaluate_assign.data.evaluate.apply_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.apply_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.apply_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.apply_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.apply_level.col5 == "/" ? "✓" : string.Empty, + }; + var success_level = new + { + col1 = evaluate_assign.data.evaluate.success_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.success_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.success_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.success_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.success_level.col5 == "/" ? "✓" : string.Empty, + }; + var achievement_other_level = new + { + col1 = evaluate_assign.data.evaluate.achievement_other_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.achievement_other_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.achievement_other_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.achievement_other_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.achievement_other_level.col5 == "/" ? "✓" : string.Empty, + }; + + var conduct_level = new + { + col1_1 = evaluate_assign.data.evaluate.conduct1_level.col1 == "/" ? "✓" : string.Empty, + col2_1 = evaluate_assign.data.evaluate.conduct1_level.col2 == "/" ? "✓" : string.Empty, + col3_1 = evaluate_assign.data.evaluate.conduct1_level.col3 == "/" ? "✓" : string.Empty, + col4_1 = evaluate_assign.data.evaluate.conduct1_level.col4 == "/" ? "✓" : string.Empty, + col5_1 = evaluate_assign.data.evaluate.conduct1_level.col5 == "/" ? "✓" : string.Empty, + + col1_2 = evaluate_assign.data.evaluate.conduct2_level.col1 == "/" ? "✓" : string.Empty, + col2_2 = evaluate_assign.data.evaluate.conduct2_level.col2 == "/" ? "✓" : string.Empty, + col3_2 = evaluate_assign.data.evaluate.conduct2_level.col3 == "/" ? "✓" : string.Empty, + col4_2 = evaluate_assign.data.evaluate.conduct2_level.col4 == "/" ? "✓" : string.Empty, + col5_2 = evaluate_assign.data.evaluate.conduct2_level.col5 == "/" ? "✓" : string.Empty, + + col1_3 = evaluate_assign.data.evaluate.conduct3_level.col1 == "/" ? "✓" : string.Empty, + col2_3 = evaluate_assign.data.evaluate.conduct3_level.col2 == "/" ? "✓" : string.Empty, + col3_3 = evaluate_assign.data.evaluate.conduct3_level.col3 == "/" ? "✓" : string.Empty, + col4_3 = evaluate_assign.data.evaluate.conduct3_level.col4 == "/" ? "✓" : string.Empty, + col5_3 = evaluate_assign.data.evaluate.conduct3_level.col5 == "/" ? "✓" : string.Empty, + + col1_4 = evaluate_assign.data.evaluate.conduct4_level.col1 == "/" ? "✓" : string.Empty, + col2_4 = evaluate_assign.data.evaluate.conduct4_level.col2 == "/" ? "✓" : string.Empty, + col3_4 = evaluate_assign.data.evaluate.conduct4_level.col3 == "/" ? "✓" : string.Empty, + col4_4 = evaluate_assign.data.evaluate.conduct4_level.col4 == "/" ? "✓" : string.Empty, + col5_4 = evaluate_assign.data.evaluate.conduct4_level.col5 == "/" ? "✓" : string.Empty, + }; + + var moral_level = new + { + col1_1 = evaluate_assign.data.evaluate.moral1_level.col1 == "/" ? "✓" : string.Empty, + col2_1 = evaluate_assign.data.evaluate.moral1_level.col2 == "/" ? "✓" : string.Empty, + col3_1 = evaluate_assign.data.evaluate.moral1_level.col3 == "/" ? "✓" : string.Empty, + col4_1 = evaluate_assign.data.evaluate.moral1_level.col4 == "/" ? "✓" : string.Empty, + col5_1 = evaluate_assign.data.evaluate.moral1_level.col5 == "/" ? "✓" : string.Empty, + + col1_2 = evaluate_assign.data.evaluate.moral2_level.col1 == "/" ? "✓" : string.Empty, + col2_2 = evaluate_assign.data.evaluate.moral2_level.col2 == "/" ? "✓" : string.Empty, + col3_2 = evaluate_assign.data.evaluate.moral2_level.col3 == "/" ? "✓" : string.Empty, + col4_2 = evaluate_assign.data.evaluate.moral2_level.col4 == "/" ? "✓" : string.Empty, + col5_2 = evaluate_assign.data.evaluate.moral2_level.col5 == "/" ? "✓" : string.Empty, + + col1_3 = evaluate_assign.data.evaluate.moral3_level.col1 == "/" ? "✓" : string.Empty, + col2_3 = evaluate_assign.data.evaluate.moral3_level.col2 == "/" ? "✓" : string.Empty, + col3_3 = evaluate_assign.data.evaluate.moral3_level.col3 == "/" ? "✓" : string.Empty, + col4_3 = evaluate_assign.data.evaluate.moral3_level.col4 == "/" ? "✓" : string.Empty, + col5_3 = evaluate_assign.data.evaluate.moral3_level.col5 == "/" ? "✓" : string.Empty, + }; + + var discipline_level = new + { + col1_1 = evaluate_assign.data.evaluate.discipline1_level.col1 == "/" ? "✓" : string.Empty, + col2_1 = evaluate_assign.data.evaluate.discipline1_level.col2 == "/" ? "✓" : string.Empty, + col3_1 = evaluate_assign.data.evaluate.discipline1_level.col3 == "/" ? "✓" : string.Empty, + col4_1 = evaluate_assign.data.evaluate.discipline1_level.col4 == "/" ? "✓" : string.Empty, + col5_1 = evaluate_assign.data.evaluate.discipline1_level.col5 == "/" ? "✓" : string.Empty, + + col1_2 = evaluate_assign.data.evaluate.discipline2_level.col1 == "/" ? "✓" : string.Empty, + col2_2 = evaluate_assign.data.evaluate.discipline2_level.col2 == "/" ? "✓" : string.Empty, + col3_2 = evaluate_assign.data.evaluate.discipline2_level.col3 == "/" ? "✓" : string.Empty, + col4_2 = evaluate_assign.data.evaluate.discipline2_level.col4 == "/" ? "✓" : string.Empty, + col5_2 = evaluate_assign.data.evaluate.discipline2_level.col5 == "/" ? "✓" : string.Empty, + + col1_3 = evaluate_assign.data.evaluate.discipline3_level.col1 == "/" ? "✓" : string.Empty, + col2_3 = evaluate_assign.data.evaluate.discipline3_level.col2 == "/" ? "✓" : string.Empty, + col3_3 = evaluate_assign.data.evaluate.discipline3_level.col3 == "/" ? "✓" : string.Empty, + col4_3 = evaluate_assign.data.evaluate.discipline3_level.col4 == "/" ? "✓" : string.Empty, + col5_3 = evaluate_assign.data.evaluate.discipline3_level.col5 == "/" ? "✓" : string.Empty, + + col1_4 = evaluate_assign.data.evaluate.discipline4_level.col1 == "/" ? "✓" : string.Empty, + col2_4 = evaluate_assign.data.evaluate.discipline4_level.col2 == "/" ? "✓" : string.Empty, + col3_4 = evaluate_assign.data.evaluate.discipline4_level.col3 == "/" ? "✓" : string.Empty, + col4_4 = evaluate_assign.data.evaluate.discipline4_level.col4 == "/" ? "✓" : string.Empty, + col5_4 = evaluate_assign.data.evaluate.discipline4_level.col5 == "/" ? "✓" : string.Empty, + + col1_5 = evaluate_assign.data.evaluate.discipline5_level.col1 == "/" ? "✓" : string.Empty, + col2_5 = evaluate_assign.data.evaluate.discipline5_level.col2 == "/" ? "✓" : string.Empty, + col3_5 = evaluate_assign.data.evaluate.discipline5_level.col3 == "/" ? "✓" : string.Empty, + col4_5 = evaluate_assign.data.evaluate.discipline5_level.col4 == "/" ? "✓" : string.Empty, + col5_5 = evaluate_assign.data.evaluate.discipline5_level.col5 == "/" ? "✓" : string.Empty, + }; + var behavior_other_level = new + { + col1 = evaluate_assign.data.evaluate.behavior_other_level.col1 == "/" ? "✓" : string.Empty, + col2 = evaluate_assign.data.evaluate.behavior_other_level.col2 == "/" ? "✓" : string.Empty, + col3 = evaluate_assign.data.evaluate.behavior_other_level.col3 == "/" ? "✓" : string.Empty, + col4 = evaluate_assign.data.evaluate.behavior_other_level.col4 == "/" ? "✓" : string.Empty, + col5 = evaluate_assign.data.evaluate.behavior_other_level.col5 == "/" ? "✓" : string.Empty, + }; + var achievement_score = evaluate_assign.data.evaluate.achievement_score != null + ? evaluate_assign.data.evaluate.achievement_score.ToThaiNumber() + : string.Empty; + var behavior_score = evaluate_assign.data.evaluate.behavior_score != null + ? evaluate_assign.data.evaluate.behavior_score.ToThaiNumber() + : string.Empty; + var sum_score = evaluate_assign.data.evaluate.sum_score != null + ? evaluate_assign.data.evaluate.sum_score.ToThaiNumber() + : string.Empty; + var achievement_percent = evaluate_assign.data.evaluate.achievement_percent != null + ? evaluate_assign.data.evaluate.achievement_percent.ToThaiNumber() + : string.Empty; + var behavior_percent = evaluate_assign.data.evaluate.behavior_percent != null + ? evaluate_assign.data.evaluate.behavior_percent.ToThaiNumber() + : string.Empty; + var sum_percent = evaluate_assign.data.evaluate.sum_percent != null + ? evaluate_assign.data.evaluate.sum_percent.ToThaiNumber() + : string.Empty; + var develop_orientation_score = evaluate_assign.data.evaluate.develop_orientation_score != null + ? evaluate_assign.data.evaluate.develop_orientation_score.ToThaiNumber() + : string.Empty; + var develop_self_learning_score = evaluate_assign.data.evaluate.develop_self_learning_score != null + ? evaluate_assign.data.evaluate.develop_self_learning_score.ToThaiNumber() + : string.Empty; + var develop_training_seminar_score = evaluate_assign.data.evaluate.develop_training_seminar_score != null + ? evaluate_assign.data.evaluate.develop_training_seminar_score.ToThaiNumber() + : string.Empty; + var develop_other_training_score = evaluate_assign.data.evaluate.develop_other_training_score != null + ? evaluate_assign.data.evaluate.develop_other_training_score.ToThaiNumber() + : string.Empty; + var develop_total_score = evaluate_assign.data.evaluate.develop_total_score != null + ? evaluate_assign.data.evaluate.develop_total_score.ToThaiNumber() + : string.Empty; + var develop_orientation_percent = evaluate_assign.data.evaluate.develop_orientation_percent != null + ? evaluate_assign.data.evaluate.develop_orientation_percent.ToThaiNumber() + : string.Empty; + var develop_self_learning_percent = evaluate_assign.data.evaluate.develop_self_learning_percent != null + ? evaluate_assign.data.evaluate.develop_self_learning_percent.ToThaiNumber() + : string.Empty; + var develop_training_seminar_percent = evaluate_assign.data.evaluate.develop_training_seminar_percent != null + ? evaluate_assign.data.evaluate.develop_training_seminar_percent.ToThaiNumber() + : string.Empty; + var develop_other_training_percent = evaluate_assign.data.evaluate.develop_other_training_percent != null + ? evaluate_assign.data.evaluate.develop_other_training_percent.ToThaiNumber() + : string.Empty; + var develop_total_percent = evaluate_assign.data.evaluate.develop_total_percent != null + ? evaluate_assign.data.evaluate.develop_total_percent.ToThaiNumber() + : string.Empty; return new { No = string.IsNullOrEmpty(evaluate_assign.data.evaluate.no.ToString()) ? string.Empty : evaluate_assign.data.evaluate.no.ToString().ToThaiNumber(), - EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), - EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), + EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "-" : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_finish.ToString()) ? "-" : evaluate_assign.data.evaluate.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), Name = string.IsNullOrEmpty(evaluate_assign.data.experimentee.name) ? string.Empty : evaluate_assign.data.experimentee.name, Position = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Position) ? string.Empty : evaluate_assign.data.experimentee.Position, Department = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Department) ? string.Empty : evaluate_assign.data.experimentee.Department, - OrganizationOrganization = string.IsNullOrEmpty(evaluate_assign.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.data.experimentee.OrganizationOrganization, + Organization = string.IsNullOrEmpty(evaluate_assign.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.data.experimentee.OrganizationOrganization, Oc = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Oc) ? string.Empty : evaluate_assign.data.experimentee.Oc, - DateStart = string.IsNullOrEmpty(evaluate_assign.data.assign.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), - DateFinish = string.IsNullOrEmpty(evaluate_assign.data.assign.date_finish.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), + DateStart = string.IsNullOrEmpty(evaluate_assign.data.assign.date_start.ToString()) ? "-" : evaluate_assign.data.assign.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + DateFinish = string.IsNullOrEmpty(evaluate_assign.data.assign.date_finish.ToString()) ? "-" : evaluate_assign.data.assign.date_finish.ToThaiFullDate().ToString().ToThaiNumber(), + Knows = knowledge_level, + Applys = apply_level, + Success = success_level, + AchievementOthers = achievement_other_level, + AchievementOtherDesc = evaluate_assign.data.evaluate.achievement_other_desc, + Conducts = conduct_level, + Morals = moral_level, + Disciplines = discipline_level, + BehaviorOthers = behavior_other_level, + BehaviorOtherDesc = evaluate_assign.data.evaluate.behavior_other_desc, + AchievementScore = achievement_score, + BehaviorScore = behavior_score, + SumScore = sum_score, + AchievementPercent = achievement_percent, + BehaviorPercent = behavior_percent, + SumPercent = sum_percent, + AchievementResult1 = evaluate_assign.data.evaluate.achievement_result == 1 ? "✓" : string.Empty, + AchievementResult2 = evaluate_assign.data.evaluate.achievement_result == 1 ? string.Empty : "✓", + BehaviorResult1 = evaluate_assign.data.evaluate.behavior_result == 1 ? "✓" : string.Empty, + BehaviorResult2 = evaluate_assign.data.evaluate.behavior_result == 1 ? string.Empty : "✓", + DevelopOrientationScore = develop_orientation_score, + DevelopSelfLearningScore = develop_self_learning_score, + DevelopTrainingSeminarScore = develop_training_seminar_score, + DevelopOtherTrainingScore = develop_other_training_score, + DevelopTotalScore = develop_total_score, + DevelopOrientationPercent = develop_orientation_percent, + DevelopSelfLearningPercent = develop_self_learning_percent, + DevelopTrainingSeminarPercent = develop_training_seminar_percent, + DevelopOtherTrainingPercent = develop_other_training_percent, + DevelopTotalPercent = develop_total_percent, + DevelopResult1 = evaluate_assign.data.evaluate.develop_result == 1 ? "✓" : string.Empty, + DevelopResult2 = evaluate_assign.data.evaluate.develop_result == 0 ? "✓" : string.Empty, + EvaluateResult1 = evaluate_assign.data.evaluate.evaluate_result == 1 ? "🗹" : "☐", + EvaluateResult2 = evaluate_assign.data.evaluate.evaluate_result == 1 ? "☐" : "🗹", 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, - ChairmanDated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.chairman_dated.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.chairman_dated.ToThaiFullDate().ToString().ToThaiNumber(), + ChairmanDated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.data.evaluate.chairman_dated.ToThaiFullDate().ToString().ToThaiNumber(), Director1Name = string.IsNullOrEmpty(evaluate_assign.data.director1.name) ? string.Empty : evaluate_assign.data.director1.name, Director1Position = string.IsNullOrEmpty(evaluate_assign.data.director1.Position) ? string.Empty : evaluate_assign.data.director1.Position, - Director1Dated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.director1_dated.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.director1_dated.ToThaiFullDate().ToString().ToThaiNumber(), + Director1Dated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.data.evaluate.director1_dated.ToThaiFullDate().ToString().ToThaiNumber(), Director2Name = string.IsNullOrEmpty(evaluate_assign.data.director2.name) ? string.Empty : evaluate_assign.data.director2.name, Director2Position = string.IsNullOrEmpty(evaluate_assign.data.director2.Position) ? string.Empty : evaluate_assign.data.director2.Position, - Director2Dated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.director2_dated.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.director2_dated.ToThaiFullDate().ToString().ToThaiNumber(), - - Evaluate = evaluate_assign.data.evaluate, + Director2Dated = string.IsNullOrEmpty(evaluate_assign.data.evaluate.director2_dated.ToString()) ? "-" : evaluate_assign.data.evaluate.director2_dated.ToThaiFullDate().ToString().ToThaiNumber(), }; } else @@ -252,7 +874,7 @@ namespace BMA.EHR.Application.Repositories.Reports } #endregion - #region แบบรายงานการประเมินผล + #region 18 แบบรายงานการประเมินผล (สำหรับประธาน และ กรณีขยายเวลา) public async Task GetEvaluateResultAssignAsync(Guid id, string token) { var api_url = $"{_configuration["APIPROBATION"]}/evaluate-result?assign_id={id}"; @@ -267,29 +889,64 @@ namespace BMA.EHR.Application.Repositories.Reports if (evaluate_assign.data != null) { + var expandMonth = string.IsNullOrEmpty(evaluate_assign.data.evaluate.expand_month.ToString()) ? string.Empty : evaluate_assign.data.evaluate.expand_month.ToString().ToThaiNumber(); + var developComplete1 = evaluate_assign.data.evaluate.develop_complete == 1 + ? "🗹" + : "☐"; + var developComplete2 = evaluate_assign.data.evaluate.develop_complete == 0 + ? "🗹" + : "☐"; + var passResult1 = evaluate_assign.data.evaluate.pass_result == 1 + ? "🗹 ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็น ควรให้รับราชการต่อไป" + : "☐ ไม่ต่ำกว่ามาตรฐานที่กำหนดเห็น ควรให้รับราชการต่อไป"; + var passResult2 = evaluate_assign.data.evaluate.pass_result == 2 + ? "🗹 ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกราชการต่อไป" + : "☐ ต่ำกว่ามาตรฐานที่กำหนดเห็นควรให้ออกราชการต่อไป"; + var passResult3 = evaluate_assign.data.evaluate.pass_result == 3 + ? $"🗹 เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน" + : "☐ เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก.....เดือน"; + + var passResult = evaluate_assign.data.evaluate.pass_result == 1 + ? "เห็นควรให้รับราชการต่อไป" + : evaluate_assign.data.evaluate.pass_result == 2 + ? "เห็นควรให้ออกจากราชการ" + : $"เห็นควรให้ขยายเวลาทดลองปฏิบัติหน้าที่ราชการต่อไปอีก {expandMonth} เดือน"; + + CultureInfo provider = new CultureInfo("en-US"); + DateTime date_start = DateTime.MinValue, date_finish = DateTime.MinValue; + if (evaluate_assign.data.assign.date_start != string.Empty && evaluate_assign.data.assign.date_finish != string.Empty) + { + date_start = DateTime.Parse(evaluate_assign.data.assign.date_start, provider); + date_finish = DateTime.Parse(evaluate_assign.data.assign.date_finish, provider); + } + var dateStart_ = date_start.ToThaiFullDate().ToString().ToThaiNumber(); + var dateFinish_ = date_finish.ToThaiFullDate().ToString().ToThaiNumber(); return new { - EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), - EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + EvaluateDateStart = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "-" : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), + EvaluateDateFinish = string.IsNullOrEmpty(evaluate_assign.data.evaluate.date_start.ToString()) ? "-" : evaluate_assign.data.evaluate.date_start.ToThaiFullDate().ToString().ToThaiNumber(), Position = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Position) ? string.Empty : evaluate_assign.data.experimentee.Position, Department = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Department) ? string.Empty : evaluate_assign.data.experimentee.Department, - OrganizationOrganization = string.IsNullOrEmpty(evaluate_assign.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.data.experimentee.OrganizationOrganization, + Organization = string.IsNullOrEmpty(evaluate_assign.data.experimentee.OrganizationOrganization) ? string.Empty : evaluate_assign.data.experimentee.OrganizationOrganization, Oc = string.IsNullOrEmpty(evaluate_assign.data.experimentee.Oc) ? string.Empty : evaluate_assign.data.experimentee.Oc, - Reson = string.IsNullOrEmpty(evaluate_assign.data.evaluate.reson) ? string.Empty : evaluate_assign.data.evaluate.reson, - DevelopComplete = string.IsNullOrEmpty(evaluate_assign.data.evaluate.develop_complete.ToString()) ? 0 : evaluate_assign.data.evaluate.develop_complete, - PassResult = string.IsNullOrEmpty(evaluate_assign.data.evaluate.pass_result.ToString()) ? 0 : evaluate_assign.data.evaluate.pass_result, - ExpandMonth = string.IsNullOrEmpty(evaluate_assign.data.evaluate.expand_month.ToString()) ? string.Empty : evaluate_assign.data.evaluate.expand_month.ToString().ToThaiNumber(), + Reason = string.IsNullOrEmpty(evaluate_assign.data.evaluate.reson) ? string.Empty : evaluate_assign.data.evaluate.reson, + ExpandMonth = expandMonth, 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(), + ChairmanDate = string.IsNullOrEmpty(evaluate_assign.data.evaluate.chairman_dated.ToString()) ? "-" : evaluate_assign.data.evaluate.chairman_dated.ToThaiFullDate().ToString().ToThaiNumber(), CommanderName = string.IsNullOrEmpty(evaluate_assign.data.commander.name) ? string.Empty : evaluate_assign.data.commander.name, CommanderPosition = string.IsNullOrEmpty(evaluate_assign.data.commander.Position) ? string.Empty : evaluate_assign.data.commander.Position, - CommanderDate = string.IsNullOrEmpty(evaluate_assign.data.evaluate.director1_dated.ToString()) ? "วันที่ เดือน พ.ศ." : evaluate_assign.data.evaluate.director1_dated.ToThaiFullDate().ToString().ToThaiNumber(), + CommanderDate = string.IsNullOrEmpty(evaluate_assign.data.evaluate.director1_dated.ToString()) ? "-" : evaluate_assign.data.evaluate.director1_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(), - + DateStart = evaluate_assign.data.assign.date_start != string.Empty ? dateStart_ : "-", + DateFinish = evaluate_assign.data.assign.date_finish != string.Empty ? dateFinish_ : "-", + Develop1 = developComplete1, + Develop2 = developComplete2, + PassResult1 = passResult1, + PassResult2 = passResult2, + PassResult3 = passResult3, + PassResult = passResult, }; } else diff --git a/BMA.EHR.Application/Responses/ProbationAssignResponse.cs b/BMA.EHR.Application/Responses/ProbationAssignResponse.cs index cc85de84..e780c42c 100644 --- a/BMA.EHR.Application/Responses/ProbationAssignResponse.cs +++ b/BMA.EHR.Application/Responses/ProbationAssignResponse.cs @@ -75,7 +75,8 @@ public class Competency { public string id { get; set; } = string.Empty; - public string title { get; set; } = string.Empty; + public string name { get; set; } = string.Empty; + public string level { get; set; } = string.Empty; public string description { get; set; } = string.Empty; } diff --git a/BMA.EHR.Report.Service/Controllers/ProbationReportController.cs b/BMA.EHR.Report.Service/Controllers/ProbationReportController.cs index d0d95b19..fdba84fb 100644 --- a/BMA.EHR.Report.Service/Controllers/ProbationReportController.cs +++ b/BMA.EHR.Report.Service/Controllers/ProbationReportController.cs @@ -6,6 +6,7 @@ using Swashbuckle.AspNetCore.Annotations; using Telerik.Reporting; using Telerik.Reporting.Processing; using System.Text.RegularExpressions; +using DocumentFormat.OpenXml.Drawing; namespace BMA.EHR.Report.Service.Controllers { @@ -75,145 +76,152 @@ namespace BMA.EHR.Report.Service.Controllers case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; } - var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-1.trdp"); - var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-2.trdp"); - var rptFile3 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-3.trdp"); + //var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-1.trdp"); + //var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-2.trdp"); + //var rptFile3 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"13-แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ-3.trdp"); - ReportPackager reportPacker = new ReportPackager(); - Telerik.Reporting.Report? report = null; - Telerik.Reporting.Report? report2 = null; - Telerik.Reporting.Report? report3 = null; + //ReportPackager reportPacker = new ReportPackager(); + //Telerik.Reporting.Report? report = null; + //Telerik.Reporting.Report? report2 = null; + //Telerik.Reporting.Report? report3 = null; - using (var sourceStream = System.IO.File.OpenRead(rptFile)) - using (var sourceStream2 = System.IO.File.OpenRead(rptFile2)) - using (var sourceStream3 = System.IO.File.OpenRead(rptFile3)) + //using (var sourceStream = System.IO.File.OpenRead(rptFile)) + //using (var sourceStream2 = System.IO.File.OpenRead(rptFile2)) + //using (var sourceStream3 = System.IO.File.OpenRead(rptFile3)) + //{ + // report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); + // report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); + // report3 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream3); + //} + + //report.ReportParameters["Name"].Value = probation.GetType().GetProperty("Name").GetValue(probation); + //report.ReportParameters["Position"].Value = probation.GetType().GetProperty("Position").GetValue(probation); + //report.ReportParameters["Department"].Value = probation.GetType().GetProperty("Department").GetValue(probation); + //report.ReportParameters["OrganizationOrganization"].Value = probation.GetType().GetProperty("OrganizationOrganization").GetValue(probation); + //report.ReportParameters["Oc"].Value = probation.GetType().GetProperty("Oc").GetValue(probation); + //report.ReportParameters["DateStart"].Value = probation.GetType().GetProperty("DateStart").GetValue(probation); + //report.ReportParameters["DateFinish"].Value = probation.GetType().GetProperty("DateFinish").GetValue(probation); + //report.ReportParameters["NameMentor1"].Value = probation.GetType().GetProperty("NameMentor1").GetValue(probation); + //report.ReportParameters["DateMentor1"].Value = probation.GetType().GetProperty("DateMentor1").GetValue(probation); + //report.ReportParameters["PositionMentor1"].Value = probation.GetType().GetProperty("PositionMentor1").GetValue(probation); + //report.ReportParameters["NameMentor2"].Value = probation.GetType().GetProperty("NameMentor2").GetValue(probation); + //report.ReportParameters["DateMentor2"].Value = probation.GetType().GetProperty("DateMentor2").GetValue(probation); + //report.ReportParameters["PositionMentor2"].Value = probation.GetType().GetProperty("PositionMentor2").GetValue(probation); + //report2.ReportParameters["Behave"].Value = + // "ความประพฤติ\n" + + // " • ให้บริการประชาชนหรือผู้รับบริการด้วยอัธยาศัยดี\n" + + // " • มีความรับผิดชอบในการปฏิบัติงาน\n" + + // " • ให้บริการประชาชนหรือผู้รับบริการด้วยความรวดเร็ว เอาใจใส่เป็นมาตรฐานเดียวกัน\n" + + // " • ตั้งใจปฏิบัติหน้าที่ราชการด้วยความอุตสาหะ ขยันหมั่นเพียร\n" + + // "ความมีคุณธรรมจริยธรรม ได้แก่\n" + + // " • อุทิศตนและเสียสละเวลาในการปฏิบัติงานอย่างเต็มกำลังความสามารถ\n" + + // " • มีจิตสำนึกที่ดี ปฏิบัติงานด้วยความซื่อสัตย์ สุจริต\n" + + // " • ยึดมั่นในสถาบันพระมหากษัตริย์ และไม่กระทำการใด ๆ อันจะก่อให้เกิดความเสียหายต่อประเทศชาติ ศาสนา และพระมหากษัตริย์\n" + + // "การรักษาวินัย ได้แก่\n" + + // " • มีความรับผิดชอบในการรักษาเวลาทำงาน\n" + + // " • แต่งกายในการปฏิบัติงานได้อย่างเหมาะสมกับการเป็นข้าราชการ\n" + + // " • ไม่กระทำการใด ๆ อันเป็นการเสื่อมเกียรติและศักดิ์ศรีของความเป็นข้าราชการ\n" + + // " • ไม่กระทำการใด ๆ อันอาจก่อให้เกิดความเสียหายแก่ชื่อเสียงของหน่วยงาน\n" + + // " • ปฏิบัติหน้าที่อย่างตรงไปตรงมาโดยยึดหลักจรรยาบรรณวิชาชีพ\n"; + //report2.ReportParameters["OtherDesc"].Value = probation.GetType().GetProperty("OtherDesc").GetValue(probation); + //report2.ReportParameters["Other4Desc"].Value = probation.GetType().GetProperty("Other4Desc").GetValue(probation); + //report2.ReportParameters["Other5No1Desc"].Value = probation.GetType().GetProperty("Other5No1Desc").GetValue(probation); + //report3.ReportParameters["Name"].Value = probation.GetType().GetProperty("Name").GetValue(probation); + //report3.ReportParameters["Position"].Value = probation.GetType().GetProperty("Position").GetValue(probation); + //report3.ReportParameters["DateStart"].Value = probation.GetType().GetProperty("DateStart").GetValue(probation); + //report3.ReportParameters["NameMentor1"].Value = probation.GetType().GetProperty("NameMentor1").GetValue(probation); + //report3.ReportParameters["PositionMentor1"].Value = probation.GetType().GetProperty("PositionMentor1").GetValue(probation); + //report3.ReportParameters["DateMentor1"].Value = probation.GetType().GetProperty("DateMentor1").GetValue(probation); + //report3.ReportParameters["NameCommander"].Value = probation.GetType().GetProperty("NameCommander").GetValue(probation); + //report3.ReportParameters["PositionCommander"].Value = probation.GetType().GetProperty("PositionCommander").GetValue(probation); + //report3.ReportParameters["DateCommander"].Value = probation.GetType().GetProperty("DateCommander").GetValue(probation); + //report3.ReportParameters["Other5No2Desc"].Value = probation.GetType().GetProperty("Other5No2Desc").GetValue(probation); + //report3.ReportParameters["NameMentor2"].Value = probation.GetType().GetProperty("NameMentor2").GetValue(probation); + //report3.ReportParameters["DateMentor2"].Value = probation.GetType().GetProperty("DateMentor2").GetValue(probation); + //report3.ReportParameters["PositionMentor2"].Value = probation.GetType().GetProperty("PositionMentor2").GetValue(probation); + + //var _jobsList = new List(); + //dynamic jobs = probation.GetType().GetProperty("Jobs").GetValue(probation); + //foreach (var job in jobs) + //{ + // _jobsList.Add(new + // { + // Id = "-", + // Activity_desc = job.activity_desc, + // Goal_desc = job.goal_desc, + // }); + //} + //var tblJobsActivity = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; + //tblJobsActivity.DataSource = _jobsList; + //var tblJobsGoal = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"]; + //tblJobsGoal.DataSource = _jobsList; + + //var _knowledgeList = new List(); + //dynamic knowledges = probation.GetType().GetProperty("Knowledge").GetValue(probation); + //foreach (var knowledge in knowledges) + //{ + // string output = Regex.Replace(knowledge.description, "<.*?>", string.Empty); + // output = output.Replace(" ", " "); + // _knowledgeList.Add(new + // { + // Title = knowledge.title, + // Description = output + // }); + //} + //var tblKnowledges = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table3"]; + //tblKnowledges.DataSource = _knowledgeList; + + //var _competencysList = new List(); + //dynamic competencys = probation.GetType().GetProperty("Competency").GetValue(probation); + //foreach (var competency in competencys) + //{ + // string output = Regex.Replace(competency.description, "<.*?>", string.Empty); + // output = output.Replace(" ", " "); + // _competencysList.Add(new + // { + // Id = competency.id, + // Title = competency.title, + // Description = output + // }); + //} + //var tblCompetencys = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table4"]; + //tblCompetencys.DataSource = _competencysList; + + //var _OutputsList = new List(); + //dynamic Outputs = probation.GetType().GetProperty("Outputs").GetValue(probation); + //foreach (var Output in Outputs) + //{ + // _OutputsList.Add(new + // { + // Output_desc = Output.output_desc, + // Indicator_desc = Output.indicator_desc, + // }); + //} + //var tblOutputs = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table1"]; + //tblOutputs.DataSource = _OutputsList; + + //var reportBook = new ReportBook(); + //reportBook.Reports.Add(report); + //reportBook.Reports.Add(report2); + //reportBook.Reports.Add(report3); + + //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()}"); + var data = new { - report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); - report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); - report3 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream3); - } - - report.ReportParameters["Name"].Value = probation.GetType().GetProperty("Name").GetValue(probation); - report.ReportParameters["Position"].Value = probation.GetType().GetProperty("Position").GetValue(probation); - report.ReportParameters["Department"].Value = probation.GetType().GetProperty("Department").GetValue(probation); - report.ReportParameters["OrganizationOrganization"].Value = probation.GetType().GetProperty("OrganizationOrganization").GetValue(probation); - report.ReportParameters["Oc"].Value = probation.GetType().GetProperty("Oc").GetValue(probation); - report.ReportParameters["DateStart"].Value = probation.GetType().GetProperty("DateStart").GetValue(probation); - report.ReportParameters["DateFinish"].Value = probation.GetType().GetProperty("DateFinish").GetValue(probation); - report.ReportParameters["NameMentor1"].Value = probation.GetType().GetProperty("NameMentor1").GetValue(probation); - report.ReportParameters["DateMentor1"].Value = probation.GetType().GetProperty("DateMentor1").GetValue(probation); - report.ReportParameters["PositionMentor1"].Value = probation.GetType().GetProperty("PositionMentor1").GetValue(probation); - report.ReportParameters["NameMentor2"].Value = probation.GetType().GetProperty("NameMentor2").GetValue(probation); - report.ReportParameters["DateMentor2"].Value = probation.GetType().GetProperty("DateMentor2").GetValue(probation); - report.ReportParameters["PositionMentor2"].Value = probation.GetType().GetProperty("PositionMentor2").GetValue(probation); - report2.ReportParameters["Behave"].Value = - "ความประพฤติ\n" + - " • ให้บริการประชาชนหรือผู้รับบริการด้วยอัธยาศัยดี\n" + - " • มีความรับผิดชอบในการปฏิบัติงาน\n" + - " • ให้บริการประชาชนหรือผู้รับบริการด้วยความรวดเร็ว เอาใจใส่เป็นมาตรฐานเดียวกัน\n" + - " • ตั้งใจปฏิบัติหน้าที่ราชการด้วยความอุตสาหะ ขยันหมั่นเพียร\n" + - "ความมีคุณธรรมจริยธรรม ได้แก่\n" + - " • อุทิศตนและเสียสละเวลาในการปฏิบัติงานอย่างเต็มกำลังความสามารถ\n" + - " • มีจิตสำนึกที่ดี ปฏิบัติงานด้วยความซื่อสัตย์ สุจริต\n" + - " • ยึดมั่นในสถาบันพระมหากษัตริย์ และไม่กระทำการใด ๆ อันจะก่อให้เกิดความเสียหายต่อประเทศชาติ ศาสนา และพระมหากษัตริย์\n" + - "การรักษาวินัย ได้แก่\n" + - " • มีความรับผิดชอบในการรักษาเวลาทำงาน\n" + - " • แต่งกายในการปฏิบัติงานได้อย่างเหมาะสมกับการเป็นข้าราชการ\n" + - " • ไม่กระทำการใด ๆ อันเป็นการเสื่อมเกียรติและศักดิ์ศรีของความเป็นข้าราชการ\n" + - " • ไม่กระทำการใด ๆ อันอาจก่อให้เกิดความเสียหายแก่ชื่อเสียงของหน่วยงาน\n" + - " • ปฏิบัติหน้าที่อย่างตรงไปตรงมาโดยยึดหลักจรรยาบรรณวิชาชีพ\n"; - report2.ReportParameters["OtherDesc"].Value = probation.GetType().GetProperty("OtherDesc").GetValue(probation); - report2.ReportParameters["Other4Desc"].Value = probation.GetType().GetProperty("Other4Desc").GetValue(probation); - report2.ReportParameters["Other5No1Desc"].Value = probation.GetType().GetProperty("Other5No1Desc").GetValue(probation); - report3.ReportParameters["Name"].Value = probation.GetType().GetProperty("Name").GetValue(probation); - report3.ReportParameters["Position"].Value = probation.GetType().GetProperty("Position").GetValue(probation); - report3.ReportParameters["DateStart"].Value = probation.GetType().GetProperty("DateStart").GetValue(probation); - report3.ReportParameters["NameMentor1"].Value = probation.GetType().GetProperty("NameMentor1").GetValue(probation); - report3.ReportParameters["PositionMentor1"].Value = probation.GetType().GetProperty("PositionMentor1").GetValue(probation); - report3.ReportParameters["DateMentor1"].Value = probation.GetType().GetProperty("DateMentor1").GetValue(probation); - report3.ReportParameters["NameCommander"].Value = probation.GetType().GetProperty("NameCommander").GetValue(probation); - report3.ReportParameters["PositionCommander"].Value = probation.GetType().GetProperty("PositionCommander").GetValue(probation); - report3.ReportParameters["DateCommander"].Value = probation.GetType().GetProperty("DateCommander").GetValue(probation); - report3.ReportParameters["Other5No2Desc"].Value = probation.GetType().GetProperty("Other5No2Desc").GetValue(probation); - report3.ReportParameters["NameMentor2"].Value = probation.GetType().GetProperty("NameMentor2").GetValue(probation); - report3.ReportParameters["DateMentor2"].Value = probation.GetType().GetProperty("DateMentor2").GetValue(probation); - report3.ReportParameters["PositionMentor2"].Value = probation.GetType().GetProperty("PositionMentor2").GetValue(probation); - - var _jobsList = new List(); - dynamic jobs = probation.GetType().GetProperty("Jobs").GetValue(probation); - foreach (var job in jobs) - { - _jobsList.Add(new - { - Id = "-", - Activity_desc = job.activity_desc, - Goal_desc = job.goal_desc, - }); - } - var tblJobsActivity = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - tblJobsActivity.DataSource = _jobsList; - var tblJobsGoal = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"]; - tblJobsGoal.DataSource = _jobsList; - - var _knowledgeList = new List(); - dynamic knowledges = probation.GetType().GetProperty("Knowledge").GetValue(probation); - foreach (var knowledge in knowledges) - { - string output = Regex.Replace(knowledge.description, "<.*?>", string.Empty); - output = output.Replace(" ", " "); - _knowledgeList.Add(new - { - Title = knowledge.title, - Description = output - }); - } - var tblKnowledges = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table3"]; - tblKnowledges.DataSource = _knowledgeList; - - var _competencysList = new List(); - dynamic competencys = probation.GetType().GetProperty("Competency").GetValue(probation); - foreach (var competency in competencys) - { - string output = Regex.Replace(competency.description, "<.*?>", string.Empty); - output = output.Replace(" ", " "); - _competencysList.Add(new - { - Id = competency.id, - Title = competency.title, - Description = output - }); - } - var tblCompetencys = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table4"]; - tblCompetencys.DataSource = _competencysList; - - var _OutputsList = new List(); - dynamic Outputs = probation.GetType().GetProperty("Outputs").GetValue(probation); - foreach (var Output in Outputs) - { - _OutputsList.Add(new - { - Output_desc = Output.output_desc, - Indicator_desc = Output.indicator_desc, - }); - } - var tblOutputs = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table1"]; - tblOutputs.DataSource = _OutputsList; - - var reportBook = new ReportBook(); - reportBook.Reports.Add(report); - reportBook.Reports.Add(report2); - reportBook.Reports.Add(report3); - - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = reportBook, + template = "probation-13", + reportName = "docx-report", + data = probation }; - - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); - var content = result.DocumentBytes; - return File(content, mimeType, $"แบบมอบหมายงาน ฯ.{exportType.Trim().ToLower()}"); + return Success(data); } else { @@ -232,9 +240,9 @@ namespace BMA.EHR.Report.Service.Controllers } #endregion - #region 14,15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา + #region 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล /// - /// 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา + /// 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล /// /// evaluate id /// pdf, docx หรือ xlsx @@ -253,7 +261,7 @@ namespace BMA.EHR.Report.Service.Controllers if (!string.IsNullOrEmpty(authorizationHeader) && authorizationHeader.StartsWith("Bearer ")) { token = authorizationHeader.Substring("Bearer ".Length).Trim(); - var evaluateRecord = await _repository.GetEvaluateRecordAsync(id, token); + var evaluateRecord = await _repository.GetEvaluateRecord14_15Async(id, token); if (evaluateRecord != null) { @@ -265,227 +273,292 @@ namespace BMA.EHR.Report.Service.Controllers case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; } - var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-1.trdp"); - var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-2.trdp"); + //var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-1.trdp"); + //var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา-2.trdp"); - ReportPackager reportPacker = new ReportPackager(); - Telerik.Reporting.Report? report = null; - Telerik.Reporting.Report? report2 = null; + //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)) + //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["DirectorName"].Value = evaluateRecord.GetType().GetProperty("DirectorName").GetValue(evaluateRecord); + //report.ReportParameters["DirectorPosition"].Value = evaluateRecord.GetType().GetProperty("DirectorPosition").GetValue(evaluateRecord); + //report.ReportParameters["Name"].Value = evaluateRecord.GetType().GetProperty("Name").GetValue(evaluateRecord); + //report.ReportParameters["Position"].Value = evaluateRecord.GetType().GetProperty("Position").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["No"].Value = evaluateRecord.GetType().GetProperty("No").GetValue(evaluateRecord); + //report.ReportParameters["EvaluateDateStart"].Value = evaluateRecord.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateRecord); + //report.ReportParameters["EvaluateDateFinish"].Value = evaluateRecord.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateRecord); + //report.ReportParameters["Role"].Value = evaluateRecord.GetType().GetProperty("Role").GetValue(evaluateRecord); + //report2.ReportParameters["Role"].Value = evaluateRecord.GetType().GetProperty("Role").GetValue(evaluateRecord); + //report2.ReportParameters["DirectorName"].Value = evaluateRecord.GetType().GetProperty("DirectorName").GetValue(evaluateRecord); + //report2.ReportParameters["DirectorPosition"].Value = evaluateRecord.GetType().GetProperty("DirectorPosition").GetValue(evaluateRecord); + //report2.ReportParameters["DirectorDated"].Value = evaluateRecord.GetType().GetProperty("DirectorDated").GetValue(evaluateRecord); + ////1.1 + //var _Achievementslist = new List(); + //dynamic Achievements = evaluateRecord.GetType().GetProperty("Achievements").GetValue(evaluateRecord); + //foreach (var achievements in Achievements) + //{ + // _Achievementslist.Add(new + // { + // evaluate_expect_desc = achievements.evaluate_expect_desc, + // expectCol1 = achievements.evaluate_expect_level.col1, + // expectCol2 = achievements.evaluate_expect_level.col2, + // expectCol3 = achievements.evaluate_expect_level.col3, + // expectCol4 = achievements.evaluate_expect_level.col4, + // expectCol5 = achievements.evaluate_expect_level.col5, + // evaluate_output_desc = achievements.evaluate_output_desc, + // outputCol1 = achievements.evaluate_output_level.col1, + // outputCol2 = achievements.evaluate_output_level.col2, + // outputCol3 = achievements.evaluate_output_level.col3, + // outputCol4 = achievements.evaluate_output_level.col4, + // outputCol5 = achievements.evaluate_output_level.col5, + // }); + //} + //var tblEvaluate1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; + //tblEvaluate1.DataSource = _Achievementslist; + ////1.2 ... 1.7 + //var _Evaluatelist = new List(); + //dynamic evaluate = evaluateRecord.GetType().GetProperty("Evaluate").GetValue(evaluateRecord); + //dynamic knowledge = evaluate.knowledge_level; + //dynamic skill = evaluate.skill_level; + //dynamic competency = evaluate.competency_level; + //dynamic learn = evaluate.learn_level; + //dynamic apply = evaluate.apply_level; + //dynamic achievement = evaluate.achievement_other_level; + //string achievement_other_desc = evaluate.achievement_other_desc; + //string achievement_strength_desc = evaluate.achievement_strength_desc; + //string achievement_improve_desc = evaluate.achievement_improve_desc; + ////2.1 ... 2.4 + //dynamic conduct1 = evaluate.conduct1_level; + //dynamic conduct2 = evaluate.conduct2_level; + //dynamic conduct3 = evaluate.conduct3_level; + //dynamic conduct4 = evaluate.conduct4_level; + //dynamic moral1 = evaluate.moral1_level; + //dynamic moral2 = evaluate.moral2_level; + //dynamic moral3 = evaluate.moral3_level; + //dynamic discipline1 = evaluate.discipline1_level; + //dynamic discipline2 = evaluate.discipline2_level; + //dynamic discipline3 = evaluate.discipline3_level; + //dynamic discipline4 = evaluate.discipline4_level; + //dynamic discipline5 = evaluate.discipline5_level; + //dynamic behavior = evaluate.behavior_other_level; + //string behavior_other_desc = evaluate.behavior_other_desc; + //string behavior_strength_desc = evaluate.behavior_strength_desc; + //string behavior_improve_desc = evaluate.behavior_improve_desc; + //string orientation = evaluate.orientation; + //string self_learning = evaluate.self_learning; + //string training_seminar = evaluate.training_seminar; + //string other_training = evaluate.other_training; + //_Evaluatelist.Add(new + //{ + // knowledge_col1 = knowledge.col1, + // knowledge_col2 = knowledge.col2, + // knowledge_col3 = knowledge.col3, + // knowledge_col4 = knowledge.col4, + // knowledge_col5 = knowledge.col5, + // skill_col1 = skill.col1, + // skill_col2 = skill.col2, + // skill_col3 = skill.col3, + // skill_col4 = skill.col4, + // skill_col5 = skill.col5, + // competency_col1 = competency.col1, + // competency_col2 = competency.col2, + // competency_col3 = competency.col3, + // competency_col4 = competency.col4, + // competency_col5 = competency.col5, + // learn_col1 = learn.col1, + // learn_col2 = learn.col2, + // learn_col3 = learn.col3, + // learn_col4 = learn.col4, + // learn_col5 = learn.col5, + // apply_col1 = apply.col1, + // apply_col2 = apply.col2, + // apply_col3 = apply.col3, + // apply_col4 = apply.col4, + // apply_col5 = apply.col5, + // achievement_col1 = achievement.col1, + // achievement_col2 = achievement.col2, + // achievement_col3 = achievement.col3, + // achievement_col4 = achievement.col4, + // achievement_col5 = achievement.col5, + // achievement_other_desc, + // achievement_strength_desc, + // achievement_improve_desc, + // conduct1_col1 = conduct1.col1, + // conduct1_col2 = conduct1.col2, + // conduct1_col3 = conduct1.col3, + // conduct1_col4 = conduct1.col4, + // conduct1_col5 = conduct1.col5, + // conduct2_col1 = conduct2.col1, + // conduct2_col2 = conduct2.col2, + // conduct2_col3 = conduct2.col3, + // conduct2_col4 = conduct2.col4, + // conduct2_col5 = conduct2.col5, + // conduct3_col1 = conduct3.col1, + // conduct3_col2 = conduct3.col2, + // conduct3_col3 = conduct3.col3, + // conduct3_col4 = conduct3.col4, + // conduct3_col5 = conduct3.col5, + // conduct4_col1 = conduct4.col1, + // conduct4_col2 = conduct4.col2, + // conduct4_col3 = conduct4.col3, + // conduct4_col4 = conduct4.col4, + // conduct4_col5 = conduct4.col5, + // moral1_col1 = moral1.col1, + // moral1_col2 = moral1.col2, + // moral1_col3 = moral1.col3, + // moral1_col4 = moral1.col4, + // moral1_col5 = moral1.col5, + // moral2_col1 = moral2.col1, + // moral2_col2 = moral2.col2, + // moral2_col3 = moral2.col3, + // moral2_col4 = moral2.col4, + // moral2_col5 = moral2.col5, + // moral3_col1 = moral3.col1, + // moral3_col2 = moral3.col2, + // moral3_col3 = moral3.col3, + // moral3_col4 = moral3.col4, + // moral3_col5 = moral3.col5, + // discipline1_col1 = discipline1.col1, + // discipline1_col2 = discipline1.col2, + // discipline1_col3 = discipline1.col3, + // discipline1_col4 = discipline1.col4, + // discipline1_col5 = discipline1.col5, + // discipline2_col1 = discipline2.col1, + // discipline2_col2 = discipline2.col2, + // discipline2_col3 = discipline2.col3, + // discipline2_col4 = discipline2.col4, + // discipline2_col5 = discipline2.col5, + // discipline3_col1 = discipline3.col1, + // discipline3_col2 = discipline3.col2, + // discipline3_col3 = discipline3.col3, + // discipline3_col4 = discipline3.col4, + // discipline3_col5 = discipline3.col5, + // discipline4_col1 = discipline4.col1, + // discipline4_col2 = discipline4.col2, + // discipline4_col3 = discipline4.col3, + // discipline4_col4 = discipline4.col4, + // discipline4_col5 = discipline4.col5, + // discipline5_col1 = discipline5.col1, + // discipline5_col2 = discipline5.col2, + // discipline5_col3 = discipline5.col3, + // discipline5_col4 = discipline5.col4, + // discipline5_col5 = discipline5.col5, + // behavior_col1 = behavior.col1, + // behavior_col2 = behavior.col2, + // behavior_col3 = behavior.col3, + // behavior_col4 = behavior.col4, + // behavior_col5 = behavior.col5, + // behavior_other_desc, + // behavior_strength_desc, + // behavior_improve_desc, + // orientation, + // self_learning, + // training_seminar, + // other_training, + //}); + + //var tblEvaluate2 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table3"]; + //tblEvaluate2.DataSource = _Evaluatelist; + //var tblEvaluate3 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table4"]; + //tblEvaluate3.DataSource = _Evaluatelist; + //var tblEvaluate4 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table1"]; + //tblEvaluate4.DataSource = _Evaluatelist; + //var tblEvaluate5 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table4"]; + //tblEvaluate5.DataSource = _Evaluatelist; + //var tblEvaluate6 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table2"]; + //tblEvaluate6.DataSource = _Evaluatelist; + + //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()}"); + var data = new { - report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); - report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); - } - - report.ReportParameters["DirectorName"].Value = evaluateRecord.GetType().GetProperty("DirectorName").GetValue(evaluateRecord); - report.ReportParameters["DirectorPosition"].Value = evaluateRecord.GetType().GetProperty("DirectorPosition").GetValue(evaluateRecord); - report.ReportParameters["Name"].Value = evaluateRecord.GetType().GetProperty("Name").GetValue(evaluateRecord); - report.ReportParameters["Position"].Value = evaluateRecord.GetType().GetProperty("Position").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["No"].Value = evaluateRecord.GetType().GetProperty("No").GetValue(evaluateRecord); - report.ReportParameters["EvaluateDateStart"].Value = evaluateRecord.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateRecord); - report.ReportParameters["EvaluateDateFinish"].Value = evaluateRecord.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateRecord); - report.ReportParameters["Role"].Value = evaluateRecord.GetType().GetProperty("Role").GetValue(evaluateRecord); - report2.ReportParameters["Role"].Value = evaluateRecord.GetType().GetProperty("Role").GetValue(evaluateRecord); - report2.ReportParameters["DirectorName"].Value = evaluateRecord.GetType().GetProperty("DirectorName").GetValue(evaluateRecord); - report2.ReportParameters["DirectorPosition"].Value = evaluateRecord.GetType().GetProperty("DirectorPosition").GetValue(evaluateRecord); - report2.ReportParameters["DirectorDated"].Value = evaluateRecord.GetType().GetProperty("DirectorDated").GetValue(evaluateRecord); - //1.1 - var _Achievementslist = new List(); - dynamic Achievements = evaluateRecord.GetType().GetProperty("Achievements").GetValue(evaluateRecord); - foreach (var achievements in Achievements) - { - _Achievementslist.Add(new - { - evaluate_expect_desc = achievements.evaluate_expect_desc, - expectCol1 = achievements.evaluate_expect_level.col1, - expectCol2 = achievements.evaluate_expect_level.col2, - expectCol3 = achievements.evaluate_expect_level.col3, - expectCol4 = achievements.evaluate_expect_level.col4, - expectCol5 = achievements.evaluate_expect_level.col5, - evaluate_output_desc = achievements.evaluate_output_desc, - outputCol1 = achievements.evaluate_output_level.col1, - outputCol2 = achievements.evaluate_output_level.col2, - outputCol3 = achievements.evaluate_output_level.col3, - outputCol4 = achievements.evaluate_output_level.col4, - outputCol5 = achievements.evaluate_output_level.col5, - }); - } - var tblEvaluate1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - tblEvaluate1.DataSource = _Achievementslist; - //1.2 ... 1.7 - var _Evaluatelist = new List(); - dynamic evaluate = evaluateRecord.GetType().GetProperty("Evaluate").GetValue(evaluateRecord); - dynamic knowledge = evaluate.knowledge_level; - dynamic skill = evaluate.skill_level; - dynamic competency = evaluate.competency_level; - dynamic learn = evaluate.learn_level; - dynamic apply = evaluate.apply_level; - dynamic achievement = evaluate.achievement_other_level; - string achievement_other_desc = evaluate.achievement_other_desc; - string achievement_strength_desc = evaluate.achievement_strength_desc; - string achievement_improve_desc = evaluate.achievement_improve_desc; - //2.1 ... 2.4 - dynamic conduct1 = evaluate.conduct1_level; - dynamic conduct2 = evaluate.conduct2_level; - dynamic conduct3 = evaluate.conduct3_level; - dynamic conduct4 = evaluate.conduct4_level; - dynamic moral1 = evaluate.moral1_level; - dynamic moral2 = evaluate.moral2_level; - dynamic moral3 = evaluate.moral3_level; - dynamic discipline1 = evaluate.discipline1_level; - dynamic discipline2 = evaluate.discipline2_level; - dynamic discipline3 = evaluate.discipline3_level; - dynamic discipline4 = evaluate.discipline4_level; - dynamic discipline5 = evaluate.discipline5_level; - dynamic behavior = evaluate.behavior_other_level; - string behavior_other_desc = evaluate.behavior_other_desc; - string behavior_strength_desc = evaluate.behavior_strength_desc; - string behavior_improve_desc = evaluate.behavior_improve_desc; - string orientation = evaluate.orientation; - string self_learning = evaluate.self_learning; - string training_seminar = evaluate.training_seminar; - string other_training = evaluate.other_training; - _Evaluatelist.Add(new - { - knowledge_col1 = knowledge.col1, - knowledge_col2 = knowledge.col2, - knowledge_col3 = knowledge.col3, - knowledge_col4 = knowledge.col4, - knowledge_col5 = knowledge.col5, - skill_col1 = skill.col1, - skill_col2 = skill.col2, - skill_col3 = skill.col3, - skill_col4 = skill.col4, - skill_col5 = skill.col5, - competency_col1 = competency.col1, - competency_col2 = competency.col2, - competency_col3 = competency.col3, - competency_col4 = competency.col4, - competency_col5 = competency.col5, - learn_col1 = learn.col1, - learn_col2 = learn.col2, - learn_col3 = learn.col3, - learn_col4 = learn.col4, - learn_col5 = learn.col5, - apply_col1 = apply.col1, - apply_col2 = apply.col2, - apply_col3 = apply.col3, - apply_col4 = apply.col4, - apply_col5 = apply.col5, - achievement_col1 = achievement.col1, - achievement_col2 = achievement.col2, - achievement_col3 = achievement.col3, - achievement_col4 = achievement.col4, - achievement_col5 = achievement.col5, - achievement_other_desc, - achievement_strength_desc, - achievement_improve_desc, - conduct1_col1 = conduct1.col1, - conduct1_col2 = conduct1.col2, - conduct1_col3 = conduct1.col3, - conduct1_col4 = conduct1.col4, - conduct1_col5 = conduct1.col5, - conduct2_col1 = conduct2.col1, - conduct2_col2 = conduct2.col2, - conduct2_col3 = conduct2.col3, - conduct2_col4 = conduct2.col4, - conduct2_col5 = conduct2.col5, - conduct3_col1 = conduct3.col1, - conduct3_col2 = conduct3.col2, - conduct3_col3 = conduct3.col3, - conduct3_col4 = conduct3.col4, - conduct3_col5 = conduct3.col5, - conduct4_col1 = conduct4.col1, - conduct4_col2 = conduct4.col2, - conduct4_col3 = conduct4.col3, - conduct4_col4 = conduct4.col4, - conduct4_col5 = conduct4.col5, - moral1_col1 = moral1.col1, - moral1_col2 = moral1.col2, - moral1_col3 = moral1.col3, - moral1_col4 = moral1.col4, - moral1_col5 = moral1.col5, - moral2_col1 = moral2.col1, - moral2_col2 = moral2.col2, - moral2_col3 = moral2.col3, - moral2_col4 = moral2.col4, - moral2_col5 = moral2.col5, - moral3_col1 = moral3.col1, - moral3_col2 = moral3.col2, - moral3_col3 = moral3.col3, - moral3_col4 = moral3.col4, - moral3_col5 = moral3.col5, - discipline1_col1 = discipline1.col1, - discipline1_col2 = discipline1.col2, - discipline1_col3 = discipline1.col3, - discipline1_col4 = discipline1.col4, - discipline1_col5 = discipline1.col5, - discipline2_col1 = discipline2.col1, - discipline2_col2 = discipline2.col2, - discipline2_col3 = discipline2.col3, - discipline2_col4 = discipline2.col4, - discipline2_col5 = discipline2.col5, - discipline3_col1 = discipline3.col1, - discipline3_col2 = discipline3.col2, - discipline3_col3 = discipline3.col3, - discipline3_col4 = discipline3.col4, - discipline3_col5 = discipline3.col5, - discipline4_col1 = discipline4.col1, - discipline4_col2 = discipline4.col2, - discipline4_col3 = discipline4.col3, - discipline4_col4 = discipline4.col4, - discipline4_col5 = discipline4.col5, - discipline5_col1 = discipline5.col1, - discipline5_col2 = discipline5.col2, - discipline5_col3 = discipline5.col3, - discipline5_col4 = discipline5.col4, - discipline5_col5 = discipline5.col5, - behavior_col1 = behavior.col1, - behavior_col2 = behavior.col2, - behavior_col3 = behavior.col3, - behavior_col4 = behavior.col4, - behavior_col5 = behavior.col5, - behavior_other_desc, - behavior_strength_desc, - behavior_improve_desc, - orientation, - self_learning, - training_seminar, - other_training, - }); - - var tblEvaluate2 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table3"]; - tblEvaluate2.DataSource = _Evaluatelist; - var tblEvaluate3 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table4"]; - tblEvaluate3.DataSource = _Evaluatelist; - var tblEvaluate4 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table1"]; - tblEvaluate4.DataSource = _Evaluatelist; - var tblEvaluate5 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table4"]; - tblEvaluate5.DataSource = _Evaluatelist; - var tblEvaluate6 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table2"]; - tblEvaluate6.DataSource = _Evaluatelist; - - 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, + template = "probation-14", + reportName = "docx-report", + data = evaluateRecord }; + return Success(data); + } + else + { + return NotFound(); + } + } + else + { + return Unauthorized(); + } + } + catch + { + throw; + } + } + #endregion - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); - var content = result.DocumentBytes; - return File(content, mimeType, $"แบบบันทึกผล.{exportType.Trim().ToLower()}"); + #region 15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา + /// + /// 15-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา + /// + /// evaluate id + /// pdf, docx หรือ xlsx + /// + /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ + /// ไม่ได้ Login เข้าระบบ + /// เมื่อเกิดข้อผิดพลาดในการทำงาน + [HttpGet("15/{exportType}/{id}")] + public async Task> 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.GetEvaluateRecord14_15Async(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 data = new + { + template = "probation-15", + reportName = "docx-report", + data = evaluateRecord + }; + return Success(data); } else { @@ -537,177 +610,184 @@ namespace BMA.EHR.Report.Service.Controllers case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; } - var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-1.trdp"); + //var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา-1.trdp"); - ReportPackager reportPacker = new ReportPackager(); - Telerik.Reporting.Report? report = null; + //ReportPackager reportPacker = new ReportPackager(); + //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)reportPacker.UnpackageDocument(sourceStream); + //} + //report.ReportParameters["No"].Value = evaluateAssign.GetType().GetProperty("No").GetValue(evaluateAssign); + //report.ReportParameters["EvaluateDateStart"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateAssign); + //report.ReportParameters["EvaluateDateFinish"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateAssign); + //report.ReportParameters["Name"].Value = evaluateAssign.GetType().GetProperty("Name").GetValue(evaluateAssign); + //report.ReportParameters["Position"].Value = evaluateAssign.GetType().GetProperty("Position").GetValue(evaluateAssign); + //report.ReportParameters["Department"].Value = evaluateAssign.GetType().GetProperty("Department").GetValue(evaluateAssign); + //report.ReportParameters["OrganizationOrganization"].Value = evaluateAssign.GetType().GetProperty("OrganizationOrganization").GetValue(evaluateAssign); + //report.ReportParameters["Oc"].Value = evaluateAssign.GetType().GetProperty("Oc").GetValue(evaluateAssign); + //report.ReportParameters["DateStart"].Value = evaluateAssign.GetType().GetProperty("DateStart").GetValue(evaluateAssign); + //report.ReportParameters["DateFinish"].Value = evaluateAssign.GetType().GetProperty("DateFinish").GetValue(evaluateAssign); + //report.ReportParameters["BehaviorStrengthDesc"].Value = evaluateAssign.GetType().GetProperty("BehaviorStrengthDesc").GetValue(evaluateAssign); + //report.ReportParameters["BehaviorImproveDesc"].Value = evaluateAssign.GetType().GetProperty("BehaviorImproveDesc").GetValue(evaluateAssign); + //report.ReportParameters["CommanderName"].Value = evaluateAssign.GetType().GetProperty("CommanderName").GetValue(evaluateAssign); + //report.ReportParameters["CommanderPosition"].Value = evaluateAssign.GetType().GetProperty("CommanderPosition").GetValue(evaluateAssign); + //report.ReportParameters["CommanderDated"].Value = evaluateAssign.GetType().GetProperty("CommanderDated").GetValue(evaluateAssign); + + //dynamic evaluate = evaluateAssign.GetType().GetProperty("Evaluate").GetValue(evaluateAssign); + //dynamic knowledge = evaluate.knowledge_level; + //dynamic skill = evaluate.skill_level; + //dynamic competency = evaluate.competency_level; + //dynamic learn = evaluate.learn_level; + //dynamic apply = evaluate.apply_level; + //dynamic success = evaluate.success_level; + //dynamic achievement = evaluate.achievement_other_level; + //dynamic conduct1 = evaluate.conduct1_level; + //dynamic conduct2 = evaluate.conduct2_level; + //dynamic conduct3 = evaluate.conduct3_level; + //dynamic conduct4 = evaluate.conduct4_level; + //dynamic moral1 = evaluate.moral1_level; + //dynamic moral2 = evaluate.moral2_level; + //dynamic moral3 = evaluate.moral3_level; + //dynamic discipline1 = evaluate.discipline1_level; + //dynamic discipline2 = evaluate.discipline2_level; + //dynamic discipline3 = evaluate.discipline3_level; + //dynamic discipline4 = evaluate.discipline4_level; + //dynamic discipline5 = evaluate.discipline5_level; + //dynamic behavior = evaluate.behavior_other_level; + //var _Evaluate= new List(); + //_Evaluate.Add(new + //{ + // Check_Knowledge1 = knowledge.col1, + // Check_Knowledge2 = knowledge.col2, + // Check_Knowledge3 = knowledge.col3, + // Check_Knowledge4 = knowledge.col4, + // Check_Knowledge5 = knowledge.col5, + // Check_SkillLevel1 = skill.col1, + // Check_SkillLevel2 = skill.col2, + // Check_SkillLevel3 = skill.col3, + // Check_SkillLevel4 = skill.col4, + // Check_SkillLevel5 = skill.col5, + // Check_CompetencyLevel1 = competency.col1, + // Check_CompetencyLevel2 = competency.col2, + // Check_CompetencyLevel3 = competency.col3, + // Check_CompetencyLevel4 = competency.col4, + // Check_CompetencyLevel5 = competency.col5, + // Check_LearnLevel1 = learn.col1, + // Check_LearnLevel2 = learn.col2, + // Check_LearnLevel3 = learn.col3, + // Check_LearnLevel4 = learn.col4, + // Check_LearnLevel5 = learn.col5, + // Check_ApplyLevel1 = apply.col1, + // Check_ApplyLevel2 = apply.col2, + // Check_ApplyLevel3 = apply.col3, + // Check_ApplyLevel4 = apply.col4, + // Check_ApplyLevel5 = apply.col5, + // Check_Success_level1 = success.col1, + // Check_Success_level2 = success.col2, + // Check_Success_level3 = success.col3, + // Check_Success_level4 = success.col4, + // Check_Success_level5 = success.col5, + // AchievementOtherDesc = evaluate.achievement_other_desc, + // Check_AchievementOtherLevel1 = achievement.col1, + // Check_AchievementOtherLevel2 = achievement.col2, + // Check_AchievementOtherLevel3 = achievement.col3, + // Check_AchievementOtherLevel4 = achievement.col4, + // Check_AchievementOtherLevel5 = achievement.col5, + // Check_Conduct1Level1 = conduct1.col1, + // Check_Conduct1Level2 = conduct1.col2, + // Check_Conduct1Level3 = conduct1.col3, + // Check_Conduct1Level4 = conduct1.col4, + // Check_Conduct1Level5 = conduct1.col5, + // Check_Conduct2Level1 = conduct2.col1, + // Check_Conduct2Level2 = conduct2.col2, + // Check_Conduct2Level3 = conduct2.col3, + // Check_Conduct2Level4 = conduct2.col4, + // Check_Conduct2Level5 = conduct2.col5, + // Check_Conduct3Level1 = conduct3.col1, + // Check_Conduct3Level2 = conduct3.col2, + // Check_Conduct3Level3 = conduct3.col3, + // Check_Conduct3Level4 = conduct3.col4, + // Check_Conduct3Level5 = conduct3.col5, + // Check_Conduct4Level1 = conduct4.col1, + // Check_Conduct4Level2 = conduct4.col2, + // Check_Conduct4Level3 = conduct4.col3, + // Check_Conduct4Level4 = conduct4.col4, + // Check_Conduct4Level5 = conduct4.col5, + // Check_Moral1Level1 = moral1.col1, + // Check_Moral1Level2 = moral1.col2, + // Check_Moral1Level3 = moral1.col3, + // Check_Moral1Level4 = moral1.col4, + // Check_Moral1Level5 = moral1.col5, + // Check_Moral2Level1 = moral2.col1, + // Check_Moral2Level2 = moral2.col2, + // Check_Moral2Level3 = moral2.col3, + // Check_Moral2Level4 = moral2.col4, + // Check_Moral2Level5 = moral2.col5, + // Check_Moral3Level1 = moral3.col1, + // Check_Moral3Level2 = moral3.col2, + // Check_Moral3Level3 = moral3.col3, + // Check_Moral3Level4 = moral3.col4, + // Check_Moral3Level5 = moral3.col5, + // Check_Discipline1Level1 = discipline1.col1, + // Check_Discipline1Level2 = discipline1.col2, + // Check_Discipline1Level3 = discipline1.col3, + // Check_Discipline1Level4 = discipline1.col4, + // Check_Discipline1Level5 = discipline1.col5, + // Check_Discipline2Level1 = discipline2.col1, + // Check_Discipline2Level2 = discipline2.col2, + // Check_Discipline2Level3 = discipline2.col3, + // Check_Discipline2Level4 = discipline2.col4, + // Check_Discipline2Level5 = discipline2.col5, + // Check_Discipline3Level1 = discipline3.col1, + // Check_Discipline3Level2 = discipline3.col2, + // Check_Discipline3Level3 = discipline3.col3, + // Check_Discipline3Level4 = discipline3.col4, + // Check_Discipline3Level5 = discipline3.col5, + // Check_Discipline4Level1 = discipline4.col1, + // Check_Discipline4Level2 = discipline4.col2, + // Check_Discipline4Level3 = discipline4.col3, + // Check_Discipline4Level4 = discipline4.col4, + // Check_Discipline4Level5 = discipline4.col5, + // Check_Discipline5Level1 = discipline5.col1, + // Check_Discipline5Level2 = discipline5.col2, + // Check_Discipline5Level3 = discipline5.col3, + // Check_Discipline5Level4 = discipline5.col4, + // Check_Discipline5Level5 = discipline5.col5, + // BehaviorOtherDesc = evaluate.behavior_other_desc, + // Check_BehaviorOtherLevel1 = behavior.col1, + // Check_BehaviorOtherLevel2 = behavior.col2, + // Check_BehaviorOtherLevel3 = behavior.col3, + // Check_BehaviorOtherLevel4 = behavior.col4, + // Check_BehaviorOtherLevel5 = behavior.col5, + //}); + //var tblEvaluateAssign1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; + //tblEvaluateAssign1.DataSource = _Evaluate; + + //var tblEvaluateAssign2 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"]; + //tblEvaluateAssign2.DataSource = _Evaluate; + + //var tblEvaluateAssign3 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table3"]; + //tblEvaluateAssign3.DataSource = evaluate; + + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report, + //}; + + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); + //var content = result.DocumentBytes; + //return File(content, mimeType, $"แบบประเมินผล(สำหรับผู้บังคับบัญชา).{exportType.Trim().ToLower()}"); + var data = new { - report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); - } - report.ReportParameters["No"].Value = evaluateAssign.GetType().GetProperty("No").GetValue(evaluateAssign); - report.ReportParameters["EvaluateDateStart"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateAssign); - report.ReportParameters["EvaluateDateFinish"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateAssign); - report.ReportParameters["Name"].Value = evaluateAssign.GetType().GetProperty("Name").GetValue(evaluateAssign); - report.ReportParameters["Position"].Value = evaluateAssign.GetType().GetProperty("Position").GetValue(evaluateAssign); - report.ReportParameters["Department"].Value = evaluateAssign.GetType().GetProperty("Department").GetValue(evaluateAssign); - report.ReportParameters["OrganizationOrganization"].Value = evaluateAssign.GetType().GetProperty("OrganizationOrganization").GetValue(evaluateAssign); - report.ReportParameters["Oc"].Value = evaluateAssign.GetType().GetProperty("Oc").GetValue(evaluateAssign); - report.ReportParameters["DateStart"].Value = evaluateAssign.GetType().GetProperty("DateStart").GetValue(evaluateAssign); - report.ReportParameters["DateFinish"].Value = evaluateAssign.GetType().GetProperty("DateFinish").GetValue(evaluateAssign); - report.ReportParameters["BehaviorStrengthDesc"].Value = evaluateAssign.GetType().GetProperty("BehaviorStrengthDesc").GetValue(evaluateAssign); - report.ReportParameters["BehaviorImproveDesc"].Value = evaluateAssign.GetType().GetProperty("BehaviorImproveDesc").GetValue(evaluateAssign); - report.ReportParameters["CommanderName"].Value = evaluateAssign.GetType().GetProperty("CommanderName").GetValue(evaluateAssign); - report.ReportParameters["CommanderPosition"].Value = evaluateAssign.GetType().GetProperty("CommanderPosition").GetValue(evaluateAssign); - report.ReportParameters["CommanderDated"].Value = evaluateAssign.GetType().GetProperty("CommanderDated").GetValue(evaluateAssign); - - dynamic evaluate = evaluateAssign.GetType().GetProperty("Evaluate").GetValue(evaluateAssign); - dynamic knowledge = evaluate.knowledge_level; - dynamic skill = evaluate.skill_level; - dynamic competency = evaluate.competency_level; - dynamic learn = evaluate.learn_level; - dynamic apply = evaluate.apply_level; - dynamic success = evaluate.success_level; - dynamic achievement = evaluate.achievement_other_level; - dynamic conduct1 = evaluate.conduct1_level; - dynamic conduct2 = evaluate.conduct2_level; - dynamic conduct3 = evaluate.conduct3_level; - dynamic conduct4 = evaluate.conduct4_level; - dynamic moral1 = evaluate.moral1_level; - dynamic moral2 = evaluate.moral2_level; - dynamic moral3 = evaluate.moral3_level; - dynamic discipline1 = evaluate.discipline1_level; - dynamic discipline2 = evaluate.discipline2_level; - dynamic discipline3 = evaluate.discipline3_level; - dynamic discipline4 = evaluate.discipline4_level; - dynamic discipline5 = evaluate.discipline5_level; - dynamic behavior = evaluate.behavior_other_level; - var _Evaluate= new List(); - _Evaluate.Add(new - { - Check_Knowledge1 = knowledge.col1, - Check_Knowledge2 = knowledge.col2, - Check_Knowledge3 = knowledge.col3, - Check_Knowledge4 = knowledge.col4, - Check_Knowledge5 = knowledge.col5, - Check_SkillLevel1 = skill.col1, - Check_SkillLevel2 = skill.col2, - Check_SkillLevel3 = skill.col3, - Check_SkillLevel4 = skill.col4, - Check_SkillLevel5 = skill.col5, - Check_CompetencyLevel1 = competency.col1, - Check_CompetencyLevel2 = competency.col2, - Check_CompetencyLevel3 = competency.col3, - Check_CompetencyLevel4 = competency.col4, - Check_CompetencyLevel5 = competency.col5, - Check_LearnLevel1 = learn.col1, - Check_LearnLevel2 = learn.col2, - Check_LearnLevel3 = learn.col3, - Check_LearnLevel4 = learn.col4, - Check_LearnLevel5 = learn.col5, - Check_ApplyLevel1 = apply.col1, - Check_ApplyLevel2 = apply.col2, - Check_ApplyLevel3 = apply.col3, - Check_ApplyLevel4 = apply.col4, - Check_ApplyLevel5 = apply.col5, - Check_Success_level1 = success.col1, - Check_Success_level2 = success.col2, - Check_Success_level3 = success.col3, - Check_Success_level4 = success.col4, - Check_Success_level5 = success.col5, - AchievementOtherDesc = evaluate.achievement_other_desc, - Check_AchievementOtherLevel1 = achievement.col1, - Check_AchievementOtherLevel2 = achievement.col2, - Check_AchievementOtherLevel3 = achievement.col3, - Check_AchievementOtherLevel4 = achievement.col4, - Check_AchievementOtherLevel5 = achievement.col5, - Check_Conduct1Level1 = conduct1.col1, - Check_Conduct1Level2 = conduct1.col2, - Check_Conduct1Level3 = conduct1.col3, - Check_Conduct1Level4 = conduct1.col4, - Check_Conduct1Level5 = conduct1.col5, - Check_Conduct2Level1 = conduct2.col1, - Check_Conduct2Level2 = conduct2.col2, - Check_Conduct2Level3 = conduct2.col3, - Check_Conduct2Level4 = conduct2.col4, - Check_Conduct2Level5 = conduct2.col5, - Check_Conduct3Level1 = conduct3.col1, - Check_Conduct3Level2 = conduct3.col2, - Check_Conduct3Level3 = conduct3.col3, - Check_Conduct3Level4 = conduct3.col4, - Check_Conduct3Level5 = conduct3.col5, - Check_Conduct4Level1 = conduct4.col1, - Check_Conduct4Level2 = conduct4.col2, - Check_Conduct4Level3 = conduct4.col3, - Check_Conduct4Level4 = conduct4.col4, - Check_Conduct4Level5 = conduct4.col5, - Check_Moral1Level1 = moral1.col1, - Check_Moral1Level2 = moral1.col2, - Check_Moral1Level3 = moral1.col3, - Check_Moral1Level4 = moral1.col4, - Check_Moral1Level5 = moral1.col5, - Check_Moral2Level1 = moral2.col1, - Check_Moral2Level2 = moral2.col2, - Check_Moral2Level3 = moral2.col3, - Check_Moral2Level4 = moral2.col4, - Check_Moral2Level5 = moral2.col5, - Check_Moral3Level1 = moral3.col1, - Check_Moral3Level2 = moral3.col2, - Check_Moral3Level3 = moral3.col3, - Check_Moral3Level4 = moral3.col4, - Check_Moral3Level5 = moral3.col5, - Check_Discipline1Level1 = discipline1.col1, - Check_Discipline1Level2 = discipline1.col2, - Check_Discipline1Level3 = discipline1.col3, - Check_Discipline1Level4 = discipline1.col4, - Check_Discipline1Level5 = discipline1.col5, - Check_Discipline2Level1 = discipline2.col1, - Check_Discipline2Level2 = discipline2.col2, - Check_Discipline2Level3 = discipline2.col3, - Check_Discipline2Level4 = discipline2.col4, - Check_Discipline2Level5 = discipline2.col5, - Check_Discipline3Level1 = discipline3.col1, - Check_Discipline3Level2 = discipline3.col2, - Check_Discipline3Level3 = discipline3.col3, - Check_Discipline3Level4 = discipline3.col4, - Check_Discipline3Level5 = discipline3.col5, - Check_Discipline4Level1 = discipline4.col1, - Check_Discipline4Level2 = discipline4.col2, - Check_Discipline4Level3 = discipline4.col3, - Check_Discipline4Level4 = discipline4.col4, - Check_Discipline4Level5 = discipline4.col5, - Check_Discipline5Level1 = discipline5.col1, - Check_Discipline5Level2 = discipline5.col2, - Check_Discipline5Level3 = discipline5.col3, - Check_Discipline5Level4 = discipline5.col4, - Check_Discipline5Level5 = discipline5.col5, - BehaviorOtherDesc = evaluate.behavior_other_desc, - Check_BehaviorOtherLevel1 = behavior.col1, - Check_BehaviorOtherLevel2 = behavior.col2, - Check_BehaviorOtherLevel3 = behavior.col3, - Check_BehaviorOtherLevel4 = behavior.col4, - Check_BehaviorOtherLevel5 = behavior.col5, - }); - var tblEvaluateAssign1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - tblEvaluateAssign1.DataSource = _Evaluate; - - var tblEvaluateAssign2 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"]; - tblEvaluateAssign2.DataSource = _Evaluate; - - var tblEvaluateAssign3 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table3"]; - tblEvaluateAssign3.DataSource = evaluate; - - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report, + template = "probation-16", + reportName = "docx-report", + data = evaluateAssign }; - - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); - var content = result.DocumentBytes; - return File(content, mimeType, $"แบบประเมินผล(สำหรับผู้บังคับบัญชา).{exportType.Trim().ToLower()}"); + return Success(data); } else { @@ -759,196 +839,203 @@ namespace BMA.EHR.Report.Service.Controllers case "xlsx": mimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; break; } - var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-1.trdp"); - var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-2.trdp"); + //var rptFile = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-1.trdp"); + //var rptFile2 = System.IO.Path.Combine(_hostingEnvironment.ContentRootPath, "Reports", $"17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ-2.trdp"); - ReportPackager reportPacker = new ReportPackager(); - Telerik.Reporting.Report? report = null; - Telerik.Reporting.Report? report2 = null; + //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)) + //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["No"].Value = evaluateAssign.GetType().GetProperty("No").GetValue(evaluateAssign); + //report.ReportParameters["EvaluateDateStart"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateAssign); + //report.ReportParameters["EvaluateDateFinish"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateAssign); + //report.ReportParameters["Name"].Value = evaluateAssign.GetType().GetProperty("Name").GetValue(evaluateAssign); + //report.ReportParameters["Position"].Value = evaluateAssign.GetType().GetProperty("Position").GetValue(evaluateAssign); + //report.ReportParameters["Department"].Value = evaluateAssign.GetType().GetProperty("Department").GetValue(evaluateAssign); + //report.ReportParameters["OrganizationOrganization"].Value = evaluateAssign.GetType().GetProperty("OrganizationOrganization").GetValue(evaluateAssign); + //report.ReportParameters["Oc"].Value = evaluateAssign.GetType().GetProperty("Oc").GetValue(evaluateAssign); + //report.ReportParameters["DateStart"].Value = evaluateAssign.GetType().GetProperty("DateStart").GetValue(evaluateAssign); + //report.ReportParameters["DateFinish"].Value = evaluateAssign.GetType().GetProperty("DateFinish").GetValue(evaluateAssign); + //report2.ReportParameters["ChairmanName"].Value = evaluateAssign.GetType().GetProperty("ChairmanName").GetValue(evaluateAssign); + //report2.ReportParameters["ChairmanPosition"].Value = evaluateAssign.GetType().GetProperty("ChairmanPosition").GetValue(evaluateAssign); + //report2.ReportParameters["MentorName1"].Value = evaluateAssign.GetType().GetProperty("Director1Name").GetValue(evaluateAssign); + //report2.ReportParameters["MentorPosition1"].Value = evaluateAssign.GetType().GetProperty("Director1Position").GetValue(evaluateAssign); + //report2.ReportParameters["MentorName2"].Value = evaluateAssign.GetType().GetProperty("Director2Name").GetValue(evaluateAssign); + //report2.ReportParameters["MentorPosition2"].Value = evaluateAssign.GetType().GetProperty("Director2Position").GetValue(evaluateAssign); + //report2.ReportParameters["ChairmanDated"].Value = evaluateAssign.GetType().GetProperty("ChairmanDated").GetValue(evaluateAssign); + //report2.ReportParameters["Director1Dated"].Value = evaluateAssign.GetType().GetProperty("Director1Dated").GetValue(evaluateAssign); + //report2.ReportParameters["Director2Dated"].Value = evaluateAssign.GetType().GetProperty("Director2Dated").GetValue(evaluateAssign); + + //dynamic evaluate = evaluateAssign.GetType().GetProperty("Evaluate").GetValue(evaluateAssign); + //dynamic knowledge = evaluate.knowledge_level; + //dynamic apply = evaluate.apply_level; + //dynamic success = evaluate.success_level; + //dynamic achievement = evaluate.achievement_other_level; + //dynamic conduct1 = evaluate.conduct1_level; + //dynamic conduct2 = evaluate.conduct2_level; + //dynamic conduct3 = evaluate.conduct3_level; + //dynamic conduct4 = evaluate.conduct4_level; + //dynamic moral1 = evaluate.moral1_level; + //dynamic moral2 = evaluate.moral2_level; + //dynamic moral3 = evaluate.moral3_level; + //dynamic discipline1 = evaluate.discipline1_level; + //dynamic discipline2 = evaluate.discipline2_level; + //dynamic discipline3 = evaluate.discipline3_level; + //dynamic discipline4 = evaluate.discipline4_level; + //dynamic discipline5 = evaluate.discipline5_level; + //dynamic behavior = evaluate.behavior_other_level; + //string behavior_other_desc = evaluate.behavior_other_desc; + //var _Evaluate = new List(); + //_Evaluate.Add(new + //{ + // Check_Knowledge1 = knowledge.col1, + // Check_Knowledge2 = knowledge.col2, + // Check_Knowledge3 = knowledge.col3, + // Check_Knowledge4 = knowledge.col4, + // Check_Knowledge5 = knowledge.col5, + // Check_ApplyLevel1 = apply.col1, + // Check_ApplyLevel2 = apply.col2, + // Check_ApplyLevel3 = apply.col3, + // Check_ApplyLevel4 = apply.col4, + // Check_ApplyLevel5 = apply.col5, + // Check_Success_level1 = success.col1, + // Check_Success_level2 = success.col2, + // Check_Success_level3 = success.col3, + // Check_Success_level4 = success.col4, + // Check_Success_level5 = success.col5, + // AchievementOtherDesc = evaluate.achievement_other_desc, + // Check_AchievementOtherLevel1 = achievement.col1, + // Check_AchievementOtherLevel2 = achievement.col2, + // Check_AchievementOtherLevel3 = achievement.col3, + // Check_AchievementOtherLevel4 = achievement.col4, + // Check_AchievementOtherLevel5 = achievement.col5, + // Check_Conduct1Level1 = conduct1.col1, + // Check_Conduct1Level2 = conduct1.col2, + // Check_Conduct1Level3 = conduct1.col3, + // Check_Conduct1Level4 = conduct1.col4, + // Check_Conduct1Level5 = conduct1.col5, + // Check_Conduct2Level1 = conduct2.col1, + // Check_Conduct2Level2 = conduct2.col2, + // Check_Conduct2Level3 = conduct2.col3, + // Check_Conduct2Level4 = conduct2.col4, + // Check_Conduct2Level5 = conduct2.col5, + // Check_Conduct3Level1 = conduct3.col1, + // Check_Conduct3Level2 = conduct3.col2, + // Check_Conduct3Level3 = conduct3.col3, + // Check_Conduct3Level4 = conduct3.col4, + // Check_Conduct3Level5 = conduct3.col5, + // Check_Conduct4Level1 = conduct4.col1, + // Check_Conduct4Level2 = conduct4.col2, + // Check_Conduct4Level3 = conduct4.col3, + // Check_Conduct4Level4 = conduct4.col4, + // Check_Conduct4Level5 = conduct4.col5, + // Check_Moral1Level1 = moral1.col1, + // Check_Moral1Level2 = moral1.col2, + // Check_Moral1Level3 = moral1.col3, + // Check_Moral1Level4 = moral1.col4, + // Check_Moral1Level5 = moral1.col5, + // Check_Moral2Level1 = moral2.col1, + // Check_Moral2Level2 = moral2.col2, + // Check_Moral2Level3 = moral2.col3, + // Check_Moral2Level4 = moral2.col4, + // Check_Moral2Level5 = moral2.col5, + // Check_Moral3Level1 = moral3.col1, + // Check_Moral3Level2 = moral3.col2, + // Check_Moral3Level3 = moral3.col3, + // Check_Moral3Level4 = moral3.col4, + // Check_Moral3Level5 = moral3.col5, + // Check_Discipline1Level1 = discipline1.col1, + // Check_Discipline1Level2 = discipline1.col2, + // Check_Discipline1Level3 = discipline1.col3, + // Check_Discipline1Level4 = discipline1.col4, + // Check_Discipline1Level5 = discipline1.col5, + // Check_Discipline2Level1 = discipline2.col1, + // Check_Discipline2Level2 = discipline2.col2, + // Check_Discipline2Level3 = discipline2.col3, + // Check_Discipline2Level4 = discipline2.col4, + // Check_Discipline2Level5 = discipline2.col5, + // Check_Discipline3Level1 = discipline3.col1, + // Check_Discipline3Level2 = discipline3.col2, + // Check_Discipline3Level3 = discipline3.col3, + // Check_Discipline3Level4 = discipline3.col4, + // Check_Discipline3Level5 = discipline3.col5, + // Check_Discipline4Level1 = discipline4.col1, + // Check_Discipline4Level2 = discipline4.col2, + // Check_Discipline4Level3 = discipline4.col3, + // Check_Discipline4Level4 = discipline4.col4, + // Check_Discipline4Level5 = discipline4.col5, + // Check_Discipline5Level1 = discipline5.col1, + // Check_Discipline5Level2 = discipline5.col2, + // Check_Discipline5Level3 = discipline5.col3, + // Check_Discipline5Level4 = discipline5.col4, + // Check_Discipline5Level5 = discipline5.col5, + // BehaviorOtherDesc = evaluate.behavior_other_desc, + // Check_BehaviorOtherLevel1 = behavior.col1, + // Check_BehaviorOtherLevel2 = behavior.col2, + // Check_BehaviorOtherLevel3 = behavior.col3, + // Check_BehaviorOtherLevel4 = behavior.col4, + // Check_BehaviorOtherLevel5 = behavior.col5, + // achievement_score = evaluate.achievement_score, + // achievement_score_total = evaluate.achievement_score_total, + // achievement_percent = evaluate.achievement_percent, + // achievement_result = evaluate.achievement_result, + // behavior_score = evaluate.behavior_score, + // behavior_score_total = evaluate.behavior_score_total, + // behavior_percent = evaluate.behavior_percent, + // behavior_result = evaluate.behavior_result, + // sum_score = evaluate.sum_score, + // sum_percent = evaluate.sum_percent, + // develop_orientation_score = evaluate.develop_orientation_score, + // develop_self_learning_score = evaluate.develop_self_learning_score, + // develop_training_seminar_score = evaluate.develop_training_seminar_score, + // develop_other_training_score = evaluate.develop_other_training_score, + // develop_total_score = evaluate.develop_total_score, + // develop_orientation_percent = evaluate.develop_orientation_percent, + // develop_self_learning_percent = evaluate.develop_self_learning_percent, + // develop_training_seminar_percent = evaluate.develop_training_seminar_percent, + // develop_other_training_percent = evaluate.develop_other_training_percent, + // develop_total_percent = evaluate.develop_total_percent, + // develop_result = evaluate.develop_result, + // evaluate_result = evaluate.evaluate_result, + + //}); + //var tblEvaluateAssign1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"]; + //tblEvaluateAssign1.DataSource = _Evaluate; + //var tblEvaluateAssign2 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; + //tblEvaluateAssign2.DataSource = _Evaluate; + //var tblEvaluateAssign3 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table2"]; + //tblEvaluateAssign3.DataSource = _Evaluate; + //var tblEvaluateAssign4 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table3"]; + //tblEvaluateAssign4.DataSource = _Evaluate; + //report2.DataSource = _Evaluate; + //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()}"); + var data = new { - report = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream); - report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); - } - report.ReportParameters["No"].Value = evaluateAssign.GetType().GetProperty("No").GetValue(evaluateAssign); - report.ReportParameters["EvaluateDateStart"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateStart").GetValue(evaluateAssign); - report.ReportParameters["EvaluateDateFinish"].Value = evaluateAssign.GetType().GetProperty("EvaluateDateFinish").GetValue(evaluateAssign); - report.ReportParameters["Name"].Value = evaluateAssign.GetType().GetProperty("Name").GetValue(evaluateAssign); - report.ReportParameters["Position"].Value = evaluateAssign.GetType().GetProperty("Position").GetValue(evaluateAssign); - report.ReportParameters["Department"].Value = evaluateAssign.GetType().GetProperty("Department").GetValue(evaluateAssign); - report.ReportParameters["OrganizationOrganization"].Value = evaluateAssign.GetType().GetProperty("OrganizationOrganization").GetValue(evaluateAssign); - report.ReportParameters["Oc"].Value = evaluateAssign.GetType().GetProperty("Oc").GetValue(evaluateAssign); - report.ReportParameters["DateStart"].Value = evaluateAssign.GetType().GetProperty("DateStart").GetValue(evaluateAssign); - report.ReportParameters["DateFinish"].Value = evaluateAssign.GetType().GetProperty("DateFinish").GetValue(evaluateAssign); - report2.ReportParameters["ChairmanName"].Value = evaluateAssign.GetType().GetProperty("ChairmanName").GetValue(evaluateAssign); - report2.ReportParameters["ChairmanPosition"].Value = evaluateAssign.GetType().GetProperty("ChairmanPosition").GetValue(evaluateAssign); - report2.ReportParameters["MentorName1"].Value = evaluateAssign.GetType().GetProperty("Director1Name").GetValue(evaluateAssign); - report2.ReportParameters["MentorPosition1"].Value = evaluateAssign.GetType().GetProperty("Director1Position").GetValue(evaluateAssign); - report2.ReportParameters["MentorName2"].Value = evaluateAssign.GetType().GetProperty("Director2Name").GetValue(evaluateAssign); - report2.ReportParameters["MentorPosition2"].Value = evaluateAssign.GetType().GetProperty("Director2Position").GetValue(evaluateAssign); - report2.ReportParameters["ChairmanDated"].Value = evaluateAssign.GetType().GetProperty("ChairmanDated").GetValue(evaluateAssign); - report2.ReportParameters["Director1Dated"].Value = evaluateAssign.GetType().GetProperty("Director1Dated").GetValue(evaluateAssign); - report2.ReportParameters["Director2Dated"].Value = evaluateAssign.GetType().GetProperty("Director2Dated").GetValue(evaluateAssign); - - dynamic evaluate = evaluateAssign.GetType().GetProperty("Evaluate").GetValue(evaluateAssign); - dynamic knowledge = evaluate.knowledge_level; - dynamic apply = evaluate.apply_level; - dynamic success = evaluate.success_level; - dynamic achievement = evaluate.achievement_other_level; - dynamic conduct1 = evaluate.conduct1_level; - dynamic conduct2 = evaluate.conduct2_level; - dynamic conduct3 = evaluate.conduct3_level; - dynamic conduct4 = evaluate.conduct4_level; - dynamic moral1 = evaluate.moral1_level; - dynamic moral2 = evaluate.moral2_level; - dynamic moral3 = evaluate.moral3_level; - dynamic discipline1 = evaluate.discipline1_level; - dynamic discipline2 = evaluate.discipline2_level; - dynamic discipline3 = evaluate.discipline3_level; - dynamic discipline4 = evaluate.discipline4_level; - dynamic discipline5 = evaluate.discipline5_level; - dynamic behavior = evaluate.behavior_other_level; - string behavior_other_desc = evaluate.behavior_other_desc; - var _Evaluate = new List(); - _Evaluate.Add(new - { - Check_Knowledge1 = knowledge.col1, - Check_Knowledge2 = knowledge.col2, - Check_Knowledge3 = knowledge.col3, - Check_Knowledge4 = knowledge.col4, - Check_Knowledge5 = knowledge.col5, - Check_ApplyLevel1 = apply.col1, - Check_ApplyLevel2 = apply.col2, - Check_ApplyLevel3 = apply.col3, - Check_ApplyLevel4 = apply.col4, - Check_ApplyLevel5 = apply.col5, - Check_Success_level1 = success.col1, - Check_Success_level2 = success.col2, - Check_Success_level3 = success.col3, - Check_Success_level4 = success.col4, - Check_Success_level5 = success.col5, - AchievementOtherDesc = evaluate.achievement_other_desc, - Check_AchievementOtherLevel1 = achievement.col1, - Check_AchievementOtherLevel2 = achievement.col2, - Check_AchievementOtherLevel3 = achievement.col3, - Check_AchievementOtherLevel4 = achievement.col4, - Check_AchievementOtherLevel5 = achievement.col5, - Check_Conduct1Level1 = conduct1.col1, - Check_Conduct1Level2 = conduct1.col2, - Check_Conduct1Level3 = conduct1.col3, - Check_Conduct1Level4 = conduct1.col4, - Check_Conduct1Level5 = conduct1.col5, - Check_Conduct2Level1 = conduct2.col1, - Check_Conduct2Level2 = conduct2.col2, - Check_Conduct2Level3 = conduct2.col3, - Check_Conduct2Level4 = conduct2.col4, - Check_Conduct2Level5 = conduct2.col5, - Check_Conduct3Level1 = conduct3.col1, - Check_Conduct3Level2 = conduct3.col2, - Check_Conduct3Level3 = conduct3.col3, - Check_Conduct3Level4 = conduct3.col4, - Check_Conduct3Level5 = conduct3.col5, - Check_Conduct4Level1 = conduct4.col1, - Check_Conduct4Level2 = conduct4.col2, - Check_Conduct4Level3 = conduct4.col3, - Check_Conduct4Level4 = conduct4.col4, - Check_Conduct4Level5 = conduct4.col5, - Check_Moral1Level1 = moral1.col1, - Check_Moral1Level2 = moral1.col2, - Check_Moral1Level3 = moral1.col3, - Check_Moral1Level4 = moral1.col4, - Check_Moral1Level5 = moral1.col5, - Check_Moral2Level1 = moral2.col1, - Check_Moral2Level2 = moral2.col2, - Check_Moral2Level3 = moral2.col3, - Check_Moral2Level4 = moral2.col4, - Check_Moral2Level5 = moral2.col5, - Check_Moral3Level1 = moral3.col1, - Check_Moral3Level2 = moral3.col2, - Check_Moral3Level3 = moral3.col3, - Check_Moral3Level4 = moral3.col4, - Check_Moral3Level5 = moral3.col5, - Check_Discipline1Level1 = discipline1.col1, - Check_Discipline1Level2 = discipline1.col2, - Check_Discipline1Level3 = discipline1.col3, - Check_Discipline1Level4 = discipline1.col4, - Check_Discipline1Level5 = discipline1.col5, - Check_Discipline2Level1 = discipline2.col1, - Check_Discipline2Level2 = discipline2.col2, - Check_Discipline2Level3 = discipline2.col3, - Check_Discipline2Level4 = discipline2.col4, - Check_Discipline2Level5 = discipline2.col5, - Check_Discipline3Level1 = discipline3.col1, - Check_Discipline3Level2 = discipline3.col2, - Check_Discipline3Level3 = discipline3.col3, - Check_Discipline3Level4 = discipline3.col4, - Check_Discipline3Level5 = discipline3.col5, - Check_Discipline4Level1 = discipline4.col1, - Check_Discipline4Level2 = discipline4.col2, - Check_Discipline4Level3 = discipline4.col3, - Check_Discipline4Level4 = discipline4.col4, - Check_Discipline4Level5 = discipline4.col5, - Check_Discipline5Level1 = discipline5.col1, - Check_Discipline5Level2 = discipline5.col2, - Check_Discipline5Level3 = discipline5.col3, - Check_Discipline5Level4 = discipline5.col4, - Check_Discipline5Level5 = discipline5.col5, - BehaviorOtherDesc = evaluate.behavior_other_desc, - Check_BehaviorOtherLevel1 = behavior.col1, - Check_BehaviorOtherLevel2 = behavior.col2, - Check_BehaviorOtherLevel3 = behavior.col3, - Check_BehaviorOtherLevel4 = behavior.col4, - Check_BehaviorOtherLevel5 = behavior.col5, - achievement_score = evaluate.achievement_score, - achievement_score_total = evaluate.achievement_score_total, - achievement_percent = evaluate.achievement_percent, - achievement_result = evaluate.achievement_result, - behavior_score = evaluate.behavior_score, - behavior_score_total = evaluate.behavior_score_total, - behavior_percent = evaluate.behavior_percent, - behavior_result = evaluate.behavior_result, - sum_score = evaluate.sum_score, - sum_percent = evaluate.sum_percent, - develop_orientation_score = evaluate.develop_orientation_score, - develop_self_learning_score = evaluate.develop_self_learning_score, - develop_training_seminar_score = evaluate.develop_training_seminar_score, - develop_other_training_score = evaluate.develop_other_training_score, - develop_total_score = evaluate.develop_total_score, - develop_orientation_percent = evaluate.develop_orientation_percent, - develop_self_learning_percent = evaluate.develop_self_learning_percent, - develop_training_seminar_percent = evaluate.develop_training_seminar_percent, - develop_other_training_percent = evaluate.develop_other_training_percent, - develop_total_percent = evaluate.develop_total_percent, - develop_result = evaluate.develop_result, - evaluate_result = evaluate.evaluate_result, - - }); - var tblEvaluateAssign1 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table2"]; - tblEvaluateAssign1.DataSource = _Evaluate; - var tblEvaluateAssign2 = (Telerik.Reporting.Table)report.Items["detailSection1"].Items["table1"]; - tblEvaluateAssign2.DataSource = _Evaluate; - var tblEvaluateAssign3 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table2"]; - tblEvaluateAssign3.DataSource = _Evaluate; - var tblEvaluateAssign4 = (Telerik.Reporting.Table)report2.Items["detailSection1"].Items["table3"]; - tblEvaluateAssign4.DataSource = _Evaluate; - report2.DataSource = _Evaluate; - 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, + template = "probation-17", + reportName = "docx-report", + data = evaluateAssign }; - - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); - var content = result.DocumentBytes; - return File(content, mimeType, $"แบบประเมินผล(สำหรับคณะกรรมการ).{exportType.Trim().ToLower()}"); + return Success(data); } else { @@ -967,9 +1054,9 @@ namespace BMA.EHR.Report.Service.Controllers } #endregion - #region 18,19-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา + #region 18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา /// - /// 19-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา + /// 18-แบบรายงานการประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับประธาน และ กรณีขยายเวลา /// /// assign id แบบมอบหมายงานการทดลองปฏิบัติหน้าที่ราชการ /// pdf, docx หรือ xlsx @@ -977,7 +1064,7 @@ namespace BMA.EHR.Report.Service.Controllers /// เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ /// ไม่ได้ Login เข้าระบบ /// เมื่อเกิดข้อผิดพลาดในการทำงาน - [HttpGet("19/{exportType}/{id}")] + [HttpGet("18/{exportType}/{id}")] public async Task> GetProbation19ConvertReportAsync(Guid id, string exportType = "pdf") { try @@ -999,51 +1086,59 @@ 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 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? report1 = null; - Telerik.Reporting.Report? report2 = null; - using (var sourceStream1 = System.IO.File.OpenRead(rptFile1)) - using (var sourceStream2 = System.IO.File.OpenRead(rptFile2)) + //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? report1 = null; + //Telerik.Reporting.Report? report2 = null; + //using (var sourceStream1 = System.IO.File.OpenRead(rptFile1)) + //using (var sourceStream2 = System.IO.File.OpenRead(rptFile2)) + //{ + // report1 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream1); + // report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); + //} + ////สำหรับประธาน + //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); + //report2.ReportParameters["CommanderName"].Value = evaluateAssign.GetType().GetProperty("CommanderName").GetValue(evaluateAssign); + //report2.ReportParameters["CommanderPosition"].Value = evaluateAssign.GetType().GetProperty("CommanderPosition").GetValue(evaluateAssign); + //report2.ReportParameters["CommanderDate"].Value = evaluateAssign.GetType().GetProperty("CommanderDate").GetValue(evaluateAssign); + //System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); + //InstanceReportSource instanceReportSource = new InstanceReportSource() + //{ + // ReportDocument = report2, + //}; + //ReportProcessor reportProcessor = new ReportProcessor(_configuration); + //RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); + //return File(result.DocumentBytes, mimeType, $"แบบรายงานการประเมินผล.{exportType.Trim().ToLower()}"); + var ExpandMonth = evaluateAssign.GetType().GetProperty("ExpandMonth").GetValue(evaluateAssign).ToString(); + var data = new { - report1 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream1); - report2 = (Telerik.Reporting.Report)reportPacker.UnpackageDocument(sourceStream2); - } - //สำหรับประธาน - 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); - report2.ReportParameters["CommanderName"].Value = evaluateAssign.GetType().GetProperty("CommanderName").GetValue(evaluateAssign); - report2.ReportParameters["CommanderPosition"].Value = evaluateAssign.GetType().GetProperty("CommanderPosition").GetValue(evaluateAssign); - report2.ReportParameters["CommanderDate"].Value = evaluateAssign.GetType().GetProperty("CommanderDate").GetValue(evaluateAssign); - System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable(); - InstanceReportSource instanceReportSource = new InstanceReportSource() - { - ReportDocument = report2, + template = ExpandMonth == "๐" ? "probation-18-1" : "probation-18-2", + reportName = "docx-report", + data = evaluateAssign }; - ReportProcessor reportProcessor = new ReportProcessor(_configuration); - RenderingResult result = reportProcessor.RenderReport($"{exportType}", instanceReportSource, deviceInfo); - return File(result.DocumentBytes, mimeType, $"แบบรายงานการประเมินผล.{exportType.Trim().ToLower()}"); + return Success(data); } else {