diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index 9b9a708..863769e 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -1062,7 +1062,9 @@ export class ReportController extends Controller { .filter((profile) => profile.citizenId === item.citizenId) .map((profile) => profile.amount); const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null ? "๐" : Extension.ToThaiNumber(Amount?.toLocaleString()); + return Amount === undefined || Amount === null + ? "๐" + : Extension.ToThaiNumber(Amount?.toLocaleString()); })() : "๐", //การเลื่อนเงินเดือนปีก่อนๆหน้า salaryIncrease2: @@ -1072,7 +1074,9 @@ export class ReportController extends Controller { .filter((profile) => profile.citizenId === item.citizenId) .map((profile) => profile.amount); const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null ? "๐" : Extension.ToThaiNumber(Amount?.toLocaleString()); + return Amount === undefined || Amount === null + ? "๐" + : Extension.ToThaiNumber(Amount?.toLocaleString()); })() : "๐", //การเลื่อนเงินเดือนปีก่อนหน้า score: null, //ผลการประเมินฯ @@ -1234,28 +1238,34 @@ export class ReportController extends Controller { .filter((profile) => profile.citizenId === item.citizenId) .map((profile) => profile.amount); const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null ? "๐" : Extension.ToThaiNumber(Amount?.toLocaleString()); + return Amount === undefined || Amount === null + ? "๐" + : Extension.ToThaiNumber(Amount?.toLocaleString()); })() : "๐", //การเลื่อนเงินเดือนปีก่อนๆหน้า salaryIncrease2: salaryProfile2.length > 0 ? (() => { - const filteredAmount = salaryProfile2 - .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null ? "๐" : Extension.ToThaiNumber(Amount?.toLocaleString()); - })() + const filteredAmount = salaryProfile2 + .filter((profile) => profile.citizenId === item.citizenId) + .map((profile) => profile.amount); + const Amount = filteredAmount[0]; + return Amount === undefined || Amount === null + ? "๐" + : Extension.ToThaiNumber(Amount?.toLocaleString()); + })() : "๐", //การเลื่อนเงินเดือนปีก่อนหน้า salaryIncreaseAPR: salaryProfile_APR.length > 0 ? (() => { - const filteredAmount = salaryProfile_APR - .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null ? "๐" : Extension.ToThaiNumber(Amount?.toLocaleString()); - })() + const filteredAmount = salaryProfile_APR + .filter((profile) => profile.citizenId === item.citizenId) + .map((profile) => profile.amount); + const Amount = filteredAmount[0]; + return Amount === undefined || Amount === null + ? "๐" + : Extension.ToThaiNumber(Amount?.toLocaleString()); + })() : "๐", //การเลื่อนเงินเดือนรอบเมษา Type: item.type === "FULL" ? "หนึ่งขั้น" : "หนึ่งขั้นครึ่ง", score1: null, //ผลการประเมินฯ ครั้งที่ 1 @@ -1659,39 +1669,14 @@ export class ReportController extends Controller { return mapData; } - /** - * API 00-สรุปรายการเอกสารลูกจ้างที่ต้องส่ง สกจ รอบเมษายน - * - * @summary 00-สรุปรายการเอกสารลูกจ้างที่ต้องส่ง สกจ รอบเมษายน - * - */ - @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: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - }, - }); - } - /** * API 01-บัญชีคำนวณโควตา * * @summary 01-บัญชีคำนวณโควตา * */ - @Get("emp-01/{rootId}/{salaryPeriodId}") - async SalaryReportEmp1(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-01/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_1(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -1714,170 +1699,38 @@ export class ReportController extends Controller { ? "" : _salaryPeriod.salaryProfiles[0].root; - if (salaryPeriod.period == "APR") { - return new HttpSuccess({ - template: "emp1-01", - reportName: "emp1-01", - data: { - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - agency: agency, - total: - _salaryPeriod == null ? "" : Extension.ToThaiNumber(_salaryPeriod.total.toString()), - fifteenPercent: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber(_salaryPeriod.fifteenPercent.toString()), - full: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - _salaryPeriod.salaryProfiles.filter((x) => x.type == "FULL").length.toString(), - ), - haft: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - _salaryPeriod.salaryProfiles.filter((x) => x.type == "HAFT").length.toString(), - ), - notPromoted: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - _salaryPeriod.salaryProfiles.filter((x) => x.type == "NONE").length.toString(), - ), - reason: null, - }, - }); - } else { - const _salaryPeriodAPR1 = await this.salaryOrgEmployeeRepository.findOne({ - where: { - snapshot: "SNAP1", - rootId: rootId, - salaryPeriod: { - period: "APR", - year: salaryPeriod.year, - }, - }, - }); - const haftSalary = - _salaryPeriod == null - ? 0 - : _salaryPeriod.salaryProfiles - .filter((x) => x.type == "HAFT") - .reduce((accumulator, object: any) => { - return ( - accumulator + - (object.amountUse == null ? 0 : object.amountUse) + - (object.amountSpecial == null ? 0 : object.amountSpecial) - ); - }, 0); - - const fullSalary = - _salaryPeriod == null - ? 0 - : _salaryPeriod.salaryProfiles - .filter((x) => x.type == "FULL") - .reduce((accumulator, object: any) => { - return ( - accumulator + - (object.amountUse == null ? 0 : object.amountUse) + - (object.amountSpecial == null ? 0 : object.amountSpecial) - ); - }, 0); - const fullHaftSalary = - _salaryPeriod == null - ? 0 - : _salaryPeriod.salaryProfiles - .filter((x) => x.type == "FULLHAFT") - .reduce((accumulator, object: any) => { - return ( - accumulator + - (object.amountUse == null ? 0 : object.amountUse) + - (object.amountSpecial == null ? 0 : object.amountSpecial) - ); - }, 0); - return new HttpSuccess({ - template: "emp2-01", - reportName: "emp2-01", - data: { - date: Extension.ToThaiNumber( - Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-03-01`)), - ), - year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), - dateNow: Extension.ToThaiNumber(Extension.ToThaiFullDate(new Date())), - agency: agency, - totalSalary: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber(_salaryPeriod.currentAmount.toString()), - totalUser: - _salaryPeriod == null ? "" : Extension.ToThaiNumber(_salaryPeriod.total.toString()), - sixPercentAmount: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber(_salaryPeriod.sixPercentAmount.toString()), - spentAmount: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber(_salaryPeriod.spentAmount.toString()), - remainingAmount: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - (_salaryPeriod.sixPercentAmount - _salaryPeriod.spentAmount).toString(), - ), - fifteenPercentOld: Extension.ToThaiNumber( - (_salaryPeriodAPR1 == null ? 0 : _salaryPeriodAPR1.fifteenPercent).toString(), - ), - totalOld: Extension.ToThaiNumber( - (_salaryPeriodAPR1 == null ? 0 : _salaryPeriodAPR1.total).toString(), - ), - haft: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - _salaryPeriod.salaryProfiles.filter((x) => x.type == "HAFT").length.toString(), - ), - full: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - _salaryPeriod.salaryProfiles.filter((x) => x.type == "FULL").length.toString(), - ), - fullHaft: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - _salaryPeriod.salaryProfiles - .filter((x) => x.type == "FULLHAFT") - .length.toString(), - ), - notPromoted: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - _salaryPeriod.salaryProfiles.filter((x) => x.type == "NONE").length.toString(), - ), - haftSalary: Extension.ToThaiNumber(haftSalary.toString()), - fullSalary: Extension.ToThaiNumber(fullSalary.toString()), - fullHaftSalary: Extension.ToThaiNumber(fullHaftSalary.toString()), - total: Extension.ToThaiNumber((haftSalary + fullSalary + fullHaftSalary).toString()), - summary: - _salaryPeriod == null - ? "" - : Extension.ToThaiNumber( - ( - _salaryPeriod.sixPercentAmount - - _salaryPeriod.spentAmount - - haftSalary - - fullSalary - - fullHaftSalary - ).toString(), - ), - reason: null, - }, - }); - } + return new HttpSuccess({ + template: "emp1-01", + reportName: "emp1-01", + data: { + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + agency: agency, + total: _salaryPeriod == null ? "" : Extension.ToThaiNumber(_salaryPeriod.total.toString()), + fifteenPercent: + _salaryPeriod == null + ? "" + : Extension.ToThaiNumber(_salaryPeriod.fifteenPercent.toString()), + full: + _salaryPeriod == null + ? "" + : Extension.ToThaiNumber( + _salaryPeriod.salaryProfiles.filter((x) => x.type == "FULL").length.toString(), + ), + haft: + _salaryPeriod == null + ? "" + : Extension.ToThaiNumber( + _salaryPeriod.salaryProfiles.filter((x) => x.type == "HAFT").length.toString(), + ), + notPromoted: + _salaryPeriod == null + ? "" + : Extension.ToThaiNumber( + _salaryPeriod.salaryProfiles.filter((x) => x.type == "NONE").length.toString(), + ), + reason: null, + }, + }); } /** * API 02-รายชื่อลูกจ้างประจำผู้ครองตำแหน่ง ณ วันที่ 1 มีนาคม @@ -1885,8 +1738,8 @@ export class ReportController extends Controller { * @summary 02-รายชื่อลูกจ้างประจำผู้ครองตำแหน่ง ณ วันที่ 1 มีนาคม * */ - @Get("emp-02/{rootId}/{salaryPeriodId}") - async SalaryReportEmp2(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-02/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_2(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -1942,8 +1795,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-02" : "emp2-02", - reportName: salaryPeriod.period == "APR" ? "emp1-02" : "emp2-02", + template: "emp1-02", + reportName: "emp1-02", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -1957,8 +1810,8 @@ export class ReportController extends Controller { * @summary 03-รายชื่อลูกจ้างประจำที่ได้รับการเสนอขอเลื่อนขั้นค่าจ้างหนึ่งขั้น * */ - @Get("emp-03/{rootId}/{salaryPeriodId}") - async SalaryReportEmp3(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-03/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_3(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2024,8 +1877,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-03" : "emp2-03", - reportName: salaryPeriod.period == "APR" ? "emp1-03" : "emp2-03", + template: "emp1-03", + reportName: "emp1-03", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), fifteenPercent: Extension.ToThaiNumber(fifteenPercent), @@ -2046,8 +1899,8 @@ export class ReportController extends Controller { * @summary 04-แบบ ลจ.กทม.1-รายชื่อลูกจ้างผู้สมควรได้เลื่อนขั้นค่าจ้าง * */ - @Get("emp-04/{rootId}/{salaryPeriodId}") - async SalaryReportEmp4(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-04/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_4(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2109,8 +1962,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-04" : "emp2-04", - reportName: salaryPeriod.period == "APR" ? "emp1-04" : "emp2-04", + template: "emp1-04", + reportName: "emp1-04", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2124,8 +1977,8 @@ export class ReportController extends Controller { * @summary 05-แบบ ลจ.กทม.1-1-รายชื่อลูกจ้างผู้สมควรได้รับค่าตอบแทนพิเศษ * */ - @Get("emp-05/{rootId}/{salaryPeriodId}") - async SalaryReportEmp5(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-05/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_5(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2191,8 +2044,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-05" : "emp2-05", - reportName: salaryPeriod.period == "APR" ? "emp1-05" : "emp2-05", + template: "emp1-05", + reportName: "emp1-05", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2206,8 +2059,8 @@ export class ReportController extends Controller { * @summary 06-แบบ ลจ.กทม.2-รายชื่อลูกจ้างผู้ไม่สมควรเลื่อนขั้นค่าจ้าง * */ - @Get("emp-06/{rootId}/{salaryPeriodId}") - async SalaryReportEmp6(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-06/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_6(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2268,8 +2121,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-06" : "emp2-06", - reportName: salaryPeriod.period == "APR" ? "emp1-06" : "emp2-06", + template: "emp1-06", + reportName: "emp1-06", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2283,8 +2136,8 @@ export class ReportController extends Controller { * @summary 07-แบบ ลจ.กทม.2-1-รายชื่อลูกจ้างผู้ไม่สมควรได้รับค่าตอบแทนพิเศษ * */ - @Get("emp-07/{rootId}/{salaryPeriodId}") - async SalaryReportEmp7(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-07/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_7(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2345,8 +2198,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-07" : "emp2-07", - reportName: salaryPeriod.period == "APR" ? "emp1-07" : "emp2-07", + template: "emp1-07", + reportName: "emp1-07", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2361,7 +2214,7 @@ export class ReportController extends Controller { // * // */ // @Get("emp-08/{rootId}/{salaryPeriodId}") - // async SalaryReportEmp8(@Path() rootId: string, @Path() salaryPeriodId: string) { + // async SalaryReportEmp1_8(@Path() rootId: string, @Path() salaryPeriodId: string) { // const salaryPeriod = await this.salaryPeriodRepository.findOne({ // where: { // id: salaryPeriodId, @@ -2377,8 +2230,8 @@ export class ReportController extends Controller { * @summary 09-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับเลื่อนขั้นค่าจ้างในวันที่ 1 เมษา ย้อนหลัง 3 ครั้ง * */ - @Get("emp-09/{rootId}/{salaryPeriodId}") - async SalaryReportEmp9(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-09/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_9(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2434,8 +2287,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp1-09", + reportName: "emp1-09", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2450,7 +2303,7 @@ export class ReportController extends Controller { // * // */ // @Get("emp-10/{rootId}/{salaryPeriodId}") - // async SalaryReportEmp10(@Path() rootId: string, @Path() salaryPeriodId: string) { + // async SalaryReportEmp1_10(@Path() rootId: string, @Path() salaryPeriodId: string) { // const salaryPeriod = await this.salaryPeriodRepository.findOne({ // where: { // id: salaryPeriodId, @@ -2466,8 +2319,8 @@ export class ReportController extends Controller { * @summary 11-คำสั่ง * */ - @Get("emp-11/{rootId}/{salaryPeriodId}") - async SalaryReportEmp11(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-11/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_11(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2523,8 +2376,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", - reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", + template: "emp1-11", + reportName: "emp1-11", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2538,8 +2391,8 @@ export class ReportController extends Controller { * @summary 12-บัญชีรายละเอียดผู้ได้รับอัตราค่าจ้างสูงกว่าขั้นสูง (แนบท้ายคำสั่ง) * */ - @Get("emp-12/{rootId}/{salaryPeriodId}") - async SalaryReportEmp12(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-12/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_12(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2605,8 +2458,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-12" : "emp2-12", - reportName: salaryPeriod.period == "APR" ? "emp1-12" : "emp2-12", + template: "emp1-12", + reportName: "emp1-12", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2620,8 +2473,8 @@ export class ReportController extends Controller { * @summary 13-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับการเลื่อนขั้นค่าจ้าง * */ - @Get("emp-13/{rootId}/{salaryPeriodId}") - async SalaryReportEmp13(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-13/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_13(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2679,8 +2532,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-13" : "emp2-13", - reportName: salaryPeriod.period == "APR" ? "emp1-13" : "emp2-13", + template: "emp1-13", + reportName: "emp1-13", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2694,8 +2547,8 @@ export class ReportController extends Controller { * @summary 14-คำสั่ง * */ - @Get("emp-14/{rootId}/{salaryPeriodId}") - async SalaryReportEmp14(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-14/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_14(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2760,8 +2613,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-14" : "emp2-14", - reportName: salaryPeriod.period == "APR" ? "emp1-14" : "emp2-14", + template: "emp1-14", + reportName: "emp1-14", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2775,8 +2628,8 @@ export class ReportController extends Controller { * @summary 15-บัญชีรายละเอียดลูกจ้างประจำที่ได้รับค่าตอบแทนพิเศษ(แนบท้ายคำสั่ง) * */ - @Get("emp-15/{rootId}/{salaryPeriodId}") - async SalaryReportEmp15(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-15/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_15(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2843,8 +2696,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-15" : "emp2-15", - reportName: salaryPeriod.period == "APR" ? "emp1-15" : "emp2-15", + template: "emp1-15", + reportName: "emp1-15", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2858,8 +2711,8 @@ export class ReportController extends Controller { * @summary 16-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับค่าตอบแทนพิเศษ * */ - @Get("emp-16/{rootId}/{salaryPeriodId}") - async SalaryReportEmp16(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-16/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_16(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2916,8 +2769,8 @@ export class ReportController extends Controller { }); return new HttpSuccess({ - template: salaryPeriod.period == "APR" ? "emp1-16" : "emp2-16", - reportName: salaryPeriod.period == "APR" ? "emp1-16" : "emp2-16", + template: "emp1-16", + reportName: "emp1-16", data: { year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), agency: agency, @@ -2931,8 +2784,224 @@ export class ReportController extends Controller { * @summary 17-คำสั่ง * */ - @Get("emp-17/{rootId}/{salaryPeriodId}") - async SalaryReportEmp17(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp1-17/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_17(@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: "emp1-17", + reportName: "emp1-17", + data: { + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + agency: agency, + data: formattedData, + }, + }); + } + /** + * API 18-คำสั่ง + * + * @summary 18-คำสั่ง + * + */ + @Get("emp1-18/{rootId}/{salaryPeriodId}") + async SalaryReportEmp1_18(@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: "emp1-18", + reportName: "emp1-18", + data: { + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + agency: agency, + data: formattedData, + }, + }); + } + /** + * API 01-บัญชีการคำนวณวงเงินเลื่อนขั้นค่าจ้างลูกจ้างประจำกรุงเทพมหานคร + * + * @summary 01-บัญชีการคำนวณวงเงินเลื่อนขั้นค่าจ้างลูกจ้างประจำกรุงเทพมหานคร + * + */ + @Get("emp2-01/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_1(@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" ? "emp1-01" : "gov2-01", + reportName: salaryPeriod.period == "APR" ? "emp1-01" : "gov2-01", + data: { + year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), + agency: agency, + data: formattedData, + }, + }); + } + /** + * API 02-รายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ครองตำแหน่ง + * + * @summary 02-รายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ครองตำแหน่ง + * + */ + @Get("emp2-02/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_2(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId, @@ -2998,13 +3067,1597 @@ export class ReportController extends Controller { }); } /** - * API 18-คำสั่ง + * API 03-รายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ได้รับการเสนอขอเลื่อนขั้นค่าจ้างรวมทั้งปีสองขั้น * - * @summary 18-คำสั่ง + * @summary 03-รายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ได้รับการเสนอขอเลื่อนขั้นค่าจ้างรวมทั้งปีสองขั้น * */ - @Get("emp-18/{rootId}/{salaryPeriodId}") - async SalaryReportEmp18(@Path() rootId: string, @Path() salaryPeriodId: string) { + @Get("emp2-03/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_3(@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 04-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้เลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.1) + * + * @summary 04-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้เลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.1) + * + */ + @Get("emp2-04/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_4(@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 05-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้รับค่าตอบแทนพิเศษ (แบบ ลจ.กทม.1/1) + * + * @summary 05-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้รับค่าตอบแทนพิเศษ (แบบ ลจ.กทม.1/1) + * + */ + @Get("emp2-05/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_5(@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 06-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่สมควรเลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.2) + * + * @summary 06-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่สมควรเลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.2) + * + */ + @Get("emp2-06/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_6(@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 07-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่สมควรได้รับค่าตอบแทนพิเศษ (แบบ ลจ.กทม.2/1) + * + * @summary 07-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่สมควรได้รับค่าตอบแทนพิเศษ (แบบ ลจ.กทม.2/1) + * + */ + @Get("emp2-07/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_7(@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 08-บัญชีแสดงวันลาในครึ่งปีที่แล้วมาของลูกจ้างประจำกรุงเทพมหานคร (แบบ ลจ.กทม.3) + * + * @summary 08-บัญชีแสดงวันลาในครึ่งปีที่แล้วมาของลูกจ้างประจำกรุงเทพมหานคร (แบบ ลจ.กทม.3) + * + */ + @Get("emp2-08/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_8(@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 09-รายชื่อลูกจ้างประจำกรุงเทพมหานครที่ครบเกษียณอายุราชการ + * + * @summary 09-รายชื่อลูกจ้างประจำกรุงเทพมหานครที่ครบเกษียณอายุราชการ + * + */ + @Get("emp2-09/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_9(@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("emp2-10/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_10(@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 11-รายชื่อลูกจ้างประจำผู้มีผลการประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานอยู่ในระดับดีเด่น + * + * @summary 11-รายชื่อลูกจ้างประจำผู้มีผลการประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานอยู่ในระดับดีเด่น + * + */ + @Get("emp2-11/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_11(@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 12-คำสั่งเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับที่เกษียณอายุราชการ + * + * @summary 12-คำสั่งเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับที่เกษียณอายุราชการ + * + */ + @Get("emp2-12/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_12(@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 13-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ที่เกษียณอายุราชการ + * + * @summary 13-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ที่เกษียณอายุราชการ + * + */ + @Get("emp2-13/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_13(@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 14-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับการเลื่อนขั้นค่าจ้างที่เกษียณอายุราชการ + * + * @summary 14-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับการเลื่อนขั้นค่าจ้างที่เกษียณอายุราชการ + * + */ + @Get("emp2-14/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_14(@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 15-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับค่าตอบแทนพิเศษที่เกษียณอายุราชการ + * + * @summary 15-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับค่าตอบแทนพิเศษที่เกษียณอายุราชการ + * + */ + @Get("emp2-15/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_15(@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 16-คำสั่งเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ + * + * @summary 16-คำสั่งเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ + * + */ + @Get("emp2-16/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_16(@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 17-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง) + * + * @summary 17-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง) + * + */ + @Get("emp2-17/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_17(@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 18-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับการเลื่อนขั้นค่าจ้าง + * + * @summary 18-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับการเลื่อนขั้นค่าจ้าง + * + */ + @Get("emp2-18/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_18(@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 19-คำสั่งให้ลูกจ้างประจำกรุงเทพมหานครได้รับค่าตอบแทนพิเศษ + * + * @summary 19-คำสั่งให้ลูกจ้างประจำกรุงเทพมหานครได้รับค่าตอบแทนพิเศษ + * + */ + @Get("emp2-19/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_19(@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 20-บัญชีรายละเอียดให้ลูกจ้างประจำกรุงเทพมหานครได้รับค่าตอบแทนพิเศษ (แนบท้ายคำสั่ง) + * + * @summary 20-บัญชีรายละเอียดให้ลูกจ้างประจำกรุงเทพมหานครได้รับค่าตอบแทนพิเศษ (แนบท้ายคำสั่ง) + * + */ + @Get("emp2-20/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_20(@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 21-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับค่าตอบแทนพิเศษ + * + * @summary 21-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้ไม่ได้รับค่าตอบแทนพิเศษ + * + */ + @Get("emp2-21/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_21(@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 22-คำสั่งแก้ไขคำสั่งเลื่อนขั้นค่าจ้างลูกจ้างประจำกรุงเทพมหานคร (เฉพาะราย) + * + * @summary 22-คำสั่งแก้ไขคำสั่งเลื่อนขั้นค่าจ้างลูกจ้างประจำกรุงเทพมหานคร (เฉพาะราย) + * + */ + @Get("emp2-22/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_22(@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 23-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง) + * + * @summary 23-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง) + * + */ + @Get("emp2-23/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_23(@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 24-คำสั่งยกเลิกคำสั่งเลื่อนขั้นค่าจ้างลูกจ้างประจำกรุงเทพมหานคร (เฉพาะราย) + * + * @summary 24-คำสั่งยกเลิกคำสั่งเลื่อนขั้นค่าจ้างลูกจ้างประจำกรุงเทพมหานคร (เฉพาะราย) + * + */ + @Get("emp2-24/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_24(@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 25-แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร + * + * @summary 25-แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร + * + */ + @Get("emp2-25/{rootId}/{salaryPeriodId}") + async SalaryReportEmp2_25(@Path() rootId: string, @Path() salaryPeriodId: string) { const salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { id: salaryPeriodId,