#1348 and checkpoint

This commit is contained in:
AdisakKanthawilang 2025-05-27 17:45:05 +07:00
parent 3def195a55
commit 26a224eeda

View file

@ -2963,16 +2963,23 @@ export class ReportController extends Controller {
if (!salaryPeriod) { if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
} }
let condition: any = {
salaryOrg: {
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
};
if(salaryPeriod.period == "APR"){
condition.type = In(["HAFT", "FULL"]);
}else{
condition.type = In(["HAFT", "FULL", "FULLHAFT"]);
}
const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({ const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"], relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: { where: condition,
type: In(["HAFT", "FULL", "FULLHAFT"]),
salaryOrg: {
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
},
order: { order: {
amount: "ASC", amount: "ASC",
rootOrder: "ASC", rootOrder: "ASC",
@ -3037,6 +3044,7 @@ export class ReportController extends Controller {
}, },
}); });
} }
/** /**
* API 05- ..1-1- * API 05- ..1-1-
* *
@ -7814,6 +7822,7 @@ export class ReportController extends Controller {
body: { body: {
type: string; type: string;
rootId: string; rootId: string;
isRetired?: boolean;
}, },
) { ) {
// let conditionGroup = ""; // let conditionGroup = "";
@ -7839,6 +7848,13 @@ export class ReportController extends Controller {
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" }, where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
}); });
let condition = "1=1";
let parameters = {};
if(body.isRetired === true){
condition = "salaryProfileEmployee.isRetired = :isRetired"
parameters = { isRetired: true }
}
let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee) let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee)
.createQueryBuilder("salaryProfileEmployee") .createQueryBuilder("salaryProfileEmployee")
// .andWhere("salaryProfileEmployee.rootId LIKE :rootId", { // .andWhere("salaryProfileEmployee.rootId LIKE :rootId", {
@ -7856,6 +7872,7 @@ export class ReportController extends Controller {
// ) // )
.andWhere("salaryProfileEmployee.status36 = :status", { status: "PENDING" }) .andWhere("salaryProfileEmployee.status36 = :status", { status: "PENDING" })
.andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId }) .andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId })
.andWhere(condition, parameters)
.select([ .select([
"salaryProfileEmployee.id", "salaryProfileEmployee.id",
"salaryProfileEmployee.orgShortName", "salaryProfileEmployee.orgShortName",
@ -7916,6 +7933,7 @@ export class ReportController extends Controller {
body: { body: {
type: string; type: string;
rootId: string; rootId: string;
isRetired?: boolean;
}, },
) { ) {
// let conditionGroup = ""; // let conditionGroup = "";
@ -7941,6 +7959,14 @@ export class ReportController extends Controller {
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" }, where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
}); });
let condition = "1=1";
let parameters = {};
if(body.isRetired === true){
condition = "salaryProfileEmployee.isRetired = :isRetired"
parameters = { isRetired: true }
}
let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee) let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee)
.createQueryBuilder("salaryProfileEmployee") .createQueryBuilder("salaryProfileEmployee")
// .andWhere("salaryProfileEmployee.rootId LIKE :rootId", { // .andWhere("salaryProfileEmployee.rootId LIKE :rootId", {
@ -7958,6 +7984,7 @@ export class ReportController extends Controller {
// ) // )
.andWhere("salaryProfileEmployee.status37 = :status", { status: "PENDING" }) .andWhere("salaryProfileEmployee.status37 = :status", { status: "PENDING" })
.andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId }) .andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId })
.andWhere(condition, parameters)
.select([ .select([
"salaryProfileEmployee.id", "salaryProfileEmployee.id",
"salaryProfileEmployee.orgShortName", "salaryProfileEmployee.orgShortName",
@ -9107,7 +9134,7 @@ export class ReportController extends Controller {
salary.salaryLevel && salary.salaryLevelNew salary.salaryLevel && salary.salaryLevelNew
? salary.salaryLevelNew ? salary.salaryLevelNew
: salary.salaryLevel, : salary.salaryLevel,
group: salary.group && salary.groupNew ? salary.groupNew : salary.group, group: salary.groupNew ?? salary.group,
}) })
.then(async () => { .then(async () => {
const before = null; const before = null;
@ -9198,7 +9225,7 @@ export class ReportController extends Controller {
salary.salaryLevel && salary.salaryLevelNew salary.salaryLevel && salary.salaryLevelNew
? salary.salaryLevelNew ? salary.salaryLevelNew
: salary.salaryLevel, : salary.salaryLevel,
group: salary.group && salary.groupNew ? salary.groupNew : salary.group, group: salary.groupNew ?? salary.group,
}) })
.then(async () => { .then(async () => {
const before = null; const before = null;