เพิ่มเวลาลูกจ้าง
This commit is contained in:
parent
b1c365a4da
commit
2c1e1dd8ff
9 changed files with 390 additions and 244 deletions
|
|
@ -252,7 +252,6 @@ export class ImportDataController extends Controller {
|
|||
@Post("uploadProfileSalary-Officer")
|
||||
async UploadFileSQLSalary(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let profileSalarys: any = [];
|
||||
let null_: any = null;
|
||||
|
||||
const [profiles, total] = await AppDataSource.getRepository(Profile)
|
||||
|
|
@ -291,7 +290,6 @@ export class ImportDataController extends Controller {
|
|||
],
|
||||
});
|
||||
|
||||
// profileSalarys = await [];
|
||||
await Promise.all(
|
||||
existingProfile.map(async (item) => {
|
||||
rowCount++;
|
||||
|
|
@ -322,21 +320,12 @@ export class ImportDataController extends Controller {
|
|||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
profileSalary.createdAt = new Date();
|
||||
profileSalary.lastUpdatedAt = new Date();
|
||||
// profileSalarys.push(profileSalary);
|
||||
// await this.salaryRepository.save(profileSalary);
|
||||
// if (profileSalarys.length === BATCH_SIZE) {
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.salaryRepository.save(profileSalary);
|
||||
// profileSalarys = await [];
|
||||
// }
|
||||
}),
|
||||
);
|
||||
// await this.salaryRepository.save(profileSalarys);
|
||||
// profileSalarys = await [];
|
||||
}),
|
||||
);
|
||||
// await this.salaryRepository.save(profileSalarys);
|
||||
// }
|
||||
console.log(rowCount);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -347,7 +336,6 @@ export class ImportDataController extends Controller {
|
|||
@Post("uploadProfileSalary-Employee")
|
||||
async UploadFileSQLSalaryEmp(@Request() request: { user: Record<string, any> }) {
|
||||
let rowCount = 0;
|
||||
let profileSalarys: any = [];
|
||||
let null_: any = null;
|
||||
|
||||
const [profiles, total] = await AppDataSource.getRepository(ProfileEmployee)
|
||||
|
|
@ -386,7 +374,6 @@ export class ImportDataController extends Controller {
|
|||
],
|
||||
});
|
||||
|
||||
profileSalarys = await [];
|
||||
await Promise.all(
|
||||
existingProfile.map(async (item) => {
|
||||
rowCount++;
|
||||
|
|
@ -417,21 +404,13 @@ export class ImportDataController extends Controller {
|
|||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
profileSalary.createdAt = new Date();
|
||||
profileSalary.lastUpdatedAt = new Date();
|
||||
// profileSalarys.push(profileSalary);
|
||||
// await this.salaryRepository.save(profileSalary);
|
||||
// if (profileSalarys.length === BATCH_SIZE) {
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.salaryRepository.save(profileSalary);
|
||||
// profileSalarys = await [];
|
||||
// }
|
||||
}),
|
||||
);
|
||||
// await this.salaryRepository.save(profileSalarys);
|
||||
// profileSalarys = await [];
|
||||
}),
|
||||
);
|
||||
// }
|
||||
// await this.salaryRepository.save(profileSalarys);
|
||||
console.log(rowCount);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,14 +102,14 @@ export class OrganizationDotnetController extends Controller {
|
|||
.createQueryBuilder("profile")
|
||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("profile.posType", "posType")
|
||||
.leftJoinAndSelect("profile.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("profile.profileSalary", "profileSalary")
|
||||
.leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||
.leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||
.leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||
.orderBy("profileSalarys.order", "DESC");
|
||||
.orderBy("profileSalary.order", "DESC");
|
||||
|
||||
if (body.citizenId || body.firstName || body.lastName) {
|
||||
queryBuilder.where(
|
||||
|
|
@ -285,7 +285,76 @@ export class OrganizationDotnetController extends Controller {
|
|||
},
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
if (!profile) {
|
||||
const profile = await this.profileEmpRepo.findOne({
|
||||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalary: true,
|
||||
profileInsignias: true,
|
||||
},
|
||||
where: { keycloak: keycloakId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
const mapProfile = {
|
||||
id: profile.id,
|
||||
avatar: profile.avatar,
|
||||
avatarName: profile.avatarName,
|
||||
rank: profile.rank,
|
||||
prefix: profile.prefix,
|
||||
firstName: profile.firstName,
|
||||
lastName: profile.lastName,
|
||||
citizenId: profile.citizenId,
|
||||
position: profile.position,
|
||||
posLevelId: profile.posLevelId,
|
||||
email: profile.email,
|
||||
phone: profile.phone,
|
||||
keycloak: profile.keycloak,
|
||||
isProbation: profile.isProbation,
|
||||
isLeave: profile.isLeave,
|
||||
leaveReason: profile.leaveReason,
|
||||
dateRetire: profile.dateRetire,
|
||||
dateAppoint: profile.dateAppoint,
|
||||
dateRetireLaw: profile.dateRetireLaw,
|
||||
dateStart: profile.dateStart,
|
||||
govAgeAbsent: profile.govAgeAbsent,
|
||||
govAgePlus: profile.govAgePlus,
|
||||
birthDate: profile.birthDate,
|
||||
reasonSameDate: profile.reasonSameDate,
|
||||
telephoneNumber: profile.telephoneNumber,
|
||||
nationality: profile.nationality,
|
||||
gender: profile.gender,
|
||||
relationship: profile.relationship,
|
||||
religion: profile.religion,
|
||||
bloodGroup: profile.bloodGroup,
|
||||
registrationAddress: profile.registrationAddress,
|
||||
registrationProvinceId: profile.registrationProvinceId,
|
||||
registrationDistrictId: profile.registrationDistrictId,
|
||||
registrationSubDistrictId: profile.registrationSubDistrictId,
|
||||
registrationZipCode: profile.registrationZipCode,
|
||||
currentAddress: profile.currentAddress,
|
||||
currentProvinceId: profile.currentProvinceId,
|
||||
currentSubDistrictId: profile.currentSubDistrictId,
|
||||
currentZipCode: profile.currentZipCode,
|
||||
dutyTimeId: profile.dutyTimeId,
|
||||
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||
posLevel: profile.posLevel ? profile.posLevel : null,
|
||||
posType: profile.posType ? profile.posType : null,
|
||||
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
|
||||
profileInsignia: profile.profileInsignias.length > 0 ? profile.profileInsignias[0] : null,
|
||||
};
|
||||
|
||||
return new HttpSuccess(mapProfile);
|
||||
}
|
||||
|
||||
const mapProfile = {
|
||||
id: profile.id,
|
||||
|
|
@ -446,12 +515,12 @@ export class OrganizationDotnetController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalarys: true,
|
||||
profileSalary: true,
|
||||
profileInsignias: true,
|
||||
},
|
||||
where: { citizenId: citizenId },
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
|
|
@ -505,7 +574,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
dutyTimeEffectiveDate: null,
|
||||
posLevel: _profile.posLevel ? _profile.posLevel : null,
|
||||
posType: _profile.posType ? _profile.posType : null,
|
||||
profileSalary: _profile.profileSalarys,
|
||||
profileSalary: _profile.profileSalary,
|
||||
profileInsignia: _profile.profileInsignias,
|
||||
profileType: "EMPLOYEE",
|
||||
};
|
||||
|
|
@ -656,12 +725,12 @@ export class OrganizationDotnetController extends Controller {
|
|||
relations: {
|
||||
posLevel: true,
|
||||
posType: true,
|
||||
profileSalarys: true,
|
||||
profileSalary: true,
|
||||
profileInsignias: true,
|
||||
},
|
||||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
|
|
@ -715,7 +784,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
// dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
|
||||
posLevel: profile.posLevel ? profile.posLevel : null,
|
||||
posType: profile.posType ? profile.posType : null,
|
||||
profileSalary: profile.profileSalarys,
|
||||
profileSalary: profile.profileSalary,
|
||||
profileInsignia: profile.profileInsignias,
|
||||
}));
|
||||
|
||||
|
|
@ -1103,7 +1172,20 @@ export class OrganizationDotnetController extends Controller {
|
|||
const profile = await this.profileRepo.findOne({
|
||||
where: { id: body.profileId },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
if (!profile) {
|
||||
const profile = await this.profileEmpRepo.findOne({
|
||||
where: { id: body.profileId },
|
||||
});
|
||||
if (!profile) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
Object.assign(profile, body);
|
||||
profile.dutyTimeId = body.roundId;
|
||||
profile.dutyTimeEffectiveDate = body.effectiveDate;
|
||||
profile.lastUpdateUserId = req.user.sub;
|
||||
profile.lastUpdateFullName = req.user.name;
|
||||
profile.lastUpdatedAt = new Date();
|
||||
await this.profileEmpRepo.save(profile);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
Object.assign(profile, body);
|
||||
profile.dutyTimeId = body.roundId;
|
||||
profile.dutyTimeEffectiveDate = body.effectiveDate;
|
||||
|
|
|
|||
|
|
@ -283,7 +283,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
.leftJoinAndSelect("employeePosMaster.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4")
|
||||
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
||||
.leftJoinAndSelect("current_holder.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||
.leftJoinAndSelect("current_holder.profileLeaves", "profileLeaves")
|
||||
.leftJoinAndSelect("current_holder.profileAssessments", "profileAssessments")
|
||||
|
|
@ -378,9 +378,9 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
}
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalarys.length == 0
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalarys.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: [
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"profileEducations",
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
|
|
@ -136,7 +136,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
],
|
||||
where: { id: id },
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
},
|
||||
},
|
||||
|
|
@ -256,16 +256,16 @@ export class ProfileEmployeeController extends Controller {
|
|||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
|
||||
: "-",
|
||||
salaryAmount:
|
||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
|
||||
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
||||
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
|
||||
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
|
||||
: "-",
|
||||
registrationAddress: Extension.ToThaiNumber(
|
||||
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||
),
|
||||
salaryDate:
|
||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
||||
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
|
||||
? Extension.ToThaiNumber(
|
||||
Extension.ToThaiShortDate_monthYear(profile.profileSalarys[0].date),
|
||||
Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
|
||||
)
|
||||
: "-",
|
||||
positionName: profile.position != null ? profile.position : "-",
|
||||
|
|
@ -1783,20 +1783,20 @@ export class ProfileEmployeeController extends Controller {
|
|||
) {
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profileEmployee")
|
||||
.leftJoinAndSelect("profileEmployee.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("profileEmployee.profileSalary", "profileSalary")
|
||||
.select([
|
||||
"profileEmployee.id",
|
||||
"profileEmployee.prefix",
|
||||
"profileEmployee.firstName",
|
||||
"profileEmployee.lastName",
|
||||
"profileEmployee.citizenId",
|
||||
"profileSalarys.position",
|
||||
"profileSalarys.posNo",
|
||||
"profileSalarys.date",
|
||||
"profileSalary.position",
|
||||
"profileSalary.posNo",
|
||||
"profileSalary.date",
|
||||
])
|
||||
.andWhere(
|
||||
requestBody.position != null && requestBody.position != "" && requestBody.posNo == undefined
|
||||
? "profileSalarys.position LIKE :position"
|
||||
? "profileSalary.position LIKE :position"
|
||||
: "1=2",
|
||||
{
|
||||
position: `%${requestBody.position}%`,
|
||||
|
|
@ -1804,7 +1804,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
)
|
||||
.orWhere(
|
||||
requestBody.posNo != null && requestBody.posNo != "" && requestBody.position == undefined
|
||||
? "profileSalarys.posNo LIKE :posNo"
|
||||
? "profileSalars.posNo LIKE :posNo"
|
||||
: "1=2",
|
||||
{
|
||||
posNo: `%${requestBody.posNo}%`,
|
||||
|
|
@ -1814,8 +1814,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
const mapData = profiles.map((profile) => {
|
||||
let profileSalary;
|
||||
if (profile.profileSalarys && profile.profileSalarys.length > 0) {
|
||||
profileSalary = profile.profileSalarys.reduce((latest, current) => {
|
||||
if (profile.profileSalary && profile.profileSalary.length > 0) {
|
||||
profileSalary = profile.profileSalary.reduce((latest, current) => {
|
||||
return new Date(current.date) > new Date(latest.date) ? current : latest;
|
||||
});
|
||||
}
|
||||
|
|
@ -1850,10 +1850,10 @@ export class ProfileEmployeeController extends Controller {
|
|||
"posType",
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
],
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
|
|
@ -1976,7 +1976,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
node: null,
|
||||
nodeId: null,
|
||||
salary:
|
||||
profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null,
|
||||
profile && profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
|
||||
};
|
||||
return new HttpSuccess(_profile);
|
||||
}
|
||||
|
|
@ -2009,7 +2009,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -2028,7 +2028,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -2047,7 +2047,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -2065,7 +2065,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -2122,8 +2122,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
|
||||
let salary: any = "";
|
||||
if (item != null && item.profileSalarys != null && item.profileSalarys.length > 0) {
|
||||
let _salary: any = item.profileSalarys.sort(
|
||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
||||
let _salary: any = item.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
||||
);
|
||||
|
|
@ -2779,7 +2779,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
.leftJoinAndSelect("employeePosMaster.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4")
|
||||
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
||||
.leftJoinAndSelect("current_holder.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||
|
|
@ -2877,9 +2877,9 @@ export class ProfileEmployeeController extends Controller {
|
|||
}
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalarys.length == 0
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalarys.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
@ -3678,7 +3678,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
keycloak: IsNull(),
|
||||
citizenId: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3690,7 +3690,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
keycloak: IsNull(),
|
||||
firstName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3702,7 +3702,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
keycloak: IsNull(),
|
||||
lastName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3713,7 +3713,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: {
|
||||
keycloak: IsNull(),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3764,8 +3764,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
|
||||
let salary: any = "";
|
||||
if (item != null && item.profileSalarys != null && item.profileSalarys.length > 0) {
|
||||
let _salary: any = item.profileSalarys.sort(
|
||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
||||
let _salary: any = item.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
||||
);
|
||||
|
|
@ -3832,10 +3832,10 @@ export class ProfileEmployeeController extends Controller {
|
|||
"posType",
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
],
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
|
|
@ -3960,24 +3960,29 @@ export class ProfileEmployeeController extends Controller {
|
|||
nodeId: null,
|
||||
posNo: shortName,
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
|
||||
const profile = await this.profileRepo.findOne({
|
||||
relations: [
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"profileEducations",
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
|
|
@ -211,8 +211,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
: "",
|
||||
RegistrationAddress: `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||
SalaryAmount:
|
||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].amount != null
|
||||
? Extension.ToThaiNumber(profile.profileSalarys[0].amount.toLocaleString())
|
||||
profile.profileSalary.length > 0 && profile.profileSalary[0].amount != null
|
||||
? Extension.ToThaiNumber(profile.profileSalary[0].amount.toLocaleString())
|
||||
: "",
|
||||
Education:
|
||||
profile.profileEducations.length > 0 &&
|
||||
|
|
@ -221,8 +221,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
: "",
|
||||
AppointText: profile.dateAppoint != null ? profile.dateAppoint : "",
|
||||
SalaryDate:
|
||||
profile.profileSalarys.length > 0 && profile.profileSalarys[0].date != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalarys[0].date))
|
||||
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate(profile.profileSalary[0].date))
|
||||
: "",
|
||||
PositionName: profile.position != null ? profile.position : "",
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
|
|
@ -1481,20 +1481,20 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
) {
|
||||
const profiles = await this.profileRepo
|
||||
.createQueryBuilder("profileEmployee")
|
||||
.leftJoinAndSelect("profileEmployee.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("profileEmployee.profileSalary", "profileSalary")
|
||||
.select([
|
||||
"profileEmployee.id",
|
||||
"profileEmployee.prefix",
|
||||
"profileEmployee.firstName",
|
||||
"profileEmployee.lastName",
|
||||
"profileEmployee.citizenId",
|
||||
"profileSalarys.position",
|
||||
"profileSalarys.posNo",
|
||||
"profileSalarys.date",
|
||||
"profileSalary.position",
|
||||
"profileSalary.posNo",
|
||||
"profileSalary.date",
|
||||
])
|
||||
.andWhere(
|
||||
requestBody.position != null && requestBody.position != "" && requestBody.posNo == undefined
|
||||
? "profileSalarys.position LIKE :position"
|
||||
? "profileSalary.position LIKE :position"
|
||||
: "1=2",
|
||||
{
|
||||
position: `%${requestBody.position}%`,
|
||||
|
|
@ -1502,7 +1502,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
)
|
||||
.orWhere(
|
||||
requestBody.posNo != null && requestBody.posNo != "" && requestBody.position == undefined
|
||||
? "profileSalarys.posNo LIKE :posNo"
|
||||
? "profileSalary.posNo LIKE :posNo"
|
||||
: "1=2",
|
||||
{
|
||||
posNo: `%${requestBody.posNo}%`,
|
||||
|
|
@ -1512,8 +1512,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
|
||||
const mapData = profiles.map((profile) => {
|
||||
let profileSalary;
|
||||
if (profile.profileSalarys && profile.profileSalarys.length > 0) {
|
||||
profileSalary = profile.profileSalarys.reduce((latest, current) => {
|
||||
if (profile.profileSalary && profile.profileSalary.length > 0) {
|
||||
profileSalary = profile.profileSalary.reduce((latest, current) => {
|
||||
return new Date(current.date) > new Date(latest.date) ? current : latest;
|
||||
});
|
||||
}
|
||||
|
|
@ -1548,10 +1548,10 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
"posType",
|
||||
"current_holders",
|
||||
"current_holders.orgRoot",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
],
|
||||
order: {
|
||||
profileSalarys: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
|
|
@ -1663,8 +1663,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
? null
|
||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgChild4
|
||||
.orgChild4Name,
|
||||
salary:
|
||||
profile && profile.profileSalarys.length > 0 ? profile.profileSalarys[0].amount : null,
|
||||
salary: profile && profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
|
||||
};
|
||||
return new HttpSuccess(_profile);
|
||||
}
|
||||
|
|
@ -1697,7 +1696,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -1716,7 +1715,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -1735,7 +1734,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -1753,7 +1752,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
"posType",
|
||||
"posLevel",
|
||||
"current_holders",
|
||||
"profileSalarys",
|
||||
"profileSalary",
|
||||
"current_holders.orgRoot",
|
||||
"current_holders.orgChild1",
|
||||
"current_holders.orgChild2",
|
||||
|
|
@ -1810,8 +1809,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
|
||||
let salary: any = "";
|
||||
if (item != null && item.profileSalarys != null && item.profileSalarys.length > 0) {
|
||||
let _salary: any = item.profileSalarys.sort(
|
||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
||||
let _salary: any = item.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
||||
);
|
||||
|
|
@ -2401,7 +2400,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
.leftJoinAndSelect("employeePosMaster.orgChild3", "orgChild3")
|
||||
.leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4")
|
||||
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
||||
.leftJoinAndSelect("current_holder.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||
|
|
@ -2499,9 +2498,9 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
}
|
||||
|
||||
const amount =
|
||||
item.current_holder == null || item.current_holder.profileSalarys.length == 0
|
||||
item.current_holder == null || item.current_holder.profileSalary.length == 0
|
||||
? null
|
||||
: item.current_holder.profileSalarys.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
: item.current_holder.profileSalary.sort((a: any, b: any) => b.date - a.date)[0].amount;
|
||||
let datePeriodStart = new Date(
|
||||
`${new Date().getFullYear()}-${String(new Date().getMonth() + 1).padStart(2, "0")}-${String(new Date().getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||
);
|
||||
|
|
@ -3267,7 +3266,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
keycloak: IsNull(),
|
||||
citizenId: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3279,7 +3278,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
keycloak: IsNull(),
|
||||
firstName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3291,7 +3290,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
keycloak: IsNull(),
|
||||
lastName: Like(`%${body.keyword}%`),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3302,7 +3301,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
where: {
|
||||
keycloak: IsNull(),
|
||||
},
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalarys"],
|
||||
relations: ["posType", "posLevel", "current_holders", "profileSalary"],
|
||||
skip,
|
||||
take,
|
||||
});
|
||||
|
|
@ -3353,8 +3352,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
: item.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot;
|
||||
|
||||
let salary: any = "";
|
||||
if (item != null && item.profileSalarys != null && item.profileSalarys.length > 0) {
|
||||
let _salary: any = item.profileSalarys.sort(
|
||||
if (item != null && item.profileSalary != null && item.profileSalary.length > 0) {
|
||||
let _salary: any = item.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) - (a.date == null ? 0 : a.date.getTime()),
|
||||
);
|
||||
|
|
@ -3542,18 +3541,23 @@ export class ProfileEmployeeTempController 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -605,7 +605,7 @@ export class ProfileEmployee extends EntityBase {
|
|||
next_holders: EmployeePosMaster[];
|
||||
|
||||
@OneToMany(() => ProfileSalary, (v) => v.profileEmployee)
|
||||
profileSalarys: ProfileSalary[];
|
||||
profileSalary: ProfileSalary[];
|
||||
|
||||
@OneToMany(() => ProfileCertificate, (v) => v.profileEmployee)
|
||||
profileCertificates: ProfileCertificate[];
|
||||
|
|
@ -786,6 +786,21 @@ export class ProfileEmployee extends EntityBase {
|
|||
length: 5,
|
||||
})
|
||||
currentZipCode: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "ไอดีรอบลงเวลาล่าสุด",
|
||||
})
|
||||
dutyTimeId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "datetime",
|
||||
comment: "รอบลงเวลาล่าสุด",
|
||||
default: null,
|
||||
})
|
||||
dutyTimeEffectiveDate: Date;
|
||||
}
|
||||
|
||||
@Entity("profileEmployeeHistory")
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ export class ProfileSalary extends EntityBase {
|
|||
@JoinColumn({ name: "profileId" })
|
||||
profile: Profile;
|
||||
|
||||
@ManyToOne(() => ProfileEmployee, (profileEmployee) => profileEmployee.profileSalarys)
|
||||
@ManyToOne(() => ProfileEmployee, (profileEmployee) => profileEmployee.profileSalary)
|
||||
@JoinColumn({ name: "profileEmployeeId" })
|
||||
profileEmployee: ProfileEmployee;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableProfileempAddDutyTimeId1730964715891 implements MigrationInterface {
|
||||
name = 'UpdateTableProfileempAddDutyTimeId1730964715891'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`dutyTimeId\` varchar(40) NULL COMMENT 'ไอดีรอบลงเวลาล่าสุด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`dutyTimeEffectiveDate\` datetime NULL COMMENT 'รอบลงเวลาล่าสุด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`dutyTimeId\` varchar(40) NULL COMMENT 'ไอดีรอบลงเวลาล่าสุด'`);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`dutyTimeEffectiveDate\` datetime NULL COMMENT 'รอบลงเวลาล่าสุด'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`dutyTimeEffectiveDate\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`dutyTimeId\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`dutyTimeEffectiveDate\``);
|
||||
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`dutyTimeId\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue