edit name null_

This commit is contained in:
kittapath 2025-03-10 09:52:50 +07:00
parent fb96c44753
commit ed111475f8
6 changed files with 171 additions and 135 deletions

View file

@ -87,11 +87,11 @@ export class AuthRoleController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateAddAuthRole,
) {
let NULL_: any = null;
let _null: any = null;
let getDetail;
if (body.authRoleId == "") {
body.authRoleId = NULL_;
body.authRoleId = _null;
} else {
getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");
@ -131,11 +131,11 @@ export class AuthRoleController extends Controller {
@Request() req: RequestWithUser,
@Body() body: CreateAddAuthRole,
) {
let NULL_: any = null;
let _null: any = null;
let getDetail;
if (body.authRoleId == "") {
body.authRoleId = NULL_;
body.authRoleId = _null;
} else {
getDetail = await this.authRoleRepo.findOneBy({ id: body.authRoleId });
if (!getDetail) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลสิทธิ์");

View file

@ -110,7 +110,7 @@ export class ImportDataController extends Controller {
// const filePath = path.resolve(__dirname, "OFFICER.csv"); // Corrected file path
// const readStream = fs.createReadStream(filePath).pipe(csvParser());
// let profiles: any = [];
let null_: any = null;
let _null: any = null;
let profile: any;
// await Promise.all(
// OFFICER.map(async (item) => {
@ -178,12 +178,12 @@ export class ImportDataController extends Controller {
: item.RANK_NAME;
profile.firstName = item.FNAME == "" ? null : item.FNAME;
profile.lastName = item.LNAME == "" ? null : item.LNAME;
profile.gender = item.SEX == "1" ? "ชาย" : item.SEX == "2" ? "หญิง" : null_;
profile.birthDate = item.BORN == "" ? null_ : new Date(item.BORN);
profile.dateAppoint = item.BEGIN_ENTRY_DATE == "" ? null_ : new Date(item.BEGIN_ENTRY_DATE);
profile.dateStart = item.BEGIN_ENTRY_DATE == "" ? null_ : new Date(item.BEGIN_ENTRY_DATE);
profile.dateRetire = dateRetire == null ? null_ : calculateRetireDate(dateRetire);
profile.dateRetireLaw = dateRetire == null ? null_ : calculateRetireLaw(dateRetire);
profile.gender = item.SEX == "1" ? "ชาย" : item.SEX == "2" ? "หญิง" : _null;
profile.birthDate = item.BORN == "" ? _null : new Date(item.BORN);
profile.dateAppoint = item.BEGIN_ENTRY_DATE == "" ? _null : new Date(item.BEGIN_ENTRY_DATE);
profile.dateStart = item.BEGIN_ENTRY_DATE == "" ? _null : new Date(item.BEGIN_ENTRY_DATE);
profile.dateRetire = dateRetire == null ? _null : calculateRetireDate(dateRetire);
profile.dateRetireLaw = dateRetire == null ? _null : calculateRetireLaw(dateRetire);
profile.position = item.WORK_LINE_NAME == "" ? null : item.WORK_LINE_NAME;
profile.posTypeId =
type_ != null && type_.posTypeName == item.MP_CATEGORY && type_ ? type_.id : null;
@ -202,11 +202,11 @@ export class ImportDataController extends Controller {
// },
// },
// });
// profile.posLevelId = level?.id ?? null_;
// profile.posLevelId = level?.id ?? _null;
// const type = await this.posTypeRepo.findOne({
// where: { posTypeName: item.MP_Type },
// });
// profile.posTypeId = type?.id ?? null_;
// profile.posTypeId = type?.id ?? _null;
profile.amount = item.SALARY == "" ? 0 : Number(item.SALARY);
// profile.isLeave =
// item.FLAG_RETIRE_STATUSxxxx == "" || item.FLAG_RETIRE_STATUSxxxx == null ? false : true;
@ -247,7 +247,7 @@ export class ImportDataController extends Controller {
const filePath = path.resolve(__dirname, "EMP.csv"); // Corrected file path
const readStream = fs.createReadStream(filePath).pipe(csvParser());
let profiles: any = [];
let null_: any = null;
let _null: any = null;
let profileEmp: any;
for await (const item of readStream) {
@ -291,13 +291,13 @@ export class ImportDataController extends Controller {
: item["RANK_NAME"];
profileEmp.firstName = item["FNAME"] == "" ? null : item["FNAME"];
profileEmp.lastName = item["LNAME"] == "" ? null : item["LNAME"];
profileEmp.gender = item["SEX"] == "1" ? "ชาย" : item["SEX"] == "2" ? "หญิง" : null_;
profileEmp.birthDate = item["BORN"] == "" ? null_ : new Date(item["BORN"]);
profileEmp.gender = item["SEX"] == "1" ? "ชาย" : item["SEX"] == "2" ? "หญิง" : _null;
profileEmp.birthDate = item["BORN"] == "" ? _null : new Date(item["BORN"]);
profileEmp.dateAppoint =
item["BEGIN_ENTRY_DATE"] == "" ? null_ : new Date(item["BEGIN_ENTRY_DATE"]);
profileEmp.dateStart = item["MP_FORCE_DATE"] == "" ? null_ : new Date(item["MP_FORCE_DATE"]);
profileEmp.dateRetire = dateRetire == null ? null_ : calculateRetireDate(dateRetire);
profileEmp.dateRetireLaw = dateRetire == null ? null_ : calculateRetireLaw(dateRetire);
item["BEGIN_ENTRY_DATE"] == "" ? _null : new Date(item["BEGIN_ENTRY_DATE"]);
profileEmp.dateStart = item["MP_FORCE_DATE"] == "" ? _null : new Date(item["MP_FORCE_DATE"]);
profileEmp.dateRetire = dateRetire == null ? _null : calculateRetireDate(dateRetire);
profileEmp.dateRetireLaw = dateRetire == null ? _null : calculateRetireLaw(dateRetire);
profileEmp.position = item["WORK_LINE_NAME"] == "" ? null : item["WORK_LINE_NAME"];
profileEmp.salaryLevel = item["SALARY_LEVEL_CODE"] == "" ? null : item["SALARY_LEVEL_CODE"];
profileEmp.relationship =
@ -332,7 +332,7 @@ export class ImportDataController extends Controller {
@Post("uploadProfileSalary-Officer")
async UploadFileSQLSalary(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let null_: any = null;
let _null: any = null;
let sqlStatements: string[] = [];
const [profiles, total] = await AppDataSource.getRepository(Profile)
@ -392,14 +392,14 @@ export class ImportDataController extends Controller {
profileSalary.commandYear = item.cur_year > 2500 ? item.cur_year - 543 : item.cur_year;
profileSalary.commandDateSign =
item.mp_command_date == null
? null_
? _null
: new Date(item.mp_command_date.setDate(item.mp_command_date.getDate() + 1))
.toISOString()
.replace("T", " ")
.substring(0, 19);
profileSalary.commandDateAffect =
item.mp_pos_date == null
? null_
? _null
: new Date(item.mp_pos_date.setDate(item.mp_pos_date.getDate() + 1))
.toISOString()
.replace("T", " ")
@ -755,15 +755,15 @@ export class ImportDataController extends Controller {
const sal_pos_amount_1: any =
item.sal_pos_amount_1 == null || item.sal_pos_amount_1 == ""
? null_
? _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_
? _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);
item.special_amt == null || item.special_amt == "" ? _null : Number(item.special_amt);
profileSalary.amountSpecial = special_amt;
profileSalary.createdUserId = request.user.sub;
@ -842,7 +842,7 @@ export class ImportDataController extends Controller {
@Post("uploadProfileSalary-Employee")
async UploadFileSQLSalaryEmp(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let null_: any = null;
let _null: any = null;
const [profiles, total] = await AppDataSource.getRepository(ProfileEmployee)
.createQueryBuilder("profile")
@ -891,15 +891,15 @@ export class ImportDataController extends Controller {
const sal_pos_amount_1: any =
item.sal_pos_amount_1 == null || item.sal_pos_amount_1 == ""
? null_
? _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_
? _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);
item.special_amt == null || item.special_amt == "" ? _null : Number(item.special_amt);
profileSalary.amountSpecial = special_amt;
profileSalary.commandId;
@ -1222,7 +1222,7 @@ export class ImportDataController extends Controller {
async UploadFileSQLEducation(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let educations: any = [];
let null_: any = null;
let _null: any = null;
const [profiles, total] = await AppDataSource.getRepository(Profile)
.createQueryBuilder("profile")
.select(["profile.citizenId", "profile.id"])
@ -1274,22 +1274,22 @@ export class ImportDataController extends Controller {
let startDate = item.START_EDUCATION_YEAR
? Extension.ConvertToDateTimeV2(item.START_EDUCATION_YEAR)
: null_;
// startDate = startDate ? new Date(startDate, 0, 1) : null_;
: _null;
// startDate = startDate ? new Date(startDate, 0, 1) : _null;
let endDate = item.EDUCATION_YEAR
? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR)
: null_;
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
: _null;
// endDate = endDate ? new Date(endDate, 0, 1) : _null;
education.level = educationLevel == null ? 1 : educationLevel.level + 1;
education.profileId = _item.id;
education.degree = educationCode ? educationCode.EDUCATION_NAME : null_;
education.field = hrMajorCode ? hrMajorCode.MAJOR_NAME : null_;
education.educationLevel = hrFundCourseCode ? hrFundCourseCode.FUND_COURSE_NAME : null_;
education.educationLevelId = hrFundCourseCode ? hrFundCourseCode.refId : null_;
education.degree = educationCode ? educationCode.EDUCATION_NAME : _null;
education.field = hrMajorCode ? hrMajorCode.MAJOR_NAME : _null;
education.educationLevel = hrFundCourseCode ? hrFundCourseCode.FUND_COURSE_NAME : _null;
education.educationLevelId = hrFundCourseCode ? hrFundCourseCode.refId : _null;
education.institute = item.INSTITUE;
education.level = item.EDUCATION_SEQ ? Number(item.EDUCATION_SEQ) : null_;
education.level = item.EDUCATION_SEQ ? Number(item.EDUCATION_SEQ) : _null;
education.startDate = startDate;
education.endDate = endDate;
education.createdUserId = request.user.sub;
@ -1318,7 +1318,7 @@ export class ImportDataController extends Controller {
async UploadFileSQLEducationEmp(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let educations: any = [];
let null_: any = null;
let _null: any = null;
const [profiles, total] = await AppDataSource.getRepository(ProfileEmployee)
.createQueryBuilder("profile")
.select(["profile.citizenId", "profile.id"])
@ -1366,19 +1366,19 @@ export class ImportDataController extends Controller {
let startDate = item.START_EDUCATION_YEAR
? Extension.ConvertToDateTimeV2(item.START_EDUCATION_YEAR)
: null_;
// startDate = startDate ? new Date(startDate, 0, 1) : null_;
: _null;
// startDate = startDate ? new Date(startDate, 0, 1) : _null;
let endDate = item.EDUCATION_YEAR
? Extension.ConvertToDateTimeV2(item.EDUCATION_YEAR)
: null_;
// endDate = endDate ? new Date(endDate, 0, 1) : null_;
: _null;
// endDate = endDate ? new Date(endDate, 0, 1) : _null;
education.level = educationLevel == null ? 1 : educationLevel.level + 1;
education.profileEmployeeId = _item.id;
education.degree = educationCode ? educationCode.EDUCATION_NAME : "";
education.institute = item.INSTITUE;
education.level = item.EDUCATION_SEQ ? null_ : Number(item.EDUCATION_SEQ);
education.level = item.EDUCATION_SEQ ? _null : Number(item.EDUCATION_SEQ);
education.startDate = startDate;
education.endDate = endDate;
education.createdUserId = request.user.sub;
@ -1509,7 +1509,7 @@ export class ImportDataController extends Controller {
@Post("uploadProfileAddress-Officer")
async UploadFileSQLAddress(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let null_: any = null;
let _null: any = null;
const [profiles, total] = await AppDataSource.getRepository(Profile)
.createQueryBuilder("profile")
.select(["profile.citizenId", "profile.id"])
@ -1559,7 +1559,7 @@ export class ImportDataController extends Controller {
});
await this.provinceIdRepo.save(provinceId);
}
_item.registrationProvinceId = provinceId ? provinceId.id : null_;
_item.registrationProvinceId = provinceId ? provinceId.id : _null;
if (AMPHUR_CODE) {
let districtRegis_ = await this.amphurRepo.findOne({
where: {
@ -1582,7 +1582,7 @@ export class ImportDataController extends Controller {
});
await this.provinceIdRepo.save(provinceId);
}
_item.registrationDistrictId = districtId ? districtId.id : null_;
_item.registrationDistrictId = districtId ? districtId.id : _null;
if (DISTRICT_CODE) {
let subDistrictRegis_ = await this.subDistrictRepo.findOne({
where: {
@ -1607,7 +1607,7 @@ export class ImportDataController extends Controller {
});
await this.provinceIdRepo.save(provinceId);
}
_item.registrationSubDistrictId = subDistrictId ? subDistrictId.id : null_;
_item.registrationSubDistrictId = subDistrictId ? subDistrictId.id : _null;
}
}
}
@ -1633,7 +1633,7 @@ export class ImportDataController extends Controller {
});
await this.provinceIdRepo.save(provinceId);
}
_item.currentProvinceId = provinceId ? provinceId.id : null_;
_item.currentProvinceId = provinceId ? provinceId.id : _null;
if (CONTACT_AMPHUR_CODE) {
let districtCurr_ = await this.amphurRepo.findOne({
where: {
@ -1656,7 +1656,7 @@ export class ImportDataController extends Controller {
});
await this.provinceIdRepo.save(provinceId);
}
_item.currentDistrictId = districtId ? districtId.id : null_;
_item.currentDistrictId = districtId ? districtId.id : _null;
if (CONTACT_DISTRICT_CODE) {
let subDistrictCurr_ = await this.subDistrictRepo.findOne({
where: {
@ -1681,7 +1681,7 @@ export class ImportDataController extends Controller {
});
await this.provinceIdRepo.save(provinceId);
}
_item.currentSubDistrictId = subDistrictId ? subDistrictId.id : null_;
_item.currentSubDistrictId = subDistrictId ? subDistrictId.id : _null;
}
}
}
@ -1711,7 +1711,7 @@ export class ImportDataController extends Controller {
async UploadFileSQLAddressEmp(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let profileDatas: any = [];
let null_: any = null;
let _null: any = null;
const [profiles, total] = await AppDataSource.getRepository(ProfileEmployee)
.createQueryBuilder("profile")
.select(["profile.citizenId", "profile.id"])
@ -1755,7 +1755,7 @@ export class ImportDataController extends Controller {
name: provinceRegis_.PROVINCE_NAME,
},
});
_item.registrationProvinceId = provinceId ? provinceId.id : null_;
_item.registrationProvinceId = provinceId ? provinceId.id : _null;
}
}
if (existingProfile.AMPHUR_CODE && provinceRegis_) {
@ -1771,7 +1771,7 @@ export class ImportDataController extends Controller {
name: districtRegis_.AMPHUR_NAME,
},
});
_item.registrationDistrictId = districtId ? districtId.id : null_;
_item.registrationDistrictId = districtId ? districtId.id : _null;
}
}
if (existingProfile.DISTRICT_CODE && districtRegis_ && provinceRegis_) {
@ -1788,7 +1788,7 @@ export class ImportDataController extends Controller {
name: subDistrictRegis_.DISTRICT_NAME,
},
});
_item.registrationSubDistrictId = subDistrictId ? subDistrictId.id : null_;
_item.registrationSubDistrictId = subDistrictId ? subDistrictId.id : _null;
}
}
//current address
@ -1802,7 +1802,7 @@ export class ImportDataController extends Controller {
name: provinceCurr_.PROVINCE_NAME,
},
});
_item.currentProvinceId = provinceId ? provinceId.id : null_;
_item.currentProvinceId = provinceId ? provinceId.id : _null;
}
}
if (existingProfile.CONTACT_AMPHUR_CODE && provinceCurr_) {
@ -1818,7 +1818,7 @@ export class ImportDataController extends Controller {
name: districtCurr_.AMPHUR_NAME,
},
});
_item.currentDistrictId = districtId ? districtId.id : null_;
_item.currentDistrictId = districtId ? districtId.id : _null;
}
}
if (existingProfile.CONTACT_DISTRICT_CODE && districtCurr_ && provinceCurr_) {
@ -1835,7 +1835,7 @@ export class ImportDataController extends Controller {
name: subDistrictCurr_.DISTRICT_NAME,
},
});
_item.currentSubDistrictId = subDistrictId ? subDistrictId.id : null_;
_item.currentSubDistrictId = subDistrictId ? subDistrictId.id : _null;
}
}
_item.registrationAddress = existingProfile.H_NUMBER;
@ -2251,7 +2251,7 @@ export class ImportDataController extends Controller {
// .take(20)
.getManyAndCount();
let rowCount = 0;
let null_: any = null;
let _null: any = null;
let type_: any = null;
let level_: any = null;
const orgRevision = await this.orgRevisionRepo.findOne({
@ -2304,17 +2304,17 @@ export class ImportDataController extends Controller {
},
});
let posMaster = new PosMaster();
posMaster.orgRootId = orgRoot?.id ?? null_;
posMaster.orgChild1Id = orgChild1?.id ?? null_;
posMaster.orgChild2Id = orgChild2?.id ?? null_;
posMaster.orgChild3Id = orgChild3?.id ?? null_;
posMaster.orgRootId = orgRoot?.id ?? _null;
posMaster.orgChild1Id = orgChild1?.id ?? _null;
posMaster.orgChild2Id = orgChild2?.id ?? _null;
posMaster.orgChild3Id = orgChild3?.id ?? _null;
posMaster.statusReport = "PENDING";
posMaster.isCondition = false;
posMaster.isStaff = false;
posMaster.isDirector = false;
posMaster.isSit = false;
posMaster.current_holderId = existingProfile.id;
posMaster.posMasterNo = item.SALARY == "" ? null_ : Number(item.POS_NUM_CODE);
posMaster.posMasterNo = item.SALARY == "" ? _null : Number(item.POS_NUM_CODE);
posMaster.orgRevisionId = orgRevision.id;
posMaster.posMasterCreatedAt = new Date();
posMaster.createdUserId = request.user.sub;
@ -2372,7 +2372,7 @@ export class ImportDataController extends Controller {
let posExecutive = new PosExecutive();
posExecutive.posExecutivePriority =
posExecutiveOrder == null ? null_ : posExecutiveOrder.posExecutivePriority + 1;
posExecutiveOrder == null ? _null : posExecutiveOrder.posExecutivePriority + 1;
posExecutive.posExecutiveName = item.ADMIN_NAME;
posExecutive.createdUserId = request.user.sub;
posExecutive.createdFullName = request.user.name;
@ -2382,8 +2382,8 @@ export class ImportDataController extends Controller {
posExecutive.lastUpdatedAt = new Date();
await this.posExecutiveRepo.save(posExecutive);
}
position.posExecutiveId = posExecutive == null ? null_ : posExecutive.id;
position.positionName = item.WORK_LINE_NAME == "" ? null_ : item.WORK_LINE_NAME;
position.posExecutiveId = posExecutive == null ? _null : posExecutive.id;
position.positionName = item.WORK_LINE_NAME == "" ? _null : item.WORK_LINE_NAME;
position.posTypeId =
type_ != null && type_.posTypeName == item.MP_CATEGORY && type_ ? type_.id : null;
position.posLevelId =
@ -2399,7 +2399,7 @@ export class ImportDataController extends Controller {
@Post("uploadProfileSalary-OfficerEntry")
async UploadFileSQLSalaryEntry(@Request() request: { user: Record<string, any> }) {
let rowCount = 0;
let null_: any = null;
let _null: any = null;
let sqlStatements: string[] = [];
const [profiles, total] = await AppDataSource.getRepository(Profile)
@ -2444,7 +2444,7 @@ export class ImportDataController extends Controller {
profileSalary.commandDateAffect =
item.Date == null
? null_
? _null
: new Date(item.Date.setDate(item.Date.getDate() + 1))
.toISOString()
.replace("T", " ")
@ -2464,7 +2464,7 @@ export class ImportDataController extends Controller {
profileSalary.positionLevel = item.PositionLevelName;
profileSalary.positionCee = this.canConvertToInt(item.PositionLevelName)
? item.PositionLevelName
: null_;
: _null;
//xxxxxxxxxxxxxxxxx
profileSalary.positionType = item.PositionTypeName;
profileSalary.isEntry = true;

View file

@ -1165,10 +1165,10 @@ export class ProfileController extends Controller {
"amount",
"remark",
],
where: {
where: {
profileId: id,
commandCode: In(["5","6"]),
isEntry: false
commandCode: In(["5", "6"]),
isEntry: false,
},
order: { order: "ASC" },
});
@ -1326,11 +1326,11 @@ export class ProfileController extends Controller {
];
const position_raw = await this.salaryRepo.find({
where: {
where: {
profileId: id,
commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16"]),
isEntry: false
},
isEntry: false,
},
order: { order: "ASC" },
});
const positionList =
@ -1457,48 +1457,83 @@ export class ProfileController extends Controller {
const profileAbility =
profileAbility_raw.length > 0
? profileAbility_raw.map((item) => ({
field: item.field?item.field:"",
detail: item.detail?item.detail:"",
}))
: [
{
field: "-",
detail: "-",
},
];
field: item.field ? item.field : "",
detail: item.detail ? item.detail : "",
}))
: [
{
field: "-",
detail: "-",
},
];
const otherIncome_raw = await this.salaryRepo.find({
where: {
profileId: id,
commandCode: "7",
isEntry: false
},
order: { order: "ASC" },
});
const otherIncome =
const otherIncome_raw = await this.salaryRepo.find({
where: {
profileId: id,
commandCode: "7",
isEntry: false,
},
order: { order: "ASC" },
});
const otherIncome =
otherIncome_raw.length > 0
? otherIncome_raw.map((item) => ({
commandDateAffect: item.commandDateAffect?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect)):"",
commandDateSign: item.commandDateSign?Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign)):"",
commandNo: item.commandNo?Extension.ToThaiNumber(item.commandNo):"",
position: item.positionName,
posLevel: item.positionLevel?Extension.ToThaiNumber(item.positionLevel):"",
amount: item.amount?Extension.ToThaiNumber(Number(item.amount).toLocaleString()):"",
}))
: [
{
commandDateAffect: "-",
commandDateSign: "-",
commandNo: "-",
position: "-",
posLevel: "-",
amount: "-",
},
];
? otherIncome_raw.map((item) => ({
commandDateAffect: item.commandDateAffect
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateAffect))
: "",
commandDateSign: item.commandDateSign
? Extension.ToThaiNumber(Extension.ToThaiFullDate2(item.commandDateSign))
: "",
commandNo: item.commandNo ? Extension.ToThaiNumber(item.commandNo) : "",
position: item.positionName,
posLevel: item.positionLevel ? Extension.ToThaiNumber(item.positionLevel) : "",
amount: item.amount ? Extension.ToThaiNumber(Number(item.amount).toLocaleString()) : "",
}))
: [
{
commandDateAffect: "-",
commandDateSign: "-",
commandNo: "-",
position: "-",
posLevel: "-",
amount: "-",
},
];
const sum = profiles?Extension.ToThaiNumber((Number(profiles.amount) + Number(profiles.positionSalaryAmount) + Number(profiles.mouthSalaryAmount) + Number(profiles.amountSpecial)).toLocaleString()):"";
const fullCurrentAddress = profiles?Extension.ToThaiNumber(profiles.currentAddress + " ตำบล/แขวง " + profiles.currentSubDistrict.name + " อำเภอ/เขต " + profiles.currentDistrict.name + " จังหวัด " + profiles.currentProvince.name + profiles.currentZipCode):"";
const fullRegistrationAddress = profiles?Extension.ToThaiNumber(profiles.registrationAddress + " ตำบล/แขวง " + profiles.registrationSubDistrict.name + " อำเภอ/เขต " + profiles.registrationDistrict.name + " จังหวัด " + profiles.registrationProvince.name + profiles.registrationZipCode):"";
const sum = profiles
? Extension.ToThaiNumber(
(
Number(profiles.amount) +
Number(profiles.positionSalaryAmount) +
Number(profiles.mouthSalaryAmount) +
Number(profiles.amountSpecial)
).toLocaleString(),
)
: "";
const fullCurrentAddress = profiles
? Extension.ToThaiNumber(
profiles.currentAddress +
" ตำบล/แขวง " +
profiles.currentSubDistrict.name +
" อำเภอ/เขต " +
profiles.currentDistrict.name +
" จังหวัด " +
profiles.currentProvince.name +
profiles.currentZipCode,
)
: "";
const fullRegistrationAddress = profiles
? Extension.ToThaiNumber(
profiles.registrationAddress +
" ตำบล/แขวง " +
profiles.registrationSubDistrict.name +
" อำเภอ/เขต " +
profiles.registrationDistrict.name +
" จังหวัด " +
profiles.registrationProvince.name +
profiles.registrationZipCode,
)
: "";
const data = {
fullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
prefix: profiles?.prefix != null ? profiles.prefix : "",
@ -1642,7 +1677,7 @@ export class ProfileController extends Controller {
duty,
assessments,
profileAbility,
otherIncome
otherIncome,
};
return new HttpSuccess({
@ -4622,10 +4657,10 @@ export class ProfileController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูลโปรไฟล์");
}
let null_: any = null;
let _null: any = null;
profile.isLeave = false;
profile.leaveReason = null_;
profile.dateLeave = null_;
profile.leaveReason = _null;
profile.dateLeave = _null;
profile.lastUpdateUserId = req.user.sub;
profile.lastUpdateFullName = req.user.name;
profile.lastUpdatedAt = new Date();

View file

@ -519,6 +519,7 @@ export class ProfileSalaryController extends Controller {
await this.salaryHistoryRepo.save(history, { data: req });
profile.amount = body?.amount ?? _null;
profile.amountSpecial = body.amountSpecial ?? _null;
profile.positionSalaryAmount = body?.positionSalaryAmount ?? _null;
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? _null;
await this.profileRepo.save(profile, { data: req });
@ -563,11 +564,11 @@ export class ProfileSalaryController extends Controller {
history.profileSalaryId = data.id;
await this.salaryHistoryRepo.save(history, { data: req });
let null_: any = null;
profile.amount = body.amount ?? null_;
profile.amountSpecial = body.amountSpecial ?? null_;
profile.positionSalaryAmount = body.positionSalaryAmount ?? null_;
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_;
let _null: any = null;
profile.amount = body.amount ?? _null;
profile.amountSpecial = body.amountSpecial ?? _null;
profile.positionSalaryAmount = body.positionSalaryAmount ?? _null;
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? _null;
await this.profileRepo.save(profile);
return new HttpSuccess();
}

View file

@ -250,11 +250,11 @@ export class ProfileSalaryEmployeeController extends Controller {
history.profileSalaryId = data.id;
await this.salaryHistoryRepo.save(history, { data: req });
let null_: any = null;
profile.amount = body.amount ?? null_;
profile.amountSpecial = body.amountSpecial ?? null_;
profile.positionSalaryAmount = body.positionSalaryAmount ?? null_;
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? null_;
let _null: any = null;
profile.amount = body.amount ?? _null;
profile.amountSpecial = body.amountSpecial ?? _null;
profile.positionSalaryAmount = body.positionSalaryAmount ?? _null;
profile.mouthSalaryAmount = body.mouthSalaryAmount ?? _null;
await this.profileRepo.save(profile);
return new HttpSuccess();
}

View file

@ -260,14 +260,14 @@ export class KeycloakController extends Controller {
});
if (!profileEmp) {
} else {
const null_: any = null;
profileEmp.keycloak = null_;
const _null: any = null;
profileEmp.keycloak = _null;
profileEmp.roleKeycloaks = [];
await this.profileEmpRepo.save(profileEmp);
}
} else {
const null_: any = null;
profile.keycloak = null_;
const _null: any = null;
profile.keycloak = _null;
profile.roleKeycloaks = [];
await this.profileRepo.save(profile);
return new HttpSuccess();