[Fix Bug] #124
This commit is contained in:
parent
fc92c378e8
commit
fa7445275b
5 changed files with 71 additions and 65 deletions
|
|
@ -5626,7 +5626,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
|
||||||
: null;
|
: null;
|
||||||
const dest_item = await this.salaryRepo.findOne({
|
const dest_item = await this.salaryRepo.findOne({
|
||||||
where: { profileId: id },
|
where: { profileEmployeeId: id },
|
||||||
order: { order: "DESC" },
|
order: { order: "DESC" },
|
||||||
});
|
});
|
||||||
const data: any = {
|
const data: any = {
|
||||||
|
|
@ -5638,7 +5638,9 @@ export class ProfileEmployeeController extends Controller {
|
||||||
posNo: orgRevisionRef?.posMasterNo,
|
posNo: orgRevisionRef?.posMasterNo,
|
||||||
positionExecutive: "",
|
positionExecutive: "",
|
||||||
positionType: profile.posType?.posTypeName,
|
positionType: profile.posType?.posTypeName,
|
||||||
positionLevel: profile.posLevel?.posLevelName,
|
positionLevel: profile.posType && profile.posLevel
|
||||||
|
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`
|
||||||
|
: "",
|
||||||
amountSpecial: profile.amountSpecial,
|
amountSpecial: profile.amountSpecial,
|
||||||
orgRoot: orgRootRef?.orgRootName,
|
orgRoot: orgRootRef?.orgRootName,
|
||||||
orgChild1: orgChild1Ref?.orgChild1Name,
|
orgChild1: orgChild1Ref?.orgChild1Name,
|
||||||
|
|
|
||||||
|
|
@ -3297,7 +3297,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
|
? `${profile.current_holders.find((x) => x.orgRevisionId == orgRevision?.id)?.orgRoot.orgRootShortName}`
|
||||||
: null;
|
: null;
|
||||||
const dest_item = await this.salaryRepo.findOne({
|
const dest_item = await this.salaryRepo.findOne({
|
||||||
where: { profileId: id },
|
where: { profileEmployeeId: id },
|
||||||
order: { order: "DESC" },
|
order: { order: "DESC" },
|
||||||
});
|
});
|
||||||
const data: any = {
|
const data: any = {
|
||||||
|
|
@ -3309,7 +3309,9 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
posNo: orgRevisionRef?.posMasterNo,
|
posNo: orgRevisionRef?.posMasterNo,
|
||||||
positionExecutive: "",
|
positionExecutive: "",
|
||||||
positionType: profile.posType?.posTypeName,
|
positionType: profile.posType?.posTypeName,
|
||||||
positionLevel: profile.posLevel?.posLevelName,
|
positionLevel: profile.posType && profile.posLevel
|
||||||
|
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`
|
||||||
|
: "",
|
||||||
amountSpecial: profile.amountSpecial,
|
amountSpecial: profile.amountSpecial,
|
||||||
orgRoot: orgRootRef?.orgRootName,
|
orgRoot: orgRootRef?.orgRootName,
|
||||||
orgChild1: orgChild1Ref?.orgChild1Name,
|
orgChild1: orgChild1Ref?.orgChild1Name,
|
||||||
|
|
|
||||||
|
|
@ -156,17 +156,16 @@ export class ProfileGovernmentHistoryController extends Controller {
|
||||||
});
|
});
|
||||||
const record = await this.profileRepo.findOne({
|
const record = await this.profileRepo.findOne({
|
||||||
where: { id: profileId },
|
where: { id: profileId },
|
||||||
relations: {
|
relations: ["posType", "posLevel", "profileSalary"],
|
||||||
posType: true,
|
order: {
|
||||||
posLevel: true,
|
profileSalary: {
|
||||||
},
|
order: "DESC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
// orgRevision: {
|
|
||||||
// orgRevisionIsCurrent: true,
|
|
||||||
// orgRevisionIsDraft: false,
|
|
||||||
// },
|
|
||||||
orgRevisionId: orgRevision?.id,
|
orgRevisionId: orgRevision?.id,
|
||||||
current_holderId: profileId,
|
current_holderId: profileId,
|
||||||
},
|
},
|
||||||
|
|
@ -183,10 +182,6 @@ export class ProfileGovernmentHistoryController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
positionIsSelected: true,
|
positionIsSelected: true,
|
||||||
posMaster: {
|
posMaster: {
|
||||||
// orgRevision: {
|
|
||||||
// orgRevisionIsCurrent: true,
|
|
||||||
// orgRevisionIsDraft: false,
|
|
||||||
// },
|
|
||||||
orgRevisionId: orgRevision?.id,
|
orgRevisionId: orgRevision?.id,
|
||||||
current_holderId: profileId,
|
current_holderId: profileId,
|
||||||
},
|
},
|
||||||
|
|
@ -220,12 +215,24 @@ export class ProfileGovernmentHistoryController extends Controller {
|
||||||
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const _OrgLeave = [
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild4 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild3 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild2 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild1 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgRoot : null,
|
||||||
|
];
|
||||||
|
const orgLeave = _OrgLeave.filter((x) => x !== undefined && x !== null).join("\n");
|
||||||
const data = {
|
const data = {
|
||||||
org: org, //สังกัด
|
org: record.isLeave == false ? org : orgLeave, //สังกัด
|
||||||
positionField: position == null ? null : position.positionField, //สายงาน
|
positionField: position == null ? null : position.positionField, //สายงาน
|
||||||
position: record.position, //ตำแหน่ง
|
position: record.position, //ตำแหน่ง
|
||||||
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
|
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
|
||||||
posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง
|
posMasterNo: record.isLeave == false
|
||||||
|
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
|
||||||
|
: record.profileSalary.length > 0
|
||||||
|
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}`
|
||||||
|
: null, //เลขที่ตำแหน่ง
|
||||||
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
|
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
|
||||||
posExecutive:
|
posExecutive:
|
||||||
position == null || position.posExecutive == null
|
position == null || position.posExecutive == null
|
||||||
|
|
|
||||||
|
|
@ -148,17 +148,16 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
});
|
});
|
||||||
const record = await this.profileEmployeeRepo.findOne({
|
const record = await this.profileEmployeeRepo.findOne({
|
||||||
where: { id: profileEmployeeId },
|
where: { id: profileEmployeeId },
|
||||||
relations: {
|
relations: ["posType", "posLevel", "profileSalary"],
|
||||||
posType: true,
|
order: {
|
||||||
posLevel: true,
|
profileSalary: {
|
||||||
},
|
order: "DESC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
// orgRevision: {
|
|
||||||
// orgRevisionIsCurrent: true,
|
|
||||||
// orgRevisionIsDraft: false,
|
|
||||||
// },
|
|
||||||
orgRevisionId: orgRevision?.id,
|
orgRevisionId: orgRevision?.id,
|
||||||
current_holderId: profileEmployeeId,
|
current_holderId: profileEmployeeId,
|
||||||
},
|
},
|
||||||
|
|
@ -171,20 +170,6 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
orgChild4: true,
|
orgChild4: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const position = await this.positionRepo.findOne({
|
|
||||||
where: {
|
|
||||||
positionIsSelected: true,
|
|
||||||
posMaster: {
|
|
||||||
// orgRevision: {
|
|
||||||
// orgRevisionIsCurrent: true,
|
|
||||||
// orgRevisionIsDraft: false,
|
|
||||||
// },
|
|
||||||
orgRevisionId: orgRevision?.id,
|
|
||||||
current_holderId: profileEmployeeId,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
order: { createdAt: "DESC" },
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
const fullNameParts = [
|
const fullNameParts = [
|
||||||
|
|
@ -209,14 +194,26 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const _OrgLeave = [
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild4 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild3 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild2 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild1 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgRoot : null,
|
||||||
|
];
|
||||||
|
const orgLeave = _OrgLeave.filter((x) => x !== undefined && x !== null).join("\n");
|
||||||
const data = {
|
const data = {
|
||||||
org: org, //สังกัด
|
org: record.isLeave == false ? org : orgLeave, //สังกัด
|
||||||
position: record.position, //ตำแหน่ง
|
position: record.position, //ตำแหน่ง
|
||||||
posLevel:
|
posLevel:
|
||||||
record.posLevel == null
|
record.posLevel == null
|
||||||
? null
|
? null
|
||||||
: `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ
|
: `${record?.posType?.posTypeShortName ?? ""} ${record?.posLevel?.posLevelName ?? ""}`, //ระดับ
|
||||||
posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง
|
posMasterNo: record.isLeave == false
|
||||||
|
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
|
||||||
|
: record.profileSalary.length > 0
|
||||||
|
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}`
|
||||||
|
: null, //เลขที่ตำแหน่ง
|
||||||
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
|
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
|
||||||
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ
|
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ
|
||||||
dateAppoint: record.dateAppoint, //วันที่สั่งบรรจุ
|
dateAppoint: record.dateAppoint, //วันที่สั่งบรรจุ
|
||||||
|
|
|
||||||
|
|
@ -40,17 +40,16 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
||||||
}
|
}
|
||||||
const record = await this.profileEmployeeRepo.findOne({
|
const record = await this.profileEmployeeRepo.findOne({
|
||||||
where: { id: profile.id },
|
where: { id: profile.id },
|
||||||
relations: {
|
relations: ["posType", "posLevel", "profileSalary"],
|
||||||
posType: true,
|
order: {
|
||||||
posLevel: true,
|
profileSalary: {
|
||||||
},
|
order: "DESC",
|
||||||
|
createdAt: "DESC"
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
// orgRevision: {
|
|
||||||
// orgRevisionIsCurrent: true,
|
|
||||||
// orgRevisionIsDraft: false,
|
|
||||||
// },
|
|
||||||
orgRevisionId: orgRevision?.id,
|
orgRevisionId: orgRevision?.id,
|
||||||
current_holderId: profile.id,
|
current_holderId: profile.id,
|
||||||
},
|
},
|
||||||
|
|
@ -63,19 +62,6 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
||||||
orgChild4: true,
|
orgChild4: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
// const position = await this.positionRepo.findOne({
|
|
||||||
// where: {
|
|
||||||
// positionIsSelected: true,
|
|
||||||
// posMaster: {
|
|
||||||
// orgRevision: {
|
|
||||||
// orgRevisionIsCurrent: true,
|
|
||||||
// orgRevisionIsDraft: false,
|
|
||||||
// },
|
|
||||||
// current_holderId: profile.id,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// order: { createdAt: "DESC" },
|
|
||||||
// });
|
|
||||||
|
|
||||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
const fullNameParts = [
|
const fullNameParts = [
|
||||||
|
|
@ -100,11 +86,23 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
||||||
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
orgShortName = posMaster.orgChild4?.orgChild4ShortName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const _OrgLeave = [
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild4 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild3 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild2 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgChild1 : null,
|
||||||
|
record.profileSalary.length > 0 ? record.profileSalary[0].orgRoot : null,
|
||||||
|
];
|
||||||
|
const orgLeave = _OrgLeave.filter((x) => x !== undefined && x !== null).join("\n");
|
||||||
const data = {
|
const data = {
|
||||||
org: org, //สังกัด
|
org: record.isLeave == false ? org : orgLeave, //สังกัด
|
||||||
position: record.position, //ตำแหน่ง
|
position: record.position, //ตำแหน่ง
|
||||||
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
|
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
|
||||||
posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง
|
posMasterNo: record.isLeave == false
|
||||||
|
? posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`
|
||||||
|
: record.profileSalary.length > 0
|
||||||
|
? `${record.profileSalary[0].posNoAbb} ${record.profileSalary[0].posNo}`
|
||||||
|
: null, //เลขที่ตำแหน่ง
|
||||||
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
|
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
|
||||||
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
|
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
|
||||||
dateRetireLaw: record.dateRetireLaw ?? null,
|
dateRetireLaw: record.dateRetireLaw ?? null,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue