From f66e721fa4e78f2d5fc88cd082fc0bc3fc16c0ed Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Wed, 27 Aug 2025 14:49:36 +0700 Subject: [PATCH] #1749 --- src/controllers/OrganizationDotnetController.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controllers/OrganizationDotnetController.ts b/src/controllers/OrganizationDotnetController.ts index f6e926c3..7453fa47 100644 --- a/src/controllers/OrganizationDotnetController.ts +++ b/src/controllers/OrganizationDotnetController.ts @@ -4054,7 +4054,7 @@ export class OrganizationDotnetController extends Controller { if (body.node === 0) { typeCondition = { orgRootId: body.nodeId, - orgChild1Id: IsNull(), + // orgChild1Id: IsNull(), }; } else if (body.node === 1) { typeCondition = { @@ -4112,7 +4112,10 @@ export class OrganizationDotnetController extends Controller { "current_holders.orgChild4", ], }); - + const startDate = new Date().getFullYear(); + const endDate = new Date().getFullYear(); + const startOfYear = new Date(startDate, 0, 1); // 1 ม.ค. ปีนี้ + const endOfYear = new Date(endDate, 11, 31, 23, 59, 59, 999); // 31 ธ.ค. ปีนี้ if (body.isRetirement) { profile = await this.profileRepo.find({ where: { @@ -4122,7 +4125,7 @@ export class OrganizationDotnetController extends Controller { // isRetirement: true, dateRetire: And( Not(IsNull()), - Between(body.startDate, body.endDate) + Between(startOfYear, endOfYear) ) }, relations: [ @@ -4137,6 +4140,7 @@ export class OrganizationDotnetController extends Controller { ], }); } + let findRevision = await this.orgRevisionRepo.findOne({ where: { orgRevisionIsCurrent: true }, });