Merge branch 'develop' into develop-Bright

This commit is contained in:
Bright 2024-06-18 13:27:20 +07:00
commit e2d5f7e13d

View file

@ -18,7 +18,7 @@ import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success"; import HttpSuccess from "../interfaces/http-success";
import HttpStatus from "../interfaces/http-status"; import HttpStatus from "../interfaces/http-status";
import HttpError from "../interfaces/http-error"; import HttpError from "../interfaces/http-error";
import { Brackets, In, IsNull, Like, Not } from "typeorm"; import { Brackets, Double, In, IsNull, Like, Not } from "typeorm";
import { OrgRevision } from "../entities/OrgRevision"; import { OrgRevision } from "../entities/OrgRevision";
import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils"; import { calculateRetireDate, calculateRetireLaw } from "../interfaces/utils";
import { EmployeePosMaster } from "../entities/EmployeePosMaster"; import { EmployeePosMaster } from "../entities/EmployeePosMaster";
@ -623,7 +623,7 @@ export class ProfileEmployeeController extends Controller {
if (!result) { if (!result) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
} }
await this.informationHistoryRepository.delete({profileEmployeeId: id}); await this.informationHistoryRepository.delete({ profileEmployeeId: id });
await this.profileRepo.remove(result); await this.profileRepo.remove(result);
return new HttpSuccess(); return new HttpSuccess();
} }
@ -826,7 +826,7 @@ export class ProfileEmployeeController extends Controller {
"current_holders.orgChild1", "current_holders.orgChild1",
"current_holders.orgChild2", "current_holders.orgChild2",
"current_holders.orgChild3", "current_holders.orgChild3",
"current_holders.orgChild4" "current_holders.orgChild4",
], ],
}); });
@ -851,8 +851,8 @@ export class ProfileEmployeeController extends Controller {
null null
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild4.orgChild4ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3 != profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
null ?.orgChild3 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild3.orgChild3ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null &&
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
@ -862,7 +862,8 @@ export class ProfileEmployeeController extends Controller {
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
?.orgChild1 != null ?.orgChild1 != null
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgChild1.orgChild1ShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
: profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) != null && : profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) !=
null &&
profile.current_holders.find((x) => x.orgRevisionId == findRevision.id) profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)
?.orgRoot != null ?.orgRoot != null
? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}` ? `${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.orgRoot.orgRootShortName}${profile.current_holders.find((x) => x.orgRevisionId == findRevision.id)?.posMasterNo}`
@ -2972,9 +2973,9 @@ export class ProfileEmployeeController extends Controller {
id: string; id: string;
personId: string; personId: string;
templateDoc: string; templateDoc: string;
amount: string; amount: Double | null;
positionSalaryAmount: string; positionSalaryAmount: Double | null;
mouthSalaryAmount: string; mouthSalaryAmount: Double | null;
refCommandNo: string; refCommandNo: string;
}[]; }[];
}, },
@ -2990,8 +2991,8 @@ export class ProfileEmployeeController extends Controller {
}); });
if (profile != null) { if (profile != null) {
await new CallAPI() await new CallAPI()
.PostData(request, "org/profile/salary", { .PostData(request, "org/profile-employee/salary", {
profileId: profile.id, profileEmployeeId: profile.id,
date: new Date(), date: new Date(),
amount: v.amount, amount: v.amount,
positionSalaryAmount: v.positionSalaryAmount, positionSalaryAmount: v.positionSalaryAmount,
@ -3005,7 +3006,7 @@ export class ProfileEmployeeController extends Controller {
}) })
.then(async (x) => { .then(async (x) => {
profile.statusTemp = "DONE"; profile.statusTemp = "DONE";
profile.employeeClass = "TEMP"; profile.employeeClass = "PERM";
await this.profileRepo.save(profile); await this.profileRepo.save(profile);
}); });
} }