เคลียรค่าสำรองเงินเดือน

This commit is contained in:
Kittapath 2024-04-03 16:34:36 +07:00
parent 866dd91d81
commit d94ca5480e
2 changed files with 31 additions and 11 deletions

View file

@ -659,6 +659,11 @@ export class SalaryPeriodController extends Controller {
);
}
}
}
if (body.type == "FULL") {
salaryProfile.isReserve = body.isReserve;
} else {
salaryProfile.isReserve = false;
}
//Type & Level
@ -692,7 +697,6 @@ export class SalaryPeriodController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบระดับตำแหน่ง");
}
salaryProfile.type = body.type;
salaryProfile.isReserve = body.isReserve;
let type = salaryProfile.type;
//SalaryRank
let salaryRanks: any = null;

View file

@ -373,6 +373,7 @@ export class SalaryPeriodEmployeeController extends Controller {
if (salaryFormula != null) {
//หาเงินตำ่สุดที่คำนวนเงิน
let salary = 0;
let _step = 0;
if (
salaryProfile.amount != null &&
salaryProfile.amount > 0 &&
@ -383,12 +384,15 @@ export class SalaryPeriodEmployeeController extends Controller {
salary = salaryProfile.amount;
} else {
salary = salaryFormula.salaryMin;
_step = 0.5;
}
} else {
if (salaryProfile.amount != null && salaryProfile.amount > 0)
salary = salaryProfile.amount;
if (salaryFormula.salaryMin != null && salaryFormula.salaryMin > 0)
if (salaryFormula.salaryMin != null && salaryFormula.salaryMin > 0) {
salary = salaryFormula.salaryMin;
_step = 0.5;
}
}
//หาขั้นต่ำสุดตามเกณฑ์
let salaryRankMin = await this.salaryRankRepository.findOne({
@ -438,14 +442,14 @@ export class SalaryPeriodEmployeeController extends Controller {
step = salaryRankMin == null ? 0.5 : salaryRankMin.step - 0.5;
group = salaryRankMin == null ? group : salaryFormula.salaryEmployee.group;
} else {
step = salaryRankMin.step;
step = salaryRankMin.step - _step;
group = salaryFormula.salaryEmployee.group;
}
} else {
step = salaryRankMin.step - 0.5;
}
} else {
step = salaryRankMin.step;
step = salaryRankMin.step - _step;
}
} else {
step = 0.5;
@ -718,6 +722,11 @@ export class SalaryPeriodEmployeeController extends Controller {
}
}
}
if (body.type == "FULL") {
salaryProfile.isReserve = body.isReserve;
} else {
salaryProfile.isReserve = false;
}
//Type & Level
const Type = await this.posTypeRepository.findOne({
@ -737,7 +746,6 @@ export class SalaryPeriodEmployeeController extends Controller {
if (!Level) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบระดับตำแหน่ง");
}
salaryProfile.isReserve = body.isReserve;
salaryProfile.type = body.type;
let type = salaryProfile.type;
@ -783,6 +791,7 @@ export class SalaryPeriodEmployeeController extends Controller {
if (salaryFormula != null) {
//หาเงินตำ่สุดที่คำนวนเงิน
let salary = 0;
let _step = 0;
if (
salaryProfile.amount != null &&
salaryProfile.amount > 0 &&
@ -793,12 +802,15 @@ export class SalaryPeriodEmployeeController extends Controller {
salary = salaryProfile.amount;
} else {
salary = salaryFormula.salaryMin;
_step = 0.5;
}
} else {
if (salaryProfile.amount != null && salaryProfile.amount > 0)
salary = salaryProfile.amount;
if (salaryFormula.salaryMin != null && salaryFormula.salaryMin > 0)
if (salaryFormula.salaryMin != null && salaryFormula.salaryMin > 0) {
salary = salaryFormula.salaryMin;
_step = 0.5;
}
}
//หาขั้นต่ำสุดตามเกณฑ์
let salaryRankMin = await this.salaryRankRepository.findOne({
@ -848,14 +860,14 @@ export class SalaryPeriodEmployeeController extends Controller {
step = salaryRankMin == null ? 0.5 : salaryRankMin.step - 0.5;
group = salaryRankMin == null ? group : salaryFormula.salaryEmployee.group;
} else {
step = salaryRankMin.step;
step = salaryRankMin.step - _step;
group = salaryFormula.salaryEmployee.group;
}
} else {
step = salaryRankMin.step - 0.5;
}
} else {
step = salaryRankMin.step;
step = salaryRankMin.step - _step;
}
} else {
step = 0.5;
@ -1302,6 +1314,7 @@ export class SalaryPeriodEmployeeController extends Controller {
if (salaryFormula != null) {
//หาเงินตำ่สุดที่คำนวนเงิน
let salary = 0;
let _step = 0;
if (
salaryProfile.amount != null &&
salaryProfile.amount > 0 &&
@ -1312,12 +1325,15 @@ export class SalaryPeriodEmployeeController extends Controller {
salary = salaryProfile.amount;
} else {
salary = salaryFormula.salaryMin;
_step = 0.5;
}
} else {
if (salaryProfile.amount != null && salaryProfile.amount > 0)
salary = salaryProfile.amount;
if (salaryFormula.salaryMin != null && salaryFormula.salaryMin > 0)
if (salaryFormula.salaryMin != null && salaryFormula.salaryMin > 0) {
salary = salaryFormula.salaryMin;
_step = 0.5;
}
}
//หาขั้นต่ำสุดตามเกณฑ์
let salaryRankMin = await this.salaryRankRepository.findOne({
@ -1367,14 +1383,14 @@ export class SalaryPeriodEmployeeController extends Controller {
step = salaryRankMin == null ? 0.5 : salaryRankMin.step - 0.5;
group = salaryRankMin == null ? group : salaryFormula.salaryEmployee.group;
} else {
step = salaryRankMin.step;
step = salaryRankMin.step - _step;
group = salaryFormula.salaryEmployee.group;
}
} else {
step = salaryRankMin.step - 0.5;
}
} else {
step = salaryRankMin.step;
step = salaryRankMin.step - _step;
}
} else {
step = 0.5;