Merge branch 'develop' into adiDev
This commit is contained in:
commit
7a32ce6d81
5 changed files with 279 additions and 317 deletions
|
|
@ -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",
|
||||
});
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -123,38 +123,68 @@ export class SalaryPeriodController extends Controller {
|
|||
const _salaryOrg = await this.salaryOrgRepository.find({
|
||||
relations: ["salaryPeriod", "salaryProfiles"],
|
||||
where: {
|
||||
group: Like(`%${body.group}%`),
|
||||
group: Like(
|
||||
`%${body.group.trim().toUpperCase() == "GROUP1" ? "GROUP1" : body.group.trim().toUpperCase() == "GROUP2" ? "GROUP2" : "GROUP1"}%`,
|
||||
),
|
||||
snapshot: body.snapshot.trim().toUpperCase(),
|
||||
salaryPeriod: { period: body.period.trim().toUpperCase(), year: body.year },
|
||||
salaryPeriod: { id: body.period },
|
||||
},
|
||||
});
|
||||
|
||||
const salaryOrg: any[] = [];
|
||||
await Promise.all(
|
||||
_salaryOrg.map(async (item) => {
|
||||
const fullNameParts = [
|
||||
item == null || item.salaryProfiles.length == 0 || item.salaryProfiles[0].root == null
|
||||
? null
|
||||
: item.salaryProfiles[0].root,
|
||||
];
|
||||
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("/");
|
||||
const _salaryOrgGROUP2 = await this.salaryOrgRepository.findOne({
|
||||
relations: ["salaryPeriod", "salaryProfiles"],
|
||||
where: {
|
||||
group: Like(
|
||||
`%${body.group.trim().toUpperCase() != "GROUP1" && body.group.trim().toUpperCase() != "GROUP2" ? "GROUP2" : "ZXCASD"}%`,
|
||||
),
|
||||
rootId: item.rootId,
|
||||
snapshot: body.snapshot.trim().toUpperCase(),
|
||||
salaryPeriod: { id: body.period },
|
||||
},
|
||||
});
|
||||
const sum = item.salaryProfiles.reduce((accumulator, object) => {
|
||||
return accumulator + object.amountSpecial;
|
||||
}, 0);
|
||||
const sumGROUP2 =
|
||||
_salaryOrgGROUP2 == null
|
||||
? 0
|
||||
: _salaryOrgGROUP2.salaryProfiles.reduce((accumulator, object) => {
|
||||
return accumulator + object.amountSpecial;
|
||||
}, 0);
|
||||
const data = {
|
||||
org: org,
|
||||
group: item.group,
|
||||
total: item.total,
|
||||
fifteenPercent: item.fifteenPercent,
|
||||
chosen: item.quantityUsed,
|
||||
remaining: item.remainQuota,
|
||||
currentAmount: item.currentAmount,
|
||||
sixPercentAmount: item.sixPercentAmount,
|
||||
spentAmount: item.spentAmount,
|
||||
sixPercentSpentAmount: item.sixPercentAmount - item.spentAmount,
|
||||
useAmount: item.useAmount,
|
||||
remainingAmount: item.remainingAmount,
|
||||
totalAmountSpecial: sum,
|
||||
totalBackup: item.salaryProfiles.filter((x) => x.isReserve == true).length,
|
||||
org: item.root,
|
||||
total: item.total + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.total),
|
||||
fifteenPercent:
|
||||
item.fifteenPercent + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.fifteenPercent),
|
||||
chosen:
|
||||
item.quantityUsed + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.quantityUsed),
|
||||
remaining:
|
||||
item.remainQuota + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.remainQuota),
|
||||
currentAmount:
|
||||
item.currentAmount + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.currentAmount),
|
||||
sixPercentAmount:
|
||||
item.sixPercentAmount +
|
||||
(_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.sixPercentAmount),
|
||||
spentAmount:
|
||||
item.spentAmount + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.spentAmount),
|
||||
sixPercentSpentAmount:
|
||||
item.sixPercentAmount -
|
||||
item.spentAmount +
|
||||
(_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.sixPercentAmount) -
|
||||
(_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.spentAmount),
|
||||
useAmount: item.useAmount + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.useAmount),
|
||||
remainingAmount:
|
||||
item.remainingAmount +
|
||||
(_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.remainingAmount),
|
||||
totalAmountSpecial: sum + sumGROUP2,
|
||||
totalBackup:
|
||||
item.salaryProfiles.filter((x) => x.isReserve == true).length +
|
||||
(_salaryOrgGROUP2 == null
|
||||
? 0
|
||||
: _salaryOrgGROUP2.salaryProfiles.filter((x) => x.isReserve == true).length),
|
||||
};
|
||||
salaryOrg.push(data);
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -124,26 +124,21 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
const _salaryOrg = await this.salaryOrgRepository.find({
|
||||
relations: ["salaryPeriod", "salaryProfiles"],
|
||||
where: {
|
||||
group: Like(`%${body.group}%`),
|
||||
group: Like(
|
||||
`%${body.group.trim().toUpperCase() == "GROUP1" ? "GROUP1" : body.group.trim().toUpperCase() == "GROUP2" ? "GROUP2" : "GROUP1"}%`,
|
||||
),
|
||||
snapshot: body.snapshot.trim().toUpperCase(),
|
||||
salaryPeriod: { period: body.period.trim().toUpperCase(), year: body.year },
|
||||
salaryPeriod: { id: body.period },
|
||||
},
|
||||
});
|
||||
const salaryOrg: any[] = [];
|
||||
await Promise.all(
|
||||
_salaryOrg.map(async (item) => {
|
||||
const fullNameParts = [
|
||||
item == null || item.salaryProfiles.length == 0 || item.salaryProfiles[0].root == null
|
||||
? null
|
||||
: item.salaryProfiles[0].root,
|
||||
];
|
||||
const org = fullNameParts.filter((part) => part !== undefined && part !== null).join("/");
|
||||
const sum = item.salaryProfiles.reduce((accumulator, object) => {
|
||||
return accumulator + object.amountSpecial;
|
||||
}, 0);
|
||||
const data = {
|
||||
org: org,
|
||||
group: item.group,
|
||||
org: item.root,
|
||||
total: item.total,
|
||||
fifteenPercent: item.fifteenPercent,
|
||||
chosen: item.quantityUsed,
|
||||
|
|
|
|||
|
|
@ -22,6 +22,13 @@ export class SalaryOrgEmployee extends EntityBase {
|
|||
})
|
||||
rootId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "orgRoot",
|
||||
length: 255,
|
||||
})
|
||||
root: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "คีย์นอก(FK)ของตาราง orgRevision",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableSalaryprofileAddRoot1711596443220 implements MigrationInterface {
|
||||
name = 'UpdateTableSalaryprofileAddRoot1711596443220'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`salaryOrg\` ADD \`root\` varchar(255) NULL COMMENT 'orgRoot'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`salaryOrg\` DROP COLUMN \`root\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue