export payment
This commit is contained in:
parent
b7b2ea40d0
commit
9a71ab6b87
3 changed files with 105 additions and 0 deletions
|
|
@ -365,6 +365,32 @@ namespace BMA.EHR.Recurit.Exam.Service.Controllers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ข้อมูลเอกสารชำระเงิน
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="examId">รหัสรอบสมัคร</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <response code="200">เมื่อทำการอ่านข้อมูลชำระเงินสำเร็จ</response>
|
||||||
|
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
|
||||||
|
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
|
||||||
|
[HttpGet("payment/{examId:length(36)}")]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status500InternalServerError)]
|
||||||
|
public async Task<ActionResult<ResponseObject>> ExportsPaymentExamAsync(string examId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var items = await _periodExamService.ExportsPaymentExamAsync(examId);
|
||||||
|
|
||||||
|
return Success(items);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Error(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// /// <summary>
|
// /// <summary>
|
||||||
// /// รายชื่อผู้สมัครสอบรอ จัดการเลขที่นั่งสอบ
|
// /// รายชื่อผู้สมัครสอบรอ จัดการเลขที่นั่งสอบ
|
||||||
// /// </summary>
|
// /// </summary>
|
||||||
|
|
|
||||||
|
|
@ -70,5 +70,46 @@ namespace BMA.EHR.Recurit.Exam.Service.Extensions
|
||||||
}
|
}
|
||||||
return result.ToString();
|
return result.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string NumberToThaiText(this float number)
|
||||||
|
{
|
||||||
|
int baht = (int)number; // แยกส่วนบาท
|
||||||
|
int satang = (int)Math.Round((number - baht) * 100); // คำนวณสตางค์ (ปัดเป็นจำนวนเต็ม)
|
||||||
|
|
||||||
|
string bahtText = ConvertIntToThai(baht) + "บาท";
|
||||||
|
string satangText = satang > 0 ? ConvertIntToThai(satang) + "สตางค์" : "ถ้วน";
|
||||||
|
|
||||||
|
return bahtText + satangText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ConvertIntToThai(int number)
|
||||||
|
{
|
||||||
|
string[] unit = { "", "สิบ", "ร้อย", "พัน", "หมื่น", "แสน", "ล้าน" };
|
||||||
|
string[] digit = { "ศูนย์", "หนึ่ง", "สอง", "สาม", "สี่", "ห้า", "หก", "เจ็ด", "แปด", "เก้า" };
|
||||||
|
|
||||||
|
string result = "";
|
||||||
|
string numStr = number.ToString();
|
||||||
|
int len = numStr.Length;
|
||||||
|
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
int num = numStr[i] - '0';
|
||||||
|
int pos = len - i - 1;
|
||||||
|
|
||||||
|
if (num != 0)
|
||||||
|
{
|
||||||
|
if (pos == 1 && num == 1)
|
||||||
|
result += "สิบ";
|
||||||
|
else if (pos == 1 && num == 2)
|
||||||
|
result += "ยี่สิบ";
|
||||||
|
else if (pos == 0 && num == 1 && len > 1)
|
||||||
|
result += "เอ็ด";
|
||||||
|
else
|
||||||
|
result += digit[num] + unit[pos];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1620,6 +1620,44 @@ namespace BMA.EHR.Recurit.Exam.Service.Services
|
||||||
return periodExam;
|
return periodExam;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<dynamic> ExportsPaymentExamAsync(string candidateId)
|
||||||
|
{
|
||||||
|
var periodExam = await _context.Candidates.AsQueryable()
|
||||||
|
.Include(x => x.PeriodExam)
|
||||||
|
.ThenInclude(x => x.PeriodExamBarCodes)
|
||||||
|
.ThenInclude(x => x.Document)
|
||||||
|
.Include(x => x.PeriodExam)
|
||||||
|
.ThenInclude(x => x.PeriodExamQrCodes)
|
||||||
|
.ThenInclude(x => x.Document)
|
||||||
|
.Where(x => x.Id == Guid.Parse(candidateId))
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (periodExam == null)
|
||||||
|
throw new Exception(GlobalMessages.ExamNotFound);
|
||||||
|
|
||||||
|
|
||||||
|
return new
|
||||||
|
{
|
||||||
|
template = "candidate",
|
||||||
|
reportName = $"Candidate_{DateTime.Now.ToString("yyyyMMddHHmmssfff")}",
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
data = new
|
||||||
|
{
|
||||||
|
FeRemarke = periodExam?.PeriodExam?.Remark ?? "-",
|
||||||
|
CompanyCode = periodExam?.PeriodExam?.CompanyCode ?? "-",
|
||||||
|
PeriodExamBarCodes = (periodExam?.PeriodExam?.PeriodExamBarCodes[0]?.Document?.Id ?? null) == null ? "" : _minioService.ImagesPath(periodExam?.PeriodExam?.PeriodExamBarCodes[0]?.Document?.Id ?? Guid.Parse("00000000-0000-0000-0000-000000000000")).Result,
|
||||||
|
Reason = periodExam?.PeriodExam?.Reason ?? "-",
|
||||||
|
RefNo1 = periodExam?.PeriodExam?.RefNo1 ?? "-",
|
||||||
|
PeriodExamQrCodes = (periodExam?.PeriodExam?.PeriodExamQrCodes[0]?.Document?.Id ?? null) == null ? "" : _minioService.ImagesPath(periodExam?.PeriodExam?.PeriodExamQrCodes[0]?.Document?.Id ?? Guid.Parse("00000000-0000-0000-0000-000000000000")).Result,
|
||||||
|
CitizenId = periodExam?.CitizenId ?? "-",
|
||||||
|
Fee = periodExam?.PeriodExam?.Fee?.ToString() ?? "-",
|
||||||
|
FeeText = (periodExam?.PeriodExam?.Fee ?? null) == null ? "-" : periodExam?.PeriodExam?.Fee.Value.NumberToThaiText() ?? "-",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<List<DashboardResponseItem>> GetsDashboardPaymentExamAsync(string examId)
|
public async Task<List<DashboardResponseItem>> GetsDashboardPaymentExamAsync(string examId)
|
||||||
{
|
{
|
||||||
var periodExam = await _context.PeriodExams.AsQueryable()
|
var periodExam = await _context.PeriodExams.AsQueryable()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue