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

This commit is contained in:
Kittapath 2024-06-27 12:02:46 +07:00
commit 93ec5e374e

View file

@ -231,125 +231,124 @@ export class ReportController extends Controller {
if (!salaryPeriod) {
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"],
// where: {
// salaryOrg: {
// snapshot: "SNAP1",
// rootId: rootId,
// salaryPeriodId: salaryPeriodId,
// group: "GROUP1",
// },
// type: "HAFT",
// },
// order: {
// orgShortName: "ASC",
// posMasterNo: "ASC",
// 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 _salaryPeriod1 = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
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,
);
// const _salaryPeriod = _salaryPeriod1.concat(
// _salaryPeriod2,
// _salaryPeriod3,
// _salaryPeriod4,
// _salaryPeriod5,
// _salaryPeriod6,
// );
if (!_salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
@ -1084,8 +1083,8 @@ export class ReportController extends Controller {
group: "GROUP2",
},
});
if (salaryPeriod.period === "APR") {
if (salaryOrg_Group1 && salaryPeriod.period === "APR") {
const salaryProfileGroup1 = await this.salaryProfileRepository.find({
where: {
salaryOrgId: salaryOrg_Group1?.id,
@ -1098,7 +1097,7 @@ export class ReportController extends Controller {
type: "FULL", //หนึ่งขั้น
},
});
//รอบปีก่อนๆ
const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({
where: {
@ -1357,9 +1356,9 @@ export class ReportController extends Controller {
score: null, //ผลการประเมินฯ
remark: null, //หมายเหตุ
})),
},
}||{},
});
} else if (salaryPeriod.period === "OCT") {
} else if (salaryOrg_Group1 &&salaryPeriod.period === "OCT") {
// find period APR
const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({
where: {