diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 2e3a4da5..55f857f4 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -10441,6 +10441,10 @@ export class ProfileController extends Controller { start: `${year - 1}-10-02`, end: `${year}-10-01`, }) + .andWhere("profile.isLeave = :isLeave AND profile.isRetirement = :isRetirement", { + isLeave: false, + isRetirement: false, + }) .getMany(); if (!profiles || profiles.length === 0) { diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 8d2ebc43..4a8f40ca 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -5033,10 +5033,17 @@ export class ProfileEmployeeController extends Controller { .leftJoinAndSelect("current_holders.orgChild4", "orgChild4") .leftJoinAndSelect("current_holders.positions", "positions") // 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) { diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index 189cb80c..6cc6e387 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -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) {