ปรับออกคำสั่งลงตำแหน่ง
This commit is contained in:
parent
c5e0fcc4f7
commit
e305ea7a88
20 changed files with 1317 additions and 1183 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -258,7 +258,7 @@ export class DPISController extends Controller {
|
|||
//relations: ["current_holders", "current_holders.orgRoot"],
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileLeaves: {
|
||||
dateLeaveStart: "ASC",
|
||||
|
|
@ -314,7 +314,7 @@ export class DPISController extends Controller {
|
|||
salaries: profile.profileSalary.map((item) => {
|
||||
return {
|
||||
posNo: item.posNo,
|
||||
position: item.position,
|
||||
position: item.positionName,
|
||||
positionType: item.positionType,
|
||||
positionLevel: item.positionLevel,
|
||||
amount: item.amount,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ import * as fs from "fs";
|
|||
import * as path from "path";
|
||||
const { createConnection } = require("typeorm");
|
||||
import csvParser from "csv-parser";
|
||||
import { HR_POSITION_OFFICER } from "../entities/HR_POSITION_OFFICER";
|
||||
import { HR_PERSONAL_OFFICER_FAMILY } from "../entities/HR_PERSONAL_OFFICER_FAMILY";
|
||||
|
||||
const BATCH_SIZE = 1000;
|
||||
|
|
@ -47,6 +46,7 @@ import { OrgRevision } from "../entities/OrgRevision";
|
|||
import { OFFICER } from "../entities/OFFICER";
|
||||
import { Position } from "../entities/Position";
|
||||
import { PosMaster } from "../entities/PosMaster";
|
||||
import { positionOfficer } from "../entities/positionOfficer";
|
||||
|
||||
@Route("api/v1/org/upload")
|
||||
@Tags("UPLOAD")
|
||||
|
|
@ -61,7 +61,7 @@ export class ImportDataController extends Controller {
|
|||
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||
private posLevelRepo = AppDataSource.getRepository(PosLevel);
|
||||
private posTypeRepo = AppDataSource.getRepository(PosType);
|
||||
private HR_POSITION_OFFICERRepo = AppDataSource.getRepository(HR_POSITION_OFFICER);
|
||||
private positionOfficerRepo = AppDataSource.getRepository(positionOfficer);
|
||||
private HR_PERSONAL_OFFICER_FAMILYRepo = AppDataSource.getRepository(HR_PERSONAL_OFFICER_FAMILY);
|
||||
private HR_EDUCATIONRepo = AppDataSource.getRepository(HR_EDUCATION);
|
||||
private HR_PERSONAL_OFFICER_ADDRESSRepo = AppDataSource.getRepository(
|
||||
|
|
@ -328,115 +328,133 @@ export class ImportDataController extends Controller {
|
|||
.createQueryBuilder("profile")
|
||||
.select(["profile.citizenId", "profile.id"])
|
||||
.orderBy("profile.citizenId", "ASC")
|
||||
.skip(20000)
|
||||
.take(10000)
|
||||
.where("profile.citizenId = '3101702379675'")
|
||||
// .skip(0)
|
||||
// .take(10000)
|
||||
.getManyAndCount();
|
||||
// for (var i = 1; i <= total / BATCH_SIZE; i++) {
|
||||
// const profiles = await AppDataSource.getRepository(Profile)
|
||||
// .createQueryBuilder("profile")
|
||||
// .select(["profile.citizenId", "profile.id"])
|
||||
// .orderBy("profile.citizenId", "ASC")
|
||||
// .skip((i - 1) * BATCH_SIZE)
|
||||
// .take(BATCH_SIZE)
|
||||
// .getMany();
|
||||
|
||||
await Promise.all(
|
||||
profiles.map(async (_item) => {
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + _item.citizenId);
|
||||
const existingProfile = await this.HR_POSITION_OFFICERRepo.find({
|
||||
where: { CIT: _item.citizenId, FLAG_PERSON_TYPE: "1" },
|
||||
select: [
|
||||
"CIT",
|
||||
"MP_POS_DATE",
|
||||
"SALARY",
|
||||
"MP_COMMAND_NUM",
|
||||
"POS_NUM_NAME",
|
||||
"POS_NUM_CODE",
|
||||
"FLAG_TO_NAME",
|
||||
"WORK_LINE_NAME",
|
||||
"SPECIALIST_NAME",
|
||||
"ADMIN_NAME",
|
||||
"REMARK",
|
||||
"ORDER_MOVE_POSITION",
|
||||
"SAL_POS_AMOUNT_1",
|
||||
"SAL_POS_AMOUNT_2",
|
||||
"SPECIAL_AMT",
|
||||
"MP_COMMAND_DATE",
|
||||
"FLAG_TO_NAME_CODE",
|
||||
"DEPARTMENT_NAME",
|
||||
"DIVISION_NAME",
|
||||
"SECTION_NAME",
|
||||
"JOB_NAME",
|
||||
"MP_CEE",
|
||||
"USER_CREATE",
|
||||
"USER_UPDATE",
|
||||
],
|
||||
const existingProfile = await this.positionOfficerRepo.find({
|
||||
where: { citizenId: _item.citizenId, flag_person_type: "1" },
|
||||
order: {
|
||||
mp_pos_date: "ASC",
|
||||
order_move_position: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
existingProfile.map(async (item) => {
|
||||
rowCount++;
|
||||
const profileSalary = new ProfileSalary();
|
||||
profileSalary.date = item.MP_POS_DATE
|
||||
? new Date(item.MP_POS_DATE.replace(" +0700 +07:00", ""))
|
||||
: null_;
|
||||
const SALARY: any =
|
||||
item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY);
|
||||
profileSalary.amount = SALARY;
|
||||
const SAL_POS_AMOUNT_1: any =
|
||||
item.SAL_POS_AMOUNT_1 == null || item.SAL_POS_AMOUNT_1 == ""
|
||||
? null_
|
||||
: Number(item.SAL_POS_AMOUNT_1);
|
||||
const SAL_POS_AMOUNT_2: any =
|
||||
item.SAL_POS_AMOUNT_2 == null || item.SAL_POS_AMOUNT_2 == ""
|
||||
? null_
|
||||
: Number(item.SAL_POS_AMOUNT_2);
|
||||
profileSalary.positionSalaryAmount = SAL_POS_AMOUNT_1 ?? SAL_POS_AMOUNT_2;
|
||||
const SPECIAL_AMT: any =
|
||||
item.SPECIAL_AMT == null || item.SPECIAL_AMT == "" ? null_ : Number(item.SPECIAL_AMT);
|
||||
profileSalary.amountSpecial = SPECIAL_AMT;
|
||||
const profileSalary: any = new ProfileSalary();
|
||||
profileSalary.profileId = _item.id;
|
||||
profileSalary.refCommandNo = item.MP_COMMAND_NUM;
|
||||
profileSalary.posNo = item.POS_NUM_NAME + item.POS_NUM_CODE;
|
||||
profileSalary.position = item.WORK_LINE_NAME;
|
||||
profileSalary.positionPathSide = item.SPECIALIST_NAME;
|
||||
profileSalary.positionExecutive = item.ADMIN_NAME;
|
||||
profileSalary.templateDoc = item.REMARK;
|
||||
profileSalary.refCommandDate =
|
||||
item.MP_COMMAND_DATE == ""
|
||||
? new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", ""))
|
||||
: null_;
|
||||
profileSalary.refCommandCode = item.FLAG_TO_NAME_CODE;
|
||||
profileSalary.refCommandName = item.FLAG_TO_NAME;
|
||||
profileSalary.orgRoot = item.DEPARTMENT_NAME;
|
||||
profileSalary.orgChild1 = item.DIVISION_NAME;
|
||||
profileSalary.orgChild2 = item.SECTION_NAME;
|
||||
profileSalary.orgChild3 = item.JOB_NAME;
|
||||
if (item.DEPARTMENT_CODE == "50") {
|
||||
profileSalary.orgRoot = item.DIVISION_NAME;
|
||||
profileSalary.orgChild1 = item.SECTION_NAME;
|
||||
profileSalary.orgChild2 = item.JOB_NAME;
|
||||
profileSalary.order = item.order_move_position; ///
|
||||
profileSalary.commandNo = item.mp_command_num;
|
||||
profileSalary.commandYear = item.cur_year;
|
||||
profileSalary.commandDateSign = item.mp_command_date;
|
||||
profileSalary.commandDateAffect = item.mp_pos_date;
|
||||
profileSalary.commandCode = item.flag_to_name_code;
|
||||
profileSalary.commandName = item.flag_to_name;
|
||||
profileSalary.posNoAbb = item.pos_num_name;
|
||||
profileSalary.posNo = item.pos_num_code;
|
||||
profileSalary.positionName = item.work_line_name;
|
||||
profileSalary.positionCee = item.mp_cee;
|
||||
var positionType = "";
|
||||
var positionLevel = "";
|
||||
if (item.mp_cee == "21") {
|
||||
positionType = "ทั่วไป";
|
||||
positionLevel = "ปฏิบัติงาน";
|
||||
} else if (item.mp_cee == "22") {
|
||||
positionType = "ทั่วไป";
|
||||
positionLevel = "ชำนาญงาน";
|
||||
} else if (item.mp_cee == "23") {
|
||||
positionType = "ทั่วไป";
|
||||
positionLevel = "อาวุโส";
|
||||
} else if (item.mp_cee == "24") {
|
||||
positionType = "ทั่วไป";
|
||||
positionLevel = "อาวุโสเฉพาะสายงานที่กำหนด";
|
||||
} else if (item.mp_cee == "25") {
|
||||
positionType = "ทั่วไป";
|
||||
positionLevel = "ทักษะพิเศษ";
|
||||
} else if (item.mp_cee == "26") {
|
||||
positionType = "วิชาการ";
|
||||
positionLevel = "ปฏิบัติการ";
|
||||
} else if (item.mp_cee == "27") {
|
||||
positionType = "วิชาการ";
|
||||
positionLevel = "ชำนาญการ";
|
||||
} else if (item.mp_cee == "28") {
|
||||
positionType = "วิชาการ";
|
||||
positionLevel = "ชำนาญการพิเศษ";
|
||||
} else if (item.mp_cee == "29") {
|
||||
positionType = "วิชาการ";
|
||||
positionLevel = "เชี่ยวชาญ";
|
||||
} else if (item.mp_cee == "30") {
|
||||
positionType = "วิชาการ";
|
||||
positionLevel = "ทรงคุณวุฒิ";
|
||||
} else if (item.mp_cee == "31") {
|
||||
positionType = "วิชาการ";
|
||||
positionLevel = "ทรงคุณวุฒิเฉพาะสายงานที่กำหนด";
|
||||
} else if (item.mp_cee == "32") {
|
||||
positionType = "อำนวยการ";
|
||||
positionLevel = "ต้น";
|
||||
} else if (item.mp_cee == "33") {
|
||||
positionType = "อำนวยการ";
|
||||
positionLevel = "สูง";
|
||||
} else if (item.mp_cee == "34") {
|
||||
positionType = "บริหาร";
|
||||
positionLevel = "ต้น";
|
||||
} else if (item.mp_cee == "35") {
|
||||
positionType = "บริหาร";
|
||||
positionLevel = "สูง";
|
||||
}
|
||||
profileSalary.mpCee = item.MP_CEE;
|
||||
const ORDER_MOVE_POSITION: any =
|
||||
item.ORDER_MOVE_POSITION == null || item.ORDER_MOVE_POSITION == ""
|
||||
var _type = await this.posTypeRepo.findOne({
|
||||
where: { posTypeName: positionType },
|
||||
});
|
||||
profileSalary.positionType = _type == null ? null_ : _type.id;
|
||||
if (_type != null) {
|
||||
var _level = await this.posLevelRepo.findOne({
|
||||
where: {
|
||||
posLevelName: positionLevel,
|
||||
posTypeId: _type.id,
|
||||
},
|
||||
});
|
||||
profileSalary.positionLevel = _level == null ? null_ : _level.id;
|
||||
}
|
||||
profileSalary.orgRoot = item.department_name;
|
||||
profileSalary.orgChild1 = item.division_name;
|
||||
profileSalary.orgChild2 = item.section_name;
|
||||
profileSalary.orgChild3 = item.job_name;
|
||||
if (item.department_code == "50") {
|
||||
profileSalary.orgRoot = item.division_name;
|
||||
profileSalary.orgChild1 = item.section_name;
|
||||
profileSalary.orgChild2 = item.job_name;
|
||||
}
|
||||
profileSalary.positionExecutive = item.admin_name;
|
||||
profileSalary.amount = item.salary;
|
||||
profileSalary.remark = item.remark;
|
||||
|
||||
const sal_pos_amount_1: any =
|
||||
item.sal_pos_amount_1 == null || item.sal_pos_amount_1 == ""
|
||||
? null_
|
||||
: Number(item.ORDER_MOVE_POSITION);
|
||||
profileSalary.order = ORDER_MOVE_POSITION;
|
||||
: Number(item.sal_pos_amount_1);
|
||||
const sal_pos_amount_2: any =
|
||||
item.sal_pos_amount_2 == null || item.sal_pos_amount_2 == ""
|
||||
? null_
|
||||
: Number(item.sal_pos_amount_2);
|
||||
profileSalary.positionSalaryAmount = sal_pos_amount_1 ?? sal_pos_amount_2;
|
||||
const special_amt: any =
|
||||
item.special_amt == null || item.special_amt == "" ? null_ : Number(item.special_amt);
|
||||
profileSalary.amountSpecial = special_amt;
|
||||
|
||||
profileSalary.createdUserId = request.user.sub;
|
||||
profileSalary.createdFullName = request.user.name;
|
||||
profileSalary.lastUpdateUserId = request.user.sub;
|
||||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
profileSalary.createdAt =
|
||||
item.USER_CREATE == ""
|
||||
? new Date(item.USER_CREATE.replace(" +0700 +07:00", ""))
|
||||
: new Date();
|
||||
profileSalary.lastUpdatedAt =
|
||||
item.USER_UPDATE == ""
|
||||
? new Date(item.USER_UPDATE.replace(" +0700 +07:00", ""))
|
||||
: new Date();
|
||||
profileSalary.createdAt = new Date();
|
||||
profileSalary.lastUpdatedAt = new Date();
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.salaryRepo.save(profileSalary);
|
||||
// save to file
|
||||
// await this.salaryRepo.save(profileSalary);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
|
|
@ -457,115 +475,75 @@ export class ImportDataController extends Controller {
|
|||
.createQueryBuilder("profile")
|
||||
.select(["profile.citizenId", "profile.id"])
|
||||
.orderBy("profile.citizenId", "ASC")
|
||||
// .skip(0)
|
||||
// .take(20)
|
||||
.skip(0)
|
||||
.take(10000)
|
||||
.getManyAndCount();
|
||||
// for (var i = 1; i <= total / BATCH_SIZE; i++) {
|
||||
// const profiles = await AppDataSource.getRepository(ProfileEmployee)
|
||||
// .createQueryBuilder("profile")
|
||||
// .select(["profile.citizenId", "profile.id"])
|
||||
// .orderBy("profile.citizenId", "ASC")
|
||||
// .skip((i - 1) * BATCH_SIZE)
|
||||
// .take(BATCH_SIZE)
|
||||
// .getMany();
|
||||
|
||||
await Promise.all(
|
||||
profiles.map(async (_item) => {
|
||||
const existingProfile = await this.HR_POSITION_OFFICERRepo.find({
|
||||
where: { CIT: _item.citizenId },
|
||||
select: [
|
||||
"CIT",
|
||||
"MP_POS_DATE",
|
||||
"SALARY",
|
||||
"MP_COMMAND_NUM",
|
||||
"POS_NUM_NAME",
|
||||
"POS_NUM_CODE",
|
||||
"FLAG_TO_NAME",
|
||||
"WORK_LINE_NAME",
|
||||
"SPECIALIST_NAME",
|
||||
"ADMIN_NAME",
|
||||
"REMARK",
|
||||
"ORDER_MOVE_POSITION",
|
||||
"SAL_POS_AMOUNT_1",
|
||||
"SAL_POS_AMOUNT_2",
|
||||
"SPECIAL_AMT",
|
||||
"MP_COMMAND_DATE",
|
||||
"FLAG_TO_NAME_CODE",
|
||||
"DEPARTMENT_NAME",
|
||||
"DIVISION_NAME",
|
||||
"SECTION_NAME",
|
||||
"JOB_NAME",
|
||||
"MP_CEE",
|
||||
"USER_CREATE",
|
||||
"USER_UPDATE",
|
||||
],
|
||||
const existingProfile = await this.positionOfficerRepo.find({
|
||||
where: { citizenId: _item.citizenId, flag_person_type: "7" },
|
||||
});
|
||||
|
||||
await Promise.all(
|
||||
existingProfile.map(async (item) => {
|
||||
rowCount++;
|
||||
const profileSalary = new ProfileSalary();
|
||||
profileSalary.date =
|
||||
item.MP_POS_DATE == ""
|
||||
? new Date(item.MP_POS_DATE.replace(" +0700 +07:00", ""))
|
||||
: null_;
|
||||
const SALARY: any =
|
||||
item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY);
|
||||
profileSalary.amount = SALARY;
|
||||
const SAL_POS_AMOUNT_1: any =
|
||||
item.SAL_POS_AMOUNT_1 == null || item.SAL_POS_AMOUNT_1 == ""
|
||||
const profileSalary: any = new ProfileSalary();
|
||||
profileSalary.profileId = _item.id;
|
||||
profileSalary.order = item.order_move_position; ///
|
||||
profileSalary.commandNo = item.mp_command_num;
|
||||
profileSalary.commandYear = item.cur_year;
|
||||
profileSalary.commandDateSign = item.mp_command_date;
|
||||
profileSalary.commandDateAffect = item.mp_pos_date;
|
||||
profileSalary.commandCode = item.flag_to_name_code;
|
||||
profileSalary.commandName = item.flag_to_name;
|
||||
profileSalary.posNoAbb = item.pos_num_name;
|
||||
profileSalary.posNo = item.pos_num_code;
|
||||
profileSalary.positionName = item.work_line_name;
|
||||
profileSalary.positionCee = item.mp_cee;
|
||||
profileSalary.positionType = item.mp_cee;
|
||||
profileSalary.positionLevel = item.mp_cee;
|
||||
profileSalary.orgRoot = item.department_name;
|
||||
profileSalary.orgChild1 = item.division_name;
|
||||
profileSalary.orgChild2 = item.section_name;
|
||||
profileSalary.orgChild3 = item.job_name;
|
||||
if (item.department_code == "50") {
|
||||
profileSalary.orgRoot = item.division_name;
|
||||
profileSalary.orgChild1 = item.section_name;
|
||||
profileSalary.orgChild2 = item.job_name;
|
||||
}
|
||||
profileSalary.positionExecutive = item.admin_name;
|
||||
profileSalary.amount = item.salary;
|
||||
profileSalary.remark = item.remark;
|
||||
|
||||
const sal_pos_amount_1: any =
|
||||
item.sal_pos_amount_1 == null || item.sal_pos_amount_1 == ""
|
||||
? null_
|
||||
: Number(item.SAL_POS_AMOUNT_1);
|
||||
const SAL_POS_AMOUNT_2: any =
|
||||
item.SAL_POS_AMOUNT_2 == null || item.SAL_POS_AMOUNT_2 == ""
|
||||
: Number(item.sal_pos_amount_1);
|
||||
const sal_pos_amount_2: any =
|
||||
item.sal_pos_amount_2 == null || item.sal_pos_amount_2 == ""
|
||||
? null_
|
||||
: Number(item.SAL_POS_AMOUNT_2);
|
||||
profileSalary.positionSalaryAmount = SAL_POS_AMOUNT_1 ?? SAL_POS_AMOUNT_2;
|
||||
const SPECIAL_AMT: any =
|
||||
item.SPECIAL_AMT == null || item.SPECIAL_AMT == "" ? null_ : Number(item.SPECIAL_AMT);
|
||||
profileSalary.amountSpecial = SPECIAL_AMT;
|
||||
profileSalary.profileEmployeeId = _item.id;
|
||||
profileSalary.refCommandNo = item.MP_COMMAND_NUM;
|
||||
profileSalary.posNo = item.POS_NUM_NAME + item.POS_NUM_CODE;
|
||||
profileSalary.position = item.WORK_LINE_NAME;
|
||||
profileSalary.positionPathSide = item.SPECIALIST_NAME;
|
||||
profileSalary.positionExecutive = item.ADMIN_NAME;
|
||||
profileSalary.templateDoc = item.REMARK;
|
||||
profileSalary.refCommandDate =
|
||||
item.MP_COMMAND_DATE == ""
|
||||
? new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", ""))
|
||||
: null_;
|
||||
profileSalary.refCommandCode = item.FLAG_TO_NAME_CODE;
|
||||
profileSalary.refCommandName = item.FLAG_TO_NAME;
|
||||
profileSalary.orgRoot = item.DEPARTMENT_NAME;
|
||||
profileSalary.orgChild1 = item.DIVISION_NAME;
|
||||
profileSalary.orgChild2 = item.SECTION_NAME;
|
||||
profileSalary.orgChild3 = item.JOB_NAME;
|
||||
profileSalary.mpCee = item.MP_CEE;
|
||||
const ORDER_MOVE_POSITION: any =
|
||||
item.ORDER_MOVE_POSITION == null || item.ORDER_MOVE_POSITION == ""
|
||||
? null_
|
||||
: Number(item.ORDER_MOVE_POSITION);
|
||||
profileSalary.order = ORDER_MOVE_POSITION;
|
||||
: Number(item.sal_pos_amount_2);
|
||||
profileSalary.positionSalaryAmount = sal_pos_amount_1 ?? sal_pos_amount_2;
|
||||
const special_amt: any =
|
||||
item.special_amt == null || item.special_amt == "" ? null_ : Number(item.special_amt);
|
||||
profileSalary.amountSpecial = special_amt;
|
||||
|
||||
profileSalary.commandId;
|
||||
|
||||
profileSalary.createdUserId = request.user.sub;
|
||||
profileSalary.createdFullName = request.user.name;
|
||||
profileSalary.lastUpdateUserId = request.user.sub;
|
||||
profileSalary.lastUpdateFullName = request.user.name;
|
||||
profileSalary.createdAt =
|
||||
item.USER_CREATE == ""
|
||||
? new Date(item.USER_CREATE.replace(" +0700 +07:00", ""))
|
||||
: new Date();
|
||||
profileSalary.lastUpdatedAt =
|
||||
item.USER_UPDATE == ""
|
||||
? new Date(item.USER_UPDATE.replace(" +0700 +07:00", ""))
|
||||
: new Date();
|
||||
profileSalary.createdAt = new Date();
|
||||
profileSalary.lastUpdatedAt = new Date();
|
||||
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
|
||||
await this.salaryRepo.save(profileSalary);
|
||||
// save to file
|
||||
// await this.salaryRepo.save(profileSalary);
|
||||
}),
|
||||
);
|
||||
}),
|
||||
);
|
||||
// }
|
||||
console.log(rowCount);
|
||||
return new HttpSuccess();
|
||||
}
|
||||
|
|
@ -1472,12 +1450,12 @@ export class ImportDataController extends Controller {
|
|||
const allId = _profileOff.concat(_profileEmp);
|
||||
|
||||
for (var i = 1; i <= 1000; i++) {
|
||||
const HR_POSITION_OFFICER = await this.HR_POSITION_OFFICERRepo.find({
|
||||
where: { CIT: Not(In(allId)) },
|
||||
const positionOfficer = await this.positionOfficerRepo.find({
|
||||
where: { citizenId: Not(In(allId)) },
|
||||
take: 1000,
|
||||
skip: 0,
|
||||
});
|
||||
this.HR_POSITION_OFFICERRepo.remove(HR_POSITION_OFFICER);
|
||||
this.positionOfficerRepo.remove(positionOfficer);
|
||||
// const HR_PERSONAL_OFFICER_FAMILY = await this.HR_PERSONAL_OFFICER_FAMILYRepo.find({
|
||||
// where: { CIT: Not(In(allId)) },
|
||||
// take: 1000,
|
||||
|
|
|
|||
|
|
@ -289,7 +289,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { keycloak: keycloakId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -318,7 +318,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { keycloak: keycloakId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -918,7 +918,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { id: profileId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -944,7 +944,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { id: profileId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -1571,7 +1571,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { citizenId: citizenId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -1597,7 +1597,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { citizenId: citizenId },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -2166,7 +2166,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -2383,7 +2383,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -2539,7 +2539,7 @@ export class OrganizationDotnetController extends Controller {
|
|||
})),
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,9 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||
private profileAssessmentRepo = AppDataSource.getRepository(ProfileAssessment);
|
||||
private viewProfileEvaluationRepo = AppDataSource.getRepository(viewProfileEvaluation);
|
||||
private viewProfileEmployeeEvaluationRepo = AppDataSource.getRepository(viewProfileEmployeeEvaluation);
|
||||
private viewProfileEmployeeEvaluationRepo = AppDataSource.getRepository(
|
||||
viewProfileEmployeeEvaluation,
|
||||
);
|
||||
|
||||
/**
|
||||
* API รายชื่อราชการที่เลื่อนเงินเดือน (unauthorize)
|
||||
|
|
@ -1001,7 +1003,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -1080,7 +1082,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
where: { current_holders: { orgRootId: rootId } },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
profileInsignias: {
|
||||
receiveDate: "DESC",
|
||||
|
|
@ -1170,7 +1172,6 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
return new HttpSuccess("Email verified successfully.");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API ผลการประเมิน 5 ปีย้อนหลังนับจากปีปัจจุบัน
|
||||
*
|
||||
|
|
@ -1208,80 +1209,102 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
// where:{
|
||||
// ...condition
|
||||
// }
|
||||
})
|
||||
if(conType == "EMPLOYEE"){
|
||||
lists = await this.viewProfileEmployeeEvaluationRepo.find({})
|
||||
});
|
||||
if (conType == "EMPLOYEE") {
|
||||
lists = await this.viewProfileEmployeeEvaluationRepo.find({});
|
||||
}
|
||||
const groupData: any = {};
|
||||
const groupData: any = {};
|
||||
const year = new Date().getFullYear();
|
||||
const years = [year, year - 1, year - 2, year - 3, year - 4];
|
||||
|
||||
|
||||
lists.forEach((item: any) => {
|
||||
if (!groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId]) {
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId] = {
|
||||
profileId: conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId,
|
||||
yearAPR1: "-", periodAPR1: "-", resultAPR1: "-",
|
||||
yearOCT1: "-", periodOCT1: "-", resultOCT1: "-",
|
||||
yearAPR2: "-", periodAPR2: "-", resultAPR2: "-",
|
||||
yearOCT2: "-", periodOCT2: "-", resultOCT2: "-",
|
||||
yearAPR3: "-", periodAPR3: "-", resultAPR3: "-",
|
||||
yearOCT3: "-", periodOCT3: "-", resultOCT3: "-",
|
||||
yearAPR4: "-", periodAPR4: "-", resultAPR4: "-",
|
||||
yearOCT4: "-", periodOCT4: "-", resultOCT4: "-",
|
||||
yearAPR5: "-", periodAPR5: "-", resultAPR5: "-",
|
||||
yearOCT5: "-", periodOCT5: "-", resultOCT5: "-"
|
||||
if (!groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId]) {
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId] = {
|
||||
profileId: conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId,
|
||||
yearAPR1: "-",
|
||||
periodAPR1: "-",
|
||||
resultAPR1: "-",
|
||||
yearOCT1: "-",
|
||||
periodOCT1: "-",
|
||||
resultOCT1: "-",
|
||||
yearAPR2: "-",
|
||||
periodAPR2: "-",
|
||||
resultAPR2: "-",
|
||||
yearOCT2: "-",
|
||||
periodOCT2: "-",
|
||||
resultOCT2: "-",
|
||||
yearAPR3: "-",
|
||||
periodAPR3: "-",
|
||||
resultAPR3: "-",
|
||||
yearOCT3: "-",
|
||||
periodOCT3: "-",
|
||||
resultOCT3: "-",
|
||||
yearAPR4: "-",
|
||||
periodAPR4: "-",
|
||||
resultAPR4: "-",
|
||||
yearOCT4: "-",
|
||||
periodOCT4: "-",
|
||||
resultOCT4: "-",
|
||||
yearAPR5: "-",
|
||||
periodAPR5: "-",
|
||||
resultAPR5: "-",
|
||||
yearOCT5: "-",
|
||||
periodOCT5: "-",
|
||||
resultOCT5: "-",
|
||||
};
|
||||
}
|
||||
const yearIndex = years.indexOf(parseInt(item.year));
|
||||
const yearIndex = years.indexOf(parseInt(item.year));
|
||||
if (yearIndex !== -1) {
|
||||
const yearSuffix = yearIndex + 1;
|
||||
const yearKey = `year${item.period}${yearSuffix}`;
|
||||
const periodKey = `period${item.period}${yearSuffix}`;
|
||||
const resultKey = `result${item.period}${yearSuffix}`;
|
||||
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId][yearKey] = item.year;
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId][periodKey] = item.period;
|
||||
groupData[conType == "EMPLOYEE"?item.profileEmployeeId:item.profileId][resultKey] = item.result;
|
||||
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId][yearKey] =
|
||||
item.year;
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId][periodKey] =
|
||||
item.period;
|
||||
groupData[conType == "EMPLOYEE" ? item.profileEmployeeId : item.profileId][resultKey] =
|
||||
item.result;
|
||||
}
|
||||
});
|
||||
const formattedResults = Object.values(groupData).map((x: any) => ({
|
||||
profileId: x.profileId,
|
||||
yearAPR1: x.yearAPR1,
|
||||
periodAPR1: x.periodAPR1,
|
||||
resultAPR1: x.resultAPR1?Extension.textPoint(x.resultAPR1):"-",
|
||||
resultAPR1: x.resultAPR1 ? Extension.textPoint(x.resultAPR1) : "-",
|
||||
yearOCT1: x.yearOCT1,
|
||||
periodOCT1: x.periodOCT1,
|
||||
resultOCT1: x.resultOCT1?Extension.textPoint(x.resultOCT1):"-",
|
||||
resultOCT1: x.resultOCT1 ? Extension.textPoint(x.resultOCT1) : "-",
|
||||
yearAPR2: x.yearAPR2,
|
||||
periodAPR2: x.periodAPR2,
|
||||
resultAPR2: x.resultAPR2?Extension.textPoint(x.resultAPR2):"-",
|
||||
resultAPR2: x.resultAPR2 ? Extension.textPoint(x.resultAPR2) : "-",
|
||||
yearOCT2: x.yearOCT2,
|
||||
periodOCT2: x.periodOCT2,
|
||||
resultOCT2: x.resultOCT2?Extension.textPoint(x.resultOCT2):"-",
|
||||
resultOCT2: x.resultOCT2 ? Extension.textPoint(x.resultOCT2) : "-",
|
||||
yearAPR3: x.yearAPR3,
|
||||
periodAPR3: x.periodAPR3,
|
||||
resultAPR3: x.resultAPR3?Extension.textPoint(x.resultAPR3):"-",
|
||||
resultAPR3: x.resultAPR3 ? Extension.textPoint(x.resultAPR3) : "-",
|
||||
yearOCT3: x.yearOCT3,
|
||||
periodOCT3: x.periodOCT3,
|
||||
resultOCT3: x.resultOCT3?Extension.textPoint(x.resultOCT3):"-",
|
||||
resultOCT3: x.resultOCT3 ? Extension.textPoint(x.resultOCT3) : "-",
|
||||
yearAPR4: x.yearAPR4,
|
||||
periodAPR4: x.periodAPR4,
|
||||
resultAPR4: x.resultAPR4?Extension.textPoint(x.resultAPR4):"-",
|
||||
resultAPR4: x.resultAPR4 ? Extension.textPoint(x.resultAPR4) : "-",
|
||||
yearOCT4: x.yearOCT4,
|
||||
periodOCT4: x.periodOCT4,
|
||||
resultOCT4: x.resultOCT4?Extension.textPoint(x.resultOCT4):"-",
|
||||
resultOCT4: x.resultOCT4 ? Extension.textPoint(x.resultOCT4) : "-",
|
||||
yearAPR5: x.yearAPR5,
|
||||
periodAPR5: x.periodAPR5,
|
||||
resultAPR5: x.resultAPR5?Extension.textPoint(x.resultAPR5):"-",
|
||||
resultAPR5: x.resultAPR5 ? Extension.textPoint(x.resultAPR5) : "-",
|
||||
yearOCT5: x.yearOCT5,
|
||||
periodOCT5: x.periodOCT5,
|
||||
resultOCT5: x.resultOCT5?Extension.textPoint(x.resultOCT5):"-",
|
||||
resultOCT5: x.resultOCT5 ? Extension.textPoint(x.resultOCT5) : "-",
|
||||
}));
|
||||
|
||||
|
||||
return new HttpSuccess(formattedResults);
|
||||
}
|
||||
|
||||
|
||||
// @Patch("retirement")
|
||||
// public async updateStatusRetirement(
|
||||
// @Body()
|
||||
|
|
@ -1306,10 +1329,10 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
// profiles.push(_profile);
|
||||
// })
|
||||
// );
|
||||
// await this.profileRepo.save(profiles);
|
||||
// await this.profileRepo.save(profiles);
|
||||
// return new HttpSuccess();
|
||||
// }
|
||||
|
||||
|
||||
// @Patch("retirement-employee")
|
||||
// public async updateStatusRetirementEmp(
|
||||
// @Body()
|
||||
|
|
@ -1334,7 +1357,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
// profiles.push(_profile);
|
||||
// })
|
||||
// );
|
||||
// await this.profileEmpRepo.save(profiles);
|
||||
// await this.profileEmpRepo.save(profiles);
|
||||
// return new HttpSuccess();
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -138,7 +138,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
where: { id: id },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -229,39 +229,40 @@ export class ProfileEmployeeController extends Controller {
|
|||
|
||||
const salary_raw = await this.salaryRepo.find({
|
||||
select: [
|
||||
"date",
|
||||
"position",
|
||||
"commandDateAffect",
|
||||
"posNo",
|
||||
"positionType",
|
||||
"positionLevel",
|
||||
"positionSalaryAmount",
|
||||
"refCommandNo",
|
||||
"commandNo",
|
||||
"amount",
|
||||
"templateDoc",
|
||||
"position",
|
||||
"remark",
|
||||
"positionName",
|
||||
"orgRoot",
|
||||
"orgChild1",
|
||||
"orgChild2",
|
||||
"orgChild3",
|
||||
"orgChild4",
|
||||
"mpCee",
|
||||
"positionCee",
|
||||
"positionExecutive",
|
||||
],
|
||||
where: { profileEmployeeId: id },
|
||||
order: { date: "ASC" },
|
||||
order: { commandDateAffect: "ASC" },
|
||||
});
|
||||
const salarys =
|
||||
salary_raw.length > 1
|
||||
? salary_raw.slice(1).map((item) => ({
|
||||
date: item.date ? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) : null,
|
||||
position: item.position != null ? item.position : "-",
|
||||
date: item.commandDateAffect
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.commandDateAffect))
|
||||
: null,
|
||||
position: item.positionName != null ? item.positionName : "-",
|
||||
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
||||
orgRoot: item.orgRoot,
|
||||
orgChild1: item.orgChild1,
|
||||
orgChild2: item.orgChild2,
|
||||
orgChild3: item.orgChild3,
|
||||
orgChild4: item.orgChild4,
|
||||
mpCee: item.mpCee,
|
||||
positionCee: item.positionCee,
|
||||
positionExecutive: item.positionExecutive,
|
||||
}))
|
||||
: [
|
||||
|
|
@ -274,7 +275,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
orgChild2: null,
|
||||
orgChild3: null,
|
||||
orgChild4: null,
|
||||
mpCee: null,
|
||||
positionCee: null,
|
||||
positionExecutive: null,
|
||||
},
|
||||
];
|
||||
|
|
@ -323,8 +324,8 @@ export class ProfileEmployeeController extends Controller {
|
|||
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||
),
|
||||
date:
|
||||
salary_raw.length > 0 && salary_raw[0].date != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(salary_raw[0].date))
|
||||
salary_raw.length > 0 && salary_raw[0].commandDateAffect != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(salary_raw[0].commandDateAffect))
|
||||
: "",
|
||||
positionName: profile.position != null ? profile.position : "",
|
||||
appointText:
|
||||
|
|
@ -336,12 +337,12 @@ export class ProfileEmployeeController extends Controller {
|
|||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].posNo))
|
||||
: "",
|
||||
position:
|
||||
salary_raw.length > 0 && salary_raw[0].position != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].position))
|
||||
salary_raw.length > 0 && salary_raw[0].positionName != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].positionName))
|
||||
: "",
|
||||
mpCee:
|
||||
salary_raw.length > 0 && salary_raw[0].mpCee != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].mpCee))
|
||||
positionCee:
|
||||
salary_raw.length > 0 && salary_raw[0].positionCee != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].positionCee))
|
||||
: "",
|
||||
positionExecutive:
|
||||
salary_raw.length > 0 && salary_raw[0].positionExecutive != null
|
||||
|
|
@ -643,15 +644,15 @@ export class ProfileEmployeeController extends Controller {
|
|||
];
|
||||
const salary_raw = await this.salaryRepo.find({
|
||||
select: [
|
||||
"date",
|
||||
"position",
|
||||
"commandDateAffect",
|
||||
"positionName",
|
||||
"posNo",
|
||||
"positionType",
|
||||
"positionLevel",
|
||||
"positionSalaryAmount",
|
||||
"refCommandNo",
|
||||
"commandNo",
|
||||
"amount",
|
||||
"templateDoc",
|
||||
"remark",
|
||||
],
|
||||
where: { profileEmployeeId: id },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -660,15 +661,15 @@ export class ProfileEmployeeController extends Controller {
|
|||
const salarys =
|
||||
salary_raw.length > 0
|
||||
? salary_raw.map((item) => ({
|
||||
SalaryDate: item.date
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date))
|
||||
SalaryDate: item.commandDateAffect
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||
: null,
|
||||
Position: item.position != null ? Extension.ToThaiNumber(item.position) : null,
|
||||
Position: item.positionName != null ? Extension.ToThaiNumber(item.positionName) : null,
|
||||
PosNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
||||
Salary:
|
||||
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
||||
Rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||
RefAll: item.templateDoc ? Extension.ToThaiNumber(item.templateDoc) : null,
|
||||
RefAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
||||
PositionLevel:
|
||||
item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||
PositionType: item.positionType ?? null,
|
||||
|
|
@ -1705,7 +1706,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
@Query() isAll?: boolean,
|
||||
@Query() retireType?: string,
|
||||
@Query() sortBy: string = "current_holders.posMasterNo",
|
||||
@Query() sort: "ASC"|"DESC" = "ASC",
|
||||
@Query() sort: "ASC" | "DESC" = "ASC",
|
||||
) {
|
||||
let _data = await new permission().PermissionOrgList(request, "SYS_REGISTRY_EMP");
|
||||
let queryLike =
|
||||
|
|
@ -4432,7 +4433,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
body: {
|
||||
result: {
|
||||
id: string;
|
||||
templateDoc: string;
|
||||
remark: string;
|
||||
amount: Double | null;
|
||||
positionSalaryAmount: Double | null;
|
||||
mouthSalaryAmount: Double | null;
|
||||
|
|
@ -4462,7 +4463,7 @@ export class ProfileEmployeeController extends Controller {
|
|||
positionType: profile.posTypeNameTemp,
|
||||
positionLevel: profile.posLevelNameTemp,
|
||||
refCommandNo: v.refCommandNo,
|
||||
templateDoc: v.templateDoc,
|
||||
remark: v.remark,
|
||||
})
|
||||
.then(async () => {
|
||||
profile.statusTemp = "DONE";
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
where: { id: id },
|
||||
order: {
|
||||
profileSalary: {
|
||||
date: "DESC",
|
||||
commandDateAffect: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -224,38 +224,40 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
|
||||
const salary_raw = await this.salaryRepo.find({
|
||||
select: [
|
||||
"date",
|
||||
"position",
|
||||
"commandDateAffect",
|
||||
"positionName",
|
||||
"posNo",
|
||||
"positionType",
|
||||
"positionLevel",
|
||||
"positionSalaryAmount",
|
||||
"refCommandNo",
|
||||
"commandNo",
|
||||
"amount",
|
||||
"templateDoc",
|
||||
"remark",
|
||||
"orgRoot",
|
||||
"orgChild1",
|
||||
"orgChild2",
|
||||
"orgChild3",
|
||||
"orgChild4",
|
||||
"mpCee",
|
||||
"positionCee",
|
||||
"positionExecutive",
|
||||
],
|
||||
where: { profileEmployeeId: id },
|
||||
order: { date: "ASC" },
|
||||
order: { commandDateAffect: "ASC" },
|
||||
});
|
||||
const salarys =
|
||||
salary_raw.length > 1
|
||||
? salary_raw.slice(1).map((item) => ({
|
||||
date: item.date ? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) : null,
|
||||
position: item.position != null ? item.position : "-",
|
||||
date: item.commandDateAffect
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(item.commandDateAffect))
|
||||
: null,
|
||||
position: item.positionName != null ? item.positionName : "-",
|
||||
posNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
||||
orgRoot: item.orgRoot,
|
||||
orgChild1: item.orgChild1,
|
||||
orgChild2: item.orgChild2,
|
||||
orgChild3: item.orgChild3,
|
||||
orgChild4: item.orgChild4,
|
||||
mpCee: item.mpCee,
|
||||
positionCee: item.positionCee,
|
||||
positionExecutive: item.positionExecutive,
|
||||
}))
|
||||
: [
|
||||
|
|
@ -268,7 +270,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
orgChild2: null,
|
||||
orgChild3: null,
|
||||
orgChild4: null,
|
||||
mpCee: null,
|
||||
positionCee: null,
|
||||
positionExecutive: null,
|
||||
},
|
||||
];
|
||||
|
|
@ -316,8 +318,8 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
|
||||
),
|
||||
date:
|
||||
salary_raw.length > 0 && salary_raw[0].date != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(salary_raw[0].date))
|
||||
salary_raw.length > 0 && salary_raw[0].commandDateAffect != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(salary_raw[0].commandDateAffect))
|
||||
: "",
|
||||
positionName: profile.position != null ? profile.position : "",
|
||||
appointText:
|
||||
|
|
@ -329,12 +331,12 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].posNo))
|
||||
: "",
|
||||
position:
|
||||
salary_raw.length > 0 && salary_raw[0].position != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].position))
|
||||
salary_raw.length > 0 && salary_raw[0].positionName != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].positionName))
|
||||
: "",
|
||||
mpCee:
|
||||
salary_raw.length > 0 && salary_raw[0].mpCee != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].mpCee))
|
||||
positionCee:
|
||||
salary_raw.length > 0 && salary_raw[0].positionCee != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiNumber(salary_raw[0].positionCee))
|
||||
: "",
|
||||
positionExecutive:
|
||||
salary_raw.length > 0 && salary_raw[0].positionExecutive != null
|
||||
|
|
@ -366,8 +368,10 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
salarys: salarys.map((item) => {
|
||||
return {
|
||||
...item,
|
||||
mpCee:
|
||||
item.mpCee == null ? "" : Extension.ToThaiNumber(Extension.ToThaiNumber(item.mpCee)),
|
||||
positionCee:
|
||||
item.positionCee == null
|
||||
? ""
|
||||
: Extension.ToThaiNumber(Extension.ToThaiNumber(item.positionCee)),
|
||||
org: `${item.orgChild4 && item.orgChild4 != "-" ? item.orgChild4 + " " : ""}${item.orgChild3 && item.orgChild3 != "-" ? item.orgChild3 + " " : ""}${item.orgChild2 && item.orgChild2 != "-" ? item.orgChild2 + " " : ""}${item.orgChild1 && item.orgChild1 != "-" ? item.orgChild1 + " " : ""}${item.orgRoot && item.orgRoot != "-" ? item.orgRoot + " " : ""}`,
|
||||
};
|
||||
}),
|
||||
|
|
@ -638,15 +642,15 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
];
|
||||
const salary_raw = await this.salaryRepo.find({
|
||||
select: [
|
||||
"date",
|
||||
"position",
|
||||
"commandDateAffect",
|
||||
"positionName",
|
||||
"posNo",
|
||||
"positionType",
|
||||
"positionLevel",
|
||||
"positionSalaryAmount",
|
||||
"refCommandNo",
|
||||
"commandNo",
|
||||
"amount",
|
||||
"templateDoc",
|
||||
"remark",
|
||||
],
|
||||
where: { profileEmployeeId: id },
|
||||
order: { order: "ASC" },
|
||||
|
|
@ -655,15 +659,15 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
const salarys =
|
||||
salary_raw.length > 0
|
||||
? salary_raw.map((item) => ({
|
||||
SalaryDate: item.date
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.date))
|
||||
SalaryDate: item.commandDateAffect
|
||||
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
|
||||
: null,
|
||||
Position: item.position != null ? Extension.ToThaiNumber(item.position) : null,
|
||||
Position: item.positionName != null ? Extension.ToThaiNumber(item.positionName) : null,
|
||||
PosNo: item.posNo != null ? Extension.ToThaiNumber(item.posNo) : null,
|
||||
Salary:
|
||||
item.amount != null ? Extension.ToThaiNumber(item.amount.toLocaleString()) : null,
|
||||
Rank: item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||
RefAll: item.templateDoc ? Extension.ToThaiNumber(item.templateDoc) : null,
|
||||
RefAll: item.remark ? Extension.ToThaiNumber(item.remark) : null,
|
||||
PositionLevel:
|
||||
item.positionLevel != null ? Extension.ToThaiNumber(item.positionLevel) : null,
|
||||
PositionType: item.positionType ?? null,
|
||||
|
|
@ -1820,16 +1824,18 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
let profileSalary;
|
||||
if (profile.profileSalary && profile.profileSalary.length > 0) {
|
||||
profileSalary = profile.profileSalary.reduce((latest, current) => {
|
||||
return new Date(current.date) > new Date(latest.date) ? current : latest;
|
||||
return new Date(current.commandDateAffect) > new Date(latest.commandDateAffect)
|
||||
? current
|
||||
: latest;
|
||||
});
|
||||
}
|
||||
return {
|
||||
id: profile.id,
|
||||
fullName: `${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
citizenId: profile.citizenId,
|
||||
position: profileSalary ? profileSalary.position : null,
|
||||
position: profileSalary ? profileSalary.positionName : null,
|
||||
posNo: profileSalary ? profileSalary.posNo : null,
|
||||
date: profileSalary ? profileSalary.date : null,
|
||||
date: profileSalary ? profileSalary.commandDateAffect : null,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -3482,7 +3488,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
body: {
|
||||
result: {
|
||||
id: string;
|
||||
templateDoc: string;
|
||||
remark: string;
|
||||
amount: Double | null;
|
||||
positionSalaryAmount: Double | null;
|
||||
mouthSalaryAmount: Double | null;
|
||||
|
|
@ -3513,7 +3519,7 @@ export class ProfileEmployeeTempController extends Controller {
|
|||
positionType: profile.posTypeNameTemp,
|
||||
positionLevel: profile.posLevelNameTemp,
|
||||
refCommandNo: v.refCommandNo,
|
||||
templateDoc: v.templateDoc,
|
||||
remark: v.remark,
|
||||
})
|
||||
.then(async () => {
|
||||
profile.statusTemp = "DONE";
|
||||
|
|
|
|||
|
|
@ -119,7 +119,6 @@ export class ProfileSalaryController extends Controller {
|
|||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
refCommandDate: new Date(),
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
|
@ -165,7 +164,6 @@ export class ProfileSalaryController extends Controller {
|
|||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
refCommandDate: new Date(),
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
|
@ -210,7 +208,6 @@ export class ProfileSalaryController extends Controller {
|
|||
history.lastUpdateFullName = req.user.name;
|
||||
history.createdUserId = req.user.sub;
|
||||
history.createdFullName = req.user.name;
|
||||
record.refCommandDate = new Date();
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
refCommandDate: new Date(),
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
|
@ -180,7 +179,6 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
refCommandDate: new Date(),
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
|
@ -230,7 +228,6 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
history.lastUpdateFullName = req.user.name;
|
||||
history.createdUserId = req.user.sub;
|
||||
history.createdFullName = req.user.name;
|
||||
record.refCommandDate = new Date();
|
||||
history.createdAt = new Date();
|
||||
history.lastUpdatedAt = new Date();
|
||||
|
||||
|
|
|
|||
|
|
@ -122,7 +122,6 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
createdFullName: req.user.name,
|
||||
lastUpdateUserId: req.user.sub,
|
||||
lastUpdateFullName: req.user.name,
|
||||
refCommandDate: new Date(),
|
||||
createdAt: new Date(),
|
||||
lastUpdatedAt: new Date(),
|
||||
};
|
||||
|
|
@ -159,7 +158,6 @@ export class ProfileSalaryEmployeeTempController extends Controller {
|
|||
record.lastUpdateUserId = req.user.sub;
|
||||
record.lastUpdateFullName = req.user.name;
|
||||
record.lastUpdatedAt = new Date();
|
||||
record.refCommandDate = new Date();
|
||||
history.lastUpdateUserId = req.user.sub;
|
||||
history.lastUpdateFullName = req.user.name;
|
||||
history.createdUserId = req.user.sub;
|
||||
|
|
|
|||
|
|
@ -1583,8 +1583,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -1957,8 +1957,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -2339,8 +2339,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -2737,8 +2737,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -3139,8 +3139,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -3734,8 +3734,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.current_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -4108,8 +4108,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.current_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -4490,8 +4490,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.current_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -4888,8 +4888,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.current_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -5290,8 +5290,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.current_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -5841,8 +5841,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -6033,8 +6033,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -6233,8 +6233,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -6441,8 +6441,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
@ -6656,8 +6656,8 @@ export class ReportController extends Controller {
|
|||
) {
|
||||
let _salary: any = posMaster.next_holder.profileSalary.sort(
|
||||
(a, b) =>
|
||||
(b.date == null ? 0 : b.date.getTime()) -
|
||||
(a.date == null ? 0 : a.date.getTime()),
|
||||
(b.commandDateAffect == null ? 0 : b.commandDateAffect.getTime()) -
|
||||
(a.commandDateAffect == null ? 0 : a.commandDateAffect.getTime()),
|
||||
);
|
||||
if (_salary.length > 0) {
|
||||
salary = _salary[0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue