fix format report data
This commit is contained in:
parent
8f7f8eaab6
commit
b415035aeb
2 changed files with 28 additions and 11 deletions
|
|
@ -307,13 +307,15 @@ export class ProfileController extends Controller {
|
|||
Prefix: profiles?.prefix != null ? profiles.prefix : "",
|
||||
FirstName: profiles?.firstName != null ? profiles.firstName : "",
|
||||
LastName: profiles?.lastName != null ? profiles.lastName : "",
|
||||
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
||||
FullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||
BirthDay: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getDate().toString())
|
||||
: null,
|
||||
BirthDayText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
? Extension.ToThaiNumber(
|
||||
Extension.ToThaiShortDate_noPrefix(profiles.birthDate).toString(),
|
||||
)
|
||||
: "",
|
||||
BirthMonth: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(new Date(profiles.birthDate).getMonth() + (1).toString())
|
||||
|
|
@ -323,7 +325,9 @@ export class ProfileController extends Controller {
|
|||
: null,
|
||||
BirthYearText:
|
||||
profiles.birthDate != null
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate).toString())
|
||||
? Extension.ToThaiNumber(
|
||||
Extension.ToThaiShortDate_noPrefix(profiles.birthDate).toString(),
|
||||
)
|
||||
: "",
|
||||
Address: "",
|
||||
District: "",
|
||||
|
|
@ -358,7 +362,7 @@ export class ProfileController extends Controller {
|
|||
StartDate: profiles?.dateStart,
|
||||
AppointDate: profiles?.dateAppoint ?? "",
|
||||
BirthDate: profiles?.birthDate
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate(profiles.birthDate))
|
||||
? Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(profiles.birthDate))
|
||||
: null,
|
||||
RetireDate:
|
||||
profiles.dateRetireLaw != null
|
||||
|
|
@ -375,7 +379,7 @@ export class ProfileController extends Controller {
|
|||
CertificateType: item.certificateType ?? null,
|
||||
Issuer: item.issuer ?? null,
|
||||
CertificateNo: Extension.ToThaiNumber(item.certificateNo) ?? null,
|
||||
IssueDate: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.issueDate)) ?? null,
|
||||
IssueDate: Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.issueDate)) ?? null,
|
||||
}));
|
||||
const trainings = await this.trainingRepository.find({
|
||||
select: ["startDate", "endDate", "place", "department", "name"],
|
||||
|
|
@ -386,12 +390,14 @@ export class ProfileController extends Controller {
|
|||
Start:
|
||||
item.startDate == null
|
||||
? ""
|
||||
: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate)),
|
||||
: Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.startDate)),
|
||||
End:
|
||||
item.endDate == null ? "" : Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate)),
|
||||
item.endDate == null
|
||||
? ""
|
||||
: Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.endDate)),
|
||||
Date:
|
||||
item.startDate && item.endDate
|
||||
? `${Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate))}`
|
||||
? `${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.endDate))}`
|
||||
: "",
|
||||
Level: "",
|
||||
Degree: item.name,
|
||||
|
|
@ -425,7 +431,7 @@ export class ProfileController extends Controller {
|
|||
: Extension.ToThaiNumber(new Date(item.endDate).getFullYear().toString()),
|
||||
Date:
|
||||
item.startDate && item.endDate
|
||||
? `${Extension.ToThaiNumber(Extension.ToThaiShortDate(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiShortDate(item.endDate))}`
|
||||
? `${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.startDate))} - ${Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.endDate))}`
|
||||
: "",
|
||||
Level: item.educationLevel ?? "",
|
||||
Degree: item.degree && item.field ? `${item.degree} ${item.field}` : "",
|
||||
|
|
@ -445,7 +451,7 @@ export class ProfileController extends Controller {
|
|||
});
|
||||
|
||||
const Salary = salarys.map((item) => ({
|
||||
SalaryDate: Extension.ToThaiNumber(Extension.ToThaiShortDate(item.date)) ?? null,
|
||||
SalaryDate: Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.date)) ?? null,
|
||||
Position: item.position ?? null,
|
||||
PosNo: item.posNo ?? null,
|
||||
Salary: "",
|
||||
|
|
@ -457,7 +463,7 @@ export class ProfileController extends Controller {
|
|||
item.positionSalaryAmount == null
|
||||
? null
|
||||
: Extension.ToThaiNumber(item.positionSalaryAmount.toString()),
|
||||
FullName: `${profiles?.prefix} ${profiles?.firstName} ${profiles?.lastName}`,
|
||||
FullName: `${profiles?.prefix}${profiles?.firstName} ${profiles?.lastName}`,
|
||||
OcFullPath: `${_child4}${_child3}${_child2}${_child1}${_root}`,
|
||||
}));
|
||||
return new HttpSuccess({
|
||||
|
|
|
|||
|
|
@ -112,6 +112,17 @@ class Extension {
|
|||
);
|
||||
}
|
||||
|
||||
public static ToThaiShortDate_noPrefix(value: Date) {
|
||||
let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear();
|
||||
return (
|
||||
value.getDate() +
|
||||
" " +
|
||||
Extension.ToThaiShortMonth(value.getMonth() + 1) +
|
||||
" " +
|
||||
yy.toString().slice(-2)
|
||||
);
|
||||
}
|
||||
|
||||
public static sumObjectValues(array: any, propertyName: any) {
|
||||
let sum = 0;
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue