diff --git a/src/controllers/ReportController.ts b/src/controllers/ReportController.ts index e513f2a..dac6bc1 100644 --- a/src/controllers/ReportController.ts +++ b/src/controllers/ReportController.ts @@ -1043,9 +1043,9 @@ export class ReportController extends Controller { } /** - * API รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น รอบเมษายน และตุลาคม + * API รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น รอบเมษายน และทั้งปีสองขั้น รอบตุลาคม * - * @summary รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น รอบเมษายน และตุลาคม + * @summary รายชื่อข้าราชการที่ได้รับการเสนอขอเลื่อนหนึ่งขั้น รอบเมษายน และทั้งปีสองขั้น รอบตุลาคม * * @param {string} rootId Guid, *Id Root * @param {string} salaryPeriodId Guid, *Id Period @@ -1144,13 +1144,13 @@ export class ReportController extends Controller { const salaryProfile1_Group1 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg1_APR_Group1?.id, salaryOrg1_OCT_Group1?.id]), - type: "FULL", + // type: "FULL", }, }); const salaryProfile1_Group2 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg1_APR_Group2?.id, salaryOrg1_OCT_Group2?.id]), - type: "FULL", + // type: "FULL", }, }); @@ -1204,13 +1204,13 @@ export class ReportController extends Controller { const salaryProfile2_Group1 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg2_APR_Group1?.id, salaryOrg2_OCT_GROUP1?.id]), - type: "FULL", + // type: "FULL", }, }); const salaryProfile2_Group2 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg2_APR_Group2?.id, salaryOrg2_OCT_GROUP2?.id]), - type: "FULL", + // type: "FULL", }, }); const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))); @@ -1272,27 +1272,23 @@ export class ReportController extends Controller { salaryIncrease1: salaryProfile1_Group1.length > 0 ? (() => { - const filteredAmount = salaryProfile1_Group1 + const filteredType = salaryProfile1_Group1 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนๆหน้า + : null, //การเลื่อนเงินเดือนปีก่อนๆหน้า salaryIncrease2: salaryProfile2_Group1.length > 0 ? (() => { - const filteredAmount = salaryProfile2_Group1 + const filteredType = salaryProfile2_Group1 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนหน้า + : null, //การเลื่อนเงินเดือนปีก่อนหน้า score: null, //ผลการประเมินฯ remark: null, //หมายเหตุ })), @@ -1320,27 +1316,23 @@ export class ReportController extends Controller { salaryIncrease1: salaryProfile1_Group2.length > 0 ? (() => { - const filteredAmount = salaryProfile1_Group2 + const filteredType = salaryProfile1_Group2 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนๆหน้า + : null, //การเลื่อนเงินเดือนปีก่อนๆหน้า salaryIncrease2: salaryProfile2_Group2.length > 0 ? (() => { - const filteredAmount = salaryProfile2_Group2 + const filteredType = salaryProfile2_Group2 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนหน้า + : null, //การเลื่อนเงินเดือนปีก่อนหน้า score: null, //ผลการประเมินฯ remark: null, //หมายเหตุ })), @@ -1374,13 +1366,13 @@ export class ReportController extends Controller { const salaryProfile_APR_Group1 = await this.salaryProfileRepository.find({ where: { salaryOrgId: salaryOrg_APR_Group1?.id, - type: In(["HAFT", "FULL"]), + // type: In(["HAFT", "FULL"]), }, }); const salaryProfile_APR_Group2 = await this.salaryProfileRepository.find({ where: { salaryOrgId: salaryOrg_APR_Group2?.id, - type: In(["HAFT", "FULL"]), + // type: In(["HAFT", "FULL"]), }, }); //end period APR @@ -1448,13 +1440,13 @@ export class ReportController extends Controller { const salaryProfile1_Group1 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg1_APR_Group1?.id, salaryOrg1_OCT_Group1?.id]), - type: "FULL", + // type: "FULL", }, }); const salaryProfile1_Group2 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg1_APR_Group2?.id, salaryOrg1_OCT_Group2?.id]), - type: "FULL", + // type: "FULL", }, }); @@ -1508,13 +1500,13 @@ export class ReportController extends Controller { const salaryProfile2_Group1 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg2_APR_Group1?.id, salaryOrg2_OCT_GROUP1?.id]), - type: "FULL", + // type: "FULL", }, }); const salaryProfile2_Group2 = await this.salaryProfileRepository.find({ where: { salaryOrgId: In([salaryOrg2_APR_Group2?.id, salaryOrg2_OCT_GROUP2?.id]), - type: "FULL", + // type: "FULL", }, }); const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))); @@ -1576,40 +1568,34 @@ export class ReportController extends Controller { salaryIncrease1: salaryProfile1_Group1.length > 0 ? (() => { - const filteredAmount = salaryProfile1_Group1 + const filteredType = salaryProfile1_Group1 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : Type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนๆหน้า + : null, //การเลื่อนเงินเดือนปีก่อนๆหน้า salaryIncrease2: salaryProfile2_Group1.length > 0 ? (() => { - const filteredAmount = salaryProfile2_Group1 + const filteredType = salaryProfile2_Group1 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : Type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนหน้า + : null, //การเลื่อนเงินเดือนปีก่อนหน้า salaryIncreaseAPR: salaryProfile_APR_Group1.length > 0 - ? (() => { - const filteredAmount = salaryProfile_APR_Group1 - .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" ? "หนึ่งขั้น" : "หนึ่งขั้นครึ่ง", + ? (() => { + const filteredType = salaryProfile_APR_Group1 + .filter((profile) => profile.citizenId === item.citizenId) + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : Type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : "ไม่ได้เลื่อนขั้น" + })() + : null, //การเลื่อนเงินเดือนรอบเมษา + Type: item.type === "FULL" ? "หนึ่งขั้น" : item.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : null, score1: null, //ผลการประเมินฯ ครั้งที่ 1 score2: null, //ผลการประเมินฯ ครั้งที่ 2 })), @@ -1637,40 +1623,34 @@ export class ReportController extends Controller { salaryIncrease1: salaryProfile1_Group2.length > 0 ? (() => { - const filteredAmount = salaryProfile1_Group2 + const filteredType = salaryProfile1_Group2 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : Type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนๆหน้า + : null, //การเลื่อนเงินเดือนปีก่อนๆหน้า salaryIncrease2: salaryProfile2_Group2.length > 0 ? (() => { - const filteredAmount = salaryProfile2_Group2 + const filteredType = salaryProfile2_Group2 .filter((profile) => profile.citizenId === item.citizenId) - .map((profile) => profile.amount); - const Amount = filteredAmount[0]; - return Amount === undefined || Amount === null - ? "๐" - : Extension.ToThaiNumber(Amount?.toLocaleString()); + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : Type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : "ไม่ได้เลื่อนขั้น" })() - : "๐", //การเลื่อนเงินเดือนปีก่อนหน้า + : null, //การเลื่อนเงินเดือนปีก่อนหน้า salaryIncreaseAPR: salaryProfile_APR_Group2.length > 0 - ? (() => { - const filteredAmount = salaryProfile_APR_Group2 - .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" ? "หนึ่งขั้น" : "หนึ่งขั้นครึ่ง", + ? (() => { + const filteredType = salaryProfile_APR_Group2 + .filter((profile) => profile.citizenId === item.citizenId) + .map((profile) => profile.type); + const Type = filteredType[0]; + return Type === "HAFT" ? "ครึ่งขั้น" : Type === "FULL" ? "หนึ่งขั้น" : Type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : "ไม่ได้เลื่อนขั้น" + })() + : null, //การเลื่อนเงินเดือนรอบเมษา + Type: item.type === "FULL" ? "หนึ่งขั้น" : item.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : null, score1: null, //ผลการประเมินฯ ครั้งที่ 1 score2: null, //ผลการประเมินฯ ครั้งที่ 2 })),