Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-04-10 11:17:10 +07:00
commit 3b32e38e53

View file

@ -215,9 +215,9 @@ export class ReportController extends Controller {
}
/**
* API
* API 1 () 1 ()
*
* @summary
* @summary 1 () 1 ()
*
*/
@Get("gov-01/{rootId}/{salaryPeriodId}")
@ -230,21 +230,125 @@ export class ReportController extends Controller {
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
const _salaryPeriod = await this.salaryProfileRepository.find({
// const _salaryPeriod = await this.salaryProfileRepository.find({
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
// where: {
// salaryOrg: {
// snapshot: "SNAP1",
// rootId: rootId,
// salaryPeriodId: salaryPeriodId,
// },
// },
// order: {
// orgShortName: "ASC",
// posMasterNo: "ASC",
// },
// });
const _salaryPeriod1 = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
group: "GROUP1",
},
type: "HAFT"
},
order: {
orgShortName: "ASC",
posMasterNo: "ASC",
citizenId: "ASC",
isReserve: "ASC",
},
});
const _salaryPeriod2 = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
group: "GROUP1",
},
type: "FULL"
},
order: {
citizenId: "ASC",
isReserve: "ASC",
},
});
const _salaryPeriod3 = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
group: "GROUP1",
},
type: "NONE"
},
order: {
citizenId: "ASC",
isReserve: "ASC",
},
});
const _salaryPeriod4 = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
group: "GROUP2",
},
type: "HAFT"
},
order: {
citizenId: "ASC",
isReserve: "ASC",
},
});
const _salaryPeriod5 = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
group: "GROUP2",
},
type: "FULL"
},
order: {
citizenId: "ASC",
isReserve: "ASC",
},
});
const _salaryPeriod6 = await this.salaryProfileRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP1",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
group: "GROUP2",
},
type: "NONE"
},
order: {
citizenId: "ASC",
isReserve: "ASC",
},
});
const _salaryPeriod = _salaryPeriod1.concat(
_salaryPeriod2,
_salaryPeriod3,
_salaryPeriod4,
_salaryPeriod5,
_salaryPeriod6
);
if (!_salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
@ -452,11 +556,12 @@ export class ReportController extends Controller {
template: "gov1-02",
reportName: "gov1-02",
data: {
date: Extension.ToThaiNumber(
Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)),
),
// date: Extension.ToThaiNumber(
// Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)),
// ),
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),
yearSlice: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)).slice(-2)),
// dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),
agency: agency,
data1: formattedData1,
data2: formattedData2,
@ -921,11 +1026,12 @@ export class ReportController extends Controller {
template: "gov2-02",
reportName: "gov2-02",
data: {
date: Extension.ToThaiNumber(
Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)),
),
// date: Extension.ToThaiNumber(
// Extension.ToThaiFullDate2(new Date(`${salaryPeriod.year}-03-01`)),
// ),
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),
yearSlice: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)).slice(-2)),
// dateNow: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),
agency: agency,
data1: formattedData1,
data2: formattedData2,
@ -1970,9 +2076,9 @@ export class ReportController extends Controller {
// }
/**
* API
* API
*
* @summary
* @summary
*
* @param {string} rootId Guid, *Id Root
* @param {string} salaryPeriodId Guid, *Id Period
@ -1982,6 +2088,7 @@ export class ReportController extends Controller {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
isActive: true
},
});
@ -1996,7 +2103,7 @@ export class ReportController extends Controller {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
salaryPeriod: {
period: "APR",
period: salaryPeriod.period === "APR" ? "APR" : "OCT",
},
},
},
@ -2046,18 +2153,22 @@ export class ReportController extends Controller {
`${item.type === "FULL" ? "หนึ่งขั้น" : ""}\n` +
`${item.type === "FULLHAFT" ? "หนึ่งขั้นครึ่ง" : ""}\n` +
`${item.amountSpecial > 0 ? "ได้รับค่าตอบแทนพิเศษ\n" : ""}` +
`${item.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`, // ห
`${item.isNext === true ? "(ได้รับเงินเดือนสูงกว่าขั้นสูงฯ)" : ""}`,
}));
return new HttpSuccess({
template: "gov1-07",
reportName: "gov1-07",
template: salaryPeriod.period === "APR" ? "gov1-07" : "gov2-08",
reportName: salaryPeriod.period === "APR" ? "gov1-07" : "gov2-08",
data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
yearOld: Extension.ToThaiNumber((salaryPeriod.year + 542).toString()),
date: Extension.ToThaiNumber(
Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-04-01`)),
),
date: salaryPeriod.period === "APR"
? Extension.ToThaiNumber(
Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-04-01`)),
)
: Extension.ToThaiNumber(
Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-10-01`)),
),
agency: root,
data: formattedData,
},