emp2-(04, 06, 08, 10, 12, 14, 16, 18, 19, 20, 22, 24)

This commit is contained in:
Bright 2024-03-28 17:21:32 +07:00
parent 7280da0b05
commit 4f1d2f6c62

View file

@ -3898,19 +3898,22 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
type: Not("NONE")
},
order: {
orgShortName: "ASC",
@ -3918,13 +3921,13 @@ export class ReportController extends Controller {
},
});
if (!_salaryPeriod) {
if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryPeriod.map((profile, index) => {
const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [
profile.child4,
profile.child3,
@ -3941,17 +3944,29 @@ export class ReportController extends Controller {
return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullName: fullName,
position:
profile.position +
"/" +
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
(profile.root == undefined && profile.root == null ? "" : profile.root),
posLevel: profile.posLevel,
posNumber:
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,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
template: "emp2-04",
reportName: "emp2-04",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
@ -4042,19 +4057,22 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
type: "NONE"
},
order: {
orgShortName: "ASC",
@ -4062,13 +4080,13 @@ export class ReportController extends Controller {
},
});
if (!_salaryPeriod) {
if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryPeriod.map((profile, index) => {
const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [
profile.child4,
profile.child3,
@ -4085,17 +4103,29 @@ export class ReportController extends Controller {
return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullName: fullName,
position:
profile.position +
"/" +
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
(profile.root == undefined && profile.root == null ? "" : profile.root),
posLevel: profile.posLevel,
posNumber:
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,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
template: "emp2-06",
reportName: "emp2-06",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
@ -4330,19 +4360,22 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
type: "NONE"
},
order: {
orgShortName: "ASC",
@ -4350,13 +4383,13 @@ export class ReportController extends Controller {
},
});
if (!_salaryPeriod) {
if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryPeriod.map((profile, index) => {
const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [
profile.child4,
profile.child3,
@ -4373,19 +4406,37 @@ export class ReportController extends Controller {
return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullName: fullName,
position:
profile.position +
"/" +
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
(profile.root == undefined && profile.root == null ? "" : profile.root),
posLevel: profile.posLevel,
posNumber:
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,
reason1: null, //เหตุผลที่ไม่ได้เลื่อนขั้น
reason2: null, //เหตุผลที่ไม่ได้เลื่อนขั้น
reason3: null, //เหตุผลที่ไม่ได้เลื่อนขั้น
score: null,
reason: null,
};
});
const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)));
const yearOld = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1)));
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
template: "emp2-10",
reportName: "emp2-10",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
year: year,
yearSlice: year.slice(-2),
yearOldSlice: yearOld.slice(-2),
agency: agency,
data: formattedData,
},
@ -4474,65 +4525,27 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
const salaryOrg = await this.salaryOrgEmployeeRepository.findOne({
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
},
order: {
orgShortName: "ASC",
posMasterNo: "ASC",
},
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
}
});
if (!_salaryPeriod) {
if (!salaryOrg) {
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,
posLevel: profile.posLevel,
posNumber:
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
data: formattedData,
},
template: "emp2-12",
reportName: "emp2-12",
});
}
/**
@ -4618,19 +4631,23 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
type: "NONE",
isRetired: true
},
order: {
orgShortName: "ASC",
@ -4638,13 +4655,13 @@ export class ReportController extends Controller {
},
});
if (!_salaryPeriod) {
if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryPeriod.map((profile, index) => {
const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [
profile.child4,
profile.child3,
@ -4661,17 +4678,28 @@ export class ReportController extends Controller {
return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullName: fullName,
position:
profile.position +
"/" +
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
(profile.root == undefined && profile.root == null ? "" : profile.root),
posLevel: profile.posLevel,
posNumber:
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,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
template: "emp2-14",
reportName: "emp2-14",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
@ -4762,65 +4790,27 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
const salaryOrg = await this.salaryOrgEmployeeRepository.findOne({
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
},
order: {
orgShortName: "ASC",
posMasterNo: "ASC",
},
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
}
});
if (!_salaryPeriod) {
if (!salaryOrg) {
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,
posLevel: profile.posLevel,
posNumber:
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
data: formattedData,
},
template: "emp2-16",
reportName: "emp2-16",
});
}
/**
@ -4906,19 +4896,23 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
type: "NONE",
isRetired: false
},
order: {
orgShortName: "ASC",
@ -4926,13 +4920,13 @@ export class ReportController extends Controller {
},
});
if (!_salaryPeriod) {
if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryPeriod.map((profile, index) => {
const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [
profile.child4,
profile.child3,
@ -4949,17 +4943,28 @@ export class ReportController extends Controller {
return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullName: fullName,
position:
profile.position +
"/" +
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
(profile.root == undefined && profile.root == null ? "" : profile.root),
posLevel: profile.posLevel,
posNumber:
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,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
template: "emp2-18",
reportName: "emp2-18",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
@ -4978,65 +4983,27 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
const salaryOrg = await this.salaryOrgEmployeeRepository.findOne({
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
},
order: {
orgShortName: "ASC",
posMasterNo: "ASC",
},
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
}
});
if (!_salaryPeriod) {
if (!salaryOrg) {
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,
posLevel: profile.posLevel,
posNumber:
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
data: formattedData,
},
template: "emp2-19",
reportName: "emp2-19",
});
}
/**
@ -5050,16 +5017,18 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
@ -5070,13 +5039,13 @@ export class ReportController extends Controller {
},
});
if (!_salaryPeriod) {
if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryPeriod.map((profile, index) => {
const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [
profile.child4,
profile.child3,
@ -5093,17 +5062,39 @@ export class ReportController extends Controller {
return {
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
fullName: fullName,
position:
profile.position +
"/" +
(profile.child4 == undefined && profile.child4 == null ? "" : profile.child4 + "/") +
(profile.child3 == undefined && profile.child3 == null ? "" : profile.child3 + "/") +
(profile.child2 == undefined && profile.child2 == null ? "" : profile.child2 + "/") +
(profile.child1 == undefined && profile.child1 == null ? "" : profile.child1 + "/") +
(profile.root == undefined && profile.root == null ? "" : profile.root),
posLevel: profile.posLevel,
posNumber:
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,
precentTwo:
profile.positionSalaryAmount == 0.02
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
: null, //ร้อยละ 2
precentFour:
profile.positionSalaryAmount == 0.04
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
: null, //ร้อยละ 4
precentSix:
profile.positionSalaryAmount == 0.06
? Extension.ToThaiNumber(profile.amountSpecial.toLocaleString())
: null, //ร้อยละ 6
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
template: "emp2-20",
reportName: "emp2-20",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
@ -5111,6 +5102,7 @@ export class ReportController extends Controller {
},
});
}
/**
* API 21-
*
@ -5194,65 +5186,27 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
const salaryOrg = await this.salaryOrgEmployeeRepository.findOne({
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
},
order: {
orgShortName: "ASC",
posMasterNo: "ASC",
},
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
}
});
if (!_salaryPeriod) {
if (!salaryOrg) {
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,
posLevel: profile.posLevel,
posNumber:
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
data: formattedData,
},
template: "emp2-22",
reportName: "emp2-22",
});
}
/**
@ -5338,65 +5292,27 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
period: "OCT",
isActive: true
},
});
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
const salaryOrg = await this.salaryOrgEmployeeRepository.findOne({
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
},
order: {
orgShortName: "ASC",
posMasterNo: "ASC",
},
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
}
});
if (!_salaryPeriod) {
if (!salaryOrg) {
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,
posLevel: profile.posLevel,
posNumber:
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
reason: null,
};
});
return new HttpSuccess({
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency,
data: formattedData,
},
template: "emp2-24",
reportName: "emp2-24",
});
}
/**