This commit is contained in:
AdisakKanthawilang 2025-07-11 11:43:38 +07:00
parent 56241eda4f
commit d742e4a3ea

View file

@ -1210,13 +1210,13 @@ export class ReportController extends Controller {
type: Not(In(["NONE", "PENDING"])), type: Not(In(["NONE", "PENDING"])),
}, },
}); });
const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))); const year = salaryPeriod.year?Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))):"";
const yearIncrease1 = Extension.ToThaiNumber( const yearIncrease1 = salaryPeriod.year?Extension.ToThaiNumber(
String(Extension.ToThaiYear(salaryPeriod.year - 2)), String(Extension.ToThaiYear(salaryPeriod.year - 2)),
); ):"";
const yearIncrease2 = Extension.ToThaiNumber( const yearIncrease2 = salaryPeriod.year?Extension.ToThaiNumber(
String(Extension.ToThaiYear(salaryPeriod.year - 1)), String(Extension.ToThaiYear(salaryPeriod.year - 1)),
); ):"";
const fifteenPercent_Group1 = const fifteenPercent_Group1 =
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
? "" ? ""
@ -1240,8 +1240,8 @@ export class ReportController extends Controller {
year: year, year: year,
yearIncrease1: yearIncrease1, yearIncrease1: yearIncrease1,
yearIncrease2: yearIncrease2, yearIncrease2: yearIncrease2,
yearIncreaseSlice: yearIncrease2.slice(-2), yearIncreaseSlice: yearIncrease2?yearIncrease2.slice(-2):"",
yearSlice: year.slice(-2), yearSlice: year?year.slice(-2):"",
point: fifteenPercent_Group1 + fifteenPoint_Group1, point: fifteenPercent_Group1 + fifteenPoint_Group1,
pointGroup2: fifteenPercent_Group2 + fifteenPoint_Group2, pointGroup2: fifteenPercent_Group2 + fifteenPoint_Group2,
root: salaryOrg?.root, root: salaryOrg?.root,
@ -1352,7 +1352,8 @@ export class ReportController extends Controller {
}, },
}); });
//รอบตุลา //รอบตุลา
} else if (salaryOrg && salaryPeriod.period === "OCT") { } else if (salaryPeriod.period === "OCT") {
// find period APR // find period APR
const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({ const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({
where: { where: {
@ -1412,7 +1413,7 @@ export class ReportController extends Controller {
where: { where: {
salaryPeriodId: salaryPeriodIncrease1_APR?.id, salaryPeriodId: salaryPeriodIncrease1_APR?.id,
// rootId: rootId, // rootId: rootId,
root: salaryOrg.root, root: salaryOrg?.root,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
@ -1425,13 +1426,12 @@ export class ReportController extends Controller {
where: { where: {
salaryPeriodId: salaryPeriodIncrease1_OCT?.id, salaryPeriodId: salaryPeriodIncrease1_OCT?.id,
// rootId: rootId, // rootId: rootId,
root: salaryOrg.root, root: salaryOrg?.root,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
}); });
} }
const salaryProfile1 = await this.salaryProfileRepository.find({ const salaryProfile1 = await this.salaryProfileRepository.find({
where: { where: {
salaryOrgId: In([salaryOrg1_APR?.id, salaryOrg1_OCT?.id]), salaryOrgId: In([salaryOrg1_APR?.id, salaryOrg1_OCT?.id]),
@ -1454,14 +1454,13 @@ export class ReportController extends Controller {
isActive: true, isActive: true,
}, },
}); });
let salaryOrg2_APR = null; let salaryOrg2_APR = null;
if (salaryPeriodIncrease2_APR) { if (salaryPeriodIncrease2_APR) {
salaryOrg2_APR = await this.salaryOrgRepository.findOne({ salaryOrg2_APR = await this.salaryOrgRepository.findOne({
where: { where: {
salaryPeriodId: salaryPeriodIncrease2_APR?.id, salaryPeriodId: salaryPeriodIncrease2_APR?.id,
// rootId: rootId, // rootId: rootId,
root: salaryOrg.root, root: salaryOrg?.root,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
@ -1474,13 +1473,12 @@ export class ReportController extends Controller {
where: { where: {
salaryPeriodId: salaryPeriodIncrease2_OCT?.id, salaryPeriodId: salaryPeriodIncrease2_OCT?.id,
// rootId: rootId, // rootId: rootId,
root: salaryOrg.root, root: salaryOrg?.root,
snapshot: "SNAP1", snapshot: "SNAP1",
group: convertGroup, group: convertGroup,
}, },
}); });
} }
const salaryProfile2 = await this.salaryProfileRepository.find({ const salaryProfile2 = await this.salaryProfileRepository.find({
//เอามาหาว่าทั้งปีได้เลื่อนขั้นไหม //เอามาหาว่าทั้งปีได้เลื่อนขั้นไหม
where: { where: {
@ -1488,14 +1486,13 @@ export class ReportController extends Controller {
type: Not(In(["NONE", "PENDING"])), type: Not(In(["NONE", "PENDING"])),
}, },
}); });
const year = salaryPeriod.year?Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))):"";
const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))); const yearIncrease1 = salaryPeriod.year?Extension.ToThaiNumber(
const yearIncrease1 = Extension.ToThaiNumber(
String(Extension.ToThaiYear(salaryPeriod.year - 2)), String(Extension.ToThaiYear(salaryPeriod.year - 2)),
); ):"";
const yearIncrease2 = Extension.ToThaiNumber( const yearIncrease2 = salaryPeriod.year?Extension.ToThaiNumber(
String(Extension.ToThaiYear(salaryPeriod.year - 1)), String(Extension.ToThaiYear(salaryPeriod.year - 1)),
); ):"";
const fifteenPercent = const fifteenPercent =
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
? "" ? ""
@ -1519,8 +1516,8 @@ export class ReportController extends Controller {
year: year, year: year,
yearIncrease1: yearIncrease1, yearIncrease1: yearIncrease1,
yearIncrease2: yearIncrease2, yearIncrease2: yearIncrease2,
yearIncreaseSlice: yearIncrease2.slice(-2), yearIncreaseSlice: yearIncrease2?yearIncrease2.slice(-2):"",
yearSlice: year.slice(-2), yearSlice: year?year.slice(-2):"",
point: fifteenPercent + fifteenPoint, point: fifteenPercent + fifteenPoint,
pointGroup2: fifteenPercent_Group2 + fifteenPoint_Group2, pointGroup2: fifteenPercent_Group2 + fifteenPoint_Group2,
root: salaryOrg?.root, root: salaryOrg?.root,