update
This commit is contained in:
parent
f1c134cb09
commit
0b38e17a0d
1 changed files with 180 additions and 16 deletions
|
|
@ -7847,7 +7847,7 @@ export class ReportController extends Controller {
|
|||
body: {
|
||||
type: string;
|
||||
rootId: string;
|
||||
isRetired?: boolean;
|
||||
// isRetired?: boolean;
|
||||
},
|
||||
) {
|
||||
// let conditionGroup = "";
|
||||
|
|
@ -7873,13 +7873,13 @@ export class ReportController extends Controller {
|
|||
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||
});
|
||||
|
||||
let condition = "1=1";
|
||||
let parameters = {};
|
||||
// let condition = "1=1";
|
||||
// let parameters = {};
|
||||
|
||||
if(body.isRetired === true){
|
||||
condition = "salaryProfileEmployee.isRetired = :isRetired"
|
||||
parameters = { isRetired: true }
|
||||
}
|
||||
// if(body.isRetired === true){
|
||||
// condition = "salaryProfileEmployee.isRetired = :isRetired"
|
||||
// parameters = { isRetired: true }
|
||||
// }
|
||||
let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee)
|
||||
.createQueryBuilder("salaryProfileEmployee")
|
||||
// .andWhere("salaryProfileEmployee.rootId LIKE :rootId", {
|
||||
|
|
@ -7897,7 +7897,7 @@ export class ReportController extends Controller {
|
|||
// )
|
||||
.andWhere("salaryProfileEmployee.status36 = :status", { status: "PENDING" })
|
||||
.andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId })
|
||||
.andWhere(condition, parameters)
|
||||
// .andWhere(condition, parameters)
|
||||
.select([
|
||||
"salaryProfileEmployee.id",
|
||||
"salaryProfileEmployee.orgShortName",
|
||||
|
|
@ -7958,7 +7958,7 @@ export class ReportController extends Controller {
|
|||
body: {
|
||||
type: string;
|
||||
rootId: string;
|
||||
isRetired?: boolean;
|
||||
// isRetired?: boolean;
|
||||
},
|
||||
) {
|
||||
// let conditionGroup = "";
|
||||
|
|
@ -7984,13 +7984,13 @@ export class ReportController extends Controller {
|
|||
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||
});
|
||||
|
||||
let condition = "1=1";
|
||||
let parameters = {};
|
||||
// let condition = "1=1";
|
||||
// let parameters = {};
|
||||
|
||||
if(body.isRetired === true){
|
||||
condition = "salaryProfileEmployee.isRetired = :isRetired"
|
||||
parameters = { isRetired: true }
|
||||
}
|
||||
// if(body.isRetired === true){
|
||||
// condition = "salaryProfileEmployee.isRetired = :isRetired"
|
||||
// parameters = { isRetired: true }
|
||||
// }
|
||||
|
||||
let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee)
|
||||
.createQueryBuilder("salaryProfileEmployee")
|
||||
|
|
@ -8009,7 +8009,7 @@ export class ReportController extends Controller {
|
|||
// )
|
||||
.andWhere("salaryProfileEmployee.status37 = :status", { status: "PENDING" })
|
||||
.andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId })
|
||||
.andWhere(condition, parameters)
|
||||
// .andWhere(condition, parameters)
|
||||
.select([
|
||||
"salaryProfileEmployee.id",
|
||||
"salaryProfileEmployee.orgShortName",
|
||||
|
|
@ -8056,6 +8056,170 @@ export class ReportController extends Controller {
|
|||
return new HttpSuccess(_salaryRank);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* API ออกคำสั่ง C-PM-45
|
||||
*
|
||||
* @summary ออกคำสั่ง C-PM-45 เลื่อนเงินเดือนลูกจ้างเกษียณ
|
||||
*
|
||||
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||
*/
|
||||
@Post("command/C-PM-45/{id}")
|
||||
async SalaryReport45Command(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
body: {
|
||||
type: string;
|
||||
rootId: string;
|
||||
},
|
||||
) {
|
||||
const salary = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!salary) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const salaryOrgs = await this.salaryOrgEmployeeRepository.find({
|
||||
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||
});
|
||||
|
||||
let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee)
|
||||
.createQueryBuilder("salaryProfileEmployee")
|
||||
.andWhere({
|
||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||
type: In(["FULLHAFT", "FULL", "HAFT"]),
|
||||
})
|
||||
.andWhere("salaryProfileEmployee.status36 = :status", { status: "PENDING" })
|
||||
.andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId })
|
||||
.andWhere("salaryProfileEmployee.isRetired = :isRetired",{ isRetired: true })
|
||||
.select([
|
||||
"salaryProfileEmployee.id",
|
||||
"salaryProfileEmployee.orgShortName",
|
||||
"salaryProfileEmployee.posMasterNo",
|
||||
"salaryProfileEmployee.position",
|
||||
"salaryProfileEmployee.posType",
|
||||
"salaryProfileEmployee.posTypeShort",
|
||||
"salaryProfileEmployee.posLevel",
|
||||
"salaryProfileEmployee.profileId",
|
||||
"salaryProfileEmployee.prefix",
|
||||
"salaryProfileEmployee.firstName",
|
||||
"salaryProfileEmployee.lastName",
|
||||
"salaryProfileEmployee.citizenId",
|
||||
"salaryProfileEmployee.amount",
|
||||
"salaryProfileEmployee.amountSpecial",
|
||||
"salaryProfileEmployee.amountUse",
|
||||
"salaryProfileEmployee.positionSalaryAmount",
|
||||
])
|
||||
.orderBy("salaryProfileEmployee.rootOrder", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child1Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child2Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child3Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child4Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.posMasterNo", "ASC")
|
||||
.getMany();
|
||||
|
||||
const _salaryRank = salaryRank.map((item) => ({
|
||||
id: item.id,
|
||||
posMasterNo: `${item.orgShortName} ${item.posMasterNo}`,
|
||||
positionName: item.position,
|
||||
posType: item.posType,
|
||||
posLevel: `${item.posTypeShort ?? ""} ${item.posLevel ?? ""}`,
|
||||
profileId: item.profileId,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
citizenId: item.citizenId,
|
||||
amount: item.amount,
|
||||
amountSpecial: item.amountSpecial,
|
||||
amountUse: item.amountUse,
|
||||
positionSalaryAmount: item.positionSalaryAmount,
|
||||
}));
|
||||
|
||||
return new HttpSuccess(_salaryRank);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ออกคำสั่ง C-PM-46
|
||||
*
|
||||
* @summary ออกคำสั่ง C-PM-46 เงินพิเศษลูกจ้างเกษียณ
|
||||
*
|
||||
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||
*/
|
||||
@Post("command/C-PM-46/{id}")
|
||||
async SalaryReport46Command(
|
||||
@Path() id: string,
|
||||
@Body()
|
||||
body: {
|
||||
type: string;
|
||||
rootId: string;
|
||||
},
|
||||
) {
|
||||
|
||||
const salary = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
if (!salary) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const salaryOrgs = await this.salaryOrgEmployeeRepository.find({
|
||||
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||
});
|
||||
|
||||
let salaryRank = await AppDataSource.getRepository(SalaryProfileEmployee)
|
||||
.createQueryBuilder("salaryProfileEmployee")
|
||||
.andWhere({
|
||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||
amountSpecial: MoreThan(0),
|
||||
})
|
||||
.andWhere("salaryProfileEmployee.status37 = :status", { status: "PENDING" })
|
||||
.andWhere("salaryProfileEmployee.rootId = :rootId", { rootId: body.rootId })
|
||||
.andWhere("salaryProfileEmployee.isRetired = :isRetired",{ isRetired: true })
|
||||
.select([
|
||||
"salaryProfileEmployee.id",
|
||||
"salaryProfileEmployee.orgShortName",
|
||||
"salaryProfileEmployee.posMasterNo",
|
||||
"salaryProfileEmployee.position",
|
||||
"salaryProfileEmployee.posType",
|
||||
"salaryProfileEmployee.posTypeShort",
|
||||
"salaryProfileEmployee.posLevel",
|
||||
"salaryProfileEmployee.profileId",
|
||||
"salaryProfileEmployee.prefix",
|
||||
"salaryProfileEmployee.firstName",
|
||||
"salaryProfileEmployee.lastName",
|
||||
"salaryProfileEmployee.citizenId",
|
||||
"salaryProfileEmployee.amount",
|
||||
"salaryProfileEmployee.amountSpecial",
|
||||
"salaryProfileEmployee.amountUse",
|
||||
"salaryProfileEmployee.positionSalaryAmount",
|
||||
])
|
||||
.orderBy("salaryProfileEmployee.rootOrder", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child1Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child2Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child3Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.child4Order", "ASC")
|
||||
.addOrderBy("salaryProfileEmployee.posMasterNo", "ASC")
|
||||
.getMany();
|
||||
|
||||
const _salaryRank = salaryRank.map((item) => ({
|
||||
id: item.id,
|
||||
posMasterNo: `${item.orgShortName} ${item.posMasterNo}`,
|
||||
positionName: item.position,
|
||||
posType: item.posType,
|
||||
posLevel: `${item.posTypeShort ?? ""} ${item.posLevel ?? ""}`,
|
||||
profileId: item.profileId,
|
||||
prefix: item.prefix,
|
||||
firstName: item.firstName,
|
||||
lastName: item.lastName,
|
||||
citizenId: item.citizenId,
|
||||
amount: item.amount,
|
||||
amountSpecial: item.amountSpecial,
|
||||
amountUse: item.amountUse,
|
||||
positionSalaryAmount: item.positionSalaryAmount,
|
||||
}));
|
||||
|
||||
return new HttpSuccess(_salaryRank);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ออกคำสั่ง C-PM-33
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue