report gov01-07
This commit is contained in:
parent
5bbda41b2f
commit
3d6ceb2229
1 changed files with 41 additions and 38 deletions
|
|
@ -768,8 +768,6 @@ export class ReportController extends Controller {
|
|||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
period: "APR",
|
||||
isActive: true,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -777,51 +775,39 @@ export class ReportController extends Controller {
|
|||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
|
||||
}
|
||||
|
||||
const salaryOrg = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP2",
|
||||
},
|
||||
order: {
|
||||
group: "ASC",
|
||||
},
|
||||
relations: ["salaryProfiles"],
|
||||
});
|
||||
|
||||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg?.id,
|
||||
amountSpecial: IsNull() || 0,
|
||||
amountUse: MoreThan(1),
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
salaryPeriod: {
|
||||
period: "APR",
|
||||
},
|
||||
},
|
||||
},
|
||||
select: [
|
||||
"id",
|
||||
"prefix",
|
||||
"firstName",
|
||||
"lastName",
|
||||
"root",
|
||||
"position",
|
||||
"posType",
|
||||
"posLevel",
|
||||
"orgShortName",
|
||||
"posMasterNo",
|
||||
"amount",
|
||||
"amountUse",
|
||||
"positionSalaryAmount",
|
||||
],
|
||||
order: {
|
||||
type: "DESC",
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root;
|
||||
|
||||
const mapData = salaryProfile.map((item, index) => ({
|
||||
const formattedData = salaryProfile.map((item, index) => ({
|
||||
no: Extension.ToThaiNumber(String(index + 1)),
|
||||
fullname: item.prefix + item.firstName + " " + item.lastName,
|
||||
position: item.position,
|
||||
position:
|
||||
item.position +
|
||||
"/" +
|
||||
(item.child4 == undefined && item.child4 == null ? "" : item.child4 + "/") +
|
||||
(item.child3 == undefined && item.child3 == null ? "" : item.child3 + "/") +
|
||||
(item.child2 == undefined && item.child2 == null ? "" : item.child2 + "/") +
|
||||
(item.child1 == undefined && item.child1 == null ? "" : item.child1 + "/") +
|
||||
(item.root == undefined && item.root == null ? "" : item.root),
|
||||
posType: item.posType,
|
||||
posLevel: item.posLevel,
|
||||
posMasterNo: Extension.ToThaiNumber(String(item.posMasterNo)),
|
||||
posMasterNo: item.orgShortName + Extension.ToThaiNumber(String(item.posMasterNo)),
|
||||
amount:
|
||||
item.amount == undefined || item.amount == null
|
||||
? "๐"
|
||||
|
|
@ -829,11 +815,28 @@ export class ReportController extends Controller {
|
|||
positionSalaryAmount:
|
||||
item.positionSalaryAmount == undefined || item.positionSalaryAmount == null
|
||||
? "๐"
|
||||
: Extension.ToThaiNumber(String(item.positionSalaryAmount)),
|
||||
remark: null,
|
||||
: Extension.ToThaiNumber(String(item.positionSalaryAmount)) +
|
||||
(item.amountSpecial > 0
|
||||
? `(${Extension.ToThaiNumber(String(item.positionSalaryAmount))})`
|
||||
: ""),
|
||||
remark:
|
||||
(item.type == "FULL" ? `หนึ่งขั้น ` : item.type == "FULLHAFT" ? `หนึ่งขั้นครึ่ง ` : "") +
|
||||
(item.isNext == true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""),
|
||||
}));
|
||||
|
||||
return mapData;
|
||||
return new HttpSuccess({
|
||||
template: "gov1-07",
|
||||
reportName: "gov1-07",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber((salaryPeriod.year + 543).toString()),
|
||||
yearOld: Extension.ToThaiNumber((salaryPeriod.year + 542).toString()),
|
||||
date: Extension.ToThaiNumber(
|
||||
Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-04-01`)),
|
||||
),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue