diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index c391463..14af0fd 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -1025,12 +1025,20 @@ export class ReportController extends Controller { }, }); const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))); - const yearIncrease1 = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-2))); - const yearIncrease2 = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1))); - const fifteenPercent = salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null ? - "๐" : Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent)); - const fifteenPoint = salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null ? - ".๐๐" : "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint)); + const yearIncrease1 = Extension.ToThaiNumber( + String(Extension.ToThaiYear(salaryPeriod.year - 2)), + ); + const yearIncrease2 = Extension.ToThaiNumber( + String(Extension.ToThaiYear(salaryPeriod.year - 1)), + ); + const fifteenPercent = + salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null + ? "๐" + : Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent)); + const fifteenPoint = + salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null + ? ".๐๐" + : "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint)); return new HttpSuccess({ template: "gov1-03", reportName: "gov1-03", @@ -1039,7 +1047,7 @@ export class ReportController extends Controller { yearIncrease1: yearIncrease1, yearIncrease2: yearIncrease2, yearIncreaseSlice: yearIncrease2.slice(-2), - yearSlice: year.slice(-2), + yearSlice: year.slice(-2), point: fifteenPercent + fifteenPoint, root: salaryProfile[0]?.root, profile: salaryProfile.map((item, index) => ({ @@ -1481,10 +1489,20 @@ export class ReportController extends Controller { */ @Get("emp-00/{rootId}/{salaryPeriodId}") async SalaryReportEmp0(@Path() rootId: string, @Path() salaryPeriodId: string) { + const salaryPeriod = await this.salaryPeriodRepository.findOne({ + where: { + id: salaryPeriodId, + }, + }); + if (!salaryPeriod) { + throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); + } return new HttpSuccess({ template: "emp1-00", reportName: "emp1-00", - data: {}, + data: { + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + }, }); } @@ -1737,7 +1755,7 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, position: profile.position, - posLevel: profile.posLevel, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, @@ -1817,7 +1835,7 @@ export class ReportController extends Controller { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, position: profile.position, - posLevel: profile.posLevel, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, @@ -1858,18 +1876,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["HAFT", "FULL", "FULLHAFT"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + amount: "ASC", }, }); @@ -1896,17 +1914,22 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount + ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) + : null, + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน reason: null, }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-04" : "emp2-04", + reportName: salaryPeriod.period == "APR" ? "emp1-04" : "emp2-04", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -1930,18 +1953,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["HAFT", "FULL", "FULLHAFT"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + amount: "ASC", }, }); @@ -1968,17 +1991,22 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, + positionSalaryAmount: profile.positionSalaryAmount + ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) + : null, + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน reason: null, }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-05" : "emp2-05", + reportName: salaryPeriod.period == "APR" ? "emp1-05" : "emp2-05", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2002,18 +2030,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["NONE"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + amount: "ASC", }, }); @@ -2040,17 +2068,22 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, + positionSalaryAmount: profile.positionSalaryAmount + ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) + : null, + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน + reason: null, //เหตุผลที่ไม่สมควรหรือไม่อาจเลื่อนขั้นค่าจ้าง }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-06" : "emp2-06", + reportName: salaryPeriod.period == "APR" ? "emp1-06" : "emp2-06", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2074,18 +2107,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["NONE"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + amount: "ASC", }, }); @@ -2112,89 +2145,22 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, + positionSalaryAmount: profile.positionSalaryAmount + ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) + : null, + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน + reason: null, //เหตุผลที่ไม่สมควรหรือไม่อาจเลื่อนขั้นค่าจ้าง }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - agency: agency, - data: formattedData, - }, - }); - } - /** - * API 08-แบบ ลจ.กทม.3-บัญชีแสดงวันลาในครึ่งปีของลูกจ้าง - * - * @summary 08-แบบ ลจ.กทม.3-บัญชีแสดงวันลาในครึ่งปีของลูกจ้าง - * - */ - @Get("emp-08/{rootId}/{salaryPeriodId}") - async SalaryReportEmp8(@Path() rootId: string, @Path() salaryPeriodId: string) { - const salaryPeriod = await this.salaryPeriodRepository.findOne({ - where: { - id: salaryPeriodId, - }, - }); - if (!salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); - } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!_salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; - - const formattedData = _salaryPeriod.map((profile, index) => { - const fullNameParts = [ - profile.child4, - profile.child3, - profile.child2, - profile.child1, - profile.root, - `${profile.prefix}${profile.firstName} ${profile.lastName}`, - ]; - - const fullName = fullNameParts - .filter((part) => part !== undefined && part !== null) - .join("/"); - - return { - no: Extension.ToThaiNumber((index + 1).toLocaleString()), - fullName: fullName, - posLevel: profile.posLevel, - posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, - }; - }); - - return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-07" : "emp2-07", + reportName: salaryPeriod.period == "APR" ? "emp1-07" : "emp2-07", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2202,6 +2168,23 @@ export class ReportController extends Controller { }, }); } + // /** + // * API 08-แบบ ลจ.กทม.3-บัญชีแสดงวันลาในครึ่งปีของลูกจ้าง + // * + // * @summary 08-แบบ ลจ.กทม.3-บัญชีแสดงวันลาในครึ่งปีของลูกจ้าง + // * + // */ + // @Get("emp-08/{rootId}/{salaryPeriodId}") + // async SalaryReportEmp8(@Path() rootId: string, @Path() salaryPeriodId: string) { + // const salaryPeriod = await this.salaryPeriodRepository.findOne({ + // where: { + // id: salaryPeriodId, + // }, + // }); + // if (!salaryPeriod) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); + // } + // } /** * API 09-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับเลื่อนขั้นค่าจ้างในวันที่ 1 เมษา ย้อนหลัง 3 ครั้ง * @@ -2274,78 +2257,23 @@ export class ReportController extends Controller { }, }); } - /** - * API 10-รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น - * - * @summary 10-รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น - * - */ - @Get("emp-10/{rootId}/{salaryPeriodId}") - async SalaryReportEmp10(@Path() rootId: string, @Path() salaryPeriodId: string) { - const salaryPeriod = await this.salaryPeriodRepository.findOne({ - where: { - id: salaryPeriodId, - }, - }); - if (!salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); - } - const _salaryPeriod = await this.salaryProfileRepository.find({ - relations: ["salaryOrg", "salaryOrg.salaryPeriod"], - where: { - salaryOrg: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriodId: salaryPeriodId, - }, - }, - order: { - orgShortName: "ASC", - posMasterNo: "ASC", - }, - }); - - if (!_salaryPeriod) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); - } - - const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; - - const formattedData = _salaryPeriod.map((profile, index) => { - const fullNameParts = [ - profile.child4, - profile.child3, - profile.child2, - profile.child1, - profile.root, - `${profile.prefix}${profile.firstName} ${profile.lastName}`, - ]; - - const fullName = fullNameParts - .filter((part) => part !== undefined && part !== null) - .join("/"); - - return { - no: Extension.ToThaiNumber((index + 1).toLocaleString()), - fullName: fullName, - posLevel: profile.posLevel, - posNumber: - profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), - amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, - }; - }); - - return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - agency: agency, - data: formattedData, - }, - }); - } + // /** + // * API 10-รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น + // * + // * @summary 10-รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น + // * + // */ + // @Get("emp-10/{rootId}/{salaryPeriodId}") + // async SalaryReportEmp10(@Path() rootId: string, @Path() salaryPeriodId: string) { + // const salaryPeriod = await this.salaryPeriodRepository.findOne({ + // where: { + // id: salaryPeriodId, + // }, + // }); + // if (!salaryPeriod) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); + // } + // } /** * API 11-คำสั่ง * @@ -2434,18 +2362,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["HAFT", "FULL", "FULLHAFT"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + positionSalaryAmount: "ASC", }, }); @@ -2472,17 +2400,26 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, + positionSalaryAmount: profile.positionSalaryAmount + ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) + : null, + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน + remark: + `${profile.type === "FULL" ? "หนึ่งขั้น" : ""}\n` + + `${profile.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : ""}\n` + + `${profile.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ\n" : ""}` + + `${profile.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`, // หมายเหตุ }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-12" : "emp2-12", + reportName: salaryPeriod.period == "APR" ? "emp1-12" : "emp2-12", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2506,18 +2443,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["NONE"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + positionSalaryAmount: "ASC", }, }); @@ -2544,17 +2481,19 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน + reason: null, // หมายเหตุ }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-13" : "emp2-13", + reportName: salaryPeriod.period == "APR" ? "emp1-13" : "emp2-13", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2578,18 +2517,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["HAFT", "FULL", "FULLHAFT"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + positionSalaryAmount: "ASC", }, }); @@ -2616,17 +2555,26 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, + positionSalaryAmount: profile.positionSalaryAmount + ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) + : null, + score: null, //สรุปผลการประเมินฯ ระดับและคะแนน + remark: + `${profile.type === "FULL" ? "หนึ่งขั้น" : ""}\n` + + `${profile.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : ""}\n` + + `${profile.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ\n" : ""}` + + `${profile.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`, // หมายเหตุ }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-14" : "emp2-14", + reportName: salaryPeriod.period == "APR" ? "emp1-14" : "emp2-14", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2650,18 +2598,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["HAFT", "FULL", "FULLHAFT"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + positionSalaryAmount: "ASC", }, }); @@ -2688,17 +2636,20 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, + precentTwo: null, //ร้อยละ 2 + precentFour: null, //ร้อยละ 4 + reason: null, // หมายเหตุ }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-15" : "emp2-15", + reportName: salaryPeriod.period == "APR" ? "emp1-15" : "emp2-15", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2722,18 +2673,18 @@ export class ReportController extends Controller { if (!salaryPeriod) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); } - const _salaryPeriod = await this.salaryProfileRepository.find({ + const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ relations: ["salaryOrg", "salaryOrg.salaryPeriod"], where: { + type: In(["NONE"]), salaryOrg: { - snapshot: "SNAP1", + snapshot: "SNAP2", rootId: rootId, salaryPeriodId: salaryPeriodId, }, }, order: { - orgShortName: "ASC", - posMasterNo: "ASC", + positionSalaryAmount: "ASC", }, }); @@ -2760,17 +2711,18 @@ export class ReportController extends Controller { return { no: Extension.ToThaiNumber((index + 1).toLocaleString()), fullName: fullName, - posLevel: profile.posLevel, + position: profile.position, + posLevel: `${profile.posTypeShort} ${profile.posLevel}`, posNumber: profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()), amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null, - reason: null, + reason: null, // หมายเหตุ }; }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: salaryPeriod.period == "APR" ? "emp1-16" : "emp2-16", + reportName: salaryPeriod.period == "APR" ? "emp1-16" : "emp2-16", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, diff --git a/src/entities/SalaryProfileEmployee.ts b/src/entities/SalaryProfileEmployee.ts index cf35700..6acca34 100644 --- a/src/entities/SalaryProfileEmployee.ts +++ b/src/entities/SalaryProfileEmployee.ts @@ -97,6 +97,14 @@ export class SalaryProfileEmployee extends EntityBase { }) posType: string; + @Column({ + nullable: true, + comment: "ประเภทตำแหน่งย่อ", + length: 100, + default: null, + }) + posTypeShort: string; + @Column({ nullable: true, comment: "ระดับตำแหน่ง",