ปรับออกคำสั่งลงตำแหน่ง

This commit is contained in:
kittapath 2025-02-21 19:10:27 +07:00
parent c5e0fcc4f7
commit e305ea7a88
20 changed files with 1317 additions and 1183 deletions

View file

@ -133,7 +133,7 @@ export class ProfileEmployeeTempController extends Controller {
where: { id: id },
order: {
profileSalary: {
date: "DESC",
commandDateAffect: "DESC",
},
},
});
@ -224,38 +224,40 @@ export class ProfileEmployeeTempController extends Controller {
const salary_raw = await this.salaryRepo.find({
select: [
"date",
"position",
"commandDateAffect",
"positionName",
"posNo",
"positionType",
"positionLevel",
"positionSalaryAmount",
"refCommandNo",
"commandNo",
"amount",
"templateDoc",
"remark",
"orgRoot",
"orgChild1",
"orgChild2",
"orgChild3",
"orgChild4",
"mpCee",
"positionCee",
"positionExecutive",
],
where: { profileEmployeeId: id },
order: { date: "ASC" },
order: { commandDateAffect: "ASC" },
});
const salarys =
salary_raw.length > 1
? salary_raw.slice(1).map((item) => ({
date: item.date ? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) : null,
position: item.position != null ? item.position : "-",
date: item.commandDateAffect
? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.commandDateAffect))
: null,
position: item.positionName != null ? item.positionName : "-",
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
orgRoot: item.orgRoot,
orgChild1: item.orgChild1,
orgChild2: item.orgChild2,
orgChild3: item.orgChild3,
orgChild4: item.orgChild4,
mpCee: item.mpCee,
positionCee: item.positionCee,
positionExecutive: item.positionExecutive,
}))
: [
@ -268,7 +270,7 @@ export class ProfileEmployeeTempController extends Controller {
orgChild2: null,
orgChild3: null,
orgChild4: null,
mpCee: null,
positionCee: null,
positionExecutive: null,
},
];
@ -316,8 +318,8 @@ export class ProfileEmployeeTempController extends Controller {
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
),
date:
salary_raw.length > 0 && salary_raw[0].date != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(salary_raw[0].date))
salary_raw.length > 0 && salary_raw[0].commandDateAffect != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate(salary_raw[0].commandDateAffect))
: "",
positionName: profile.position != null ? profile.position : "",
appointText:
@ -329,12 +331,12 @@ export class ProfileEmployeeTempController extends Controller {
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].posNo))
: "",
position:
salary_raw.length > 0 && salary_raw[0].position != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].position))
salary_raw.length > 0 && salary_raw[0].positionName != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].positionName))
: "",
mpCee:
salary_raw.length > 0 && salary_raw[0].mpCee != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].mpCee))
positionCee:
salary_raw.length > 0 && salary_raw[0].positionCee != null
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].positionCee))
: "",
positionExecutive:
salary_raw.length > 0 && salary_raw[0].positionExecutive != null
@ -366,8 +368,10 @@ export class ProfileEmployeeTempController extends Controller {
salarys: salarys.map((item) => {
return {
...item,
mpCee:
item.mpCee == null ? "" : Extension.ToThaiNumber(Extension.ToThaiNumber(item.mpCee)),
positionCee:
item.positionCee == null
? ""
: Extension.ToThaiNumber(Extension.ToThaiNumber(item.positionCee)),
org: `${item.orgChild4 && item.orgChild4 != "-" ? item.orgChild4 + " " : ""}${item.orgChild3 && item.orgChild3 != "-" ? item.orgChild3 + " " : ""}${item.orgChild2 && item.orgChild2 != "-" ? item.orgChild2 + " " : ""}${item.orgChild1 && item.orgChild1 != "-" ? item.orgChild1 + " " : ""}${item.orgRoot && item.orgRoot != "-" ? item.orgRoot + " " : ""}`,
};
}),
@ -638,15 +642,15 @@ export class ProfileEmployeeTempController extends Controller {
];
const salary_raw = await this.salaryRepo.find({
select: [
"date",
"position",
"commandDateAffect",
"positionName",
"posNo",
"positionType",
"positionLevel",
"positionSalaryAmount",
"refCommandNo",
"commandNo",
"amount",
"templateDoc",
"remark",
],
where: { profileEmployeeId: id },
order: { order: "ASC" },
@ -655,15 +659,15 @@ export class ProfileEmployeeTempController extends Controller {
const salarys =
salary_raw.length > 0
? salary_raw.map((item) => ({
SalaryDate: item.date
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date))
SalaryDate: item.commandDateAffect
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
: null,
Position: item.position != null ? Extension.ToThaiNumber(item.position) : null,
Position: item.positionName != null ? Extension.ToThaiNumber(item.positionName) : null,
PosNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
Salary:
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
Rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
RefAll: item.templateDoc ? Extension.ToThaiNumber(item.templateDoc) : null,
RefAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
PositionLevel:
item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
PositionType: item.positionType ?? null,
@ -1820,16 +1824,18 @@ export class ProfileEmployeeTempController extends Controller {
let profileSalary;
if (profile.profileSalary && profile.profileSalary.length > 0) {
profileSalary = profile.profileSalary.reduce((latest, current) => {
return new Date(current.date) > new Date(latest.date) ? current : latest;
return new Date(current.commandDateAffect) > new Date(latest.commandDateAffect)
? current
: latest;
});
}
return {
id: profile.id,
fullName: `${profile.prefix}${profile.firstName} ${profile.lastName}`,
citizenId: profile.citizenId,
position: profileSalary ? profileSalary.position : null,
position: profileSalary ? profileSalary.positionName : null,
posNo: profileSalary ? profileSalary.posNo : null,
date: profileSalary ? profileSalary.date : null,
date: profileSalary ? profileSalary.commandDateAffect : null,
};
});
@ -3482,7 +3488,7 @@ export class ProfileEmployeeTempController extends Controller {
body: {
result: {
id: string;
templateDoc: string;
remark: string;
amount: Double | null;
positionSalaryAmount: Double | null;
mouthSalaryAmount: Double | null;
@ -3513,7 +3519,7 @@ export class ProfileEmployeeTempController extends Controller {
positionType: profile.posTypeNameTemp,
positionLevel: profile.posLevelNameTemp,
refCommandNo: v.refCommandNo,
templateDoc: v.templateDoc,
remark: v.remark,
})
.then(async () => {
profile.statusTemp = "DONE";