แก้บันทึกผลประวัติตำแหน่ง

This commit is contained in:
DESKTOP-2S5P7D1\Windows 10 2025-03-10 12:53:11 +07:00
parent 3db68cd99c
commit 1fe092da16

View file

@ -1096,7 +1096,7 @@ export class ReportController extends Controller {
// }, // },
// select: ["root"], // select: ["root"],
// }); // });
//รอบปีก่อนหน้า //รอบปีก่อนหน้า
const salaryPeriodIncrease2_APR = await this.salaryPeriodRepository.findOne({ const salaryPeriodIncrease2_APR = await this.salaryPeriodRepository.findOne({
where: { where: {
@ -1119,7 +1119,7 @@ export class ReportController extends Controller {
salaryPeriodId: salaryPeriodIncrease2_APR?.id, salaryPeriodId: salaryPeriodIncrease2_APR?.id,
// rootId: rootId, // rootId: rootId,
// root: rootName?.root, // root: rootName?.root,
rootId:salaryOrg?.rootDnaId, rootId: salaryOrg?.rootDnaId,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
@ -1133,7 +1133,7 @@ export class ReportController extends Controller {
salaryPeriodId: salaryPeriodIncrease2_OCT?.id, salaryPeriodId: salaryPeriodIncrease2_OCT?.id,
// rootId: rootId, // rootId: rootId,
// root: rootName?.root, // root: rootName?.root,
rootId:salaryOrg?.rootDnaId, rootId: salaryOrg?.rootDnaId,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
@ -1147,8 +1147,8 @@ export class ReportController extends Controller {
}, },
}); });
//รอบปีก่อนๆ //รอบปีก่อนๆ
const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({ const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({
where: { where: {
period: "APR", period: "APR",
year: salaryPeriod.year - 2, year: salaryPeriod.year - 2,
@ -1170,7 +1170,7 @@ export class ReportController extends Controller {
salaryPeriodId: salaryPeriodIncrease1_APR?.id, salaryPeriodId: salaryPeriodIncrease1_APR?.id,
// rootId: rootId, // rootId: rootId,
// root: rootName?.root, // root: rootName?.root,
rootId:salaryOrg2_APR?.rootDnaId, rootId: salaryOrg2_APR?.rootDnaId,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
@ -1184,7 +1184,7 @@ export class ReportController extends Controller {
salaryPeriodId: salaryPeriodIncrease1_OCT?.id, salaryPeriodId: salaryPeriodIncrease1_OCT?.id,
// rootId: rootId, // rootId: rootId,
// root: rootName?.root, // root: rootName?.root,
rootId:salaryOrg2_APR?.rootDnaId, rootId: salaryOrg2_APR?.rootDnaId,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
@ -2503,7 +2503,6 @@ export class ReportController extends Controller {
@Path() salaryPeriodId: string, @Path() salaryPeriodId: string,
@Path() group: string, @Path() group: string,
) { ) {
const salaryPeriod = await this.salaryPeriodRepository.findOne({ const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: { where: {
id: salaryPeriodId, id: salaryPeriodId,
@ -2577,53 +2576,53 @@ export class ReportController extends Controller {
const formattedData = salaryProfile.map((item, index) => ({ const formattedData = salaryProfile.map((item, index) => ({
no: Extension.ToThaiNumber(String(index + 1)), no: Extension.ToThaiNumber(String(index + 1)),
fullname: item.prefix + item.firstName + " " + item.lastName, fullname: item.prefix + item.firstName + " " + item.lastName,
root: item.root??"-", root: item.root ?? "-",
position: item.position??"-", position: item.position ?? "-",
posMasterNo: posMasterNo:
Extension.ToThaiNumber(item.orgShortName) + Extension.ToThaiNumber(String(item.posMasterNo)), Extension.ToThaiNumber(item.orgShortName) +
posTypeCurrent: item.posType??"-", Extension.ToThaiNumber(String(item.posMasterNo)),
posLevelCurrent: item.posLevel??"-", posTypeCurrent: item.posType ?? "-",
amountCurrent: item.amount? Extension.ToThaiNumber(item.amount.toLocaleString()):"-", posLevelCurrent: item.posLevel ?? "-",
posTypePrevious: salaryProfilePrevious.length > 0 amountCurrent: item.amount ? Extension.ToThaiNumber(item.amount.toLocaleString()) : "-",
? (() => { posTypePrevious:
const filteredType = salaryProfilePrevious salaryProfilePrevious.length > 0
.filter((profile) => profile.citizenId === item.citizenId) ? (() => {
.map((profile) => profile.posType); const filteredType = salaryProfilePrevious
const posType = filteredType[0]; .filter((profile) => profile.citizenId === item.citizenId)
return posType .map((profile) => profile.posType);
? posType : "-"; const posType = filteredType[0];
})() return posType ? posType : "-";
: "-", })()
posLevelPrevious: salaryProfilePrevious.length > 0 : "-",
? (() => { posLevelPrevious:
const filteredLevel = salaryProfilePrevious salaryProfilePrevious.length > 0
.filter((profile) => profile.citizenId === item.citizenId) ? (() => {
.map((profile) => profile.posLevel); const filteredLevel = salaryProfilePrevious
const posLevel = filteredLevel[0]; .filter((profile) => profile.citizenId === item.citizenId)
return posLevel .map((profile) => profile.posLevel);
? posLevel : "-"; const posLevel = filteredLevel[0];
})() return posLevel ? posLevel : "-";
: "-", })()
amountPrevious: salaryProfilePrevious.length > 0 : "-",
? (() => { amountPrevious:
const filteredAmount = salaryProfilePrevious salaryProfilePrevious.length > 0
.filter((profile) => profile.citizenId === item.citizenId) ? (() => {
.map((profile) => profile.amount); const filteredAmount = salaryProfilePrevious
const amount = filteredAmount[0]; .filter((profile) => profile.citizenId === item.citizenId)
return amount .map((profile) => profile.amount);
? Extension.ToThaiNumber(amount.toLocaleString()):"-" const amount = filteredAmount[0];
})() return amount ? Extension.ToThaiNumber(amount.toLocaleString()) : "-";
: "-", })()
deduction: "-", //เงินปรับลด : "-",
promote: item.amountUse?Extension.ToThaiNumber(item.amountUse.toLocaleString()):"-", //เงินเลื่อนขั้น deduction: "-", //เงินปรับลด
qualification: "-", //เงินปรับวุฒิ promote: item.amountUse ? Extension.ToThaiNumber(item.amountUse.toLocaleString()) : "-", //เงินเลื่อนขั้น
qualification: "-", //เงินปรับวุฒิ
adjustRate: "-", //เงินปรับอัตรา adjustRate: "-", //เงินปรับอัตรา
newRate: "-", //อัตราตั้งใหม่ newRate: "-", //อัตราตั้งใหม่
specialPromote: "-", //ลำดับการเลื่อนกรณีพิเศษ specialPromote: "-", //ลำดับการเลื่อนกรณีพิเศษ
remark: item.remark??"-", remark: item.remark ?? "-",
temporaryPayment: "-", //ถือจ่ายชั่วคราวขั้น temporaryPayment: "-", //ถือจ่ายชั่วคราวขั้น
})) }));
return new HttpSuccess({ return new HttpSuccess({
template: "gov2-10", template: "gov2-10",
@ -7984,11 +7983,11 @@ export class ReportController extends Controller {
positionLevel: salary.posLevel, positionLevel: salary.posLevel,
commandId: v.commandId, commandId: v.commandId,
remark: v.remark, remark: v.remark,
orgRoot: salary.root, orgRootName: salary.root,
orgChild1: salary.child1, orgChild1Name: salary.child1,
orgChild2: salary.child2, orgChild2Name: salary.child2,
orgChild3: salary.child3, orgChild3Name: salary.child3,
orgChild4: salary.child4, orgChild4Name: salary.child4,
commandCode: v.commandCode, commandCode: v.commandCode,
commandName: v.commandName, commandName: v.commandName,
commandNo: v.commandNo, commandNo: v.commandNo,
@ -8024,7 +8023,7 @@ export class ReportController extends Controller {
refId: string; refId: string;
// commandAffectDate: Date | null;//เก่า // commandAffectDate: Date | null;//เก่า
commandDateAffect: Date | null; //ใหม่ (ปรับตาม rabbitMQ ORG) commandDateAffect: Date | null; //ใหม่ (ปรับตาม rabbitMQ ORG)
commandDateSign?: Date | null commandDateSign?: Date | null;
commandNo: string | null; commandNo: string | null;
commandYear: number | null; commandYear: number | null;
commandId: string | null; commandId: string | null;
@ -8050,7 +8049,7 @@ export class ReportController extends Controller {
id: v.refId, id: v.refId,
}, },
}); });
if (salary != null) { if (salary != null) {
await new CallAPI() await new CallAPI()
.PostData(request, "/org/profile-employee/salary/update", { .PostData(request, "/org/profile-employee/salary/update", {
@ -8061,11 +8060,11 @@ export class ReportController extends Controller {
amountSpecial: v.amountSpecial, amountSpecial: v.amountSpecial,
positionSalaryAmount: v.positionSalaryAmount, positionSalaryAmount: v.positionSalaryAmount,
mouthSalaryAmount: v.mouthSalaryAmount, mouthSalaryAmount: v.mouthSalaryAmount,
posNo: salary.posMasterNo != null?salary.posMasterNo.toString():null, posNo: salary.posMasterNo != null ? salary.posMasterNo.toString() : null,
posNoAbb: salary.orgShortName, posNoAbb: salary.orgShortName,
positionName: salary.position, positionName: salary.position,
positionType: salary.posType, positionType: salary.posType,
positionLevel: salary.posLevel != null?salary.posLevel.toString():null, positionLevel: salary.posLevel != null ? salary.posLevel.toString() : null,
remark: v.remark, remark: v.remark,
orgRoot: salary.root, orgRoot: salary.root,
orgChild1: salary.child1, orgChild1: salary.child1,