Merge branch 'develop' into working
This commit is contained in:
commit
adac4d0e53
7 changed files with 147 additions and 22 deletions
|
|
@ -5364,7 +5364,9 @@ namespace BMA.EHR.Application.Repositories
|
|||
}
|
||||
foreach (var r in type_coin)
|
||||
{
|
||||
result_candidate.Add(r);
|
||||
var old = result_candidate.FirstOrDefault(x => x.ProfileId == r.ProfileId);
|
||||
if (old == null)
|
||||
result_candidate.Add(r);
|
||||
}
|
||||
|
||||
return result_candidate.OrderBy(x => x.Seq).ThenBy(x => x.Gender).ThenBy(x => x.ProfileId).ToList();
|
||||
|
|
@ -5652,6 +5654,8 @@ namespace BMA.EHR.Application.Repositories
|
|||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Position)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionEmployeePosition)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PosNo)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.PositionLevel)
|
||||
|
|
@ -5674,9 +5678,9 @@ namespace BMA.EHR.Application.Repositories
|
|||
ProfileId = h.Profile.Id,
|
||||
ProfileType = h.Profile.ProfileType,
|
||||
FullName = $"{h.Profile.Prefix?.Name}{h.Profile.FirstName} {h.Profile.LastName}",
|
||||
Position = h.Profile.Position.Name,
|
||||
PosNo = h.Profile.PosNo.Id,
|
||||
Rank = $"{h.Profile.PositionType.Name}/{h.Profile.PositionLevel.Name}",
|
||||
Position = h.Profile.ProfileType == " officer" ? h.Profile.Position?.Name : h.Profile.PositionEmployeePosition?.Name,
|
||||
PosNo = h.Profile.ProfileType == " officer" ? h.Profile.PosNo?.Name : h.Profile.PosNoEmployee,
|
||||
Rank = h.Profile.ProfileType == " officer" ? $"{h.Profile.PositionType?.Name}/{h.Profile.PositionLevel?.Name}" : $"-",
|
||||
Salary = h.Salary.ToString(),
|
||||
LastInsignia = h.Profile.Insignias.Count == 0 ? "" : h.Profile.Insignias.OrderByDescending(x => x.Year).FirstOrDefault().Insignia.Name,
|
||||
RequestInsignia = h.RequestInsignia.Name,
|
||||
|
|
|
|||
|
|
@ -477,6 +477,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
Male = 0,
|
||||
Female = 0,
|
||||
InsigniaId = ins.InsigniaId,
|
||||
// OCName = ""
|
||||
OCName = tmpOC,
|
||||
SumMale = sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName) == null ? 0 : sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName)!.SumMale,
|
||||
SumFemale = sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName) == null ? 0 : sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName)!.SumFemale,
|
||||
|
|
@ -484,8 +485,120 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
ret.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
public async Task<dynamic> GetKhr3ReportV2(Guid id)
|
||||
{
|
||||
var period = await _dbContext.Set<InsigniaPeriod>()
|
||||
.FirstOrDefaultAsync(x => x.Id == id);
|
||||
if (period == null)
|
||||
throw new Exception(GlobalMessages.InsigniaPeriodNotFound);
|
||||
|
||||
var data = (from r in await _dbContext.Set<InsigniaRequestProfile>()
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Gender)
|
||||
.Include(x => x.Profile)
|
||||
.ThenInclude(x => x.Prefix)
|
||||
.Include(x => x.Request)
|
||||
.ThenInclude(x => x.Period)
|
||||
.Include(x => x.Request)
|
||||
.ThenInclude(x => x.Organization)
|
||||
.Include(x => x.RequestInsignia)
|
||||
.ThenInclude(x => x.InsigniaType)
|
||||
.ToListAsync()
|
||||
where r.Request.Period == period
|
||||
&& r.IsApprove == true
|
||||
&& r.RequestInsignia.InsigniaType != null
|
||||
&& r.RequestInsignia.InsigniaType.Name != "เหรียญบำเหน็จในราชการ"
|
||||
select new
|
||||
{
|
||||
InsigniaInitial = r.RequestInsignia.ShortName,
|
||||
InsigniaName = r.RequestInsignia.Name,
|
||||
ProfileId = r.Profile.Id,
|
||||
FullName = $"{r.Profile.Prefix?.Name}{r.Profile.FirstName} {r.Profile.LastName}",
|
||||
Gender = r.Profile.Gender == null ? null : r.Profile.Gender.Name,
|
||||
Male = r.Profile.Gender == null ? 0 : (r.Profile.Gender.Name == "ชาย" ? 1 : 0),
|
||||
Female = r.Profile.Gender == null ? 0 : (r.Profile.Gender.Name == "หญิง" ? 1 : 0),
|
||||
InsigniaId = r.RequestInsignia.Id,
|
||||
OCName = _organizationCommonRepository.GetOrganizationNameFullPath(r.Request.Organization.Id, false, false)
|
||||
})
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
// loop to add temp row with 50 rows per page
|
||||
var insigniaList = data.Select(x => new { InsigniaId = x.InsigniaId, InsigniaInitial = x.InsigniaInitial, InsigniaName = x.InsigniaName })
|
||||
.Distinct().ToList();
|
||||
|
||||
// var tmpOC = data.First().OCName;
|
||||
|
||||
// var sumData = (from x in data
|
||||
// group x by x.InsigniaName into grp
|
||||
// select new
|
||||
// {
|
||||
// InsigniaName = grp.Key,
|
||||
// SumMale = grp.Sum(x => x.Male),
|
||||
// SumFemale = grp.Sum(x => x.Female)
|
||||
// }).ToList();
|
||||
|
||||
// var ret = new List<dynamic>();
|
||||
|
||||
// foreach (var item in data)
|
||||
// {
|
||||
// var p = new
|
||||
// {
|
||||
// InsigniaInitial = item.InsigniaInitial,
|
||||
// InsigniaName = item.InsigniaName,
|
||||
// ProfileId = item.ProfileId,
|
||||
// FullName = item.FullName,
|
||||
// Gender = item.Gender,
|
||||
// Male = item.Male,
|
||||
// Female = item.Female,
|
||||
// InsigniaId = item.InsigniaId,
|
||||
// OCName = item.OCName,
|
||||
// SumMale = sumData.FirstOrDefault(x => x.InsigniaName == item.InsigniaName) == null ? 0 : sumData.FirstOrDefault(x => x.InsigniaName == item.InsigniaName)!.SumMale,
|
||||
// SumFemale = sumData.FirstOrDefault(x => x.InsigniaName == item.InsigniaName) == null ? 0 : sumData.FirstOrDefault(x => x.InsigniaName == item.InsigniaName)!.SumFemale,
|
||||
// };
|
||||
// ret.Add(p);
|
||||
// }
|
||||
|
||||
foreach (var ins in insigniaList)
|
||||
{
|
||||
var count = data.Where(x => x.InsigniaId == ins.InsigniaId).Count();
|
||||
var mod_val = count <= 50 ? 50 - count : count % 50.0;
|
||||
for (int i = 0; i < mod_val; i++)
|
||||
{
|
||||
var p = new
|
||||
{
|
||||
InsigniaInitial = ins.InsigniaInitial,
|
||||
InsigniaName = ins.InsigniaName,
|
||||
ProfileId = Guid.Parse("00000000-0000-0000-0000-000000000000"),
|
||||
FullName = "",
|
||||
Gender = "",
|
||||
Male = 0,
|
||||
Female = 0,
|
||||
InsigniaId = ins.InsigniaId,
|
||||
OCName = ""
|
||||
// OCName = tmpOC,
|
||||
// SumMale = sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName) == null ? 0 : sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName)!.SumMale,
|
||||
// SumFemale = sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName) == null ? 0 : sumData.FirstOrDefault(x => x.InsigniaName == ins.InsigniaName)!.SumFemale,
|
||||
};
|
||||
data.Add(p);
|
||||
}
|
||||
}
|
||||
|
||||
var sumData = (from x in data
|
||||
group x by x.InsigniaName into grp
|
||||
select new
|
||||
{
|
||||
InsigniaName = grp.Key,
|
||||
SumMale = grp.Sum(x => x.Male),
|
||||
SumFemale = grp.Sum(x => x.Female),
|
||||
Data = grp.ToList(),
|
||||
}).ToList();
|
||||
|
||||
return sumData;
|
||||
}
|
||||
|
||||
//42-แบบ ขร4 บัญชีแสดงคุณสมบัติของข้าราชการซึ่งเสนอขอเครื่องราชฯ
|
||||
public async Task<dynamic> GetKhr4Report(Guid id)
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Microsoft.EntityFrameworkCore;
|
|||
using System.Net.Http.Headers;
|
||||
using Newtonsoft.Json;
|
||||
using System.Globalization;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BMA.EHR.Application.Repositories.Reports
|
||||
{
|
||||
|
|
@ -18,6 +19,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
private readonly IApplicationDBContext _dbContext;
|
||||
private readonly IWebHostEnvironment _hostingEnvironment;
|
||||
private readonly NotificationRepository _repositoryNoti;
|
||||
private readonly IConfiguration _configuration;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -25,11 +27,13 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
|
||||
public ProbationReportRepository(IApplicationDBContext dbContext,
|
||||
NotificationRepository repositoryNoti,
|
||||
IWebHostEnvironment hostEnvironment)
|
||||
IWebHostEnvironment hostEnvironment,
|
||||
IConfiguration configuration)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
_hostingEnvironment = hostEnvironment;
|
||||
_repositoryNoti = repositoryNoti;
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
@ -39,7 +43,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region แบบมอบหมายงาน ฯ
|
||||
public async Task<object> GetProbationAssignAsync(Guid assign_id, string token)
|
||||
{
|
||||
var api_url = $"https://bma-ehr.frappet.synology.me/api/v1/probation/assign/probation-assign?assign_id={assign_id}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}assign/probation-assign?assign_id={assign_id}";
|
||||
ProbationAssignResponse probation_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -63,9 +67,9 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
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 = string.IsNullOrEmpty(probation_assign.data.mentors[1].name) ? string.Empty : probation_assign.data.mentors[1].name,
|
||||
DateMentor2 = string.IsNullOrEmpty(probation_assign.data.mentors[1].dated.ToString()) ? "วันที่ เดือน พ.ศ." : probation_assign.data.mentors[1].dated.ToThaiFullDate().ToString().ToThaiNumber(),
|
||||
PositionMentor2 = string.IsNullOrEmpty(probation_assign.data.mentors[1].Position) ? string.Empty : probation_assign.data.mentors[1].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,
|
||||
|
|
@ -90,7 +94,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region แบบบันทึกผล (ผู้ดูแล, ผู้บังคับบัญชา)
|
||||
public async Task<object> GetEvaluateRecordAsync(Guid assign_id, string token)
|
||||
{
|
||||
var api_url = $"https://bma-ehr.frappet.synology.me/api/v1/probation/report/form-record?id={assign_id}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}report/form-record?id={assign_id}";
|
||||
EvaluateRecordAssignResponse evaluate_record;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -138,7 +142,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region แบบประเมินผล(ผู้บังคับบัญชา)
|
||||
public async Task<object> GetEvaluateAssignAsync(Guid id, string token)
|
||||
{
|
||||
var api_url = $"https://bma-ehr.frappet.synology.me/api/v1/probation/report/evaluate-commander?id={id}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}report/evaluate-commander?id={id}";
|
||||
EvaluateAssignResponse evaluate_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -186,7 +190,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region แบบประเมินผล(คณะกรรมการ)
|
||||
public async Task<object> GetEvaluateChairmanAssignAsync(Guid id, string token)
|
||||
{
|
||||
var api_url = $"https://bma-ehr.frappet.synology.me/api/v1/probation/report/evaluate-chairman?id={id}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}report/evaluate-chairman?id={id}";
|
||||
EvaluateChairmanAssignResponse evaluate_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -234,7 +238,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
#region แบบรายงานการประเมินผล
|
||||
public async Task<object> GetEvaluateResultAssignAsync(Guid id, string token)
|
||||
{
|
||||
var api_url = $"https://bma-ehr.frappet.synology.me/api/v1/probation/evaluate-result?assign_id={id}";
|
||||
var api_url = $"{_configuration["APIPROBATION"]}evaluate-result?assign_id={id}";
|
||||
EvaluateResultAssignResponse evaluate_assign;
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
|
|
@ -260,7 +264,7 @@ namespace BMA.EHR.Application.Repositories.Reports
|
|||
PassResult = evaluate_assign.data.evaluate.pass_result.ToString() == "1" ? "/" : " ",
|
||||
NotPassResult = evaluate_assign.data.evaluate.pass_result.ToString() == "0" ? "/" : " ",
|
||||
ExpandMonth = string.IsNullOrEmpty(evaluate_assign.data.evaluate.expand_month.ToString()) ? string.Empty : evaluate_assign.data.evaluate.expand_month.ToString().ToThaiNumber(),
|
||||
ChairmanName = string.IsNullOrEmpty(evaluate_assign.data.chairman.name) ? string.Empty : evaluate_assign.data.chairman.name,
|
||||
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(),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
public Guid ProfileId { get; set; }
|
||||
public string FullName { get; set; }
|
||||
public string Position { get; set; }
|
||||
public Guid PosNo { get; set; }
|
||||
public string PosNo { get; set; }
|
||||
public string Rank { get; set; }
|
||||
public string Salary { get; set; }
|
||||
public string LastInsignia { get; set; }
|
||||
|
|
|
|||
|
|
@ -112,10 +112,10 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
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["NameMentor2"].Value = probation.GetType().GetProperty("NameMentor2").GetValue(probation);
|
||||
report.ReportParameters["DateMentor1"].Value = probation.GetType().GetProperty("DateMentor1").GetValue(probation);
|
||||
report.ReportParameters["DateMentor2"].Value = probation.GetType().GetProperty("DateMentor2").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);
|
||||
report.ReportParameters["OtherDesc"].Value = probation.GetType().GetProperty("OtherDesc").GetValue(probation);
|
||||
report2.ReportParameters["Other4Desc"].Value = probation.GetType().GetProperty("Other4Desc").GetValue(probation);
|
||||
|
|
@ -130,6 +130,9 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
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);
|
||||
|
||||
report.ReportParameters["Behave"].Value =
|
||||
"ความประพฤติ\n" +
|
||||
|
|
@ -241,7 +244,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
/// <summary>
|
||||
/// 14-แบบบันทึกผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้ดูแล และ ผู้บังคับบัญชา
|
||||
/// </summary>
|
||||
/// <param name="id">id </param>
|
||||
/// <param name="id">evaluate id</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
|
|
@ -673,7 +676,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
/// <summary>
|
||||
/// 16-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับผู้บังคับบัญชา
|
||||
/// </summary>
|
||||
/// <param name="id">id</param>
|
||||
/// <param name="id">evaluate id</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
|
|
@ -895,7 +898,7 @@ namespace BMA.EHR.Report.Service.Controllers
|
|||
/// <summary>
|
||||
/// 17-แบบประเมินผลการทดลองปฏิบัติหน้าที่ราชการ สำหรับคณะกรรมการ
|
||||
/// </summary>
|
||||
/// <param name="id">id</param>
|
||||
/// <param name="id">evaluate id</param>
|
||||
/// <param name="exportType">pdf, docx หรือ xlsx</param>
|
||||
/// <returns></returns>
|
||||
/// <response code="200">เมื่อทำการอ่านข้อมูลจาก Relational Database สำเร็จ</response>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -45,7 +45,7 @@
|
|||
},
|
||||
{
|
||||
"fontFamily": "TH SarabunPSK",
|
||||
"path": "Fonts/THSarabunNew.ttf",
|
||||
"path": "Fonts/THSarabunNew.ttf"
|
||||
|
||||
},
|
||||
{
|
||||
|
|
@ -54,5 +54,6 @@
|
|||
"fontStyle": "Bold"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"APIPROBATION": "https://bma-ehr.frappet.synology.me/api/v1/probation/"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue