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) {
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 },
});