Merge branch 'develop' of github.com:Frappet/bma-ehr-salary into develop

This commit is contained in:
Kittapath 2024-03-20 18:06:14 +07:00
commit dc8b7f815a

View file

@ -912,6 +912,77 @@ export class ReportController extends Controller {
],
});
//รอบปีก่อนๆ
const salaryPeriodIncrease1_APR = await this.salaryPeriodRepository.findOne({
where: {
period: "APR",
year: salaryPeriod.year - 2,
isActive: true,
},
});
const salaryPeriodIncrease1_OCT = await this.salaryPeriodRepository.findOne({
where: {
period: "OCT",
year: salaryPeriod.year - 2,
isActive: true,
},
});
const salaryOrg1_APR = await this.salaryOrgRepository.findOne({
where: {
salaryPeriodId: salaryPeriodIncrease1_APR?.id,
rootId: rootId,
snapshot: "SNAP2",
}
});
const salaryOrg1_OCT = await this.salaryOrgRepository.findOne({
where: {
salaryPeriodId: salaryPeriodIncrease1_OCT?.id,
rootId: rootId,
snapshot: "SNAP2",
}
});
const salaryProfile1 = await this.salaryProfileRepository.find({
where: {
salaryOrgId: In([salaryOrg1_APR?.id, salaryOrg1_OCT?.id]),
type: "FULL",
}
});
//รอบปีก่อนหน้า
const salaryPeriodIncrease2_APR = await this.salaryPeriodRepository.findOne({
where: {
period: "APR",
year: salaryPeriod.year - 1,
isActive: true,
},
});
const salaryPeriodIncrease2_OCT = await this.salaryPeriodRepository.findOne({
where: {
period: "OCT",
year: salaryPeriod.year - 1,
isActive: true,
},
});
const salaryOrg2_APR = await this.salaryOrgRepository.findOne({
where: {
salaryPeriodId: salaryPeriodIncrease2_APR?.id,
rootId: rootId,
snapshot: "SNAP2",
}
});
const salaryOrg2_OCT = await this.salaryOrgRepository.findOne({
where: {
salaryPeriodId: salaryPeriodIncrease2_OCT?.id,
rootId: rootId,
snapshot: "SNAP2",
}
});
const salaryProfile2 = await this.salaryProfileRepository.find({
where: {
salaryOrgId: In([salaryOrg2_APR?.id, salaryOrg2_OCT?.id]),
type: "FULL",
}
});
return new HttpSuccess({
template: "gov1-03",
reportName: "gov1-03",
@ -937,8 +1008,16 @@ export class ReportController extends Controller {
item.amount == undefined || item.amount == null
? ""
: Extension.ToThaiNumber(String(item.amount.toLocaleString())),
salaryIncrease1: null, //การเลื่อนเงินเดือนปีก่อนๆหน้า
salaryIncrease2: null, //การเลื่อนเงินเดือนปีก่อนหน้า
salaryIncrease1: salaryProfile1.length > 0 ?
salaryProfile1
.filter(profile => profile.citizenId === item.citizenId)
.map(profile => profile.amount)
: "", //การเลื่อนเงินเดือนปีก่อนๆหน้า
salaryIncrease2: salaryProfile2.length > 0 ?
salaryProfile2
.filter(profile => profile.citizenId === item.citizenId)
.map(profile => profile.amount)
: "", //การเลื่อนเงินเดือนปีก่อนหน้า
score: null, //ผลการประเมินฯ
remark: null, //หมายเหตุ
})),