fix report kpi8
This commit is contained in:
parent
772a0b3a93
commit
9526799ec0
1 changed files with 48 additions and 3 deletions
|
|
@ -971,6 +971,15 @@ export class ReportController extends Controller {
|
||||||
const target_ = await this.kpiUserDevelopmentRepository.findOne({
|
const target_ = await this.kpiUserDevelopmentRepository.findOne({
|
||||||
where: { kpiUserEvaluationId: x.id },
|
where: { kpiUserEvaluationId: x.id },
|
||||||
});
|
});
|
||||||
|
const isDev70 = target_ && target_?.isDevelopment70 === true
|
||||||
|
? "🗹 70 การลงมือปฏิบัติ (โดยผู้บังคับบัญชามอบหมาย)"
|
||||||
|
: ""
|
||||||
|
const isDev20 = target_ && target_?.isDevelopment20 === true
|
||||||
|
? "🗹 20 การเรียนรู้จากผู้อื่น (Coach/Mentor/Consulting)"
|
||||||
|
: ""
|
||||||
|
const isDev10 = target_ && target_?.isDevelopment10 === true
|
||||||
|
? "🗹 10 การฝึกอบรมอื่นๆ"
|
||||||
|
: ""
|
||||||
return {
|
return {
|
||||||
no: Extension.ToThaiNumber((idx + 1).toString()),
|
no: Extension.ToThaiNumber((idx + 1).toString()),
|
||||||
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
fullName: `${x.prefix}${x.firstName} ${x.lastName}`,
|
||||||
|
|
@ -981,6 +990,9 @@ export class ReportController extends Controller {
|
||||||
target: target_ ? target_.target : "",
|
target: target_ ? target_.target : "",
|
||||||
timeEvaluator: x.timeEvaluator ? Extension.ToThaiNumber(x.timeEvaluator) : "",
|
timeEvaluator: x.timeEvaluator ? Extension.ToThaiNumber(x.timeEvaluator) : "",
|
||||||
developResults: "", //วิธีการวัดผลการพัฒนา
|
developResults: "", //วิธีการวัดผลการพัฒนา
|
||||||
|
isDev70,
|
||||||
|
isDev20,
|
||||||
|
isDev10,
|
||||||
evaluationResults: x.evaluationResults
|
evaluationResults: x.evaluationResults
|
||||||
? Extension.EvaluationResult(x.evaluationResults)
|
? Extension.EvaluationResult(x.evaluationResults)
|
||||||
: "",
|
: "",
|
||||||
|
|
@ -1063,17 +1075,50 @@ export class ReportController extends Controller {
|
||||||
const affiliation = fullNameParts
|
const affiliation = fullNameParts
|
||||||
.filter((part) => part !== undefined && part !== null)
|
.filter((part) => part !== undefined && part !== null)
|
||||||
.join("/");
|
.join("/");
|
||||||
|
const period_ = await this.kpiPeriodRepository.findOne({
|
||||||
|
where: { id: String(requestBody.periodId) }
|
||||||
|
})
|
||||||
|
if(period_ && !period1 && !period2) {
|
||||||
|
if(period_?.durationKPI === "APR") {
|
||||||
|
period1 = `${Extension.ToThaiFullDate2(period_.startDate)} ถึง ${Extension.ToThaiFullDate2(period_.endDate)}`;
|
||||||
|
let _period2 = await this.kpiPeriodRepository.findOne({
|
||||||
|
where: {
|
||||||
|
year: period_.year,
|
||||||
|
durationKPI: "OCT",
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
period2 = _period2
|
||||||
|
? `${Extension.ToThaiFullDate2(_period2?.startDate)} ถึง ${Extension.ToThaiFullDate2(_period2?.endDate)}`
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
else if (period_?.durationKPI === "OCT"){
|
||||||
|
period2 = `${Extension.ToThaiFullDate2(period_.startDate)} ถึง ${Extension.ToThaiFullDate2(period_.endDate)}`;
|
||||||
|
let _period1 = await this.kpiPeriodRepository.findOne({
|
||||||
|
where: {
|
||||||
|
year: period_.year,
|
||||||
|
durationKPI: "APR",
|
||||||
|
isActive: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
period1 = _period1
|
||||||
|
? `${Extension.ToThaiFullDate2(_period1?.startDate)} ถึง ${Extension.ToThaiFullDate2(_period1?.endDate)}`
|
||||||
|
: "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
formattedData = {
|
formattedData = {
|
||||||
fullName: userInfo
|
fullName: userInfo
|
||||||
? userInfo[0]?.prefix + userInfo[0]?.firstName + " " + userInfo[0]?.lastName
|
? userInfo[0]?.prefix + userInfo[0]?.firstName + " " + userInfo[0]?.lastName
|
||||||
: null,
|
: null,
|
||||||
affiliation: affiliation ?? null,
|
affiliation: affiliation ?? null,
|
||||||
durationKPI: data?.durationKPI ?? null,
|
// durationKPI: data?.durationKPI ?? null,
|
||||||
|
durationKPI: period_ ? period_.durationKPI : null,
|
||||||
position: userInfo ? userInfo[0]?.position : null,
|
position: userInfo ? userInfo[0]?.position : null,
|
||||||
posType: userInfo ? userInfo[0]?.posTypeName : null,
|
posType: userInfo ? userInfo[0]?.posTypeName : null,
|
||||||
posLevel: userInfo ? userInfo[0]?.posLevelName : null,
|
posLevel: userInfo ? userInfo[0]?.posLevelName : null,
|
||||||
period1: Extension.ToThaiNumber(period1),
|
period1: period1 ? Extension.ToThaiNumber(period1) : "-",
|
||||||
period2: Extension.ToThaiNumber(period2),
|
period2: period2 ? Extension.ToThaiNumber(period2) : "-",
|
||||||
developments:
|
developments:
|
||||||
formattedUserDevelopmentLists.length > 0 ? formattedUserDevelopmentLists : [{}],
|
formattedUserDevelopmentLists.length > 0 ? formattedUserDevelopmentLists : [{}],
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue