fix report
This commit is contained in:
parent
449317de92
commit
cc38e27085
1 changed files with 99 additions and 211 deletions
|
|
@ -1056,8 +1056,8 @@ export class ReportController extends Controller {
|
|||
* @param {string} rootId Guid, *Id Root
|
||||
* @param {string} salaryPeriodId Guid, *Id Period
|
||||
*/
|
||||
@Get("gov-03/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReport3(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
@Get("gov-03/{rootId}/{salaryPeriodId}/{group}")
|
||||
async SalaryReport3(@Path() rootId: string, @Path() salaryPeriodId: string, @Path() group: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
|
|
@ -1068,39 +1068,23 @@ export class ReportController extends Controller {
|
|||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
|
||||
}
|
||||
|
||||
const salaryOrg_Group1 = await this.salaryOrgRepository.findOne({
|
||||
const convertGroup = group.toUpperCase();
|
||||
const salaryOrg = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
},
|
||||
});
|
||||
const salaryOrg_Group2 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
|
||||
if (salaryPeriod.period === "APR") {
|
||||
let salaryProfileGroup1: any;
|
||||
let salaryProfileGroup2: any;
|
||||
if (salaryOrg_Group1) {
|
||||
if (salaryOrg) {
|
||||
salaryProfileGroup1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg_Group1?.id,
|
||||
type: "FULL", //หนึ่งขั้น
|
||||
},
|
||||
});
|
||||
}
|
||||
if (salaryOrg_Group2) {
|
||||
salaryProfileGroup2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg_Group2?.id,
|
||||
salaryOrgId: salaryOrg?.id,
|
||||
type: "FULL", //หนึ่งขั้น
|
||||
},
|
||||
});
|
||||
|
|
@ -1120,50 +1104,31 @@ export class ReportController extends Controller {
|
|||
isActive: true,
|
||||
},
|
||||
});
|
||||
const salaryOrg1_APR_Group1 = await this.salaryOrgRepository.findOne({
|
||||
const salaryOrg1_APR = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg1_APR_Group2 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryOrg1_OCT_Group1 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryOrg1_OCT = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg1_OCT_Group2 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryProfile1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryProfile1_Group1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg1_APR_Group1?.id, salaryOrg1_OCT_Group1?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
const salaryProfile1_Group2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg1_APR_Group2?.id, salaryOrg1_OCT_Group2?.id]),
|
||||
salaryOrgId: In([salaryOrg1_APR?.id, salaryOrg1_OCT?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//รอบปีก่อนหน้า
|
||||
const salaryPeriodIncrease2_APR = await this.salaryPeriodRepository.findOne({
|
||||
|
|
@ -1180,50 +1145,31 @@ export class ReportController extends Controller {
|
|||
isActive: true,
|
||||
},
|
||||
});
|
||||
const salaryOrg2_APR_Group1 = await this.salaryOrgRepository.findOne({
|
||||
const salaryOrg2_APR = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg2_APR_Group2 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryOrg2_OCT_GROUP1 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryOrg2_OCT = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg2_OCT_GROUP2 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryProfile2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryProfile2_Group1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg2_APR_Group1?.id, salaryOrg2_OCT_GROUP1?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
const salaryProfile2_Group2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg2_APR_Group2?.id, salaryOrg2_OCT_GROUP2?.id]),
|
||||
salaryOrgId: In([salaryOrg2_APR?.id, salaryOrg2_OCT?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
|
||||
const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)));
|
||||
const yearIncrease1 = Extension.ToThaiNumber(
|
||||
String(Extension.ToThaiYear(salaryPeriod.year - 2)),
|
||||
|
|
@ -1232,21 +1178,21 @@ export class ReportController extends Controller {
|
|||
String(Extension.ToThaiYear(salaryPeriod.year - 1)),
|
||||
);
|
||||
const fifteenPercent_Group1 =
|
||||
salaryOrg_Group1?.fifteenPercent == undefined || salaryOrg_Group1?.fifteenPercent == null
|
||||
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
|
||||
? "๐"
|
||||
: Extension.ToThaiNumber(String(salaryOrg_Group1?.fifteenPercent));
|
||||
: Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint_Group1 =
|
||||
salaryOrg_Group1?.fifteenPoint == undefined || salaryOrg_Group1?.fifteenPoint == null
|
||||
salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null
|
||||
? ".๐๐"
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg_Group1?.fifteenPoint));
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
const fifteenPercent_Group2 =
|
||||
salaryOrg_Group2?.fifteenPercent == undefined || salaryOrg_Group2?.fifteenPercent == null
|
||||
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
|
||||
? "๐"
|
||||
: Extension.ToThaiNumber(String(salaryOrg_Group2?.fifteenPercent));
|
||||
: Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint_Group2 =
|
||||
salaryOrg_Group2?.fifteenPoint == undefined || salaryOrg_Group2?.fifteenPoint == null
|
||||
salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null
|
||||
? ".๐๐"
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg_Group2?.fifteenPoint));
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
return new HttpSuccess({
|
||||
template: "gov1-03",
|
||||
reportName: "gov1-03",
|
||||
|
|
@ -1258,7 +1204,7 @@ export class ReportController extends Controller {
|
|||
yearSlice: year.slice(-2),
|
||||
point: fifteenPercent_Group1 + fifteenPoint_Group1,
|
||||
pointGroup2: fifteenPercent_Group2 + fifteenPoint_Group2,
|
||||
root: salaryOrg_Group1?.root,
|
||||
root: salaryOrg?.root,
|
||||
profile: salaryProfileGroup1
|
||||
? salaryProfileGroup1.map((item: any, index: any) => ({
|
||||
no: Extension.ToThaiNumber(String(index + 1)),
|
||||
|
|
@ -1279,9 +1225,9 @@ export class ReportController extends Controller {
|
|||
? "๐"
|
||||
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
|
||||
salaryIncrease1:
|
||||
salaryProfile1_Group1.length > 0
|
||||
salaryProfile1.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile1_Group1
|
||||
const filteredType = salaryProfile1
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1293,9 +1239,9 @@ export class ReportController extends Controller {
|
|||
})()
|
||||
: null, //การเลื่อนเงินเดือนปีก่อนๆหน้า
|
||||
salaryIncrease2:
|
||||
salaryProfile2_Group1.length > 0
|
||||
salaryProfile2.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile2_Group1
|
||||
const filteredType = salaryProfile2
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1330,9 +1276,9 @@ export class ReportController extends Controller {
|
|||
? "๐"
|
||||
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
|
||||
salaryIncrease1:
|
||||
salaryProfile1_Group2.length > 0
|
||||
salaryProfile1.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile1_Group2
|
||||
const filteredType = salaryProfile1
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1344,9 +1290,9 @@ export class ReportController extends Controller {
|
|||
})()
|
||||
: null, //การเลื่อนเงินเดือนปีก่อนๆหน้า
|
||||
salaryIncrease2:
|
||||
salaryProfile2_Group2.length > 0
|
||||
salaryProfile2.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile2_Group2
|
||||
const filteredType = salaryProfile2
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1363,7 +1309,7 @@ export class ReportController extends Controller {
|
|||
: null,
|
||||
},
|
||||
});
|
||||
} else if (salaryOrg_Group1 && salaryPeriod.period === "OCT") {
|
||||
} else if (salaryOrg && salaryPeriod.period === "OCT") {
|
||||
// find period APR
|
||||
const salaryPeriod_APR = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
|
|
@ -1372,45 +1318,33 @@ export class ReportController extends Controller {
|
|||
isActive: true,
|
||||
},
|
||||
});
|
||||
const salaryOrg_APR_Group1 = await this.salaryOrgRepository.findOne({
|
||||
const salaryOrg_APR = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriod_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg_APR_Group2 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryProfile_APR = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriod_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryProfile_APR_Group1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg_APR_Group1?.id,
|
||||
// type: In(["HAFT", "FULL"]),
|
||||
},
|
||||
});
|
||||
const salaryProfile_APR_Group2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg_APR_Group2?.id,
|
||||
salaryOrgId: salaryOrg_APR?.id,
|
||||
// type: In(["HAFT", "FULL"]),
|
||||
},
|
||||
});
|
||||
|
||||
//end period APR
|
||||
|
||||
const salaryProfileGroup1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg_Group1?.id,
|
||||
salaryOrgId: salaryOrg?.id,
|
||||
type: In(["FULLHAFT", "FULL"]),
|
||||
},
|
||||
});
|
||||
const salaryProfileGroup2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: salaryOrg_Group2?.id,
|
||||
salaryOrgId: salaryOrg?.id,
|
||||
type: In(["FULLHAFT", "FULL"]),
|
||||
},
|
||||
});
|
||||
|
|
@ -1430,50 +1364,31 @@ export class ReportController extends Controller {
|
|||
isActive: true,
|
||||
},
|
||||
});
|
||||
const salaryOrg1_APR_Group1 = await this.salaryOrgRepository.findOne({
|
||||
const salaryOrg1_APR = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg1_APR_Group2 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryOrg1_OCT_Group1 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryOrg1_OCT = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg1_OCT_Group2 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryProfile1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease1_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryProfile1_Group1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg1_APR_Group1?.id, salaryOrg1_OCT_Group1?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
const salaryProfile1_Group2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg1_APR_Group2?.id, salaryOrg1_OCT_Group2?.id]),
|
||||
salaryOrgId: In([salaryOrg1_APR?.id, salaryOrg1_OCT?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
//รอบปีก่อนหน้า
|
||||
const salaryPeriodIncrease2_APR = await this.salaryPeriodRepository.findOne({
|
||||
|
|
@ -1490,50 +1405,31 @@ export class ReportController extends Controller {
|
|||
isActive: true,
|
||||
},
|
||||
});
|
||||
const salaryOrg2_APR_Group1 = await this.salaryOrgRepository.findOne({
|
||||
const salaryOrg2_APR = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg2_APR_Group2 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_APR?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryOrg2_OCT_GROUP1 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryOrg2_OCT = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP1",
|
||||
group: convertGroup,
|
||||
},
|
||||
});
|
||||
const salaryOrg2_OCT_GROUP2 = await this.salaryOrgRepository.findOne({
|
||||
|
||||
const salaryProfile2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodIncrease2_OCT?.id,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP1",
|
||||
group: "GROUP2",
|
||||
},
|
||||
});
|
||||
const salaryProfile2_Group1 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg2_APR_Group1?.id, salaryOrg2_OCT_GROUP1?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
const salaryProfile2_Group2 = await this.salaryProfileRepository.find({
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrg2_APR_Group2?.id, salaryOrg2_OCT_GROUP2?.id]),
|
||||
salaryOrgId: In([salaryOrg2_APR?.id, salaryOrg2_OCT?.id]),
|
||||
// type: "FULL",
|
||||
},
|
||||
});
|
||||
|
||||
const year = Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year)));
|
||||
const yearIncrease1 = Extension.ToThaiNumber(
|
||||
String(Extension.ToThaiYear(salaryPeriod.year - 2)),
|
||||
|
|
@ -1542,21 +1438,21 @@ export class ReportController extends Controller {
|
|||
String(Extension.ToThaiYear(salaryPeriod.year - 1)),
|
||||
);
|
||||
const fifteenPercent =
|
||||
salaryOrg_Group1?.fifteenPercent == undefined || salaryOrg_Group1?.fifteenPercent == null
|
||||
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
|
||||
? "๐"
|
||||
: Extension.ToThaiNumber(String(salaryOrg_Group1?.fifteenPercent));
|
||||
: Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint =
|
||||
salaryOrg_Group1?.fifteenPoint == undefined || salaryOrg_Group1?.fifteenPoint == null
|
||||
salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null
|
||||
? ".๐๐"
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg_Group1?.fifteenPoint));
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
const fifteenPercent_Group2 =
|
||||
salaryOrg_Group2?.fifteenPercent == undefined || salaryOrg_Group2?.fifteenPercent == null
|
||||
salaryOrg?.fifteenPercent == undefined || salaryOrg?.fifteenPercent == null
|
||||
? "๐"
|
||||
: Extension.ToThaiNumber(String(salaryOrg_Group2?.fifteenPercent));
|
||||
: Extension.ToThaiNumber(String(salaryOrg?.fifteenPercent));
|
||||
const fifteenPoint_Group2 =
|
||||
salaryOrg_Group2?.fifteenPoint == undefined || salaryOrg_Group2?.fifteenPoint == null
|
||||
salaryOrg?.fifteenPoint == undefined || salaryOrg?.fifteenPoint == null
|
||||
? ".๐๐"
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg_Group2?.fifteenPoint));
|
||||
: "." + Extension.ToThaiNumber(String(salaryOrg?.fifteenPoint));
|
||||
return new HttpSuccess({
|
||||
template: "gov2-03",
|
||||
reportName: "gov2-03",
|
||||
|
|
@ -1568,7 +1464,7 @@ export class ReportController extends Controller {
|
|||
yearSlice: year.slice(-2),
|
||||
point: fifteenPercent + fifteenPoint,
|
||||
pointGroup2: fifteenPercent_Group2 + fifteenPoint_Group2,
|
||||
root: salaryOrg_Group1?.root,
|
||||
root: salaryOrg?.root,
|
||||
profile: salaryProfileGroup1
|
||||
? salaryProfileGroup1.map((item: any, index: any) => ({
|
||||
no: Extension.ToThaiNumber(String(index + 1)),
|
||||
|
|
@ -1592,9 +1488,9 @@ export class ReportController extends Controller {
|
|||
? "๐"
|
||||
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
|
||||
salaryIncrease1:
|
||||
salaryProfile1_Group1.length > 0
|
||||
salaryProfile1.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile1_Group1
|
||||
const filteredType = salaryProfile1
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1608,9 +1504,9 @@ export class ReportController extends Controller {
|
|||
})()
|
||||
: null, //การเลื่อนเงินเดือนปีก่อนๆหน้า
|
||||
salaryIncrease2:
|
||||
salaryProfile2_Group1.length > 0
|
||||
salaryProfile2.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile2_Group1
|
||||
const filteredType = salaryProfile2
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1624,9 +1520,9 @@ export class ReportController extends Controller {
|
|||
})()
|
||||
: null, //การเลื่อนเงินเดือนปีก่อนหน้า
|
||||
salaryIncreaseAPR:
|
||||
salaryProfile_APR_Group1.length > 0
|
||||
salaryProfile_APR.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile_APR_Group1
|
||||
const filteredType = salaryProfile_APR
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1672,9 +1568,9 @@ export class ReportController extends Controller {
|
|||
? "๐"
|
||||
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
|
||||
salaryIncrease1:
|
||||
salaryProfile1_Group2.length > 0
|
||||
salaryProfile1.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile1_Group2
|
||||
const filteredType = salaryProfile1
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1688,9 +1584,9 @@ export class ReportController extends Controller {
|
|||
})()
|
||||
: null, //การเลื่อนเงินเดือนปีก่อนๆหน้า
|
||||
salaryIncrease2:
|
||||
salaryProfile2_Group2.length > 0
|
||||
salaryProfile2.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile2_Group2
|
||||
const filteredType = salaryProfile2
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -1704,9 +1600,9 @@ export class ReportController extends Controller {
|
|||
})()
|
||||
: null, //การเลื่อนเงินเดือนปีก่อนหน้า
|
||||
salaryIncreaseAPR:
|
||||
salaryProfile_APR_Group2.length > 0
|
||||
salaryProfile_APR.length > 0
|
||||
? (() => {
|
||||
const filteredType = salaryProfile_APR_Group2
|
||||
const filteredType = salaryProfile_APR
|
||||
.filter((profile) => profile.citizenId === item.citizenId)
|
||||
.map((profile) => profile.type);
|
||||
const Type = filteredType[0];
|
||||
|
|
@ -2365,8 +2261,8 @@ export class ReportController extends Controller {
|
|||
* @param {string} rootId Guid, *Id Root
|
||||
* @param {string} salaryPeriodId Guid, *Id Period
|
||||
*/
|
||||
@Get("gov-08/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReport8(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
@Get("gov-08/{rootId}/{salaryPeriodId}/{group}")
|
||||
async SalaryReport8(@Path() rootId: string, @Path() salaryPeriodId: string, @Path() group: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
|
|
@ -2378,30 +2274,22 @@ export class ReportController extends Controller {
|
|||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
|
||||
}
|
||||
|
||||
const salaryOrgGroup1 = await this.salaryOrgRepository.findOne({
|
||||
const convertGroup = group.toUpperCase();
|
||||
const salaryOrg = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP2",
|
||||
group: "GROUP1",
|
||||
},
|
||||
relations: ["salaryProfiles"],
|
||||
});
|
||||
const salaryOrgGroup2 = await this.salaryOrgRepository.findOne({
|
||||
where: {
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
rootId: rootId,
|
||||
snapshot: "SNAP2",
|
||||
group: "GROUP2",
|
||||
group: convertGroup,
|
||||
},
|
||||
relations: ["salaryProfiles"],
|
||||
});
|
||||
|
||||
|
||||
const salaryProfileSpecial = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg"],
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrgGroup1?.id, salaryOrgGroup2?.id]),
|
||||
salaryOrgId: In([salaryOrg?.id]),
|
||||
amountSpecial: MoreThan(1),
|
||||
},
|
||||
select: [
|
||||
|
|
@ -2429,7 +2317,7 @@ export class ReportController extends Controller {
|
|||
const salaryProfileNoAmount = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg"],
|
||||
where: {
|
||||
salaryOrgId: In([salaryOrgGroup1?.id, salaryOrgGroup2?.id]),
|
||||
salaryOrgId: In([salaryOrg?.id]),
|
||||
// amountUse: IsNull() || 0,
|
||||
// positionSalaryAmount: IsNull() || 0,
|
||||
type: "NONE",
|
||||
|
|
@ -2516,7 +2404,7 @@ export class ReportController extends Controller {
|
|||
: Extension.ToThaiNumber(
|
||||
Extension.ToThaiFullDate(new Date(`${salaryPeriod.year}-10-01`)),
|
||||
),
|
||||
agency: salaryOrgGroup1?.root,
|
||||
agency: salaryOrg?.root,
|
||||
profileSpecial: profileSpecial,
|
||||
profileNoAmount: profileNoAmount,
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue