fix report 16 to 14
This commit is contained in:
parent
c149234bf9
commit
5879ccf93d
1 changed files with 75 additions and 157 deletions
|
|
@ -3025,7 +3025,7 @@ export class ReportController extends Controller {
|
|||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel,
|
||||
posLevel: profile.posLevel ? Extension.ToThaiNumber(String(profile.posLevel.toLocaleString())): null,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -3275,90 +3275,83 @@ export class ReportController extends Controller {
|
|||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* API 14-คำสั่ง
|
||||
|
||||
/**
|
||||
* API 14-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับค่าตอบแทนพิเศษ
|
||||
*
|
||||
* @summary 14-คำสั่ง
|
||||
* @summary 14-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับค่าตอบแทนพิเศษ
|
||||
*
|
||||
*/
|
||||
@Get("emp-14/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp1_14(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
type: In(["HAFT", "FULL", "FULLHAFT"]),
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
positionSalaryAmount: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
];
|
||||
|
||||
const fullName = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: null,
|
||||
posNumber:
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
positionSalaryAmount: profile.positionSalaryAmount
|
||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
: null,
|
||||
score: null, //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
remark:
|
||||
`${profile.type === "FULL" ? "หนึ่งขั้น" : ""}\n` +
|
||||
`${profile.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : ""}\n` +
|
||||
`${profile.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ\n" : ""}` +
|
||||
`${profile.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`, // หมายเหตุ
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "emp1-14",
|
||||
reportName: "emp1-14",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
@Get("emp-14/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp1_14(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
isNext: false,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
positionSalaryAmount: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
];
|
||||
|
||||
const fullName = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: null,
|
||||
posNumber:
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null, // หมายเหตุ
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "emp1-14",
|
||||
reportName: "emp1-14",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* API 15-บัญชีรายละเอียดลูกจ้างประจำที่ได้รับค่าตอบแทนพิเศษ(แนบท้ายคำสั่ง)
|
||||
*
|
||||
|
|
@ -3445,82 +3438,7 @@ export class ReportController extends Controller {
|
|||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* API 16-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับค่าตอบแทนพิเศษ
|
||||
*
|
||||
* @summary 16-บัญชีรายชื่อลูกจ้างประจำผู้ไม่ได้รับค่าตอบแทนพิเศษ
|
||||
*
|
||||
*/
|
||||
@Get("emp-16/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp1_16(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
isNext: false,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
positionSalaryAmount: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
];
|
||||
|
||||
const fullName = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel
|
||||
? `${profile.posTypeShort} ${Extension.ToThaiNumber(profile.posLevel.toLocaleString())}`
|
||||
: null,
|
||||
posNumber:
|
||||
Extension.ToThaiNumber(profile.orgShortName) +
|
||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null, // หมายเหตุ
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "emp1-16",
|
||||
reportName: "emp1-16",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
/**
|
||||
* API 17-คำสั่ง
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue