คำนวนเงินเดือน กรณีไม่พอดีฐาน

This commit is contained in:
Kittapath 2024-04-02 13:33:08 +07:00
parent 08af376c6a
commit 168e59fdf4

View file

@ -13,7 +13,7 @@ import {
Query,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import { In, Not, MoreThan, Brackets, Like } from "typeorm";
import { In, Not, MoreThan, Brackets, Like, MoreThanOrEqual } from "typeorm";
import HttpSuccess from "../interfaces/http-success";
import HttpError from "../interfaces/http-error";
import HttpStatusCode from "../interfaces/http-status";
@ -385,20 +385,11 @@ export class SalaryPeriodController extends Controller {
salaryRanks = await this.salaryRankRepository.findOne({
where: {
salaryId: salarys.id,
salary: salaryProfile.amount,
salary: MoreThanOrEqual(salaryProfile.amount),
isNext: false,
},
order: { salary: "ASC" },
});
if (salaryRanks == null) {
salaryRanks = await this.salaryRankRepository.findOne({
where: {
salaryId: salarys.id,
salary: MoreThan(salaryProfile.amount),
isNext: false,
},
order: { salary: "DESC" },
});
}
if (salaryRanks != null) {
if (salaryProfile.type == "HAFT") {
if (salaryRanks.salaryHalfSpecial != null && salaryRanks.salaryHalfSpecial > 0) {
@ -457,7 +448,7 @@ export class SalaryPeriodController extends Controller {
salary: MoreThan(salaryProfile.amount),
isNext: true,
},
order: { salary: "DESC" },
order: { salary: "ASC" },
});
}
}
@ -707,20 +698,11 @@ export class SalaryPeriodController extends Controller {
salaryRanks = await this.salaryRankRepository.findOne({
where: {
salaryId: salarys.id,
salary: salaryProfile.amount,
salary: MoreThanOrEqual(salaryProfile.amount),
isNext: false,
},
order: { salary: "ASC" },
});
if (salaryRanks == null) {
salaryRanks = await this.salaryRankRepository.findOne({
where: {
salaryId: salarys.id,
salary: MoreThan(salaryProfile.amount),
isNext: false,
},
order: { salary: "DESC" },
});
}
if (salaryRanks != null) {
if (salaryProfile.type == "HAFT") {
if (salaryRanks.salaryHalfSpecial != null && salaryRanks.salaryHalfSpecial > 0) {
@ -779,7 +761,7 @@ export class SalaryPeriodController extends Controller {
salary: MoreThan(salaryProfile.amount),
isNext: true,
},
order: { salary: "DESC" },
order: { salary: "ASC" },
});
}
}
@ -1085,20 +1067,11 @@ export class SalaryPeriodController extends Controller {
salaryRanks = await this.salaryRankRepository.findOne({
where: {
salaryId: salarys.id,
salary: salaryProfile.amount,
salary: MoreThanOrEqual(salaryProfile.amount),
isNext: false,
},
order: { salary: "ASC" },
});
if (salaryRanks == null) {
salaryRanks = await this.salaryRankRepository.findOne({
where: {
salaryId: salarys.id,
salary: MoreThan(salaryProfile.amount),
isNext: false,
},
order: { salary: "DESC" },
});
}
if (salaryRanks != null) {
if (salaryProfile.type == "HAFT") {
if (salaryRanks.salaryHalfSpecial != null && salaryRanks.salaryHalfSpecial > 0) {
@ -1157,7 +1130,7 @@ export class SalaryPeriodController extends Controller {
salary: MoreThan(salaryProfile.amount),
isNext: true,
},
order: { salary: "DESC" },
order: { salary: "ASC" },
});
}
}