fix retire: table name & add status isLeave, isRetirement

This commit is contained in:
Warunee Tamkoo 2025-10-17 11:07:26 +07:00
parent f2efb44336
commit a25b017bad
3 changed files with 20 additions and 2 deletions

View file

@ -3230,10 +3230,17 @@ export class ProfileEmployeeTempController extends Controller {
.leftJoinAndSelect("current_holders.positions", "positions")
// .leftJoinAndSelect("positions.posExecutive", "posExecutive")
// calculate range: start = 2 Oct of (year-1), end = 1 Oct of year (inclusive)
.where("profile.dateRetire BETWEEN :start AND :end", {
.where("profileEmployee.dateRetire BETWEEN :start AND :end", {
start: `${year - 1}-10-02`,
end: `${year}-10-01`,
})
.andWhere(
"profileEmployee.isLeave = :isLeave AND profileEmployee.isRetirement = :isRetirement",
{
isLeave: false,
isRetirement: false,
},
)
.getMany();
if (!profiles || profiles.length === 0) {