เพิ่มแสดงเหตุผลการพ้นจากราชการในทะเบียนประวัติ #1240
This commit is contained in:
parent
03a7b45aa3
commit
b2c8bdecf3
4 changed files with 90 additions and 10 deletions
|
|
@ -10,6 +10,7 @@ import { Command } from "../entities/Command";
|
|||
import { ProfileSalary } from "../entities/ProfileSalary";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||
import { CommandRecive } from "../entities/CommandRecive";
|
||||
export function calculateAge(start: Date, end = new Date()) {
|
||||
if (start.getTime() > end.getTime()) return null;
|
||||
|
||||
|
|
@ -347,20 +348,62 @@ export async function checkExceptCommandType(commandId: string) {
|
|||
|
||||
export async function checkCommandType(commandId: string) {
|
||||
const commandRepository = AppDataSource.getRepository(Command);
|
||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive)
|
||||
const _type = await commandRepository.findOne({
|
||||
where: {
|
||||
id: commandId,
|
||||
},
|
||||
relations: ["commandType"],
|
||||
relations: ["commandType", "commandRecives"],
|
||||
});
|
||||
|
||||
if (
|
||||
!["C-PM-12", "C-PM-13", "C-PM-17", "C-PM-18", "C-PM-23", "C-PM-19", "C-PM-20"].includes(
|
||||
String(_type?.commandType.code),
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
// return false;
|
||||
return { status: false, LeaveType: null, leaveRemark: null};
|
||||
}
|
||||
return true;
|
||||
// return true;
|
||||
const _commandRecive = await commandReciveRepository.findOne({
|
||||
where: { commandId: commandId }
|
||||
});
|
||||
|
||||
let _leaveType: string =""
|
||||
switch(String(_type?.commandType.code)){
|
||||
case "C-PM-12" : {
|
||||
_leaveType = "PROBATION_REPORT";
|
||||
break;
|
||||
}
|
||||
case "C-PM-13" : {
|
||||
_leaveType = "PLACEMENT_TRANSFER";
|
||||
break;
|
||||
}
|
||||
case "C-PM-17" : {
|
||||
_leaveType = "RETIRE_RESIGN";
|
||||
break;
|
||||
}
|
||||
case "C-PM-18" : {
|
||||
_leaveType = "RETIRE_OUT";
|
||||
break;
|
||||
}
|
||||
case "C-PM-19" : {
|
||||
_leaveType = "DISCIPLINE_RESULT_REMOVE";
|
||||
break;
|
||||
}
|
||||
case "C-PM-20" : {
|
||||
_leaveType = "DISCIPLINE_RESULT_DISMISS";
|
||||
break;
|
||||
}
|
||||
case "C-PM-23" : {
|
||||
_leaveType = "RETIRE_RESIGN_EMP";
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
_leaveType = ""
|
||||
}
|
||||
}
|
||||
return { status: true, LeaveType: _leaveType, leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null };
|
||||
}
|
||||
|
||||
//logs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue