fix เอกสาร กพ.7/กก.1 #1642

This commit is contained in:
Bright 2025-07-23 15:07:59 +07:00
parent ee2221b719
commit acfac64f9c
6 changed files with 1451 additions and 39 deletions

View file

@ -1107,12 +1107,14 @@ export class ProfileEmployeeController extends Controller {
: null,
disciplineDetail: item.detail ?? null,
refNo: Extension.ToThaiNumber(item.refCommandNo) ?? null,
level: item.level ?? ""
}))
: [
{
disciplineYear: "-",
disciplineDetail: "-",
refNo: "-",
level: "-"
},
];
@ -1139,20 +1141,6 @@ export class ProfileEmployeeController extends Controller {
},
];
const salary_raw = await this.salaryRepo.find({
select: [
"commandDateAffect",
"positionName",
"posNoAbb",
"posNo",
"positionType",
"positionLevel",
"positionSalaryAmount",
"commandNo",
"positionCee",
"amount",
"amountSpecial",
"remark",
],
where: {
profileEmployeeId: id,
commandCode: In(["5", "6"]),
@ -1164,6 +1152,7 @@ export class ProfileEmployeeController extends Controller {
const salarys =
salary_raw.length > 0
? salary_raw.map((item) => ({
commandName: item.commandName ?? "",
salaryDate: item.commandDateAffect
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
: null,
@ -1198,6 +1187,7 @@ export class ProfileEmployeeController extends Controller {
}))
: [
{
commandName: "-",
salaryDate: "-",
position: "-",
posNo: "-",
@ -1403,6 +1393,26 @@ export class ProfileEmployeeController extends Controller {
},
];
const profileHistory = await this.profileHistoryRepo.find({
where: { profileEmployeeId: id },
order: { createdAt: "ASC" },
});
const history = profileHistory.length > 0
? profileHistory.map(item => ({
birthDateOld: item.birthDateOld
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.birthDateOld))
: "",
birthDate: item.birthDate
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.birthDate))
: "",
}))
: [
{
birthDateOld: "-",
birthDate: "-",
}
]
const position_raw = await this.salaryRepo.find({
where: {
profileEmployeeId: id,
@ -1414,6 +1424,7 @@ export class ProfileEmployeeController extends Controller {
const positionList =
position_raw.length > 0
? position_raw.map((item) => ({
commandName: item.commandName ?? "",
commandDateAffect: item.commandDateAffect
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
: "",
@ -1422,7 +1433,7 @@ export class ProfileEmployeeController extends Controller {
: "",
posNo:
item.posNoAbb && item.posNo
? Extension.ToThaiNumber(`${item.posNoAbb}${item.posNo}`)
? Extension.ToThaiNumber(`${item.posNoAbb} ${item.posNo}`)
: "",
position: item.positionName,
posType: item.positionType,
@ -1438,6 +1449,7 @@ export class ProfileEmployeeController extends Controller {
}))
: [
{
commandName: "-",
commandDateAffect: "-",
commandDateSign: "-",
posNo: "-",
@ -1548,6 +1560,15 @@ export class ProfileEmployeeController extends Controller {
: "",
pointSum: item.pointSum ? Extension.ToThaiNumber(item.pointSum.toString()) : "",
pointSumTh: item.pointSum ? Extension.textPoint(item.pointSum) : "",
level: item.pointSum < 60.00
? "ต้องปรับปรุง (คะแนนต่ำกว่าร้อยละ ๖๐.)"
: item.pointSum <= 69.99 && item.pointSum >= 60.00
? "พอใช้ (คะแนนร้อยละ ๖๐. - ๖๙.๙๙)"
: item.pointSum <= 79.99 && item.pointSum >= 70.00
? "ดี (คะแนนร้อยละ ๗๐. - ๗๙.๙๙)"
: item.pointSum <= 89.99 && item.pointSum >= 80.00
? "ดีมาก (คะแนนร้อยละ ๘๐. - ๘๙.๙๙)"
: "ดีเด่น (คะแนนร้อยละ ๙๐. ขึ้นไป)"
}))
: [
{
@ -1587,6 +1608,7 @@ export class ProfileEmployeeController extends Controller {
const otherIncome =
otherIncome_raw.length > 0
? otherIncome_raw.map((item) => ({
commandName: item.commandName ?? "",
commandDateAffect: item.commandDateAffect
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
: "",
@ -1604,6 +1626,7 @@ export class ProfileEmployeeController extends Controller {
}))
: [
{
commandName: "-",
commandDateAffect: "-",
commandDateSign: "-",
commandNo: "-",
@ -1759,6 +1782,7 @@ export class ProfileEmployeeController extends Controller {
? Extension.ToThaiNumber(profiles.registrationZipCode)
: "",
fullRegistrationAddress: fullRegistrationAddress,
updateAt: Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.lastUpdatedAt)),
telephone: profiles.phone != null ? Extension.ToThaiNumber(profiles.phone) : "",
url: ImgUrl ? ImgUrl : `${process.env.VITE_URL_MGT}`,
url1: _ImgUrl[0] ? _ImgUrl[0] : null,
@ -1800,6 +1824,7 @@ export class ProfileEmployeeController extends Controller {
educations,
salarys,
changeName,
history,
positionList,
actposition,
duty,
@ -1981,6 +2006,7 @@ export class ProfileEmployeeController extends Controller {
await this.profileHistoryRepo.save(
Object.assign(new ProfileEmployeeHistory(), {
...record,
birthDateOld: _record?.birthDate,
lastUpdateUserId: request.user.sub,
lastUpdateFullName: request.user.name,
lastUpdatedAt: new Date(),