เพิ่มเวลาลูกจ้าง

This commit is contained in:
kittapath 2024-11-07 15:55:23 +07:00
parent b1c365a4da
commit 2c1e1dd8ff
9 changed files with 390 additions and 244 deletions

View file

@ -252,9 +252,8 @@ export class ProfileController extends Controller {
profile.dateRetire != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
: "-",
salaryAmount: profile.amount != null
? Extension.ToThaiNumber(profile.amount.toLocaleString())
: "-",
salaryAmount:
profile.amount != null ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
registrationAddress: Extension.ToThaiNumber(
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
),
@ -1911,21 +1910,21 @@ export class ProfileController extends Controller {
// const posType = await this.posTypeRepo.findOneBy({ id: String(profile.posTypeId) })
// const posLevel = await this.posLevelRepo.findOneBy({ id: String(profile.posLevelId) })
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -1935,13 +1934,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
if (profile.isProbation != false) {
profile.isProbation = false;
profile.lastUpdateUserId = req.user.sub;
@ -1956,12 +1957,12 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount:profile.positionSalaryAmount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
@ -1999,7 +2000,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2026,21 +2027,21 @@ export class ProfileController extends Controller {
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2050,13 +2051,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2065,7 +2068,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2109,7 +2112,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2135,21 +2138,21 @@ export class ProfileController extends Controller {
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2159,13 +2162,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2174,7 +2179,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2218,7 +2223,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2244,21 +2249,21 @@ export class ProfileController extends Controller {
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2268,13 +2273,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2283,7 +2290,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2343,7 +2350,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2369,21 +2376,21 @@ export class ProfileController extends Controller {
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2393,13 +2400,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2408,7 +2417,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2452,7 +2461,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2477,21 +2486,21 @@ export class ProfileController extends Controller {
_profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2501,13 +2510,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2516,7 +2527,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2560,7 +2571,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2579,21 +2590,21 @@ export class ProfileController extends Controller {
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2603,13 +2614,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2618,7 +2631,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2661,7 +2674,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2680,21 +2693,21 @@ export class ProfileController extends Controller {
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2704,13 +2717,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2719,7 +2734,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2762,7 +2777,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2781,21 +2796,21 @@ export class ProfileController extends Controller {
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2805,14 +2820,16 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2821,7 +2838,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2864,7 +2881,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2883,21 +2900,21 @@ export class ProfileController extends Controller {
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -2907,13 +2924,15 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -2922,7 +2941,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -2965,7 +2984,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary","posType","posLevel"],
relations: ["profileSalary", "posType", "posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2984,21 +3003,21 @@ export class ProfileController extends Controller {
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
where: {
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
orgRevisionIsDraft: false,
},
});
const shortName =
!profile.current_holders || profile.current_holders.length == 0
!profile.current_holders || profile.current_holders.length == 0
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild3 != null
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3 !=
null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
@ -3008,14 +3027,16 @@ export class ProfileController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) !=
null &&
: profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)
?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.posMasterNo}`
: null;
let position = profile.current_holders.filter((x) => x.orgRevisionId == orgRevision?.id)[0]?.positions?.filter((pos) => pos.positionIsSelected === true)[0]?? null;
let position =
profile.current_holders
.filter((x) => x.orgRevisionId == orgRevision?.id)[0]
?.positions?.filter((pos) => pos.positionIsSelected === true)[0] ?? null;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
@ -3024,7 +3045,7 @@ export class ProfileController extends Controller {
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
posNo: shortName ? shortName : "-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
@ -4413,10 +4434,10 @@ export class ProfileController extends Controller {
"posType",
"current_holders",
"current_holders.orgRoot",
"profileSalarys",
"profileSalary",
],
order: {
profileSalarys: {
profileSalary: {
order: "DESC",
},
},
@ -4545,23 +4566,28 @@ export class ProfileController extends Controller {
nodeId: null,
type: profile.employeeClass,
salary:
profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null,
profile && profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
};
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeShortName = _profile.child4ShortName;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeShortName = _profile.child3ShortName;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeShortName = _profile.child2ShortName;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeShortName = _profile.child1ShortName;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeShortName = _profile.rootShortName;
}
return new HttpSuccess(_profile);
}
@ -4679,24 +4705,29 @@ export class ProfileController extends Controller {
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
nodeId: null,
salary: profile ? profile.amount: null,
salary: profile ? profile.amount : null,
};
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeShortName = _profile.child4ShortName;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeShortName = _profile.child3ShortName;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeShortName = _profile.child2ShortName;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeShortName = _profile.child1ShortName;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeShortName = _profile.rootShortName;
}
return new HttpSuccess(_profile);
}
@ -5209,18 +5240,23 @@ export class ProfileController extends Controller {
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeShortName = _profile.child4ShortName;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeShortName = _profile.child3ShortName;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeShortName = _profile.child2ShortName;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeShortName = _profile.child1ShortName;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeShortName = _profile.rootShortName;
}
return new HttpSuccess(_profile);
}
@ -5424,7 +5460,7 @@ export class ProfileController extends Controller {
posNo: shortName,
isPosmasterAct: data.length > 0,
posmasterAct: data,
salary: profile ? profile.amount: null,
salary: profile ? profile.amount : null,
};
if (_profile.child4Id != null) {
@ -5578,7 +5614,7 @@ export class ProfileController extends Controller {
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
nodeId: null,
amount: profile ? profile.amount : null,
amount: profile ? profile.amount : null,
positionSalaryAmount: profile ? profile.positionSalaryAmount : null,
mouthSalaryAmount: profile ? profile.mouthSalaryAmount : null,
};
@ -5707,18 +5743,23 @@ export class ProfileController extends Controller {
if (_profile.child4Id != null) {
_profile.node = 4;
_profile.nodeId = _profile.child4Id;
_profile.nodeShortName = _profile.child4ShortName;
} else if (_profile.child3Id != null) {
_profile.node = 3;
_profile.nodeId = _profile.child3Id;
_profile.nodeShortName = _profile.child3ShortName;
} else if (_profile.child2Id != null) {
_profile.node = 2;
_profile.nodeId = _profile.child2Id;
_profile.nodeShortName = _profile.child2ShortName;
} else if (_profile.child1Id != null) {
_profile.node = 1;
_profile.nodeId = _profile.child1Id;
_profile.nodeShortName = _profile.child1ShortName;
} else if (_profile.rootId != null) {
_profile.node = 0;
_profile.nodeId = _profile.rootId;
_profile.nodeShortName = _profile.rootShortName;
}
return new HttpSuccess(_profile);
}