แก้ ออก คำ สั่ง

This commit is contained in:
kittapath 2024-10-03 18:34:13 +07:00
parent e862829246
commit 604b234c4b
15 changed files with 897 additions and 845 deletions

View file

@ -6797,11 +6797,7 @@ namespace BMA.EHR.Command.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
foreach (var placementProfile in placementProfiles)
{
// update placementstatus
placementProfile.Status = "REPORT";
}
placementProfiles.ForEach(profile => profile.Status = "REPORT");
await _context.SaveChangesAsync();
return Success();
}
@ -6873,11 +6869,7 @@ namespace BMA.EHR.Command.Service.Controllers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.ToListAsync();
foreach (var placementProfile in placementProfiles)
{
// update placementstatus
placementProfile.Status = "REPORT";
}
placementProfiles.ForEach(profile => profile.Status = "REPORT");
await _context.SaveChangesAsync();
return Success();
}
@ -7120,21 +7112,13 @@ namespace BMA.EHR.Command.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportCommand25Attachment([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand25Attachment([FromBody] ReportAttachmentRequest req)
{
try
{
var raw_data = await _context.Set<CommandReceiver>()
.Include(c => c.Command)
.Where(c => req_.refIds.Contains(c.Id.ToString()))
.ToListAsync();
if (raw_data == null)
foreach (var d in req.refIds)
{
throw new Exception(GlobalMessages.CommandNotFound);
}
foreach (var d in raw_data)
{
var apiUrl = $"{_configuration["API"]}/discipline/result/report/find/{d.RefDisciplineId}/{d.RefPlacementProfileId}";
var apiUrl = $"{_configuration["API"]}/discipline/result/report/find/{d.refId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
@ -7148,7 +7132,7 @@ namespace BMA.EHR.Command.Service.Controllers
continue;
var receiver = new CommandType23Response
{
fullName = $"{org.result.prefix}{org.result.firstName} {org.result.lastName}",
fullName = $"{d.Prefix}{d.FirstName} {d.LastName}",
positionname = org.result.position,
positionno = org.result.posNo == null ? null : org.result.posNo.ToThaiNumber(),
organizationname = org.result.organization,
@ -7164,7 +7148,7 @@ namespace BMA.EHR.Command.Service.Controllers
{
throw;
}
}
}
/// <summary>
/// ออกคำสั่ง C-PM-25
@ -8115,48 +8099,47 @@ namespace BMA.EHR.Command.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command33/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand33([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand33([FromBody] ReportPersonRequest req)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
foreach (var id in req_.refIds)
{
var apiUrl = $"{baseAPI}/salary/report/command/33/{id}";
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/33/{id}";
var response = new PassSalaryResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
// var response = new PassSalaryResponse();
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var res = await client.SendAsync(_req);
// // var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
// // response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = d.citizenId,
Prefix = d.prefix == null ? "" : d.prefix,
FirstName = d.firstName,
LastName = d.lastName,
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
RefDisciplineId = d.id,
};
seq++;
// // var seq = 1;
// // foreach (var d in response!.result)
// // {
// // var receiver = new CommandReceiver
// // {
// // Sequence = seq,
// // CitizenId = d.citizenId,
// // Prefix = d.prefix == null ? "" : d.prefix,
// // FirstName = d.firstName,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
resultData.Add(receiver);
}
}
}
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
@ -8204,47 +8187,47 @@ namespace BMA.EHR.Command.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command34/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand34([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand34([FromBody] ReportPersonRequest req)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
foreach (var id in req_.refIds)
{
var apiUrl = $"{baseAPI}/salary/report/command/34/{id}";
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/34/{id}";
var response = new PassSalaryResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
// var response = new PassSalaryResponse();
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var res = await client.SendAsync(_req);
// // var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
// // response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = d.citizenId,
Prefix = d.prefix == null ? "" : d.prefix,
FirstName = d.firstName,
LastName = d.lastName,
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
RefDisciplineId = d.id,
};
seq++;
// // var seq = 1;
// // foreach (var d in response!.result)
// // {
// // var receiver = new CommandReceiver
// // {
// // Sequence = seq,
// // CitizenId = d.citizenId,
// // Prefix = d.prefix == null ? "" : d.prefix,
// // FirstName = d.firstName,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
resultData.Add(receiver);
}
}
}
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
@ -8292,47 +8275,47 @@ namespace BMA.EHR.Command.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command35/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand35([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand35([FromBody] ReportPersonRequest req)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
foreach (var id in req_.refIds)
{
var apiUrl = $"{baseAPI}/salary/report/command/35/{id}";
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/35/{id}";
var response = new PassSalaryResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
// var response = new PassSalaryResponse();
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var res = await client.SendAsync(_req);
// // var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
// // response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = d.citizenId,
Prefix = d.prefix == null ? "" : d.prefix,
FirstName = d.firstName,
LastName = d.lastName,
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
RefDisciplineId = d.id,
};
seq++;
// // var seq = 1;
// // foreach (var d in response!.result)
// // {
// // var receiver = new CommandReceiver
// // {
// // Sequence = seq,
// // CitizenId = d.citizenId,
// // Prefix = d.prefix == null ? "" : d.prefix,
// // FirstName = d.firstName,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
resultData.Add(receiver);
}
}
}
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
@ -8380,47 +8363,47 @@ namespace BMA.EHR.Command.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command36/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand36([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand36([FromBody] ReportPersonRequest req)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
foreach (var id in req_.refIds)
{
var apiUrl = $"{baseAPI}/salary/report/command/36/{id}";
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/36/{id}";
var response = new PassSalaryResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
// var response = new PassSalaryResponse();
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var res = await client.SendAsync(_req);
// // var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
// // response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = d.citizenId,
Prefix = d.prefix == null ? "" : d.prefix,
FirstName = d.firstName,
LastName = d.lastName,
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
RefDisciplineId = d.id,
};
seq++;
// // var seq = 1;
// // foreach (var d in response!.result)
// // {
// // var receiver = new CommandReceiver
// // {
// // Sequence = seq,
// // CitizenId = d.citizenId,
// // Prefix = d.prefix == null ? "" : d.prefix,
// // FirstName = d.firstName,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
resultData.Add(receiver);
}
}
}
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
@ -8468,47 +8451,47 @@ namespace BMA.EHR.Command.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command37/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand37([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand37([FromBody] ReportPersonRequest req)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
foreach (var id in req_.refIds)
{
var apiUrl = $"{baseAPI}/salary/report/command/37/{id}";
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/37/{id}";
var response = new PassSalaryResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
// var response = new PassSalaryResponse();
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var res = await client.SendAsync(_req);
// // var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
// // response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = d.citizenId,
Prefix = d.prefix == null ? "" : d.prefix,
FirstName = d.firstName,
LastName = d.lastName,
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
RefDisciplineId = d.id,
};
seq++;
// // var seq = 1;
// // foreach (var d in response!.result)
// // {
// // var receiver = new CommandReceiver
// // {
// // Sequence = seq,
// // CitizenId = d.citizenId,
// // Prefix = d.prefix == null ? "" : d.prefix,
// // FirstName = d.firstName,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
resultData.Add(receiver);
}
}
}
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
@ -8555,47 +8538,47 @@ namespace BMA.EHR.Command.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command38/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand38([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand38([FromBody] ReportPersonRequest req)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
foreach (var id in req_.refIds)
{
var apiUrl = $"{baseAPI}/salary/report/command/38/{id}";
// foreach (var id in req.refIds)
// {
// var apiUrl = $"{baseAPI}/salary/report/command/38/{id}";
var response = new PassSalaryResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
// var response = new PassSalaryResponse();
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var res = await client.SendAsync(_req);
// // var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
// // response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = d.citizenId,
Prefix = d.prefix == null ? "" : d.prefix,
FirstName = d.firstName,
LastName = d.lastName,
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
RefDisciplineId = d.id,
};
seq++;
// // var seq = 1;
// // foreach (var d in response!.result)
// // {
// // var receiver = new CommandReceiver
// // {
// // Sequence = seq,
// // CitizenId = d.citizenId,
// // Prefix = d.prefix == null ? "" : d.prefix,
// // FirstName = d.firstName,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
resultData.Add(receiver);
}
}
}
// // resultData.Add(receiver);
// // }
// }
// }
return Success();
}
catch
@ -8627,43 +8610,43 @@ namespace BMA.EHR.Command.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpPost("command40/report")]
public async Task<ActionResult<ResponseObject>> PostReportCommand40([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand40([FromBody] ReportPersonRequest req)
{
try
{
var resultData = new List<CommandReceiver>();
var baseAPI = _configuration["API"];
var apiUrl = $"{baseAPI}/org/pos/act/profile";
// var resultData = new List<CommandReceiver>();
// var baseAPI = _configuration["API"];
// var apiUrl = $"{baseAPI}/org/pos/act/profile";
var response = new PassSalaryResponse();
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
var req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
var res = await client.SendAsync(req);
var result = await res.Content.ReadAsStringAsync();
// var response = new PassSalaryResponse();
// using (var client = new HttpClient())
// {
// client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
// client.DefaultRequestHeaders.Add("api_key", _configuration["API_KEY"]);
// var _req = new HttpRequestMessage(HttpMethod.Get, apiUrl);
// var res = await client.SendAsync(_req);
// // var result = await res.Content.ReadAsStringAsync();
response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
// // response = JsonConvert.DeserializeObject<PassSalaryResponse>(result);
var seq = 1;
foreach (var d in response!.result)
{
var receiver = new CommandReceiver
{
Sequence = seq,
CitizenId = d.citizenId,
Prefix = d.prefix == null ? "" : d.prefix,
FirstName = d.firstName,
LastName = d.lastName,
RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
RefDisciplineId = d.id,
};
seq++;
// // var seq = 1;
// // foreach (var d in response!.result)
// // {
// // var receiver = new CommandReceiver
// // {
// // Sequence = seq,
// // CitizenId = d.citizenId,
// // Prefix = d.prefix == null ? "" : d.prefix,
// // FirstName = d.firstName,
// // LastName = d.lastName,
// // RefPlacementProfileId = d.profileId == null ? null : Guid.Parse(d.profileId),
// // RefDisciplineId = d.id,
// // };
// // seq++;
resultData.Add(receiver);
}
}
// // resultData.Add(receiver);
// // }
// }
return Success();
}
catch
@ -8686,23 +8669,15 @@ namespace BMA.EHR.Command.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportCommand40Attachment([FromBody] ReportPersonRequest req_)
public async Task<ActionResult<ResponseObject>> PostReportCommand40Attachment([FromBody] ReportAttachmentRequest req)
{
try
{
var raw_data = await _context.Set<CommandReceiver>()
.Include(c => c.Command)
.Where(c => req_.refIds.Contains(c.Id.ToString()))
.ToListAsync();
if (raw_data == null)
{
throw new Exception(GlobalMessages.CommandNotFound);
}
var data = new List<CommandType40Response>();
var no = 1;
foreach (var d in raw_data)
foreach (var d in req.refIds)
{
var apiUrl = $"{_configuration["API"]}/org/pos/act/{d.RefDisciplineId}/{d.RefPlacementProfileId}";
var apiUrl = $"{_configuration["API"]}/org/pos/act/{d.refId}";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.Replace("Bearer ", ""));
@ -8723,8 +8698,10 @@ namespace BMA.EHR.Command.Service.Controllers
postype = org.result.postype,
poslevel = org.result.poslevel,
organizationNew = org.result.organizationNew,
dateStart = d.Command.ActStartDate == null ? "-" : d.Command.ActStartDate.Value.ToThaiFullDate3().ToThaiNumber(),
dateEnd = d.Command.ActEndDate == null ? "-" : d.Command.ActEndDate.Value.ToThaiFullDate3().ToThaiNumber(),
// dateStart = d.Command.ActStartDate == null ? "-" : d.Command.ActStartDate.Value.ToThaiFullDate3().ToThaiNumber(),
// dateEnd = d.Command.ActEndDate == null ? "-" : d.Command.ActEndDate.Value.ToThaiFullDate3().ToThaiNumber(),
dateStart = "xxx",
dateEnd = "xxx",
order = org.result.order,
};
no = no + 1;

View file

@ -0,0 +1,26 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Command.Service.Requests
{
public class ReportAttachmentRequest
{
public ReportAttachmentRequestObj[] refIds { get; set; }
}
public class ReportAttachmentRequestObj
{
public string? refId { get; set; }
public int? Sequence { get; set; }
public string? CitizenId { get; set; }
public string? Prefix { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public double? Amount { get; set; }
public double? PositionSalaryAmount { get; set; }
public double? MouthSalaryAmount { get; set; }
public string? RemarkHorizontal { get; set; }
public string? RemarkVertical { get; set; }
public int CommandYear { get; set; }
}
}

View file

@ -708,30 +708,26 @@ namespace BMA.EHR.DisciplineResult.Service.Controllers
/// <response code="400">ค่าตัวแปรที่ส่งมาไม่ถูกต้อง</response>
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet("report/find/{periodId:guid}/{personId:guid}")]
public async Task<ActionResult<ResponseObject>> GetPersonReportFind(Guid periodId, Guid personId)
[HttpGet("report/find/{periodId:guid}")]
public async Task<ActionResult<ResponseObject>> GetPersonReportFind(Guid periodId)
{
var data1 = await _context.DisciplineComplaint_Profiles
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
if (data1 == null)
{
var data2 = await _context.DisciplineInvestigate_ProfileComplaints
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
if (data2 == null)
{
var data3 = await _context.DisciplineDisciplinary_ProfileComplaintInvestigates
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
if (data3 == null)
{
var data4 = await _context.DisciplineReport_Profiles
.Where(x => x.Id == periodId)
.Where(x => x.PersonId == personId.ToString())
.FirstOrDefaultAsync();
return Success(data4);
}

View file

@ -763,7 +763,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
/// <summary>
/// เอกสารแนบท้าย C-PM-5
/// เอกสารแนบท้าย C-PM-05
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
@ -776,45 +776,45 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementAppointments
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason
})
.ToListAsync();
var report_data = (from p in _context.PlacementAppointments
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -920,7 +920,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
/// <summary>
/// เอกสารแนบท้าย C-PM-6
/// เอกสารแนบท้าย C-PM-06
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
@ -933,45 +933,45 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReporSlipAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReporSlipAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementAppointments
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason
})
.ToListAsync();
var report_data = (from p in _context.PlacementAppointments
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -1077,7 +1077,7 @@ namespace BMA.EHR.Placement.Service.Controllers
}
/// <summary>
/// เอกสารแนบท้าย C-PM-7
/// เอกสารแนบท้าย C-PM-07
/// </summary>
/// <param name="id">Record Id ของคำสั่ง</param>
/// <param name="exportType">pdf, docx หรือ xlsx</param>
@ -1090,44 +1090,45 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReporMoveAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReporMoveAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementAppointments
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason
})
.ToListAsync();
var report_data = (from p in _context.PlacementAppointments
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -1244,39 +1245,41 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportEmployeeAppointAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportEmployeeAppointAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementAppointments
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.type == "EMPLOYEE")
.Select(p => new
{
//Seq = r.Sequence.ToString().ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
FullName = "",
Organization = p.rootOld,
OldOrganization = p.OrganizationOld,
OldPositionName = p.positionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld.ToThaiNumber(),
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName.ToThaiNumber(),
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
Reason = p.Reason == null ? "-" : p.Reason
})
.ToListAsync();
var report_data = (from p in _context.PlacementAppointments
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.Where(x => x.type == "EMPLOYEE")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Seq = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = p.rootOld,
OldOrganization = p.OrganizationOld,
OldPositionName = p.positionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld.ToThaiNumber(),
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName.ToThaiNumber(),
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -1391,40 +1394,41 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportEmployeeMoveAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportEmployeeMoveAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementAppointments
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.type == "EMPLOYEE")
.Select(p => new
{
//Seq = r.Sequence.ToString().ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
FullName = "",
Organization = p.OrganizationPositionOld,
OldOrganization = p.OrganizationOld,
OldPositionName = p.positionOld,
OldPositionLevel = p.PositionLevelOld,
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToListAsync();
var report_data = (from p in _context.PlacementAppointments
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.Where(x => x.type == "EMPLOYEE")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Seq = r.Sequence.ToString().ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = p.OrganizationPositionOld,
OldOrganization = p.OrganizationOld,
OldPositionName = p.positionOld,
OldPositionLevel = p.PositionLevelOld,
OldPositionNumber = p.PositionNumberOld == null ? null : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch

View file

@ -1498,44 +1498,44 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportRecruitAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportRecruitAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.Select(p => new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
PositionType = p.posTypeName == null ? "" : p.posTypeName,
PositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
Salary = p.Amount == null ? "0" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
RemarkHorizontal = p.RemarkHorizontal,
RemarkVertical = p.RemarkVertical,
})
.ToListAsync();
var report_data = (from p in _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
PositionType = p.posTypeName == null ? "" : p.posTypeName,
PositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
Salary = r.Amount == null ? "0" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -1771,44 +1771,44 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportCandidateAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportCandidateAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.Select(p => new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
PositionType = p.posTypeName == null ? "" : p.posTypeName,
PositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
Salary = p.Amount == null ? "0" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
RemarkHorizontal = p.RemarkHorizontal,
RemarkVertical = p.RemarkVertical,
})
.ToListAsync();
var report_data = (from p in _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name != "สอบแข่งขัน")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOINTED")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Oc = p.root == null ? "" : p.root,
PositionName = p.positionName == null ? "" : p.positionName,
PositionLevel = p.posLevelName == null ? "" : p.posLevelName,
PositionType = p.posTypeName == null ? "" : p.posTypeName,
PositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
Salary = r.Amount == null ? "0" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
ExamNumber = p.ExamNumber == null ? "0" : p.ExamNumber.Value.ToString().ToThaiNumber(),
PlacementName = $"{p.Placement.Name.ToThaiNumber()} ครั้งที่ {p.Placement.Round.ToThaiNumber()}/{p.Placement.Year.ToThaiYear().ToString().ToThaiNumber()}",
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -2043,55 +2043,55 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name == "แต่งตั้งข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOIN")
.Select(p => new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
Probation = "",
OldPositionName = p.positionNameOld == null ? "" : p.positionNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "" :
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
var report_data = (from p in _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name == "แต่งตั้งข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOIN")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
Probation = "",
OldPositionName = p.positionNameOld == null ? "" : p.positionNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "" :
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
RemarkHorizontal = p.RemarkHorizontal,
RemarkVertical = p.RemarkVertical
})
.ToListAsync();
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical
}).ToList();
return Success(report_data);
}
catch
@ -2212,51 +2212,53 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportMoveAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportMoveAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name == "แต่งตั้งข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOIN")
.Select(p => new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "":
p.PlacementEducations.FirstOrDefault().Degree,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.positionNameOld == null ? "" : p.positionNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "" :
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
})
.ToListAsync();
var report_data = (from p in _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name == "แต่งตั้งข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "APPOIN")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.positionNameOld == null ? "" : p.positionNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "" :
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -2377,51 +2379,53 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportSlipAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportSlipAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name == "เลื่อนข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "SLIP")
.Select(p => new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.positionNameOld == null ? "" : p.positionNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "" :
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = p.Amount == null ? "" : p.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber()
})
.ToListAsync();
var report_data = (from p in _context.PlacementProfiles
.Include(x => x.Placement)
.ThenInclude(x => x.PlacementType)
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.Where(x => x.Placement!.PlacementType!.Name == "เลื่อนข้าราชการ")
.Where(x => x.typeCommand.Trim().ToUpper() == "SLIP")
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.PlacementEducations == null || p.PlacementEducations.Count == 0 ? "" :
p.PlacementEducations.FirstOrDefault().Degree,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.positionNameOld == null ? "" : p.positionNameOld,
OldPositionLevel = p.posLevelNameOld == null ? "" : p.posLevelNameOld,
OldPositionType = p.posTypeNameOld == null ? "" : p.posTypeNameOld,
OldPositionNumber = p.posMasterNoOld == null ? "" :
p.nodeOld == "4" ? $"{p.child4ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "3" ? $"{p.child3ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "2" ? $"{p.child2ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "1" ? $"{p.child1ShortNameOld}{p.posMasterNoOld}".ToThaiNumber() :
p.nodeOld == "0" ? $"{p.rootShortNameOld}{p.posMasterNoOld}".ToThaiNumber() : "",
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.positionName == null ? "" : p.positionName,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch

View file

@ -109,6 +109,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Select(p => new
{
p.Id,
p.citizenId,
p.prefix,
p.firstName,
p.lastName,
@ -601,27 +602,29 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementOfficers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
PositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
Organization = p.Organization == null ? "" : p.Organization,
StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate2().ToThaiNumber(),
EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "" : p.Reason.ToThaiNumber()
})
.ToListAsync();
var report_data = (from p in _context.PlacementOfficers
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
Organization = p.Organization == null ? "" : p.Organization,
StartDate = p.DateStart == null ? "" : p.DateStart.Value.ToThaiShortDate2().ToThaiNumber(),
EndDate = p.DateEnd == null ? "" : p.DateEnd.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "" : p.Reason.ToThaiNumber(),
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch

View file

@ -913,43 +913,44 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementReceives
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.OrganizationPositionOld ?? "",
OldPositionName = p.OrganizationPositionOld ?? "",
OldPositionLevel = p.PositionLevelOld ?? "",
OldPositionType = p.PositionTypeOld ?? "",
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToListAsync();
var report_data = (from p in _context.PlacementReceives
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.OrganizationPositionOld ?? "",
OldPositionName = p.OrganizationPositionOld ?? "",
OldPositionLevel = p.PositionLevelOld ?? "",
OldPositionType = p.PositionTypeOld ?? "",
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewOc = p.root == null ? "" : p.root,
NewPositionName = p.position == null ? "" : p.position,
NewPositionLevel = p.posLevelName == null ? "" : p.posLevelName,
NewPositionType = p.posTypeName == null ? "" : p.posTypeName,
NewPositionNumber = p.posMasterNo == null ? "" :
p.node == 4 ? $"{p.child4ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 3 ? $"{p.child3ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 2 ? $"{p.child2ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 1 ? $"{p.child1ShortName}{p.posMasterNo}".ToThaiNumber() :
p.node == 0 ? $"{p.rootShortName}{p.posMasterNo}".ToThaiNumber() : "",
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.ReportingDate == null ? "" : p.ReportingDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch

View file

@ -110,6 +110,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,

View file

@ -198,6 +198,7 @@ namespace BMA.EHR.Placement.Service.Controllers
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
@ -791,32 +792,32 @@ namespace BMA.EHR.Placement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.PlacementTransfers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
PositionName = p.PositionOld == null ? "" : p.PositionOld,
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiShortDate2().ToThaiNumber(),
//ReceiveOrganizationName = r.Command!.ReceiveOrganizationName ?? "",
ReceiveOrganizationName = "",
Reason = p.Reason ?? ""
})
.ToListAsync();
var report_data = (from p in _context.PlacementTransfers
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
PositionName = p.PositionOld == null ? "" : p.PositionOld,
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
ActiveDate = p.Date == null ? "" : p.Date.Value.ToThaiShortDate2().ToThaiNumber(),
//ReceiveOrganizationName = r.Command!.ReceiveOrganizationName ?? "",
ReceiveOrganizationName = "",
Reason = p.Reason ?? ""
}).ToList();
return Success(report_data);
}
catch

View file

@ -9,16 +9,17 @@ namespace BMA.EHR.Placement.Service.Requests
}
public class ReportAttachmentRequestObj
{
public string? refId { get; set; }
public int? Sequence { get; set; }
public string? CitizenId { get; set; }
public string? Prefix { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public double? amount { get; set; }
public double? positionSalaryAmount { get; set; }
public double? mouthSalaryAmount { get; set; }
public double? Amount { get; set; }
public double? PositionSalaryAmount { get; set; }
public double? MouthSalaryAmount { get; set; }
public string? RemarkHorizontal { get; set; }
public string? RemarkVertical { get; set; }
public int CommandYear { get; set; }
}
}

View file

@ -118,6 +118,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,

View file

@ -109,6 +109,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
@ -658,40 +659,41 @@ namespace BMA.EHR.Retirement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportAppointAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.RetirementOthers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
//NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
NewSalary = "",
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToListAsync();
var report_data = (from p in _context.RetirementOthers
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -804,40 +806,42 @@ namespace BMA.EHR.Retirement.Service.Controllers
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportOutAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportOutAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.RetirementOthers
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
// NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
})
.ToListAsync();
var report_data = (from p in _context.RetirementOthers
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Education = p.EducationOld == null ? "-" : p.EducationOld,
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
OldOc = p.rootOld == null ? "" : p.rootOld,
OldPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
OldPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
OldPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
OldPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
OldSalary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
OldSalaryDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
NewOc = p.rootOld == null ? "" : p.rootOld,
NewPositionName = p.OrganizationPositionOld == null ? "" : p.OrganizationPositionOld,
NewPositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld,
NewPositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld,
NewPositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
NewSalary = r.Amount == null ? "" : r.Amount.Value.ToNumericNoDecimalText().ToThaiNumber(),
AppointDate = p.PositionDate == null ? "" : p.PositionDate.Value.ToThaiShortDate2().ToThaiNumber(),
LeaveDate = p.LeaveDate == null ? "" : p.LeaveDate.Value.ToThaiShortDate2().ToThaiNumber(),
MilitaryDate = p.MilitaryDate == null ? "" : p.MilitaryDate.Value.ToThaiShortDate2().ToThaiNumber(),
Reason = p.Reason == null ? "-" : p.Reason,
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch

View file

@ -108,6 +108,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,

View file

@ -182,6 +182,7 @@ namespace BMA.EHR.Retirement.Service.Controllers
.Select(p => new
{
p.Id,
p.citizenId,
p.profileId,
p.prefix,
p.firstName,
@ -1659,28 +1660,32 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.RetirementResigns
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.PositionOld ?? "",
Organization = p.OrganizationPositionOld ?? "",
PositionLevel = p.PositionLevelOld ?? "",
PositionType = p.PositionTypeOld ?? "",
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
Remark = p.Reason ?? "",
RemarkHorizontal = p.RemarkHorizontal,
})
.ToListAsync();
var report_data = (from p in _context.RetirementResigns
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.PositionOld ?? "",
Organization = p.OrganizationPositionOld ?? "",
PositionLevel = p.PositionLevelOld ?? "",
PositionType = p.PositionTypeOld ?? "",
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
Remark = p.Reason ?? "",
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -1793,31 +1798,32 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportEmployeeAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportEmployeeAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.RetirementResigns
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
Organization = p.OrganizationPositionOld ?? "",
PositionName = p.PositionOld ?? "",
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld.ToThaiNumber(),
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld.ToThaiNumber(),
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
RetireDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiFullDate3().ToThaiNumber(),
//CommandYear = r.Command.CommandYear.ToInteger().ToThaiYear().ToString().ToThaiNumber(),
CommandYear = ""
})
.ToListAsync();
var report_data = (from p in _context.RetirementResigns
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Organization = p.OrganizationPositionOld ?? "",
PositionName = p.PositionOld ?? "",
PositionLevel = p.PositionLevelOld == null ? "" : p.PositionLevelOld.ToThaiNumber(),
PositionType = p.PositionTypeOld == null ? "" : p.PositionTypeOld.ToThaiNumber(),
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
RetireDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiFullDate3().ToThaiNumber(),
CommandYear = r.CommandYear.ToThaiYear().ToString().ToThaiNumber(),
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch
@ -1904,31 +1910,32 @@ $"คำขอลาออกของ {updated.prefix}{updated.firstName} {upda
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
public async Task<ActionResult<ResponseObject>> PostReportLeaveCancelAttachment([FromBody] ReportPersonRequest req)
public async Task<ActionResult<ResponseObject>> PostReportLeaveCancelAttachment([FromBody] ReportAttachmentRequest req)
{
try
{
var report_data = await _context.RetirementResigns
.Where(x => req.refIds.Contains(x.Id.ToString()))
.Select(p => new
{
//Seq = r.Sequence.ToString().ToThaiNumber(),
//CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
//FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
Seq = "",
CitizenId = "",
FullName = "",
PositionName = p.PositionOld ?? "",
Organization = p.OrganizationPositionOld ?? "",
PositionLevel = p.PositionLevelOld ?? "",
PositionType = p.PositionTypeOld ?? "",
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
Remark = p.Reason ?? "",
RemarkHorizontal = p.RemarkHorizontal,
})
.ToListAsync();
var report_data = (from p in _context.RetirementResigns
.Where(x => req.refIds.Select(x => x.refId).Contains(x.Id.ToString()))
.ToList()
join r in req.refIds
on p.Id.ToString() equals r.refId
orderby r.Sequence
select new
{
Seq = r.Sequence.ToString().ToThaiNumber(),
CitizenId = r.CitizenId == null ? "-" : r.CitizenId.ToThaiNumber(),
FullName = $"{r.Prefix}{r.FirstName} {r.LastName}",
PositionName = p.PositionOld ?? "",
Organization = p.OrganizationPositionOld ?? "",
PositionLevel = p.PositionLevelOld ?? "",
PositionType = p.PositionTypeOld ?? "",
PositionNumber = p.PositionNumberOld == null ? "" : p.PositionNumberOld.ToThaiNumber(),
ActiveDate = p.ActiveDate == null ? "" : p.ActiveDate.Value.ToThaiShortDate2().ToThaiNumber(),
Salary = p.AmountOld == null ? "" : p.AmountOld.Value.ToNumericNoDecimalText().ToThaiNumber(),
Remark = p.Reason ?? "",
RemarkHorizontal = r.RemarkHorizontal,
RemarkVertical = r.RemarkVertical,
}).ToList();
return Success(report_data);
}
catch

View file

@ -0,0 +1,25 @@
using BMA.EHR.Domain.Models.MetaData;
using Microsoft.EntityFrameworkCore;
namespace BMA.EHR.Retirement.Service.Requests
{
public class ReportAttachmentRequest
{
public ReportAttachmentRequestObj[] refIds { get; set; }
}
public class ReportAttachmentRequestObj
{
public string? refId { get; set; }
public int? Sequence { get; set; }
public string? CitizenId { get; set; }
public string? Prefix { get; set; }
public string? FirstName { get; set; }
public string? LastName { get; set; }
public double? Amount { get; set; }
public double? PositionSalaryAmount { get; set; }
public double? MouthSalaryAmount { get; set; }
public string? RemarkHorizontal { get; set; }
public string? RemarkVertical { get; set; }
public int CommandYear { get; set; }
}
}