Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

This commit is contained in:
kittapath 2024-11-07 13:48:43 +07:00
commit e701287969
2 changed files with 636 additions and 289 deletions

View file

@ -2313,7 +2313,7 @@ export class CommandController extends Controller {
await Promise.all(
body.data.map(async (item) => {
const profile = await this.profileRepository.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posLevel","posType","current_holders"],
where: { id: item.profileId },
order: {
profileSalary: {
@ -2324,7 +2324,38 @@ export class CommandController extends Controller {
if (!profile) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
}
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
// ประวัติตำแหน่ง
const data = new ProfileSalary();
const meta = {
@ -2333,18 +2364,13 @@ export class CommandController extends Controller {
date: item.date,
refCommandNo: item.refCommandNo,
templateDoc: item.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: item.amount ? item.amount : null,
positionSalaryAmount: item.positionSalaryAmount ? item.positionSalaryAmount : null,
mouthSalaryAmount: item.mouthSalaryAmount ? item.mouthSalaryAmount : null,
@ -2449,7 +2475,7 @@ export class CommandController extends Controller {
await Promise.all(
body.data.map(async (item) => {
const profile = await this.profileRepository.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: item.profileId },
order: {
profileSalary: {
@ -2461,6 +2487,39 @@ export class CommandController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลทะเบียนประวัตินี้");
}
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
// ประวัติตำแหน่ง
const data = new ProfileSalary();
const meta = {
@ -2469,18 +2528,13 @@ export class CommandController extends Controller {
refCommandNo: item.refCommandNo,
templateDoc: item.salaryRef,
commandId: item.commandId,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: item.amount ? item.amount : null,
positionSalaryAmount: item.positionSalaryAmount ? item.positionSalaryAmount : null,
mouthSalaryAmount: item.mouthSalaryAmount ? item.mouthSalaryAmount : null,
@ -2497,7 +2551,6 @@ export class CommandController extends Controller {
createdAt: new Date(),
lastUpdatedAt: new Date(),
};
Object.assign(data, meta);
const history = new ProfileSalaryHistory();
Object.assign(history, { ...data, id: undefined });
@ -2543,7 +2596,7 @@ export class CommandController extends Controller {
await Promise.all(
body.data.map(async (item) => {
const profile = await this.profileRepository.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel",'current_holders','current_holders.positions','current_holders.positions.posExecutive'],
where: { id: item.profileId },
order: {
profileSalary: {
@ -2561,7 +2614,6 @@ export class CommandController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = item.date;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason =
"คำสั่งให้ข้าราชการออกจากราชการเพราะผลการทดลองปฏิบัติหน้าที่ราชการต่ำกว่ามาตรฐานที่กำหนด";
@ -2569,24 +2621,52 @@ export class CommandController extends Controller {
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: item.profileId,
date: item.date,
refCommandNo: item.refCommandNo,
templateDoc: item.salaryRef,
commandId: item.commandId,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName,
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: item.amount ? item.amount : null,
positionSalaryAmount: item.positionSalaryAmount ? item.positionSalaryAmount : null,
mouthSalaryAmount: item.mouthSalaryAmount ? item.mouthSalaryAmount : null,
@ -2605,25 +2685,26 @@ export class CommandController extends Controller {
dateGovernment: new Date(),
isGovernment: item.isGovernment,
});
await removeProfileInOrganize(profile.id, "OFFICER");
const clearProfile = await checkCommandType(String(item.commandId));
const _null: any = null;
if (clearProfile) {
if (_profile.keycloak != null) {
const delUserKeycloak = await deleteUser(_profile.keycloak);
if (delUserKeycloak) _profile.keycloak = _null;
}
_profile.position = _null;
_profile.posTypeId = _null;
_profile.posLevelId = _null;
}
await Promise.all([
this.profileRepository.save(_profile),
this.salaryRepo.save(profileSalary),
]);
const history = new ProfileSalaryHistory();
Object.assign(history, { ...profileSalary, id: undefined });
history.profileSalaryId = profileSalary.id;
await this.salaryHistoryRepo.save(history);
if (_profile.keycloak != null) {
const delUserKeycloak = await deleteUser(_profile.keycloak);
if (delUserKeycloak) _profile.keycloak = _null;
}
_profile.position = _null;
_profile.posTypeId = _null;
_profile.posLevelId = _null;
}
await Promise.all([
this.profileRepository.save(_profile),
this.salaryRepo.save(profileSalary),
]);
const history = new ProfileSalaryHistory();
Object.assign(history, { ...profileSalary, id: undefined });
history.profileSalaryId = profileSalary.id;
await this.salaryHistoryRepo.save(history);
}),
);

View file

@ -252,9 +252,8 @@ export class ProfileController extends Controller {
profile.dateRetire != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
: "-",
salaryAmount:
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
salaryAmount: profile.amount != null
? Extension.ToThaiNumber(profile.amount.toLocaleString())
: "-",
registrationAddress: Extension.ToThaiNumber(
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
@ -1911,7 +1910,38 @@ 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:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
if (profile.isProbation != false) {
profile.isProbation = false;
profile.lastUpdateUserId = req.user.sub;
@ -1923,23 +1953,16 @@ export class ProfileController extends Controller {
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
//profile.position,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount:profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -1976,7 +1999,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -1994,7 +2017,6 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason =
"คำสั่งให้ข้าราชการออกจากราชการเพราะผลการทดลองปฏิบัติหน้าที่ราชการต่ำกว่ามาตรฐานที่กำหนด";
@ -2002,26 +2024,54 @@ export class ProfileController extends Controller {
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2035,6 +2085,7 @@ export class ProfileController extends Controller {
createdAt: new Date(),
lastUpdatedAt: new Date(),
});
await removeProfileInOrganize(profile.id, "OFFICER");
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
@ -2058,7 +2109,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2076,33 +2127,60 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย ปลดออกจากราชการ";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2116,6 +2194,7 @@ export class ProfileController extends Controller {
createdAt: new Date(),
lastUpdatedAt: new Date(),
});
await removeProfileInOrganize(profile.id, "OFFICER");
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
@ -2139,7 +2218,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2157,33 +2236,60 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย ไล่ออกจากราชการ";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2209,6 +2315,7 @@ export class ProfileController extends Controller {
// createdAt: new Date(),
// lastUpdatedAt: new Date(),
// });
await removeProfileInOrganize(profile.id, "OFFICER");
await Promise.all([
this.profileRepo.save(_profile),
this.salaryRepository.save(profileSalary),
@ -2236,7 +2343,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2254,33 +2361,60 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย พักจากราชการ";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
_profile.lastUpdatedAt = new Date();
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2294,6 +2428,7 @@ export class ProfileController extends Controller {
createdAt: new Date(),
lastUpdatedAt: new Date(),
});
await removeProfileInOrganize(profile.id, "OFFICER");
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
@ -2317,7 +2452,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2335,32 +2470,59 @@ export class ProfileController extends Controller {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let dateLeave_: any = body.date;
await removeProfileInOrganize(profile.id, "OFFICER");
_profile.isLeave = true;
_profile.leaveReason = "ได้รับโทษทางวินัย ให้ออกจากราชการไว้ก่อน";
_profile.dateLeave = dateLeave_;
_profile.lastUpdateUserId = req.user.sub;
_profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2374,6 +2536,7 @@ export class ProfileController extends Controller {
createdAt: new Date(),
lastUpdatedAt: new Date(),
});
await removeProfileInOrganize(profile.id, "OFFICER");
await Promise.all([this.profileRepo.save(_profile), this.salaryRepository.save(profileSalary)]);
return new HttpSuccess();
@ -2397,7 +2560,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2414,26 +2577,54 @@ export class ProfileController extends Controller {
// profile.dateLeave = dateLeave_;
// profile.lastUpdateUserId = req.user.sub;
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2470,7 +2661,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2487,26 +2678,54 @@ export class ProfileController extends Controller {
// profile.dateLeave = dateLeave_;
// profile.lastUpdateUserId = req.user.sub;
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2543,7 +2762,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2560,26 +2779,55 @@ export class ProfileController extends Controller {
// profile.dateLeave = dateLeave_;
// profile.lastUpdateUserId = req.user.sub;
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2616,7 +2864,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2633,26 +2881,54 @@ export class ProfileController extends Controller {
// profile.dateLeave = dateLeave_;
// profile.lastUpdateUserId = req.user.sub;
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2689,7 +2965,7 @@ export class ProfileController extends Controller {
},
) {
const profile = await this.profileRepo.findOne({
relations: ["profileSalary"],
relations: ["profileSalary","posType","posLevel"],
where: { id: body.profileId },
order: {
profileSalary: {
@ -2706,26 +2982,55 @@ export class ProfileController extends Controller {
// profile.dateLeave = dateLeave_;
// profile.lastUpdateUserId = req.user.sub;
// profile.lastUpdateFullName = req.user.name;
const orgRevision = await this.orgRevisionRepo.findOne({
where:{
orgRevisionIsCurrent: true,
orgRevisionIsDraft: false
}
})
const shortName =
!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.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)
?.orgChild2 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgChild2.orgChild2ShortName}${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)
?.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)
?.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;
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
profileId: body.profileId,
date: body.date,
refCommandNo: body.refCommandNo,
templateDoc: body.salaryRef,
position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
positionLevel:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
positionPathSide:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
positionExecutive:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
mouthSalaryAmount:
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
position: profile.position,
positionType: profile.posType.posTypeName,
positionLevel: profile.posLevel.posLevelName,
posNo: shortName?shortName:"-",
positionLine: position?.positionField ?? "-",
positionPathSide: position?.positionArea ?? "-",
positionExecutive: position?.posExecutive?.posExecutiveName ?? "-",
amount: profile.amount,
positionSalaryAmount: profile.positionSalaryAmount,
mouthSalaryAmount: profile.mouthSalaryAmount,
order:
profile.profileSalary.length >= 0
? profile.profileSalary.length > 0
@ -2780,39 +3085,7 @@ export class ProfileController extends Controller {
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
profile.lastUpdatedAt = new Date();
// const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
// profileId: body.profileId,
// date: body.date,
// refCommandNo: body.refCommandNo,
// templateDoc: body.salaryRef,
// position: profile.profileSalary.length > 0 ? profile.profileSalary[0].position : null,
// positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
// positionLevel:
// profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
// posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
// positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
// positionPathSide:
// profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
// positionExecutive:
// profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
// amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
// positionSalaryAmount:
// profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
// mouthSalaryAmount:
// profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
// order:
// profile.profileSalary.length >= 0
// ? profile.profileSalary.length > 0
// ? profile.profileSalary[0].order + 1
// : 1
// : null,
// createdUserId: req.user.sub,
// createdFullName: req.user.name,
// lastUpdateUserId: req.user.sub,
// lastUpdateFullName: req.user.name,
// createdAt: new Date(),
// lastUpdatedAt: new Date(),
// });
await Promise.all([this.profileRepo.save(profile)]);
return new HttpSuccess();
@ -4406,8 +4679,7 @@ export class ProfileController extends Controller {
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
nodeId: null,
type: "OFFICER",
salary: profile && profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
salary: profile ? profile.amount: null,
};
if (_profile.child4Id != null) {
@ -5152,7 +5424,7 @@ export class ProfileController extends Controller {
posNo: shortName,
isPosmasterAct: data.length > 0,
posmasterAct: data,
salary: profile && profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
salary: profile ? profile.amount: null,
};
if (_profile.child4Id != null) {
@ -5306,15 +5578,9 @@ export class ProfileController extends Controller {
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
nodeId: null,
amount: profile && profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
positionSalaryAmount:
profile && profile.profileSalary.length > 0
? profile.profileSalary[0].positionSalaryAmount
: null,
mouthSalaryAmount:
profile && profile.profileSalary.length > 0
? profile.profileSalary[0].mouthSalaryAmount
: null,
amount: profile ? profile.amount : null,
positionSalaryAmount: profile ? profile.positionSalaryAmount : null,
mouthSalaryAmount: profile ? profile.mouthSalaryAmount : null,
};
if (_profile.child4Id != null) {