Merge branch 'develop' into adiDev
This commit is contained in:
commit
027cbe2814
10 changed files with 520 additions and 61 deletions
|
|
@ -40,7 +40,7 @@ async function main() {
|
||||||
const APP_HOST = process.env.APP_HOST || "0.0.0.0";
|
const APP_HOST = process.env.APP_HOST || "0.0.0.0";
|
||||||
const APP_PORT = +(process.env.APP_PORT || 3000);
|
const APP_PORT = +(process.env.APP_PORT || 3000);
|
||||||
|
|
||||||
const cronTime = "0 8 * * * *"; // ตั้งเวลาทุกวันเวลา 08:00:00
|
const cronTime = "0 0 3 * * *"; // ตั้งเวลาทุกวันเวลา 08:00:00
|
||||||
// const cronTime = "*/10 * * * * *";
|
// const cronTime = "*/10 * * * * *";
|
||||||
cron.schedule(cronTime, async () => {
|
cron.schedule(cronTime, async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -51,12 +51,13 @@ async function main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const cronTime_command = "0 2 * * * *";
|
const cronTime_command = "0 0 2 * * *";
|
||||||
// const cronTime_command = "*/10 * * * * *";
|
// const cronTime_command = "*/10 * * * * *";
|
||||||
cron.schedule(cronTime_command, async () => {
|
cron.schedule(cronTime_command, async () => {
|
||||||
try {
|
try {
|
||||||
const commandController = new CommandController();
|
const commandController = new CommandController();
|
||||||
await commandController.cronjobCommand();
|
await commandController.cronjobCommand();
|
||||||
|
await commandController.cronjobTest();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error executing function from controller:", error);
|
console.error("Error executing function from controller:", error);
|
||||||
}
|
}
|
||||||
|
|
@ -72,7 +73,7 @@ async function main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const cronTime_Tenure = "0 0 * * *";
|
const cronTime_Tenure = "0 0 0 * * *";
|
||||||
cron.schedule(cronTime_Tenure, async () => {
|
cron.schedule(cronTime_Tenure, async () => {
|
||||||
try {
|
try {
|
||||||
const profileSalaryController = new ProfileSalaryController();
|
const profileSalaryController = new ProfileSalaryController();
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,8 @@ import { OrgRoot } from "../entities/OrgRoot";
|
||||||
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
|
||||||
import { ProfileInsignia, CreateProfileInsignia } from "../entities/ProfileInsignia";
|
import { ProfileInsignia, CreateProfileInsignia } from "../entities/ProfileInsignia";
|
||||||
import { ProfileInsigniaHistory } from "../entities/ProfileInsigniaHistory";
|
import { ProfileInsigniaHistory } from "../entities/ProfileInsigniaHistory";
|
||||||
|
import { Gender } from "../entities/Gender";
|
||||||
|
import { ProfileAvatar } from "../entities/ProfileAvatar";
|
||||||
@Route("api/v1/org/command")
|
@Route("api/v1/org/command")
|
||||||
@Tags("Command")
|
@Tags("Command")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -141,6 +143,8 @@ export class CommandController extends Controller {
|
||||||
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
private orgRootRepository = AppDataSource.getRepository(OrgRoot);
|
||||||
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||||
private insigniaHistoryRepo = AppDataSource.getRepository(ProfileInsigniaHistory);
|
private insigniaHistoryRepo = AppDataSource.getRepository(ProfileInsigniaHistory);
|
||||||
|
private genderRepo = AppDataSource.getRepository(Gender);
|
||||||
|
private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API list รายการคำสั่ง
|
* API list รายการคำสั่ง
|
||||||
|
|
@ -5510,7 +5514,7 @@ export class CommandController extends Controller {
|
||||||
|
|
||||||
let profile: any = await this.profileRepository.findOne({
|
let profile: any = await this.profileRepository.findOne({
|
||||||
where: { citizenId: item.bodyProfile.citizenId /*, isActive: true */ },
|
where: { citizenId: item.bodyProfile.citizenId /*, isActive: true */ },
|
||||||
relations: ["roleKeycloaks", "profileInsignias"],
|
relations: ["roleKeycloaks", "profileInsignias", "profileAvatars"],
|
||||||
});
|
});
|
||||||
let _oldInsigniaIds: string[] = [];
|
let _oldInsigniaIds: string[] = [];
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
|
|
@ -5961,6 +5965,48 @@ export class CommandController extends Controller {
|
||||||
await this.insigniaHistoryRepo.save(history, { data: req });
|
await this.insigniaHistoryRepo.save(history, { data: req });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// เพิ่มรูปภาพโปรไฟล์
|
||||||
|
if (item.bodyProfile.objectRefId) {
|
||||||
|
const _profileAvatar = new ProfileAvatar();
|
||||||
|
Object.assign(_profileAvatar, {
|
||||||
|
...meta,
|
||||||
|
profileId: profile.id,
|
||||||
|
profileEmployeeId: undefined,
|
||||||
|
});
|
||||||
|
if (profile.profileAvatars && profile.profileAvatars.length > 0) {
|
||||||
|
await Promise.all(
|
||||||
|
profile.profileAvatars.map(async (item: any) => {
|
||||||
|
item.isActive = false;
|
||||||
|
await this.avatarRepository.save(item);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await this.avatarRepository.save(_profileAvatar);
|
||||||
|
let avatar = `ทะเบียนประวัติ/โปรไฟล์/${profile.id}`;
|
||||||
|
let fileName = `profile-${_profileAvatar.id}`;
|
||||||
|
_profileAvatar.isActive = true;
|
||||||
|
_profileAvatar.avatar = avatar;
|
||||||
|
_profileAvatar.avatarName = fileName;
|
||||||
|
await this.avatarRepository.save(_profileAvatar, { data: req });
|
||||||
|
profile.avatar = avatar;
|
||||||
|
profile.avatarName = fileName;
|
||||||
|
await this.profileRepository.save(profile, { data: req });
|
||||||
|
const checkAvatar = await this.avatarRepository.findOne({
|
||||||
|
where: { avatar: avatar, avatarName: fileName },
|
||||||
|
});
|
||||||
|
if (checkAvatar && checkAvatar.profileId == null) {
|
||||||
|
checkAvatar.profileId = profile.id;
|
||||||
|
await this.avatarRepository.save(checkAvatar);
|
||||||
|
}
|
||||||
|
//duplicate รูปภาพโปรไฟล์โดยอิงจากรูปภาพเดิม
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(req, `/salary/file/avatar/${item.bodyProfile.objectRefId}`, {
|
||||||
|
prefix: avatar,
|
||||||
|
fileName: fileName,
|
||||||
|
})
|
||||||
|
.then(() => {})
|
||||||
|
.catch(() => {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
@ -7052,4 +7098,19 @@ export class CommandController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async cronjobTest(@Request() request?: RequestWithUser) {
|
||||||
|
const gender = {
|
||||||
|
name: "เพศทางเลือก",
|
||||||
|
code: "M",
|
||||||
|
isActive: true,
|
||||||
|
createdFullName: "system",
|
||||||
|
createdAt: new Date(),
|
||||||
|
updatedAt: new Date(),
|
||||||
|
};
|
||||||
|
|
||||||
|
await this.genderRepo.save(gender);
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,8 @@ import { ProfileInsignias } from "../entities/ProfileInsignias";
|
||||||
import { ProfileLeave } from "../entities/ProfileLeave";
|
import { ProfileLeave } from "../entities/ProfileLeave";
|
||||||
import { ProfileLeaves } from "../entities/ProfileLeaves";
|
import { ProfileLeaves } from "../entities/ProfileLeaves";
|
||||||
import { ProfileSalaryTemp } from "../entities/ProfileSalaryTemp";
|
import { ProfileSalaryTemp } from "../entities/ProfileSalaryTemp";
|
||||||
|
import { ProfileTraining } from "../entities/ProfileTraining";
|
||||||
|
import { ProfileTrainings } from "../entities/ProfileTrainings";
|
||||||
@Route("api/v1/org/upload")
|
@Route("api/v1/org/upload")
|
||||||
@Tags("UPLOAD")
|
@Tags("UPLOAD")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -185,6 +187,8 @@ export class ImportDataController extends Controller {
|
||||||
private LeaveSummaryRepo = AppDataSource.getRepository(ProfileLeave);
|
private LeaveSummaryRepo = AppDataSource.getRepository(ProfileLeave);
|
||||||
private ProfileInsigniasRepo = AppDataSource.getRepository(ProfileInsignias);
|
private ProfileInsigniasRepo = AppDataSource.getRepository(ProfileInsignias);
|
||||||
private InsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
private InsigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||||
|
private ProfileTrainingsRepo = AppDataSource.getRepository(ProfileTrainings);
|
||||||
|
private TrainingRepo = AppDataSource.getRepository(ProfileTraining);
|
||||||
private salaryTempRepo = AppDataSource.getRepository(ProfileSalaryTemp);
|
private salaryTempRepo = AppDataSource.getRepository(ProfileSalaryTemp);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -4699,6 +4703,58 @@ export class ImportDataController extends Controller {
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary เครื่องราช ข้าราชการ
|
||||||
|
*/
|
||||||
|
@Post("uploadProfileTraining-OfficerEntry")
|
||||||
|
async UploadFileSQLTrainingEntry(@Request() request: { user: Record<string, any> }) {
|
||||||
|
let rowCount = 0;
|
||||||
|
let _null: any = null;
|
||||||
|
const existingProfile = await this.ProfileTrainingsRepo.find({
|
||||||
|
// order: {
|
||||||
|
// citizenId: "ASC",
|
||||||
|
// },
|
||||||
|
});
|
||||||
|
for await (const _item of existingProfile) {
|
||||||
|
const citizenId: any = _item.createdFullName ?? "";
|
||||||
|
const profiles = await this.profileRepo.find({
|
||||||
|
where: { citizenId: citizenId },
|
||||||
|
// order: {
|
||||||
|
// Order: "ASC",
|
||||||
|
// },
|
||||||
|
});
|
||||||
|
let order = 1;
|
||||||
|
for await (const item of profiles) {
|
||||||
|
rowCount++;
|
||||||
|
const profile: any = new ProfileTraining();
|
||||||
|
profile.profileId = item.id;
|
||||||
|
profile.startDate = _item.startDate;
|
||||||
|
profile.endDate = _item.endDate;
|
||||||
|
profile.numberOrder = _item.numberOrder;
|
||||||
|
profile.topic = _item.topic;
|
||||||
|
profile.place = _item.place;
|
||||||
|
profile.dateOrder = _item.dateOrder;
|
||||||
|
profile.department = _item.department;
|
||||||
|
profile.duration = _item.duration;
|
||||||
|
profile.name = _item.name;
|
||||||
|
profile.yearly = _item.yearly;
|
||||||
|
profile.isDate = _item.isDate;
|
||||||
|
|
||||||
|
profile.isEntry = true;
|
||||||
|
profile.createdUserId = request.user.sub;
|
||||||
|
profile.createdFullName = request.user.name;
|
||||||
|
profile.lastUpdateUserId = request.user.sub;
|
||||||
|
profile.lastUpdateFullName = request.user.name;
|
||||||
|
profile.createdAt = new Date().toISOString().split("T")[0];
|
||||||
|
profile.lastUpdatedAt = new Date().toISOString().split("T")[0];
|
||||||
|
await this.TrainingRepo.save(profile);
|
||||||
|
console.log("profiles successfully written to Profile.csv: " + rowCount);
|
||||||
|
}
|
||||||
|
order = 1;
|
||||||
|
}
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @summary การลา ข้าราชการ
|
* @summary การลา ข้าราชการ
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import { Position } from "../entities/Position";
|
||||||
import { Insignia } from "../entities/Insignia";
|
import { Insignia } from "../entities/Insignia";
|
||||||
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
|
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
|
||||||
import { PosMaster } from "../entities/PosMaster";
|
import { PosMaster } from "../entities/PosMaster";
|
||||||
|
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||||
import { EmployeePosDict } from "../entities/EmployeePosDict";
|
import { EmployeePosDict } from "../entities/EmployeePosDict";
|
||||||
import { calculateRetireLaw } from "../interfaces/utils";
|
import { calculateRetireLaw } from "../interfaces/utils";
|
||||||
import Extension from "../interfaces/extension";
|
import Extension from "../interfaces/extension";
|
||||||
|
|
@ -44,6 +45,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||||
private positionRepository = AppDataSource.getRepository(Position);
|
private positionRepository = AppDataSource.getRepository(Position);
|
||||||
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
private posMasterRepository = AppDataSource.getRepository(PosMaster);
|
||||||
|
private empPosMasterRepository = AppDataSource.getRepository(EmployeePosMaster);
|
||||||
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
|
||||||
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
|
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
|
||||||
|
|
||||||
|
|
@ -188,10 +190,103 @@ export class OrganizationDotnetController extends Controller {
|
||||||
citizenId?: string | null;
|
citizenId?: string | null;
|
||||||
firstName?: string | null;
|
firstName?: string | null;
|
||||||
lastName?: string | null;
|
lastName?: string | null;
|
||||||
|
role?: string | null;
|
||||||
|
nodeId?: string | null;
|
||||||
|
node?: number | null;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const profileRepository = AppDataSource.getRepository(ProfileEmployee);
|
// const profileRepository = AppDataSource.getRepository(ProfileEmployee);
|
||||||
const queryBuilder = profileRepository
|
// const queryBuilder = profileRepository
|
||||||
|
// .createQueryBuilder("profile")
|
||||||
|
// .leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
|
// .leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
// .leftJoinAndSelect("profile.profileSalary", "profileSalary")
|
||||||
|
// .leftJoinAndSelect("profile.current_holders", "current_holders")
|
||||||
|
// .leftJoinAndSelect("current_holders.orgRoot", "orgRoot")
|
||||||
|
// .leftJoinAndSelect("current_holders.orgChild1", "orgChild1")
|
||||||
|
// .leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
|
// .leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
|
// .leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
|
// .orderBy("profileSalary.order", "DESC");
|
||||||
|
|
||||||
|
// if (body.citizenId || body.firstName || body.lastName) {
|
||||||
|
// queryBuilder.where(
|
||||||
|
// new Brackets((qb) => {
|
||||||
|
// if (body.citizenId) {
|
||||||
|
// qb.orWhere("profile.citizenId LIKE :citizenId", { citizenId: `%${body.citizenId}%` });
|
||||||
|
// }
|
||||||
|
// if (body.firstName) {
|
||||||
|
// qb.orWhere("profile.firstName LIKE :firstName", { firstName: `%${body.firstName}%` });
|
||||||
|
// }
|
||||||
|
// if (body.lastName) {
|
||||||
|
// qb.orWhere("profile.lastName LIKE :lastName", { lastName: `%${body.lastName}%` });
|
||||||
|
// }
|
||||||
|
// }),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
|
||||||
|
// const profileEmp = await queryBuilder.getMany();
|
||||||
|
|
||||||
|
let condition = "1=1";
|
||||||
|
let conditionParams = {};
|
||||||
|
if (body.role === "CHILD") {
|
||||||
|
switch (body.node) {
|
||||||
|
case 0:
|
||||||
|
condition = "orgRoot.ancestorDNA = :nodeId";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
condition = "orgChild1.ancestorDNA = :nodeId";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
condition = "orgChild2.ancestorDNA = :nodeId";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
condition = "orgChild3.ancestorDNA = :nodeId";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
condition = "orgChild4.ancestorDNA = :nodeId";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
condition = "1=1";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
conditionParams = { nodeId: body.nodeId };
|
||||||
|
}
|
||||||
|
else if (body.role === "ROOT") {
|
||||||
|
condition = "orgRoot.ancestorDNA = :nodeId";
|
||||||
|
conditionParams = { nodeId: body.nodeId };
|
||||||
|
}
|
||||||
|
else if (body.role === "NORMAL") {
|
||||||
|
switch (body.node) {
|
||||||
|
case 0:
|
||||||
|
condition = "orgRoot.ancestorDNA = :nodeId AND current_holders.orgChild1 IS NULL";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
condition = "orgChild1.ancestorDNA = :nodeId AND current_holders.orgChild2 IS NULL";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
condition = "orgChild2.ancestorDNA = :nodeId AND current_holders.orgChild3 IS NULL";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
condition = "orgChild3.ancestorDNA = :nodeId AND current_holders.orgChild4 IS NULL";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
condition = "orgChild4.ancestorDNA = :nodeId";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
condition = "1=1";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
conditionParams = { nodeId: body.nodeId };
|
||||||
|
}
|
||||||
|
|
||||||
|
const findRevision = await this.orgRevisionRepo.findOne({
|
||||||
|
where: { orgRevisionIsCurrent: true },
|
||||||
|
});
|
||||||
|
if (!findRevision) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "not found. OrgRevision");
|
||||||
|
}
|
||||||
|
const profileEmp = await this.profileEmpRepo
|
||||||
.createQueryBuilder("profile")
|
.createQueryBuilder("profile")
|
||||||
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
.leftJoinAndSelect("profile.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("profile.posType", "posType")
|
.leftJoinAndSelect("profile.posType", "posType")
|
||||||
|
|
@ -202,10 +297,8 @@ export class OrganizationDotnetController extends Controller {
|
||||||
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
.leftJoinAndSelect("current_holders.orgChild2", "orgChild2")
|
||||||
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
.leftJoinAndSelect("current_holders.orgChild3", "orgChild3")
|
||||||
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
.leftJoinAndSelect("current_holders.orgChild4", "orgChild4")
|
||||||
.orderBy("profileSalary.order", "DESC");
|
.where("current_holders.orgRevisionId = :orgRevisionId", { orgRevisionId: findRevision.id })
|
||||||
|
.andWhere(
|
||||||
if (body.citizenId || body.firstName || body.lastName) {
|
|
||||||
queryBuilder.where(
|
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
if (body.citizenId) {
|
if (body.citizenId) {
|
||||||
qb.orWhere("profile.citizenId LIKE :citizenId", { citizenId: `%${body.citizenId}%` });
|
qb.orWhere("profile.citizenId LIKE :citizenId", { citizenId: `%${body.citizenId}%` });
|
||||||
|
|
@ -217,14 +310,10 @@ export class OrganizationDotnetController extends Controller {
|
||||||
qb.orWhere("profile.lastName LIKE :lastName", { lastName: `%${body.lastName}%` });
|
qb.orWhere("profile.lastName LIKE :lastName", { lastName: `%${body.lastName}%` });
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
);
|
)
|
||||||
}
|
.andWhere(condition, conditionParams)
|
||||||
|
.orderBy("profileSalary.order", "DESC")
|
||||||
const profileEmp = await queryBuilder.getMany();
|
.getMany()
|
||||||
|
|
||||||
const findRevision = await this.orgRevisionRepo.findOne({
|
|
||||||
where: { orgRevisionIsCurrent: true },
|
|
||||||
});
|
|
||||||
|
|
||||||
const profileEmp_ = await Promise.all(
|
const profileEmp_ = await Promise.all(
|
||||||
profileEmp.map((item: ProfileEmployee) => {
|
profileEmp.map((item: ProfileEmployee) => {
|
||||||
|
|
@ -4121,19 +4210,39 @@ export class OrganizationDotnetController extends Controller {
|
||||||
if (body.role === "OWNER" || body.role === "CHILD") {
|
if (body.role === "OWNER" || body.role === "CHILD") {
|
||||||
switch (node) {
|
switch (node) {
|
||||||
case 0:
|
case 0:
|
||||||
typeCondition = { orgRootId: body.nodeId };
|
typeCondition = {
|
||||||
|
orgRoot: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
typeCondition = { orgChild1Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild1: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
typeCondition = { orgChild2Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild2: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
typeCondition = { orgChild3Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild3: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
typeCondition = { orgChild4Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild4: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case null:
|
case null:
|
||||||
typeCondition = {};
|
typeCondition = {};
|
||||||
|
|
@ -4144,32 +4253,49 @@ export class OrganizationDotnetController extends Controller {
|
||||||
}
|
}
|
||||||
} else if (body.role === "ROOT") {
|
} else if (body.role === "ROOT") {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgRootId: body.nodeId
|
orgRoot: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
};
|
};
|
||||||
} else if (body.role === "NORMAL") {
|
} else if (body.role === "NORMAL") {
|
||||||
switch (node) {
|
switch (node) {
|
||||||
case 0:
|
case 0:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgRootId: body.nodeId,
|
orgRoot: {
|
||||||
orgChild1Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild1: IsNull()
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild1Id: body.nodeId,
|
orgChild1: {
|
||||||
orgChild2Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild2: IsNull()
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild2Id: body.nodeId,
|
orgChild2: {
|
||||||
orgChild3Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild3: IsNull()
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild3Id: body.nodeId,
|
orgChild3: {
|
||||||
orgChild4Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild4: IsNull()
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
typeCondition = {
|
||||||
|
orgChild4: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -4190,6 +4316,26 @@ export class OrganizationDotnetController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
order: {
|
||||||
|
current_holders: {
|
||||||
|
orgRoot: {
|
||||||
|
orgRootOrder: "ASC",
|
||||||
|
},
|
||||||
|
orgChild1: {
|
||||||
|
orgChild1Order: "ASC",
|
||||||
|
},
|
||||||
|
orgChild2: {
|
||||||
|
orgChild2Order: "ASC",
|
||||||
|
},
|
||||||
|
orgChild3: {
|
||||||
|
orgChild3Order: "ASC",
|
||||||
|
},
|
||||||
|
orgChild4: {
|
||||||
|
orgChild4Order: "ASC",
|
||||||
|
},
|
||||||
|
posMasterNo: "ASC",
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (body.isRetirement) {
|
if (body.isRetirement) {
|
||||||
profile = await this.profileRepo.find({
|
profile = await this.profileRepo.find({
|
||||||
|
|
@ -4211,7 +4357,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let findRevision = await this.orgRevisionRepo.findOne({
|
let findRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true },
|
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (body.revisionId) {
|
if (body.revisionId) {
|
||||||
|
|
@ -4221,7 +4367,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
const profile_ = await Promise.all(
|
const profile_ = await Promise.all(
|
||||||
profile.map((item: Profile) => {
|
profile.map(async(item: Profile) => {
|
||||||
const shortName =
|
const shortName =
|
||||||
item.current_holders.length == 0
|
item.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
|
|
@ -4250,17 +4396,25 @@ export class OrganizationDotnetController extends Controller {
|
||||||
const Oc =
|
const Oc =
|
||||||
item.current_holders.length == 0
|
item.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
: body.node == 4 && item.current_holders[0].orgChild4 != null
|
: item.current_holders[0].orgChild4 != null
|
||||||
? `${item.current_holders[0].orgChild4.orgChild4Name}/${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild4.orgChild4Name}/${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 3 && item.current_holders[0].orgChild3 != null
|
: item.current_holders[0].orgChild3 != null
|
||||||
? `${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 2 && item.current_holders[0].orgChild2 != null
|
: item.current_holders[0].orgChild2 != null
|
||||||
? `${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 1 && item.current_holders[0].orgChild1 != null
|
: item.current_holders[0].orgChild1 != null
|
||||||
? `${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 0 && item.current_holders[0].orgRoot != null
|
: item.current_holders[0].orgRoot != null
|
||||||
? `${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
let _posMaster = await this.posMasterRepository.findOne({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: findRevision?.id,
|
||||||
|
current_holderId: item.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
prefix: item.prefix,
|
prefix: item.prefix,
|
||||||
|
|
@ -4273,6 +4427,11 @@ export class OrganizationDotnetController extends Controller {
|
||||||
positionLevel: item.posLevel?.posLevelName ?? null,
|
positionLevel: item.posLevel?.posLevelName ?? null,
|
||||||
positionType: item.posType?.posTypeName ?? null,
|
positionType: item.posType?.posTypeName ?? null,
|
||||||
oc: Oc,
|
oc: Oc,
|
||||||
|
orgRootId: _posMaster?.orgRootId,
|
||||||
|
orgChild1Id: _posMaster?.orgChild1Id,
|
||||||
|
orgChild2Id: _posMaster?.orgChild2Id,
|
||||||
|
orgChild3Id: _posMaster?.orgChild3Id,
|
||||||
|
orgChild4Id: _posMaster?.orgChild4Id
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
@ -4611,19 +4770,39 @@ export class OrganizationDotnetController extends Controller {
|
||||||
if (body.role === "OWNER" || body.role === "CHILD") {
|
if (body.role === "OWNER" || body.role === "CHILD") {
|
||||||
switch (node) {
|
switch (node) {
|
||||||
case 0:
|
case 0:
|
||||||
typeCondition = { orgRootId: body.nodeId };
|
typeCondition = {
|
||||||
|
orgRoot: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
typeCondition = { orgChild1Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild1: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
typeCondition = { orgChild2Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild2: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
typeCondition = { orgChild3Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild3: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
typeCondition = { orgChild4Id: body.nodeId };
|
typeCondition = {
|
||||||
|
orgChild4: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
}
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case null:
|
case null:
|
||||||
typeCondition = {};
|
typeCondition = {};
|
||||||
|
|
@ -4634,32 +4813,49 @@ export class OrganizationDotnetController extends Controller {
|
||||||
}
|
}
|
||||||
} else if (body.role === "ROOT") {
|
} else if (body.role === "ROOT") {
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgRootId: body.nodeId
|
orgRoot: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
};
|
};
|
||||||
} else if (body.role === "NORMAL") {
|
} else if (body.role === "NORMAL") {
|
||||||
switch (node) {
|
switch (node) {
|
||||||
case 0:
|
case 0:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgRootId: body.nodeId,
|
orgRoot: {
|
||||||
orgChild1Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild1: IsNull()
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild1Id: body.nodeId,
|
orgChild1: {
|
||||||
orgChild2Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild2: IsNull()
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild2Id: body.nodeId,
|
orgChild2: {
|
||||||
orgChild3Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild3: IsNull()
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
typeCondition = {
|
typeCondition = {
|
||||||
orgChild3Id: body.nodeId,
|
orgChild3: {
|
||||||
orgChild4Id: IsNull(),
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
|
orgChild4: IsNull()
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
typeCondition = {
|
||||||
|
orgChild4: {
|
||||||
|
ancestorDNA: body.nodeId
|
||||||
|
},
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -4680,6 +4876,26 @@ export class OrganizationDotnetController extends Controller {
|
||||||
"current_holders.orgChild3",
|
"current_holders.orgChild3",
|
||||||
"current_holders.orgChild4",
|
"current_holders.orgChild4",
|
||||||
],
|
],
|
||||||
|
order: {
|
||||||
|
current_holders: {
|
||||||
|
orgRoot: {
|
||||||
|
orgRootOrder: "ASC",
|
||||||
|
},
|
||||||
|
orgChild1: {
|
||||||
|
orgChild1Order: "ASC",
|
||||||
|
},
|
||||||
|
orgChild2: {
|
||||||
|
orgChild2Order: "ASC",
|
||||||
|
},
|
||||||
|
orgChild3: {
|
||||||
|
orgChild3Order: "ASC",
|
||||||
|
},
|
||||||
|
orgChild4: {
|
||||||
|
orgChild4Order: "ASC",
|
||||||
|
},
|
||||||
|
posMasterNo: "ASC",
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (body.isRetirement) {
|
if (body.isRetirement) {
|
||||||
profile = await this.profileEmpRepo.find({
|
profile = await this.profileEmpRepo.find({
|
||||||
|
|
@ -4701,7 +4917,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
let findRevision = await this.orgRevisionRepo.findOne({
|
let findRevision = await this.orgRevisionRepo.findOne({
|
||||||
where: { orgRevisionIsCurrent: true },
|
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false }
|
||||||
});
|
});
|
||||||
|
|
||||||
if (body.revisionId) {
|
if (body.revisionId) {
|
||||||
|
|
@ -4711,7 +4927,7 @@ export class OrganizationDotnetController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
const profile_ = await Promise.all(
|
const profile_ = await Promise.all(
|
||||||
profile.map((item: ProfileEmployee) => {
|
profile.map(async(item: ProfileEmployee) => {
|
||||||
const shortName =
|
const shortName =
|
||||||
item.current_holders.length == 0
|
item.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
|
|
@ -4740,17 +4956,25 @@ export class OrganizationDotnetController extends Controller {
|
||||||
const Oc =
|
const Oc =
|
||||||
item.current_holders.length == 0
|
item.current_holders.length == 0
|
||||||
? null
|
? null
|
||||||
: body.node == 4 && item.current_holders[0].orgChild4 != null
|
: item.current_holders[0].orgChild4 != null
|
||||||
? `${item.current_holders[0].orgChild4.orgChild4Name}/${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild4.orgChild4Name}/${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 3 && item.current_holders[0].orgChild3 != null
|
: item.current_holders[0].orgChild3 != null
|
||||||
? `${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild3.orgChild3Name}/${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 2 && item.current_holders[0].orgChild2 != null
|
: item.current_holders[0].orgChild2 != null
|
||||||
? `${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild2.orgChild2Name}/${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 1 && item.current_holders[0].orgChild1 != null
|
: item.current_holders[0].orgChild1 != null
|
||||||
? `${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgChild1.orgChild1Name}/${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: body.node == 0 && item.current_holders[0].orgRoot != null
|
: item.current_holders[0].orgRoot != null
|
||||||
? `${item.current_holders[0].orgRoot.orgRootName}`
|
? `${item.current_holders[0].orgRoot.orgRootName}`
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
let _posMaster = await this.empPosMasterRepository.findOne({
|
||||||
|
where: {
|
||||||
|
orgRevisionId: findRevision?.id,
|
||||||
|
current_holderId: item.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
prefix: item.prefix,
|
prefix: item.prefix,
|
||||||
|
|
@ -4760,9 +4984,16 @@ export class OrganizationDotnetController extends Controller {
|
||||||
keycloak: item.keycloak,
|
keycloak: item.keycloak,
|
||||||
posNo: shortName,
|
posNo: shortName,
|
||||||
position: item.position,
|
position: item.position,
|
||||||
positionLevel: item.posLevel?.posLevelName ?? null,
|
positionLevel: item.posType?.posTypeShortName && item.posLevel?.posLevelName
|
||||||
|
? `${item.posType?.posTypeShortName} ${item.posLevel?.posLevelName}`
|
||||||
|
: null,
|
||||||
positionType: item.posType?.posTypeName ?? null,
|
positionType: item.posType?.posTypeName ?? null,
|
||||||
oc: Oc,
|
oc: Oc,
|
||||||
|
orgRootId: _posMaster?.orgRootId,
|
||||||
|
orgChild1Id: _posMaster?.orgChild1Id,
|
||||||
|
orgChild2Id: _posMaster?.orgChild2Id,
|
||||||
|
orgChild3Id: _posMaster?.orgChild3Id,
|
||||||
|
orgChild4Id: _posMaster?.orgChild4Id,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1153,6 +1153,7 @@ export class ProfileController extends Controller {
|
||||||
"commandNo",
|
"commandNo",
|
||||||
"positionCee",
|
"positionCee",
|
||||||
"amount",
|
"amount",
|
||||||
|
"amountSpecial",
|
||||||
"remark",
|
"remark",
|
||||||
],
|
],
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -1176,6 +1177,8 @@ export class ProfileController extends Controller {
|
||||||
: null,
|
: null,
|
||||||
salary:
|
salary:
|
||||||
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
||||||
|
special:
|
||||||
|
item.amountSpecial != null ? Extension.ToThaiNumber(item.amountSpecial.toLocaleString()) : null,
|
||||||
rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||||
refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
||||||
positionLevel: item.positionLevel
|
positionLevel: item.positionLevel
|
||||||
|
|
@ -1202,6 +1205,7 @@ export class ProfileController extends Controller {
|
||||||
position: "-",
|
position: "-",
|
||||||
posNo: "-",
|
posNo: "-",
|
||||||
salary: "-",
|
salary: "-",
|
||||||
|
special: "-",
|
||||||
rank: "-",
|
rank: "-",
|
||||||
refAll: "-",
|
refAll: "-",
|
||||||
positionLevel: "-",
|
positionLevel: "-",
|
||||||
|
|
|
||||||
|
|
@ -1150,6 +1150,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
"commandNo",
|
"commandNo",
|
||||||
"positionCee",
|
"positionCee",
|
||||||
"amount",
|
"amount",
|
||||||
|
"amountSpecial",
|
||||||
"remark",
|
"remark",
|
||||||
],
|
],
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -1173,6 +1174,8 @@ export class ProfileEmployeeController extends Controller {
|
||||||
: null,
|
: null,
|
||||||
salary:
|
salary:
|
||||||
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
||||||
|
special:
|
||||||
|
item.amountSpecial != null ? Extension.ToThaiNumber(item.amountSpecial.toLocaleString()) : null,
|
||||||
rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||||
refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
refAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
||||||
positionLevel: item.positionLevel
|
positionLevel: item.positionLevel
|
||||||
|
|
@ -1199,6 +1202,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
position: "-",
|
position: "-",
|
||||||
posNo: "-",
|
posNo: "-",
|
||||||
salary: "-",
|
salary: "-",
|
||||||
|
special: "-",
|
||||||
rank: "-",
|
rank: "-",
|
||||||
refAll: "-",
|
refAll: "-",
|
||||||
positionLevel: "-",
|
positionLevel: "-",
|
||||||
|
|
|
||||||
|
|
@ -670,6 +670,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
"positionSalaryAmount",
|
"positionSalaryAmount",
|
||||||
"commandNo",
|
"commandNo",
|
||||||
"amount",
|
"amount",
|
||||||
|
"amountSpecial",
|
||||||
"remark",
|
"remark",
|
||||||
],
|
],
|
||||||
where: { profileEmployeeId: id },
|
where: { profileEmployeeId: id },
|
||||||
|
|
@ -686,6 +687,8 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
PosNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
PosNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
||||||
Salary:
|
Salary:
|
||||||
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
||||||
|
Special:
|
||||||
|
item.amountSpecial != null ? Extension.ToThaiNumber(item.amountSpecial.toLocaleString()) : null,
|
||||||
Rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
Rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||||
RefAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
RefAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
||||||
PositionLevel:
|
PositionLevel:
|
||||||
|
|
@ -709,6 +712,7 @@ export class ProfileEmployeeTempController extends Controller {
|
||||||
Position: "-",
|
Position: "-",
|
||||||
PosNo: "-",
|
PosNo: "-",
|
||||||
Salary: "-",
|
Salary: "-",
|
||||||
|
Special: "-",
|
||||||
Rank: "-",
|
Rank: "-",
|
||||||
RefAll: "-",
|
RefAll: "-",
|
||||||
PositionLevel: "-",
|
PositionLevel: "-",
|
||||||
|
|
|
||||||
|
|
@ -857,6 +857,7 @@ export class CreateProfileAllFields {
|
||||||
currentZipCode: string | null;
|
currentZipCode: string | null;
|
||||||
amount?: Double | null;
|
amount?: Double | null;
|
||||||
amountSpecial?: Double | null;
|
amountSpecial?: Double | null;
|
||||||
|
objectRefId?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateProfile = {
|
export type UpdateProfile = {
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,12 @@ export class ProfileTraining extends EntityBase {
|
||||||
})
|
})
|
||||||
isDate: boolean;
|
isDate: boolean;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "ข้อมูลจาก Entry",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
isEntry: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 40,
|
length: 40,
|
||||||
|
|
|
||||||
91
src/entities/ProfileTrainings.ts
Normal file
91
src/entities/ProfileTrainings.ts
Normal file
|
|
@ -0,0 +1,91 @@
|
||||||
|
import { Entity, Column } from "typeorm";
|
||||||
|
import { EntityBase } from "./base/Base";
|
||||||
|
|
||||||
|
@Entity("ProfileTrainings")
|
||||||
|
export class ProfileTrainings extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "datetime",
|
||||||
|
comment: "วันเริ่มต้นการฝึกอบรม/ดูงาน ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
startDate: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "datetime",
|
||||||
|
comment: "วันสิ้นสุดการฝึกอบรม/ดูงาน ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
endDate: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 200,
|
||||||
|
comment: "เลขที่คำสั่ง/เลขที่หนังสืออนุมัติ ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
numberOrder: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 200,
|
||||||
|
comment: "หัวข้อการฝึกอบรม/ดูงาน ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
topic: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 200,
|
||||||
|
comment: "สถานที่ฝึกอบรม/ดูงาน ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
place: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: "datetime",
|
||||||
|
comment: "คำสั่งลงวันที่/หนังสืออนุมัติลงวันที่ ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
dateOrder: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 200,
|
||||||
|
comment: "หน่วยงานที่รับผิดชอบจัดการฝึกอบรม/ดูงาน ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
department: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 200,
|
||||||
|
comment: "รวมระยะเวลาในการฝึกอบรม/ดูงาน ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
duration: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
length: 200,
|
||||||
|
comment: "ชื่อโครงการ/หลักสูตรการฝึกอบรม ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ปีที่อบรม (พ.ศ.) ",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
yearly: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ประเภทช่วงเวลาการศึกษา",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
isDate: boolean;
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue