add command code 20
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m3s

This commit is contained in:
mamoss 2026-01-21 08:00:21 +07:00
parent b1210d51e8
commit 757da877f6
8 changed files with 268 additions and 218 deletions

View file

@ -80,6 +80,7 @@ export class ProfileSalaryEmployeeController extends Controller {
"14",
"15",
"16",
"20",
]),
},
{ profileEmployeeId: profile.id, commandCode: IsNull() },
@ -128,6 +129,7 @@ export class ProfileSalaryEmployeeController extends Controller {
"14",
"15",
"16",
"20",
]),
},
{ profileEmployeeId: profileId, commandCode: IsNull() },
@ -146,13 +148,12 @@ export class ProfileSalaryEmployeeController extends Controller {
const CURRENT_DATE = await AppDataSource.query("SELECT CURRENT_DATE() as today");
let _currentDate = CURRENT_DATE[0].today;
if (profile && profile?.isLeave) {
_currentDate = profile && profile.leaveDate
? Extension.toDateOnlyString(profile.leaveDate)
: _currentDate
_currentDate =
profile && profile.leaveDate ? Extension.toDateOnlyString(profile.leaveDate) : _currentDate;
}
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?, ?)", [
profile.id,
_currentDate
_currentDate,
]);
const _position = position.length > 0 ? position[0] : [];
const mapPosition =
@ -185,7 +186,7 @@ export class ProfileSalaryEmployeeController extends Controller {
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?, ?)", [
profile.id,
_currentDate
_currentDate,
]);
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
const mapPosLevel =
@ -228,21 +229,22 @@ export class ProfileSalaryEmployeeController extends Controller {
@Get("tenure/{profileId}")
public async getPositionTenure(@Path() profileId: string, @Request() req: RequestWithUser) {
const _profile = await this.profileRepo.findOne({
where: { id: profileId }
})
where: { id: profileId },
});
if (!_profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
const CURRENT_DATE = await AppDataSource.query("SELECT CURRENT_DATE() as today");
let _currentDate = CURRENT_DATE[0].today;
if (_profile && _profile?.isLeave) {
_currentDate = _profile && _profile.leaveDate
? Extension.toDateOnlyString(_profile.leaveDate)
: _currentDate
_currentDate =
_profile && _profile.leaveDate
? Extension.toDateOnlyString(_profile.leaveDate)
: _currentDate;
}
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?, ?)", [
profileId,
_currentDate
_currentDate,
]);
const _position = position.length > 0 ? position[0] : [];
const mapPosition =
@ -275,7 +277,7 @@ export class ProfileSalaryEmployeeController extends Controller {
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?, ?)", [
profileId,
_currentDate
_currentDate,
]);
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
const mapPosLevel =