Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-02-29 14:53:34 +07:00
commit 43a8c8c8f0
3 changed files with 44 additions and 20 deletions

View file

@ -433,7 +433,7 @@ export class SalaryPeriodController extends Controller {
if (body.type == "NONE") {
salaryProfile.amountSpecial = 0;
salaryProfile.amountUse = 0;
salaryProfile.positionSalaryAmount = salaryProfile.amount;
salaryProfile.positionSalaryAmount = salaryProfile.amount == null ? 0 : salaryProfile.amount;
} else if (body.type == "PENDING") {
salaryProfile.amountSpecial = 0;
salaryProfile.amountUse = 0;
@ -485,7 +485,14 @@ export class SalaryPeriodController extends Controller {
@Put("org/{id}")
async GetListsSalaryProfile(
@Path() id: string,
@Body() body: { page: number; pageSize: number; keyword?: string; type: string },
@Body()
body: {
page: number;
pageSize: number;
keyword?: string;
type?: any;
isRetire?: boolean | null;
},
) {
const salaryOrg = await this.salaryOrgRepository.findOne({
where: {
@ -497,11 +504,12 @@ export class SalaryPeriodController extends Controller {
}
const [salaryProfile, total] = await AppDataSource.getRepository(SalaryProfile)
.createQueryBuilder("profile")
.orWhere(
.andWhere(
new Brackets((qb) => {
qb.andWhere(body.type != null && body.type != "" ? "profile.type LIKE :type" : "1=1", {
type: `%${body.type.toUpperCase()}%`,
qb.andWhere(body.type != null && body.type != "" ? `profile.type LIKE :type` : "1=1", {
type: body.type == null ? "" : `%${body.type.toUpperCase()}%`,
})
.andWhere(body.isRetire != null ? `profile.isRetired = ${body.isRetire}` : "1=1")
.andWhere({
salaryOrgId: salaryOrg.id,
})
@ -564,6 +572,7 @@ export class SalaryPeriodController extends Controller {
const salaryOrgAll = await this.salaryOrgRepository.find({
where: {
salaryPeriodId: salaryOrg.salaryPeriodId,
snapshot: salaryOrg.snapshot,
},
});
if (!salaryOrgAll) {