เก็บเงินพิเศษลูกจ้าง
This commit is contained in:
parent
9449a1f989
commit
f4c6831c0b
4 changed files with 167 additions and 29 deletions
|
|
@ -931,14 +931,14 @@ export class ReportController extends Controller {
|
|||
},
|
||||
relations: ["salaryProfiles"],
|
||||
});
|
||||
if(salaryPeriod.period === 'APR'){
|
||||
if (salaryPeriod.period === "APR") {
|
||||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg?.id,
|
||||
type: "FULL", //หนึ่งขั้น
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//รอบปีก่อนๆ
|
||||
const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -1010,13 +1010,21 @@ export class ReportController extends Controller {
|
|||
},
|
||||
});
|
||||
const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)));
|
||||
const yearIncrease1 = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-2)));
|
||||
const yearIncrease2 = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1)));
|
||||
const fifteenPercent = salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null ?
|
||||
"๐" : Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint = salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null ?
|
||||
".๐๐" : "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
|
||||
const yearIncrease1 = Extension.ToThaiNumber(
|
||||
String(Extension.ToThaiYear(salaryPeriod.year - 2)),
|
||||
);
|
||||
const yearIncrease2 = Extension.ToThaiNumber(
|
||||
String(Extension.ToThaiYear(salaryPeriod.year - 1)),
|
||||
);
|
||||
const fifteenPercent =
|
||||
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
|
||||
? "๐"
|
||||
: Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint =
|
||||
salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null
|
||||
? ".๐๐"
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "gov1-03",
|
||||
reportName: "gov1-03",
|
||||
|
|
@ -1025,7 +1033,7 @@ export class ReportController extends Controller {
|
|||
yearIncrease1: yearIncrease1,
|
||||
yearIncrease2: yearIncrease2,
|
||||
yearIncreaseSlice: yearIncrease2.slice(-2),
|
||||
yearSlice: year.slice(-2),
|
||||
yearSlice: year.slice(-2),
|
||||
point: fifteenPercent + fifteenPoint,
|
||||
root: salaryProfile[0]?.root,
|
||||
profile: salaryProfile.map((item, index) => ({
|
||||
|
|
@ -1064,8 +1072,7 @@ export class ReportController extends Controller {
|
|||
})),
|
||||
},
|
||||
});
|
||||
}
|
||||
else if(salaryPeriod.period === 'OCT'){
|
||||
} else if (salaryPeriod.period === "OCT") {
|
||||
//find period APR
|
||||
const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -1079,23 +1086,23 @@ export class ReportController extends Controller {
|
|||
salaryPeriodId: salaryPeriod_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP2",
|
||||
}
|
||||
},
|
||||
});
|
||||
const salaryProfile_APR = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg_APR?.id,
|
||||
type: In(["HAFT","FULL"]),
|
||||
}
|
||||
type: In(["HAFT", "FULL"]),
|
||||
},
|
||||
});
|
||||
//end period APR
|
||||
|
||||
const salaryProfile = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg?.id,
|
||||
type: In(["FULLHAFT","FULL"]),
|
||||
}
|
||||
type: In(["FULLHAFT", "FULL"]),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//รอบปีก่อนๆ
|
||||
const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -1167,13 +1174,21 @@ export class ReportController extends Controller {
|
|||
},
|
||||
});
|
||||
const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)));
|
||||
const yearIncrease1 = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-2)));
|
||||
const yearIncrease2 = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1)));
|
||||
const fifteenPercent = salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null ?
|
||||
"๐" : Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint = salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null ?
|
||||
".๐๐" : "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
|
||||
const yearIncrease1 = Extension.ToThaiNumber(
|
||||
String(Extension.ToThaiYear(salaryPeriod.year - 2)),
|
||||
);
|
||||
const yearIncrease2 = Extension.ToThaiNumber(
|
||||
String(Extension.ToThaiYear(salaryPeriod.year - 1)),
|
||||
);
|
||||
const fifteenPercent =
|
||||
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
|
||||
? "๐"
|
||||
: Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint =
|
||||
salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null
|
||||
? ".๐๐"
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "gov2-03",
|
||||
reportName: "gov2-03",
|
||||
|
|
@ -1182,7 +1197,7 @@ export class ReportController extends Controller {
|
|||
yearIncrease1: yearIncrease1,
|
||||
yearIncrease2: yearIncrease2,
|
||||
yearIncreaseSlice: yearIncrease2.slice(-2),
|
||||
yearSlice: year.slice(-2),
|
||||
yearSlice: year.slice(-2),
|
||||
point: fifteenPercent + fifteenPoint,
|
||||
root: salaryProfile[0]?.root,
|
||||
profile: salaryProfile.map((item, index) => ({
|
||||
|
|
@ -1219,8 +1234,8 @@ export class ReportController extends Controller {
|
|||
salaryIncreaseAPR:
|
||||
salaryProfile_APR.length > 0
|
||||
? salaryProfile_APR
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.amount)
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.amount)
|
||||
: "๐", //การเลื่อนเงินเดือนรอบเมษา
|
||||
Type: item.type === "FULL" ? "หนึ่งขั้น" : "หนึ่งขั้นครึ่ง",
|
||||
score1: null, //ผลการประเมินฯ ครั้งที่ 1
|
||||
|
|
@ -1935,6 +1950,7 @@ export class ReportController extends Controller {
|
|||
const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
type: "FULL",
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
|
|
@ -1982,6 +1998,7 @@ export class ReportController extends Controller {
|
|||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
score: null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
|
@ -2023,6 +2040,7 @@ export class ReportController extends Controller {
|
|||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
type: In(["HAFT", "FULL", "FULLHAFT"]),
|
||||
isNext: false,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
|
|
@ -2100,6 +2118,7 @@ export class ReportController extends Controller {
|
|||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
type: In(["HAFT", "FULL", "FULLHAFT"]),
|
||||
isNext: true,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
|
|
@ -2142,6 +2161,10 @@ export class ReportController extends Controller {
|
|||
positionSalaryAmount: profile.positionSalaryAmount
|
||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||
: null,
|
||||
amountSpecial:
|
||||
profile.amountSpecial > 0
|
||||
? "(" + Extension.ToThaiNumber(profile.amountSpecial.toString()) + ")"
|
||||
: "",
|
||||
score: null, //สรุปผลการประเมินฯ ระดับและคะแนน
|
||||
reason: null,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -346,16 +346,48 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
salaryRankAmountMax == null ? 0 : salaryRankAmountMax.salaryDay;
|
||||
salaryProfile.groupNew = salaryFormula.salaryEmployee.group;
|
||||
salaryProfile.salaryLevelNew = salaryRankAmountMax == null ? 0 : salaryRankAmountMax.step;
|
||||
salaryRankAmountMax == null ? 0 : salaryRankAmountMax.step;
|
||||
if (salaryRankAmountMax != null) {
|
||||
if (step - salaryRankAmountMax.step <= 0.5) {
|
||||
salaryProfile.positionSalaryAmountPer = 0.2;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.2;
|
||||
} else if (step - salaryRankAmountMax.step <= 1) {
|
||||
salaryProfile.positionSalaryAmountPer = 0.4;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.4;
|
||||
} else {
|
||||
salaryProfile.positionSalaryAmountPer = 0.6;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.6;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.isNext = false;
|
||||
salaryProfile.amountUse = salaryRanks.salaryMonth - salaryProfile.amount;
|
||||
salaryProfile.positionSalaryAmount = salaryRanks.salaryMonth;
|
||||
salaryProfile.positionSalaryDayAmount = salaryRanks.salaryDay;
|
||||
salaryProfile.groupNew = group;
|
||||
salaryProfile.salaryLevelNew = step;
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.isNext = false;
|
||||
salaryProfile.amountUse = 0;
|
||||
salaryProfile.positionSalaryAmount = salaryProfile.amount;
|
||||
salaryProfile.positionSalaryDayAmount = 0;
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง");
|
||||
|
|
@ -644,18 +676,49 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
salaryRankAmountMax == null ? 0 : salaryRankAmountMax.salaryDay;
|
||||
salaryProfile.groupNew = salaryFormula.salaryEmployee.group;
|
||||
salaryProfile.salaryLevelNew = salaryRankAmountMax == null ? 0 : salaryRankAmountMax.step;
|
||||
if (salaryRankAmountMax != null) {
|
||||
if (step - salaryRankAmountMax.step <= 0.5) {
|
||||
salaryProfile.positionSalaryAmountPer = 0.2;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.2;
|
||||
} else if (step - salaryRankAmountMax.step <= 1) {
|
||||
salaryProfile.positionSalaryAmountPer = 0.4;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.4;
|
||||
} else {
|
||||
salaryProfile.positionSalaryAmountPer = 0.6;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.6;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.isNext = false;
|
||||
salaryProfile.amountUse =
|
||||
salaryRanks.salaryMonth - (salaryProfile.amount == null ? 0 : salaryProfile.amount);
|
||||
salaryProfile.positionSalaryAmount = salaryRanks.salaryMonth;
|
||||
salaryProfile.positionSalaryDayAmount = salaryRanks.salaryDay;
|
||||
salaryProfile.groupNew = group;
|
||||
salaryProfile.salaryLevelNew = step;
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.isNext = false;
|
||||
salaryProfile.amountUse = 0;
|
||||
salaryProfile.positionSalaryAmount =
|
||||
salaryProfile.amount == null ? 0 : salaryProfile.amount;
|
||||
salaryProfile.positionSalaryDayAmount = 0;
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง");
|
||||
|
|
@ -1000,18 +1063,49 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
salaryRankAmountMax == null ? 0 : salaryRankAmountMax.salaryDay;
|
||||
salaryProfile.groupNew = salaryFormula.salaryEmployee.group;
|
||||
salaryProfile.salaryLevelNew = salaryRankAmountMax == null ? 0 : salaryRankAmountMax.step;
|
||||
if (salaryRankAmountMax != null) {
|
||||
if (step - salaryRankAmountMax.step <= 0.5) {
|
||||
salaryProfile.positionSalaryAmountPer = 0.2;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.2;
|
||||
} else if (step - salaryRankAmountMax.step <= 1) {
|
||||
salaryProfile.positionSalaryAmountPer = 0.4;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.4;
|
||||
} else {
|
||||
salaryProfile.positionSalaryAmountPer = 0.6;
|
||||
salaryProfile.amountSpecial =
|
||||
salaryRankAmountMax == null || salaryRankAmountMax.salaryMonth == null
|
||||
? 0
|
||||
: salaryRankAmountMax.salaryMonth * 0.6;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.isNext = false;
|
||||
salaryProfile.amountUse =
|
||||
salaryRanks.salaryMonth - (salaryProfile.amount == null ? 0 : salaryProfile.amount);
|
||||
salaryProfile.positionSalaryAmount = salaryRanks.salaryMonth;
|
||||
salaryProfile.positionSalaryDayAmount = salaryRanks.salaryDay;
|
||||
salaryProfile.groupNew = group;
|
||||
salaryProfile.salaryLevelNew = step;
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
salaryProfile.isNext = false;
|
||||
salaryProfile.amountUse = 0;
|
||||
salaryProfile.positionSalaryAmount =
|
||||
salaryProfile.amount == null ? 0 : salaryProfile.amount;
|
||||
salaryProfile.positionSalaryDayAmount = 0;
|
||||
salaryProfile.positionSalaryAmountPer = 0;
|
||||
salaryProfile.amountSpecial = 0;
|
||||
}
|
||||
} else {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทการเลื่อนขึ้นเงินเดือนไม่ถูกต้อง");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue