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

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

@ -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