diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 2e3a4da5..d4e65f29 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -10438,8 +10438,12 @@ export class ProfileController extends Controller { .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", { - start: `${year - 1}-10-02`, - end: `${year}-10-01`, + start: `${year - 1}-10-01`, + end: `${year}-09-30`, + }) + .andWhere("profile.isLeave = :isLeave AND profile.isRetirement = :isRetirement", { + isLeave: false, + isRetirement: false, }) .getMany(); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 8d2ebc43..a7d905ad 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", { - start: `${year - 1}-10-02`, - end: `${year}-10-01`, + .where("profileEmployee.dateRetire BETWEEN :start AND :end", { + start: `${year - 1}-10-01`, + end: `${year}-09-30`, }) + .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..46ef525b 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", { - start: `${year - 1}-10-02`, - end: `${year}-10-01`, + .where("profileEmployee.dateRetire BETWEEN :start AND :end", { + start: `${year - 1}-10-01`, + end: `${year}-09-30`, }) + .andWhere( + "profileEmployee.isLeave = :isLeave AND profileEmployee.isRetirement = :isRetirement", + { + isLeave: false, + isRetirement: false, + }, + ) .getMany(); if (!profiles || profiles.length === 0) {