fix report
This commit is contained in:
parent
8050b53228
commit
dee1a6d2b4
1 changed files with 111 additions and 112 deletions
|
|
@ -231,125 +231,124 @@ export class ReportController extends Controller {
|
||||||
if (!salaryPeriod) {
|
if (!salaryPeriod) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||||
}
|
}
|
||||||
// const _salaryPeriod = await this.salaryProfileRepository.find({
|
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||||
|
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||||
|
where: {
|
||||||
|
salaryOrg: {
|
||||||
|
snapshot: "SNAP1",
|
||||||
|
rootId: rootId,
|
||||||
|
salaryPeriodId: salaryPeriodId,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
order: {
|
||||||
|
orgShortName: "ASC",
|
||||||
|
posMasterNo: "ASC",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// const _salaryPeriod1 = await this.salaryProfileRepository.find({
|
||||||
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||||
// where: {
|
// where: {
|
||||||
// salaryOrg: {
|
// salaryOrg: {
|
||||||
// snapshot: "SNAP1",
|
// snapshot: "SNAP1",
|
||||||
// rootId: rootId,
|
// rootId: rootId,
|
||||||
// salaryPeriodId: salaryPeriodId,
|
// salaryPeriodId: salaryPeriodId,
|
||||||
|
// group: "GROUP1",
|
||||||
// },
|
// },
|
||||||
|
// type: "HAFT",
|
||||||
// },
|
// },
|
||||||
// order: {
|
// order: {
|
||||||
// orgShortName: "ASC",
|
// citizenId: "ASC",
|
||||||
// posMasterNo: "ASC",
|
// isReserve: "ASC",
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// const _salaryPeriod2 = await this.salaryProfileRepository.find({
|
||||||
|
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||||
|
// where: {
|
||||||
|
// salaryOrg: {
|
||||||
|
// snapshot: "SNAP1",
|
||||||
|
// rootId: rootId,
|
||||||
|
// salaryPeriodId: salaryPeriodId,
|
||||||
|
// group: "GROUP1",
|
||||||
|
// },
|
||||||
|
// type: "FULL",
|
||||||
|
// },
|
||||||
|
// order: {
|
||||||
|
// citizenId: "ASC",
|
||||||
|
// isReserve: "ASC",
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// const _salaryPeriod3 = await this.salaryProfileRepository.find({
|
||||||
|
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||||
|
// where: {
|
||||||
|
// salaryOrg: {
|
||||||
|
// snapshot: "SNAP1",
|
||||||
|
// rootId: rootId,
|
||||||
|
// salaryPeriodId: salaryPeriodId,
|
||||||
|
// group: "GROUP1",
|
||||||
|
// },
|
||||||
|
// type: "NONE",
|
||||||
|
// },
|
||||||
|
// order: {
|
||||||
|
// citizenId: "ASC",
|
||||||
|
// isReserve: "ASC",
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// const _salaryPeriod4 = await this.salaryProfileRepository.find({
|
||||||
|
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||||
|
// where: {
|
||||||
|
// salaryOrg: {
|
||||||
|
// snapshot: "SNAP1",
|
||||||
|
// rootId: rootId,
|
||||||
|
// salaryPeriodId: salaryPeriodId,
|
||||||
|
// group: "GROUP2",
|
||||||
|
// },
|
||||||
|
// type: "HAFT",
|
||||||
|
// },
|
||||||
|
// order: {
|
||||||
|
// citizenId: "ASC",
|
||||||
|
// isReserve: "ASC",
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// const _salaryPeriod5 = await this.salaryProfileRepository.find({
|
||||||
|
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||||
|
// where: {
|
||||||
|
// salaryOrg: {
|
||||||
|
// snapshot: "SNAP1",
|
||||||
|
// rootId: rootId,
|
||||||
|
// salaryPeriodId: salaryPeriodId,
|
||||||
|
// group: "GROUP2",
|
||||||
|
// },
|
||||||
|
// type: "FULL",
|
||||||
|
// },
|
||||||
|
// order: {
|
||||||
|
// citizenId: "ASC",
|
||||||
|
// isReserve: "ASC",
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// const _salaryPeriod6 = await this.salaryProfileRepository.find({
|
||||||
|
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||||
|
// where: {
|
||||||
|
// salaryOrg: {
|
||||||
|
// snapshot: "SNAP1",
|
||||||
|
// rootId: rootId,
|
||||||
|
// salaryPeriodId: salaryPeriodId,
|
||||||
|
// group: "GROUP2",
|
||||||
|
// },
|
||||||
|
// type: "NONE",
|
||||||
|
// },
|
||||||
|
// order: {
|
||||||
|
// citizenId: "ASC",
|
||||||
|
// isReserve: "ASC",
|
||||||
// },
|
// },
|
||||||
// });
|
// });
|
||||||
|
|
||||||
const _salaryPeriod1 = await this.salaryProfileRepository.find({
|
// const _salaryPeriod = _salaryPeriod1.concat(
|
||||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
// _salaryPeriod2,
|
||||||
where: {
|
// _salaryPeriod3,
|
||||||
salaryOrg: {
|
// _salaryPeriod4,
|
||||||
snapshot: "SNAP1",
|
// _salaryPeriod5,
|
||||||
rootId: rootId,
|
// _salaryPeriod6,
|
||||||
salaryPeriodId: salaryPeriodId,
|
// );
|
||||||
group: "GROUP1",
|
|
||||||
},
|
|
||||||
type: "HAFT",
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
citizenId: "ASC",
|
|
||||||
isReserve: "ASC",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const _salaryPeriod2 = await this.salaryProfileRepository.find({
|
|
||||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
|
||||||
where: {
|
|
||||||
salaryOrg: {
|
|
||||||
snapshot: "SNAP1",
|
|
||||||
rootId: rootId,
|
|
||||||
salaryPeriodId: salaryPeriodId,
|
|
||||||
group: "GROUP1",
|
|
||||||
},
|
|
||||||
type: "FULL",
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
citizenId: "ASC",
|
|
||||||
isReserve: "ASC",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const _salaryPeriod3 = await this.salaryProfileRepository.find({
|
|
||||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
|
||||||
where: {
|
|
||||||
salaryOrg: {
|
|
||||||
snapshot: "SNAP1",
|
|
||||||
rootId: rootId,
|
|
||||||
salaryPeriodId: salaryPeriodId,
|
|
||||||
group: "GROUP1",
|
|
||||||
},
|
|
||||||
type: "NONE",
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
citizenId: "ASC",
|
|
||||||
isReserve: "ASC",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const _salaryPeriod4 = await this.salaryProfileRepository.find({
|
|
||||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
|
||||||
where: {
|
|
||||||
salaryOrg: {
|
|
||||||
snapshot: "SNAP1",
|
|
||||||
rootId: rootId,
|
|
||||||
salaryPeriodId: salaryPeriodId,
|
|
||||||
group: "GROUP2",
|
|
||||||
},
|
|
||||||
type: "HAFT",
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
citizenId: "ASC",
|
|
||||||
isReserve: "ASC",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const _salaryPeriod5 = await this.salaryProfileRepository.find({
|
|
||||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
|
||||||
where: {
|
|
||||||
salaryOrg: {
|
|
||||||
snapshot: "SNAP1",
|
|
||||||
rootId: rootId,
|
|
||||||
salaryPeriodId: salaryPeriodId,
|
|
||||||
group: "GROUP2",
|
|
||||||
},
|
|
||||||
type: "FULL",
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
citizenId: "ASC",
|
|
||||||
isReserve: "ASC",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const _salaryPeriod6 = await this.salaryProfileRepository.find({
|
|
||||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
|
||||||
where: {
|
|
||||||
salaryOrg: {
|
|
||||||
snapshot: "SNAP1",
|
|
||||||
rootId: rootId,
|
|
||||||
salaryPeriodId: salaryPeriodId,
|
|
||||||
group: "GROUP2",
|
|
||||||
},
|
|
||||||
type: "NONE",
|
|
||||||
},
|
|
||||||
order: {
|
|
||||||
citizenId: "ASC",
|
|
||||||
isReserve: "ASC",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const _salaryPeriod = _salaryPeriod1.concat(
|
|
||||||
_salaryPeriod2,
|
|
||||||
_salaryPeriod3,
|
|
||||||
_salaryPeriod4,
|
|
||||||
_salaryPeriod5,
|
|
||||||
_salaryPeriod6,
|
|
||||||
);
|
|
||||||
if (!_salaryPeriod) {
|
if (!_salaryPeriod) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
|
|
@ -1084,8 +1083,8 @@ export class ReportController extends Controller {
|
||||||
group: "GROUP2",
|
group: "GROUP2",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (salaryPeriod.period === "APR") {
|
if (salaryOrg_Group1 && salaryPeriod.period === "APR") {
|
||||||
const salaryProfileGroup1 = await this.salaryProfileRepository.find({
|
const salaryProfileGroup1 = await this.salaryProfileRepository.find({
|
||||||
where: {
|
where: {
|
||||||
salaryOrgId: salaryOrg_Group1?.id,
|
salaryOrgId: salaryOrg_Group1?.id,
|
||||||
|
|
@ -1098,7 +1097,7 @@ export class ReportController extends Controller {
|
||||||
type: "FULL", //หนึ่งขั้น
|
type: "FULL", //หนึ่งขั้น
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
//รอบปีก่อนๆ
|
//รอบปีก่อนๆ
|
||||||
const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({
|
const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -1357,9 +1356,9 @@ export class ReportController extends Controller {
|
||||||
score: null, //ผลการประเมินฯ
|
score: null, //ผลการประเมินฯ
|
||||||
remark: null, //หมายเหตุ
|
remark: null, //หมายเหตุ
|
||||||
})),
|
})),
|
||||||
},
|
}||{},
|
||||||
});
|
});
|
||||||
} else if (salaryPeriod.period === "OCT") {
|
} else if (salaryOrg_Group1 &&salaryPeriod.period === "OCT") {
|
||||||
// find period APR
|
// find period APR
|
||||||
const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({
|
const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue