ออกคำสั่ง 19,20,25,26,27,28,29,30,31,32
This commit is contained in:
parent
7ad713116f
commit
f7c553ec1d
1 changed files with 928 additions and 2 deletions
|
|
@ -784,7 +784,10 @@ export class ProfileController extends Controller {
|
||||||
date: body.date,
|
date: body.date,
|
||||||
refCommandNo: body.refCommandNo,
|
refCommandNo: body.refCommandNo,
|
||||||
templateDoc: body.salaryRef,
|
templateDoc: body.salaryRef,
|
||||||
position: profile.position,
|
position: //profile.position,
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
positionType:
|
positionType:
|
||||||
profile.profileSalary.length > 0
|
profile.profileSalary.length > 0
|
||||||
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
|
@ -876,7 +879,930 @@ export class ProfileController extends Controller {
|
||||||
date: body.date,
|
date: body.date,
|
||||||
refCommandNo: body.refCommandNo,
|
refCommandNo: body.refCommandNo,
|
||||||
templateDoc: body.salaryRef,
|
templateDoc: body.salaryRef,
|
||||||
position: profile.position,
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งปลดออกจากราชการ
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งปลดออกจากราชการ (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command19/{profileId}")
|
||||||
|
async ExecuteCommand19Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย ปลดออกจากราชการ";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งไล่ออกจากราชการ
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งไล่ออกจากราชการ (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command20/{profileId}")
|
||||||
|
async ExecuteCommand20Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย ไล่ออกจากราชการ";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งพักจากราชการ
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งพักจากราชการ (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command25/{profileId}")
|
||||||
|
async ExecuteCommand25Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย พักจากราชการ";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งให้ออกจากราชการไว้ก่อน
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งให้ออกจากราชการไว้ก่อน (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command26/{profileId}")
|
||||||
|
async ExecuteCommand26Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย ให้ออกจากราชการไว้ก่อน";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งลงโทษ ภาคทัณฑ์
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งลงโทษ ภาคทัณฑ์ (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command27/{profileId}")
|
||||||
|
async ExecuteCommand27Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย ลงโทษ ภาคทัณฑ์";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งลงโทษ ตัดเงินเดือน
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งลงโทษ ตัดเงินเดือน (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command28/{profileId}")
|
||||||
|
async ExecuteCommand28Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย ลงโทษ ตัดเงินเดือน";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งลงโทษ ลดขั้นเงินเดือน
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งลงโทษ ลดขั้นเงินเดือน (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command29/{profileId}")
|
||||||
|
async ExecuteCommand29Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย ลงโทษ ลดขั้นเงินเดือน";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งเพิ่มโทษ
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งเพิ่มโทษ (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command30/{profileId}")
|
||||||
|
async ExecuteCommand30Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย เพิ่มโทษ";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งยุติเรื่อง
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งยุติเรื่อง (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command32/{profileId}")
|
||||||
|
async ExecuteCommand32Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย ยุติเรื่อง";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
|
positionType:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
: null,
|
||||||
|
positionLevel:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLevel
|
||||||
|
: null,
|
||||||
|
posNo:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].posNo
|
||||||
|
: null,
|
||||||
|
positionLine:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionLine
|
||||||
|
: null,
|
||||||
|
positionPathSide:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionPathSide
|
||||||
|
: null,
|
||||||
|
positionExecutive:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionExecutive
|
||||||
|
: null,
|
||||||
|
amount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].amount
|
||||||
|
: null,
|
||||||
|
positionSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].positionSalaryAmount
|
||||||
|
: null,
|
||||||
|
mouthSalaryAmount:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].mouthSalaryAmount
|
||||||
|
: null,
|
||||||
|
order:
|
||||||
|
profile.profileSalary.length >= 0
|
||||||
|
? profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].order + 1
|
||||||
|
: 1
|
||||||
|
: null,
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
});
|
||||||
|
await Promise.all([this.profileRepo.save(profile), this.salaryRepository.save(profileSalary)]);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง คำสั่งงดโทษ
|
||||||
|
*
|
||||||
|
* @summary API ออกคำสั่ง คำสั่งงดโทษ (ADMIN)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Post("command31/{profileId}")
|
||||||
|
async ExecuteCommand31Async(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body()
|
||||||
|
body: {
|
||||||
|
profileId: string;
|
||||||
|
date: Date | null;
|
||||||
|
refCommandNo: string | null;
|
||||||
|
salaryRef: string | null;
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepo.findOne({
|
||||||
|
relations: ["profileSalary"],
|
||||||
|
where: { id: body.profileId },
|
||||||
|
});
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
|
||||||
|
}
|
||||||
|
let dateLeave_: any = body.date;
|
||||||
|
profile.isLeave = true;
|
||||||
|
profile.leaveReason =
|
||||||
|
"ได้รับโทษทางวินัย งดโทษ";
|
||||||
|
profile.dateLeave = dateLeave_;
|
||||||
|
profile.lastUpdateUserId = req.user.sub;
|
||||||
|
profile.lastUpdateFullName = req.user.name;
|
||||||
|
const profileSalary: ProfileSalary = Object.assign(new ProfileSalary(), {
|
||||||
|
profileId: body.profileId,
|
||||||
|
date: body.date,
|
||||||
|
refCommandNo: body.refCommandNo,
|
||||||
|
templateDoc: body.salaryRef,
|
||||||
|
position:
|
||||||
|
profile.profileSalary.length > 0
|
||||||
|
? profile.profileSalary[profile.profileSalary.length - 1].position
|
||||||
|
: null,
|
||||||
positionType:
|
positionType:
|
||||||
profile.profileSalary.length > 0
|
profile.profileSalary.length > 0
|
||||||
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
? profile.profileSalary[profile.profileSalary.length - 1].positionType
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue