fix format

This commit is contained in:
AdisakKanthawilang 2024-06-06 18:06:01 +07:00
parent 594371d23f
commit 8a624efe6f
2 changed files with 11 additions and 15 deletions

View file

@ -177,11 +177,11 @@ export class ProfileController extends Controller {
LastName: profile.lastName != null ? profile.lastName : "", LastName: profile.lastName != null ? profile.lastName : "",
DateOfBirth: DateOfBirth:
profile.birthDate != null profile.birthDate != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.birthDate)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.birthDate))
: "", : "",
DateRetire: DateRetire:
profile.dateRetire != null profile.dateRetire != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.dateRetire)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateRetire))
: "", : "",
RegistrationAddress: Extension.ToThaiNumber( RegistrationAddress: Extension.ToThaiNumber(
`${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`, `${_regisAddres}${_subDistrict}${_district}${_province}${registrationZipCode}`,
@ -197,12 +197,12 @@ export class ProfileController extends Controller {
: "", : "",
AppointText: AppointText:
profile.dateAppoint != null profile.dateAppoint != null
? Extension.ToThaiNumber(Extension.ToThaiShortDate_perfixMonthYear(profile.dateAppoint)) ? Extension.ToThaiNumber(Extension.ToThaiShortDate_monthYear(profile.dateAppoint))
: "", : "",
SalaryDate: SalaryDate:
profile.profileSalary.length > 0 && profile.profileSalary[0].date != null profile.profileSalary.length > 0 && profile.profileSalary[0].date != null
? Extension.ToThaiNumber( ? Extension.ToThaiNumber(
Extension.ToThaiShortDate_perfixMonthYear(profile.profileSalary[0].date), Extension.ToThaiShortDate_monthYear(profile.profileSalary[0].date),
) )
: "", : "",
PositionName: profile.position != null ? profile.position : "", PositionName: profile.position != null ? profile.position : "",
@ -414,7 +414,7 @@ export class ProfileController extends Controller {
DisciplineYear: DisciplineYear:
Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ?? null, Extension.ToThaiNumber(new Date(item.refCommandDate).getFullYear().toString()) ?? null,
DisciplineDetail: item.detail ?? null, DisciplineDetail: item.detail ?? null,
RefNo: item.refCommandNo ?? null, RefNo: Extension.ToThaiNumber(item.refCommandNo) ?? null,
})); }));
const educations = await this.educationRepository.find({ const educations = await this.educationRepository.find({
@ -448,6 +448,8 @@ export class ProfileController extends Controller {
"positionLevel", "positionLevel",
"positionSalaryAmount", "positionSalaryAmount",
"refCommandNo", "refCommandNo",
"amount",
"templateDoc",
], ],
where: { profileId: id }, where: { profileId: id },
}); });
@ -456,9 +458,9 @@ export class ProfileController extends Controller {
SalaryDate: Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.date)) ?? null, SalaryDate: Extension.ToThaiNumber(Extension.ToThaiShortDate_noPrefix(item.date)) ?? null,
Position: item.position ?? null, Position: item.position ?? null,
PosNo: item.posNo ?? null, PosNo: item.posNo ?? null,
Salary: "", Salary: item.amount ?? null,
Rank: item.positionLevel ?? null, Rank: item.positionLevel ?? null,
RefAll: item.refCommandNo ?? null, RefAll: Extension.ToThaiNumber(item.templateDoc) ?? null,
PositionType: item.positionType ?? null, PositionType: item.positionType ?? null,
PositionLevel: item.positionLevel ?? null, PositionLevel: item.positionLevel ?? null,
PositionAmount: PositionAmount:

View file

@ -123,15 +123,9 @@ class Extension {
); );
} }
public static ToThaiShortDate_perfixMonthYear(value: Date) { public static ToThaiShortDate_monthYear(value: Date) {
let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear(); let yy = value.getFullYear() < 2400 ? value.getFullYear() + 543 : value.getFullYear();
return ( return value.getDate() + " เดือน " + Extension.ToThaiMonth(value.getMonth() + 1) + " พ.ศ. " + yy;
value.getDate() +
" เดือน " +
Extension.ToThaiShortMonth(value.getMonth() + 1) +
" พ.ศ. " +
yy
);
} }
public static sumObjectValues(array: any, propertyName: any) { public static sumObjectValues(array: any, propertyName: any) {