This commit is contained in:
AdisakKanthawilang 2025-08-27 14:49:36 +07:00
parent a9cfcfc6b9
commit f66e721fa4

View file

@ -4054,7 +4054,7 @@ export class OrganizationDotnetController extends Controller {
if (body.node === 0) { if (body.node === 0) {
typeCondition = { typeCondition = {
orgRootId: body.nodeId, orgRootId: body.nodeId,
orgChild1Id: IsNull(), // orgChild1Id: IsNull(),
}; };
} else if (body.node === 1) { } else if (body.node === 1) {
typeCondition = { typeCondition = {
@ -4112,7 +4112,10 @@ export class OrganizationDotnetController extends Controller {
"current_holders.orgChild4", "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) { if (body.isRetirement) {
profile = await this.profileRepo.find({ profile = await this.profileRepo.find({
where: { where: {
@ -4122,7 +4125,7 @@ export class OrganizationDotnetController extends Controller {
// isRetirement: true, // isRetirement: true,
dateRetire: And( dateRetire: And(
Not(IsNull()), Not(IsNull()),
Between(body.startDate, body.endDate) Between(startOfYear, endOfYear)
) )
}, },
relations: [ relations: [
@ -4137,6 +4140,7 @@ export class OrganizationDotnetController extends Controller {
], ],
}); });
} }
let findRevision = await this.orgRevisionRepo.findOne({ let findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true }, where: { orgRevisionIsCurrent: true },
}); });