From 7a01067222f859dd7dc07ffeb7cb5d2d1b61148d Mon Sep 17 00:00:00 2001 From: "DESKTOP-2S5P7D1\\Windows 10" Date: Fri, 10 Jan 2025 16:11:34 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B8=9A=E0=B8=B1=E0=B8=99=E0=B8=97=E0=B8=B6?= =?UTF-8?q?=E0=B8=81=E0=B8=9B=E0=B8=A3=E0=B8=B0=E0=B8=A7=E0=B8=B1=E0=B8=95?= =?UTF-8?q?=E0=B8=B4=E0=B8=95=E0=B8=B3=E0=B9=81=E0=B8=AB=E0=B8=99=E0=B9=88?= =?UTF-8?q?=E0=B8=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controllers/ReportController.ts | 291 ++++++++++++++++++++++------ 1 file changed, 230 insertions(+), 61 deletions(-) diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 5345fc7..ac7a7cd 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -6268,7 +6268,16 @@ export class ReportController extends Controller { @Post("command/33/resume") async SalaryReport33Resume( @Body() - body: { result: { id: string; refCommandNo: string; templateDoc: string }[] }, + body: { + result: { + id: string; + refCommandNo: string; + templateDoc: string; + mpCee?: string | null; + refCommandCode?: string | null; + refCommandName?: string | null; + }[]; + }, @Request() request: RequestWithUser, ) { await Promise.all( @@ -6296,6 +6305,8 @@ export class ReportController extends Controller { positionLevel: salary.posLevel, refCommandNo: v.refCommandNo, templateDoc: v.templateDoc, + refCommandCode: v.refCommandCode, + refCommandName: v.refCommandName, }) .then(async () => { const before = null; @@ -6322,7 +6333,16 @@ export class ReportController extends Controller { @Post("command/34/resume") async SalaryReport34Resume( @Body() - body: { result: { id: string; refCommandNo: string; templateDoc: string }[] }, + body: { + result: { + id: string; + refCommandNo: string; + templateDoc: string; + mpCee?: string | null; + refCommandCode?: string | null; + refCommandName?: string | null; + }[]; + }, @Request() request: RequestWithUser, ) { await Promise.all( @@ -6349,6 +6369,8 @@ export class ReportController extends Controller { positionLevel: salary.posLevel, refCommandNo: v.refCommandNo, templateDoc: v.templateDoc, + refCommandCode: v.refCommandCode, + refCommandName: v.refCommandName, }) .then(async () => { const before = null; @@ -6375,7 +6397,16 @@ export class ReportController extends Controller { @Post("command/35/resume") async SalaryReport35Resume( @Body() - body: { result: { id: string; refCommandNo: string; templateDoc: string }[] }, + body: { + result: { + id: string; + refCommandNo: string; + templateDoc: string; + mpCee?: string | null; + refCommandCode?: string | null; + refCommandName?: string | null; + }[]; + }, @Request() request: RequestWithUser, ) { await Promise.all( @@ -6402,6 +6433,8 @@ export class ReportController extends Controller { positionLevel: salary.posLevel, refCommandNo: v.refCommandNo, templateDoc: v.templateDoc, + refCommandCode: v.refCommandCode, + refCommandName: v.refCommandName, }) .then(async () => { const before = null; @@ -6428,7 +6461,16 @@ export class ReportController extends Controller { @Post("command/36/resume") async SalaryReport36Resume( @Body() - body: { result: { id: string; refCommandNo: string; templateDoc: string }[] }, + body: { + result: { + id: string; + refCommandNo: string; + templateDoc: string; + mpCee?: string | null; + refCommandCode?: string | null; + refCommandName?: string | null; + }[]; + }, @Request() request: RequestWithUser, ) { await Promise.all( @@ -6455,6 +6497,8 @@ export class ReportController extends Controller { positionLevel: salary.posLevel ? String(salary.posLevel) : null, refCommandNo: v.refCommandNo, templateDoc: v.templateDoc, + refCommandCode: v.refCommandCode, + refCommandName: v.refCommandName, }) .then(async () => { const before = null; @@ -6481,7 +6525,16 @@ export class ReportController extends Controller { @Post("command/37/resume") async SalaryReport37Resume( @Body() - body: { result: { id: string; refCommandNo: string; templateDoc: string }[] }, + body: { + result: { + id: string; + refCommandNo: string; + templateDoc: string; + mpCee?: string | null; + refCommandCode?: string | null; + refCommandName?: string | null; + }[]; + }, @Request() request: RequestWithUser, ) { await Promise.all( @@ -6508,6 +6561,8 @@ export class ReportController extends Controller { positionLevel: salary.posLevel, refCommandNo: v.refCommandNo, templateDoc: v.templateDoc, + refCommandCode: v.refCommandCode, + refCommandName: v.refCommandName, }) .then(async () => { const before = null; @@ -6892,7 +6947,7 @@ export class ReportController extends Controller { amountSpecial: MoreThan(0), type: Not("NONE"), status: "PENDING", - })/*.orWhere({ + }); /*.orWhere({ salaryOrgId: In(salaryOrgs.map((x) => x.id)), type: "NONE", status: "PENDING", @@ -7228,7 +7283,7 @@ export class ReportController extends Controller { return new HttpSuccess(_salaryRank); } - + /** * API ออกคำสั่ง * @@ -7321,37 +7376,89 @@ export class ReportController extends Controller { 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 : "-", + 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 ? Extension.ToThaiNumber(salary.posLevel.toString()) : "-", - positionNumber: salary.orgShortName != null && salary.posMasterNo != null - ? Extension.ToThaiNumber(salary.orgShortName + salary.posMasterNo) + positionLevel: salary.posLevel + ? Extension.ToThaiNumber(salary.posLevel.toString()) + : "-", + 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()) : "-", - 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 - } + remarkHorizontal: v.RemarkHorizontal, + }; data.push(_data); } }), @@ -7399,37 +7506,89 @@ export class ReportController extends Controller { 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 : "-", + 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 ? Extension.ToThaiNumber(salary.posLevel.toString()) : "-", - positionNumber: salary.orgShortName != null && salary.posMasterNo != null - ? Extension.ToThaiNumber(salary.orgShortName + salary.posMasterNo) + positionLevel: salary.posLevel + ? Extension.ToThaiNumber(salary.posLevel.toString()) + : "-", + 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()) : "-", - 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 - } + remarkHorizontal: v.RemarkHorizontal, + }; data.push(_data); } }), @@ -7459,6 +7618,9 @@ export class ReportController extends Controller { amountSpecial: Double | null; positionSalaryAmount: Double | null; mouthSalaryAmount: Double | null; + mpCee?: string | null; + refCommandCode?: string | null; + refCommandName?: string | null; }[]; }, @Request() request: RequestWithUser, @@ -7490,6 +7652,8 @@ export class ReportController extends Controller { positionLevel: salary.posLevel, refCommandNo: `${v.commandNo}/${Extension.ToThaiYear(v.commandYear)}`, templateDoc: v.templateDoc, + refCommandCode: v.refCommandCode, + refCommandName: v.refCommandName, }) .then(async () => { const before = null; @@ -7528,6 +7692,9 @@ export class ReportController extends Controller { amountSpecial: Double | null; positionSalaryAmount: Double | null; mouthSalaryAmount: Double | null; + mpCee?: string | null; + refCommandCode?: string | null; + refCommandName?: string | null; }[]; }, @Request() request: RequestWithUser, @@ -7554,6 +7721,8 @@ export class ReportController extends Controller { positionLevel: salary.posLevel ? String(salary.posLevel) : null, refCommandNo: `${v.commandNo}/${Extension.ToThaiYear(v.commandYear)}`, templateDoc: v.templateDoc, + refCommandCode: v.refCommandCode, + refCommandName: v.refCommandName, }) .then(async () => { const before = null;