From c0a9e177e1c36960be61db81c9aa3b0173042d69 Mon Sep 17 00:00:00 2001 From: Bright Date: Thu, 31 Oct 2024 13:51:40 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=AD=E0=B8=81=E0=B8=AA=E0=B8=B2?= =?UTF-8?q?=E0=B8=A3=E0=B9=81=E0=B8=99=E0=B8=9A=E0=B8=97=E0=B9=89=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 156 ++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 7476105..efee779 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -7238,6 +7238,162 @@ export class ReportController extends Controller { return new HttpSuccess(); } + /** + * เอกสารแนบท้าย ขรก. + * + * @summary เอกสารแนบท้าย ขรก. + * + */ + @Post("command/officer/report/attachment") + async SalaryReportAttachment( + @Body() + body: { + refIds: { + refId?: string; + Sequence?: any | null; + CitizenId?: any | null; + Prefix?: any | null; + FirstName?: any | null; + LastName?: any | null; + Amount?: any | null; + PositionSalaryAmount?: any | null; + MouthSalaryAmount?: any | null; + RemarkHorizontal?: any | null; + RemarkVertical?: any | null; + CommandYear?: any | null; + }[]; + }, + @Request() request: RequestWithUser, + ) { + let data = new Array(); + await Promise.all( + body.refIds.map(async (v) => { + const salary = await this.salaryProfileRepository.findOne({ + where: { + id: v.refId, + }, + }); + + if (salary != null) { + const _data = { + no: Extension.ToThaiNumber((data.length + 1).toString()), + fullName: `${v.Prefix}${v.FirstName} ${v.LastName}`, + oc: salary.rootId == null ? salary.position == null ? "-" : salary.position : + salary.child4 != null + ? salary.position == null ? salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root + : salary.position+"/"+salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root : + salary.child3 != null + ? salary.position == null ? salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root + : salary.position+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root : + salary.child2 != null + ? salary.position == null ? salary.child2+"/"+salary.child1+"/"+salary.root + : salary.position+"/"+salary.child2+"/"+salary.child1+"/"+salary.root : + salary.child1 != null + ? salary.position == null ? salary.child1+"/"+salary.root + : salary.position+"/"+salary.child1+"/"+salary.root : + salary.root != null + ? salary.position == null ? salary.root + : salary.position+"/"+salary.root : "-", + positionType: salary.posType ? salary.posType : "-", + positionLevel: salary.posLevel ? salary.posLevel : "-", + positionNumber: salary.orgShortName != null && salary.posMasterNo != null + ? Extension.ToThaiNumber(salary.orgShortName + salary.posMasterNo) + : "-", + amount: salary.amount + ? Extension.ToThaiNumber(salary.amount.toLocaleString()) : "-", + positionSalaryAmount: salary.positionSalaryAmount + ? Extension.ToThaiNumber(salary.positionSalaryAmount.toLocaleString()) : "-", + amountSpecial: salary.amountSpecial + ? Extension.ToThaiNumber(salary.amountSpecial.toLocaleString()) : "-", + remark: salary.remark ? salary.remark : "-", + remarkVertical: v.RemarkVertical, + remarkHorizontal: v.RemarkHorizontal + } + data.push(_data); + } + }), + ); + return new HttpSuccess(data); + } + + /** + * เอกสารแนบท้าย ลูกจ้าง + * + * @summary เอกสารแนบท้าย ลูกจ้าง + * + */ + @Post("command/employee/report/attachment") + async SalaryEmployeeReportAttachment( + @Body() + body: { + refIds: { + refId?: string; + Sequence?: any | null; + CitizenId?: any | null; + Prefix?: any | null; + FirstName?: any | null; + LastName?: any | null; + Amount?: any | null; + PositionSalaryAmount?: any | null; + MouthSalaryAmount?: any | null; + RemarkHorizontal?: any | null; + RemarkVertical?: any | null; + CommandYear?: any | null; + }[]; + }, + @Request() request: RequestWithUser, + ) { + let data = new Array(); + await Promise.all( + body.refIds.map(async (v) => { + const salary = await this.salaryProfileEmployeeRepository.findOne({ + where: { + id: v.refId, + }, + }); + + if (salary != null) { + const _data = { + no: Extension.ToThaiNumber((data.length + 1).toString()), + fullName: `${v.Prefix}${v.FirstName} ${v.LastName}`, + oc: salary.rootId == null ? salary.position == null ? "-" : salary.position : + salary.child4 != null + ? salary.position == null ? salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root + : salary.position+"/"+salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root : + salary.child3 != null + ? salary.position == null ? salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root + : salary.position+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root : + salary.child2 != null + ? salary.position == null ? salary.child2+"/"+salary.child1+"/"+salary.root + : salary.position+"/"+salary.child2+"/"+salary.child1+"/"+salary.root : + salary.child1 != null + ? salary.position == null ? salary.child1+"/"+salary.root + : salary.position+"/"+salary.child1+"/"+salary.root : + salary.root != null + ? salary.position == null ? salary.root + : salary.position+"/"+salary.root : "-", + positionType: salary.posType ? salary.posType : "-", + positionLevel: salary.posLevel ? salary.posLevel : "-", + positionNumber: salary.orgShortName != null && salary.posMasterNo != null + ? Extension.ToThaiNumber(salary.orgShortName + salary.posMasterNo) + : "-", + amount: salary.amount + ? Extension.ToThaiNumber(salary.amount.toLocaleString()) : "-", + positionSalaryAmount: salary.positionSalaryAmount + ? Extension.ToThaiNumber(salary.positionSalaryAmount.toLocaleString()) : "-", + amountSpecial: salary.amountSpecial + ? Extension.ToThaiNumber(salary.amountSpecial.toLocaleString()) : "-", + remark: salary.remark ? salary.remark : "-", + remarkVertical: v.RemarkVertical, + remarkHorizontal: v.RemarkHorizontal + } + data.push(_data); + } + }), + ); + return new HttpSuccess(data); + } + /** * API ออกคำสั่ง *