Merge branch 'develop' into adiDev
This commit is contained in:
commit
df264107d1
3 changed files with 132 additions and 27 deletions
|
|
@ -2487,33 +2487,73 @@ export class ReportController extends Controller {
|
|||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
period: "APR",
|
||||
isActive: true
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
|
||||
const salaryPeriodAPR = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
year: salaryPeriod.year - 1,
|
||||
period: "APR",
|
||||
isActive: true
|
||||
},
|
||||
});
|
||||
const salaryPeriodOCT = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
year: salaryPeriod.year - 1,
|
||||
period: "OCT",
|
||||
isActive: true
|
||||
},
|
||||
});
|
||||
|
||||
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg",],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
type: "NONE"
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
if (!_salaryProfileEmp) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const _salaryProfileEmpAPR = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg",],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodAPR?.id,
|
||||
}
|
||||
}
|
||||
});
|
||||
const _salaryProfileEmpOCT = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg",],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodOCT?.id,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
|
||||
const formattedData = _salaryProfileEmp.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
|
|
@ -2530,11 +2570,37 @@ export class ReportController extends Controller {
|
|||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
posLevel: profile.posLevel,
|
||||
position: profile.position,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "๐",
|
||||
type1: _salaryProfileEmpAPR.length > 0
|
||||
? (() => {
|
||||
const _profile = _salaryProfileEmpAPR
|
||||
.filter((profileAPR) => profileAPR.citizenId === profile.citizenId)
|
||||
.map((profile) => ({ type: profile.type, isNext: profile.isNext, positionSalaryAmountPer: profile.positionSalaryAmountPer }));
|
||||
if(_profile[0].isNext){
|
||||
return _profile[0].positionSalaryAmountPer === 0.02 ? "๒%" : _profile[0].positionSalaryAmountPer === 0.04 ? "๔%": "๖%"
|
||||
}
|
||||
return _profile[0].type === "HALF" ? "๐.๕ ขั้น" : _profile[0].type === "FULL" ? "๑ ขั้น" : "ไม่ได้เลื่อนขั้นฯ";
|
||||
})()
|
||||
: null, //เมษา ปีก่อนหน้า
|
||||
type2: _salaryProfileEmpOCT.length > 0
|
||||
? (() => {
|
||||
const _profile = _salaryProfileEmpOCT
|
||||
.filter((profileOCT) => profileOCT.citizenId === profile.citizenId)
|
||||
.map((profile) => ({ type: profile.type, isNext: profile.isNext, positionSalaryAmountPer: profile.positionSalaryAmountPer }));
|
||||
if(_profile[0].isNext){
|
||||
return _profile[0].positionSalaryAmountPer === 0.02 ? "๒%" : _profile[0].positionSalaryAmountPer === 0.04 ? "๔%": "๖%"
|
||||
}
|
||||
return _profile[0].type === "HALF" ? "๐.๕ ขั้น" : _profile[0].type === "FULL" ? "๑ ขั้น" : "ไม่ได้เลื่อนขั้นฯ";
|
||||
})()
|
||||
: null, //ตุลา ปีก่อนหน้า
|
||||
type: profile.isNext === true
|
||||
? profile.positionSalaryAmountPer === 0.02 ? "๒%" : profile.positionSalaryAmountPer === 0.04 ? "๔%" : "๖%"
|
||||
: profile.type === "HALF" ? "๐.๕ ขั้น" : profile.type === "FULL" ? "๑ ขั้น" : "ไม่ได้เลื่อนขั้นฯ",
|
||||
score: null, //ผลการประเมิน
|
||||
remark: null, //หมายเหตุ
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -2543,11 +2609,14 @@ export class ReportController extends Controller {
|
|||
reportName: "emp1-09",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
yearBeforeSlice: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1)).slice(-2)),
|
||||
yearSlice: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)).slice(-2)),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// /**
|
||||
// * API 10-รายชื่อลูกจ้างประจำผู้มีผลการประเมินดีเด่น
|
||||
// *
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue