คำสั่งรักษาการแทน
This commit is contained in:
parent
87a49c5cc1
commit
1718176911
3 changed files with 269 additions and 114 deletions
|
|
@ -396,7 +396,7 @@ export class ProfileController extends Controller {
|
|||
StartDate: profiles?.dateStart
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateStart))
|
||||
: "",
|
||||
AppointDate: profiles?.dateAppoint
|
||||
AppointDate: profiles?.dateAppoint
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(profiles.dateAppoint))
|
||||
: "",
|
||||
BirthDate: profiles?.birthDate
|
||||
|
|
@ -1820,12 +1820,12 @@ export class ProfileController extends Controller {
|
|||
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;
|
||||
// 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,
|
||||
|
|
@ -1891,12 +1891,12 @@ export class ProfileController extends Controller {
|
|||
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;
|
||||
// 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,
|
||||
|
|
@ -1962,12 +1962,12 @@ export class ProfileController extends Controller {
|
|||
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;
|
||||
// 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,
|
||||
|
|
@ -2033,12 +2033,83 @@ export class ProfileController extends Controller {
|
|||
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;
|
||||
// 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[0].position : null,
|
||||
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
|
||||
positionLevel:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
|
||||
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
|
||||
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
|
||||
positionPathSide:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
|
||||
positionExecutive:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
|
||||
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
|
||||
positionSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
|
||||
mouthSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
|
||||
order:
|
||||
profile.profileSalary.length >= 0
|
||||
? profile.profileSalary.length > 0
|
||||
? profile.profileSalary[0].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 },
|
||||
order: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
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,
|
||||
|
|
@ -2147,77 +2218,6 @@ export class ProfileController extends Controller {
|
|||
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 },
|
||||
order: {
|
||||
profileSalary: {
|
||||
order: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
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[0].position : null,
|
||||
positionType: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionType : null,
|
||||
positionLevel:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLevel : null,
|
||||
posNo: profile.profileSalary.length > 0 ? profile.profileSalary[0].posNo : null,
|
||||
positionLine: profile.profileSalary.length > 0 ? profile.profileSalary[0].positionLine : null,
|
||||
positionPathSide:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionPathSide : null,
|
||||
positionExecutive:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionExecutive : null,
|
||||
amount: profile.profileSalary.length > 0 ? profile.profileSalary[0].amount : null,
|
||||
positionSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].positionSalaryAmount : null,
|
||||
mouthSalaryAmount:
|
||||
profile.profileSalary.length > 0 ? profile.profileSalary[0].mouthSalaryAmount : null,
|
||||
order:
|
||||
profile.profileSalary.length >= 0
|
||||
? profile.profileSalary.length > 0
|
||||
? profile.profileSalary[0].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 คำนวนวันเกษียณ
|
||||
*
|
||||
|
|
@ -2298,9 +2298,9 @@ export class ProfileController extends Controller {
|
|||
// chkDigit = cal % 10;
|
||||
// }
|
||||
|
||||
// if (citizenIdDigits[12] !== chkDigit) {
|
||||
// throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
|
||||
// }
|
||||
// if (citizenIdDigits[12] !== chkDigit) {
|
||||
// throw new HttpError(HttpStatus.NOT_FOUND, "ข้อมูลรหัสบัตรประจำตัวประชาชนไม่ถูกต้อง");
|
||||
// }
|
||||
}
|
||||
|
||||
const record = await this.profileRepo.findOneBy({ id });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue