Merge branch 'develop' into adiDev
This commit is contained in:
commit
1a9b60dc7b
4 changed files with 223 additions and 68 deletions
|
|
@ -1529,9 +1529,9 @@ export class ReportController extends Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* API แบบ 1 กท บัญชีรายชื่อผู้สมควรได้เลื่อนเงินเดือน รอบเมษายน
|
||||
* API แบบ 1 กท บัญชีรายชื่อผู้สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม
|
||||
*
|
||||
* @summary แบบ 1 กท บัญชีรายชื่อผู้สมควรได้เลื่อนเงินเดือน รอบเมษายน
|
||||
* @summary แบบ 1 กท บัญชีรายชื่อผู้สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม
|
||||
*
|
||||
* @param {string} rootId Guid, *Id Root
|
||||
* @param {string} salaryPeriodId Guid, *Id Period
|
||||
|
|
@ -1557,6 +1557,7 @@ export class ReportController extends Controller {
|
|||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
type: "NONE", //ไม่ได้เลื่อน
|
||||
isReserve: false //กรองเฉพาะคนที่ไม่เกษียณ
|
||||
},
|
||||
order: {
|
||||
salaryOrg: {
|
||||
|
|
@ -1624,9 +1625,105 @@ export class ReportController extends Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* API แบบ 2 กท บัญชีรายชื่อผู้ไม่สมควรได้เลื่อนเงินเดือน รอบเมษายน
|
||||
* API แบบ 1 กท บัญชีรายชื่อผู้สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม (เกษียณอายุราชการ)
|
||||
*
|
||||
* @summary แบบ 2 กท บัญชีรายชื่อผู้ไม่สมควรได้เลื่อนเงินเดือน รอบเมษายน
|
||||
* @summary แบบ 1 กท บัญชีรายชื่อผู้สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม (เกษียณอายุราชการ)
|
||||
*
|
||||
* @param {string} rootId Guid, *Id Root
|
||||
* @param {string} salaryPeriodId Guid, *Id Period
|
||||
*/
|
||||
@Get("gov-04-01/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReport4Retire(@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: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
type: "NONE", //ไม่ได้เลื่อน
|
||||
isReserve: true //กรองเฉพาะคนที่เกษียณ
|
||||
},
|
||||
order: {
|
||||
salaryOrg: {
|
||||
group: "ASC",
|
||||
},
|
||||
type: "DESC",
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
return {
|
||||
no: Extension.ToThaiNumber(String(index + 1)),
|
||||
fullname: profile.prefix + profile.firstName + " " + profile.lastName,
|
||||
log_group: profile.salaryOrg.group,
|
||||
log_type: profile.type,
|
||||
log_isNext: profile.isNext,
|
||||
position:
|
||||
profile.position +
|
||||
"/" +
|
||||
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
|
||||
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
|
||||
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
|
||||
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
|
||||
(profile.root == undefined && profile.root == null ? "" : profile.root),
|
||||
posLevel: profile.posLevel,
|
||||
orgShortName: profile.orgShortName + Extension.ToThaiNumber(String(profile.posMasterNo)),
|
||||
amount:
|
||||
profile.amount == undefined || profile.amount == null || profile.amount == 0
|
||||
? ""
|
||||
: Extension.ToThaiNumber(String(profile.amount)),
|
||||
amountSpecial:
|
||||
(profile.positionSalaryAmount == undefined ||
|
||||
profile.positionSalaryAmount == null ||
|
||||
profile.positionSalaryAmount == 0
|
||||
? ""
|
||||
: Extension.ToThaiNumber(String(profile.positionSalaryAmount))) +
|
||||
(profile.amountSpecial == undefined ||
|
||||
profile.amountSpecial == null ||
|
||||
profile.amountSpecial == 0
|
||||
? ""
|
||||
: `(${Extension.ToThaiNumber(String(profile.amountSpecial))})`),
|
||||
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-04" : "gov2-04",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-04" : "gov2-04",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
effectiveDate: salaryPeriod.effectiveDate,
|
||||
root: agency,
|
||||
profile: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API แบบ 2 กท บัญชีรายชื่อผู้ไม่สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม
|
||||
*
|
||||
* @summary แบบ 2 กท บัญชีรายชื่อผู้ไม่สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม
|
||||
*
|
||||
* @param {string} rootId Guid, *Id Root
|
||||
* @param {string} salaryPeriodId Guid, *Id Period
|
||||
|
|
@ -1652,6 +1749,87 @@ export class ReportController extends Controller {
|
|||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
type: "NONE", //ไม่ได้เลื่อน
|
||||
isReserve: false //กรองเฉพาะคนที่ไม่เกษียณ
|
||||
},
|
||||
order: {
|
||||
salaryOrg: {
|
||||
group: "ASC",
|
||||
},
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.position,
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
];
|
||||
|
||||
const position = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullname: profile.prefix + profile.firstName + " " + profile.lastName,
|
||||
position: position,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
score: null, //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-05" : "gov2-05",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-05" : "gov2-05",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API แบบ 2 กท บัญชีรายชื่อผู้ไม่สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม (เกษียณอายุราชการ)
|
||||
*
|
||||
* @summary แบบ 2 กท บัญชีรายชื่อผู้ไม่สมควรได้เลื่อนเงินเดือน รอบเมษายน และ ตุลาคม (เกษียณอายุราชการ)
|
||||
*
|
||||
* @param {string} rootId Guid, *Id Root
|
||||
* @param {string} salaryPeriodId Guid, *Id Period
|
||||
*/
|
||||
@Get("gov-05-01/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReport5retire(@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: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
type: "NONE", //ไม่ได้เลื่อน
|
||||
isReserve: true //กรองเฉพาะคนที่เกษียณ
|
||||
},
|
||||
order: {
|
||||
salaryOrg: {
|
||||
|
|
@ -3044,11 +3222,11 @@ export class ReportController extends Controller {
|
|||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
: null,
|
||||
precentTwo:
|
||||
profile.positionSalaryAmountPer == 0.2
|
||||
profile.positionSalaryAmountPer == 0.02
|
||||
? profile.positionSalaryAmount * profile.positionSalaryAmountPer
|
||||
: null, //ร้อยละ 2
|
||||
precentFour:
|
||||
profile.positionSalaryAmountPer == 0.4
|
||||
profile.positionSalaryAmountPer == 0.04
|
||||
? profile.positionSalaryAmount * profile.positionSalaryAmountPer
|
||||
: null, //ร้อยละ 4
|
||||
reason: null, // หมายเหตุ
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue