diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 12582e36..391fb4d5 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -31,7 +31,7 @@ import { UpdateProfileMother, UpdateProfileCouple, } from "../entities/Profile"; -import { Brackets, IsNull, Like, Not } from "typeorm"; +import { Brackets, In, IsNull, Like, Not } from "typeorm"; import { OrgRevision } from "../entities/OrgRevision"; import { PosMaster } from "../entities/PosMaster"; import { PosLevel } from "../entities/PosLevel"; @@ -1136,7 +1136,11 @@ export class ProfileController extends Controller { "amount", "remark", ], - where: { profileId: id }, + where: { + profileId: id, + commandCode: In(["5","6"]), + isEntry: false + }, order: { order: "ASC" }, }); @@ -1291,7 +1295,11 @@ export class ProfileController extends Controller { ]; const position_raw = await this.salaryRepo.find({ - where: { profileId: id }, + where: { + profileId: id, + commandCode: In(["1", "2", "3", "4", "8", "10", "11", "12", "15", "16"]), + isEntry: false + }, order: { order: "ASC" }, }); const positionList = @@ -1310,7 +1318,6 @@ export class ProfileController extends Controller { { commandDateAffect: "-", commandDateSign: "-", - refCommandNo: "-", posNo: "-", position: "-", posType: "-", @@ -1402,6 +1409,36 @@ export class ProfileController extends Controller { detail: "-", }, ]; + + 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: "-", + }, + ]; + 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):""; @@ -1535,6 +1572,7 @@ export class ProfileController extends Controller { duty, assessments, profileAbility, + otherIncome }; return new HttpSuccess({