This commit is contained in:
AdisakKanthawilang 2024-03-29 17:09:40 +07:00
parent 331c3ef2ac
commit 9bfa2dd8c5

View file

@ -35,6 +35,7 @@ import {
import { EmployeePosLevel } from "../entities/EmployeePosLevel";
import { SalaryOrgEmployee } from "../entities/SalaryOrgEmployee";
import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee";
import { log } from "console";
@Route("api/v1/salary/report/tum")
@Tags("Tum")
@Security("bearerAuth")
@ -407,10 +408,25 @@ import {
if (!salaryProfileCurrentOCT) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root;
const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root;
const formattedData = salaryProfileCurrentOCT.map((profile, index) => {
//งวดปีก่อนหน้า
const matchedAPRProfileOld = salaryProfilePerviousAPR.find(aprProfile_old => aprProfile_old.citizenId === profile.citizenId);
const matchedOCTProfileOld = salaryProfilePerviousOCT.find(octProfile_old => octProfile_old.citizenId === profile.citizenId);
const amountUseAPR_Old = matchedAPRProfileOld ? matchedAPRProfileOld.amountUse : 0;
const amountUseOCT_Old = matchedOCTProfileOld ? matchedOCTProfileOld.amountUse : 0;
const amountUseOld = amountUseAPR_Old + amountUseOCT_Old;
//งวดปีปัจจุบัน
const matchedAPRProfile = salaryProfileCurrentAPR.find(aprProfile => aprProfile.citizenId === profile.citizenId);
const matchedOCTProfile = salaryProfileCurrentOCT.find(octProfile => octProfile.citizenId === profile.citizenId);
const amountUseAPR = matchedAPRProfile ? matchedAPRProfile.amountUse : 0;
const amountUseOCT = matchedOCTProfile ? matchedOCTProfile.amountUse : 0;
const amountUse = amountUseAPR + amountUseOCT;
const fullNameParts = [
profile.child4,
profile.child3,
@ -433,8 +449,8 @@ import {
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,
amountUseOld: null,
amountUse: null,
amountUseOld: amountUseOld ? Extension.ToThaiNumber(amountUseOld.toLocaleString()) : null,
amountUse: amountUse ? Extension.ToThaiNumber(amountUse.toLocaleString()) : null,
reason: null,
};
});