แก้รอบเงินเดือนเดือนลูกจ้าง
This commit is contained in:
parent
a2d109ab6a
commit
dba2e15403
2 changed files with 31 additions and 19 deletions
|
|
@ -762,7 +762,7 @@ export class SalaryPeriodController extends Controller {
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
type?: any;
|
type?: any;
|
||||||
isRetire?: boolean | null;
|
isRetire?: string | null;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const salaryOrg = await this.salaryOrgRepository.findOne({
|
const salaryOrg = await this.salaryOrgRepository.findOne({
|
||||||
|
|
@ -780,7 +780,13 @@ export class SalaryPeriodController extends Controller {
|
||||||
qb.andWhere(body.type != null && body.type != "" ? `profile.type LIKE :type` : "1=1", {
|
qb.andWhere(body.type != null && body.type != "" ? `profile.type LIKE :type` : "1=1", {
|
||||||
type: body.type == null ? "" : `${body.type.toUpperCase()}`,
|
type: body.type == null ? "" : `${body.type.toUpperCase()}`,
|
||||||
})
|
})
|
||||||
.andWhere(body.isRetire != null ? `profile.isRetired = ${body.isRetire}` : "1=1")
|
.andWhere(
|
||||||
|
body.isRetire != null
|
||||||
|
? body.isRetire == "1"
|
||||||
|
? `profile.isRetired = true`
|
||||||
|
: `profile.isRetired = false`
|
||||||
|
: "1=1",
|
||||||
|
)
|
||||||
.andWhere({
|
.andWhere({
|
||||||
salaryOrgId: salaryOrg.id,
|
salaryOrgId: salaryOrg.id,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
isActive: true,
|
isActive: true,
|
||||||
},
|
},
|
||||||
order: { effectiveDate: "DESC" },
|
order: { effectiveDate: "DESC" },
|
||||||
relations: ["salaryOrgs"],
|
relations: ["salaryOrgEmployees"],
|
||||||
});
|
});
|
||||||
if (!salaryPeriod) {
|
if (!salaryPeriod) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
|
||||||
|
|
@ -66,28 +66,28 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
group1id:
|
group1id:
|
||||||
salaryPeriod.salaryOrgs.find(
|
salaryPeriod.salaryOrgEmployees.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.group == "GROUP1" &&
|
x.group == "GROUP1" &&
|
||||||
x.rootId == body.rootId &&
|
x.rootId == body.rootId &&
|
||||||
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
||||||
) == null
|
) == null
|
||||||
? null
|
? null
|
||||||
: salaryPeriod.salaryOrgs.find(
|
: salaryPeriod.salaryOrgEmployees.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.group == "GROUP1" &&
|
x.group == "GROUP1" &&
|
||||||
x.rootId == body.rootId &&
|
x.rootId == body.rootId &&
|
||||||
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
||||||
)?.id,
|
)?.id,
|
||||||
group2id:
|
group2id:
|
||||||
salaryPeriod.salaryOrgs.find(
|
salaryPeriod.salaryOrgEmployees.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.group == "GROUP2" &&
|
x.group == "GROUP2" &&
|
||||||
x.rootId == body.rootId &&
|
x.rootId == body.rootId &&
|
||||||
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
||||||
) == null
|
) == null
|
||||||
? null
|
? null
|
||||||
: salaryPeriod.salaryOrgs.find(
|
: salaryPeriod.salaryOrgEmployees.find(
|
||||||
(x) =>
|
(x) =>
|
||||||
x.group == "GROUP2" &&
|
x.group == "GROUP2" &&
|
||||||
x.rootId == body.rootId &&
|
x.rootId == body.rootId &&
|
||||||
|
|
@ -765,7 +765,7 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
keyword?: string;
|
keyword?: string;
|
||||||
type?: any;
|
type?: any;
|
||||||
isRetire?: boolean | null;
|
isRetire?: string | null;
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
const salaryOrg = await this.salaryOrgRepository.findOne({
|
const salaryOrg = await this.salaryOrgRepository.findOne({
|
||||||
|
|
@ -783,7 +783,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
qb.andWhere(body.type != null && body.type != "" ? `profile.type LIKE :type` : "1=1", {
|
qb.andWhere(body.type != null && body.type != "" ? `profile.type LIKE :type` : "1=1", {
|
||||||
type: body.type == null ? "" : `${body.type.toUpperCase()}`,
|
type: body.type == null ? "" : `${body.type.toUpperCase()}`,
|
||||||
})
|
})
|
||||||
.andWhere(body.isRetire != null ? `profile.isRetired = ${body.isRetire}` : "1=1")
|
.andWhere(
|
||||||
|
body.isRetire != null
|
||||||
|
? body.isRetire == "1"
|
||||||
|
? `profile.isRetired = true`
|
||||||
|
: `profile.isRetired = false`
|
||||||
|
: "1=1",
|
||||||
|
)
|
||||||
.andWhere({
|
.andWhere({
|
||||||
salaryOrgId: salaryOrg.id,
|
salaryOrgId: salaryOrg.id,
|
||||||
})
|
})
|
||||||
|
|
@ -1461,12 +1467,12 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
async OfficerApprove(@Path() periodId: string, rootId: string) {
|
async OfficerApprove(@Path() periodId: string, rootId: string) {
|
||||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||||
where: { id: periodId },
|
where: { id: periodId },
|
||||||
relations: ["salaryOrgs"],
|
relations: ["salaryOrgEmployees"],
|
||||||
});
|
});
|
||||||
if (!salaryPeriod)
|
if (!salaryPeriod)
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
salaryPeriod.salaryOrgs
|
salaryPeriod.salaryOrgEmployees
|
||||||
.filter((x) => x.rootId == rootId)
|
.filter((x) => x.rootId == rootId)
|
||||||
.map(async (x: any) => {
|
.map(async (x: any) => {
|
||||||
x.status = "WAITHEAD1";
|
x.status = "WAITHEAD1";
|
||||||
|
|
@ -1487,13 +1493,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
async HeadApprove(@Path() periodId: string, rootId: string) {
|
async HeadApprove(@Path() periodId: string, rootId: string) {
|
||||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||||
where: { id: periodId },
|
where: { id: periodId },
|
||||||
relations: ["salaryOrgs"],
|
relations: ["salaryOrgEmployees"],
|
||||||
});
|
});
|
||||||
if (!salaryPeriod)
|
if (!salaryPeriod)
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
salaryPeriod.salaryOrgs
|
salaryPeriod.salaryOrgEmployees
|
||||||
.filter((x) => x.rootId == rootId)
|
.filter((x) => x.rootId == rootId)
|
||||||
.map(async (x: any) => {
|
.map(async (x: any) => {
|
||||||
x.status = "WAITOWNER1";
|
x.status = "WAITOWNER1";
|
||||||
|
|
@ -1514,13 +1520,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
async OwnerApprove(@Path() periodId: string, rootId: string) {
|
async OwnerApprove(@Path() periodId: string, rootId: string) {
|
||||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||||
where: { id: periodId },
|
where: { id: periodId },
|
||||||
relations: ["salaryOrgs"],
|
relations: ["salaryOrgEmployees"],
|
||||||
});
|
});
|
||||||
if (!salaryPeriod)
|
if (!salaryPeriod)
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
salaryPeriod.salaryOrgs
|
salaryPeriod.salaryOrgEmployees
|
||||||
.filter((x) => x.rootId == rootId)
|
.filter((x) => x.rootId == rootId)
|
||||||
.map(async (x: any) => {
|
.map(async (x: any) => {
|
||||||
x.status = "REPORT";
|
x.status = "REPORT";
|
||||||
|
|
@ -1548,13 +1554,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
) {
|
) {
|
||||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||||
where: { id: periodId },
|
where: { id: periodId },
|
||||||
relations: ["salaryOrgs"],
|
relations: ["salaryOrgEmployees"],
|
||||||
});
|
});
|
||||||
if (!salaryPeriod)
|
if (!salaryPeriod)
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
salaryPeriod.salaryOrgs
|
salaryPeriod.salaryOrgEmployees
|
||||||
.filter((x) => x.rootId == rootId)
|
.filter((x) => x.rootId == rootId)
|
||||||
.map(async (x: any) => {
|
.map(async (x: any) => {
|
||||||
x.status = "WAITHEAD2";
|
x.status = "WAITHEAD2";
|
||||||
|
|
@ -1583,13 +1589,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
) {
|
) {
|
||||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||||
where: { id: periodId },
|
where: { id: periodId },
|
||||||
relations: ["salaryOrgs"],
|
relations: ["salaryOrgEmployees"],
|
||||||
});
|
});
|
||||||
if (!salaryPeriod)
|
if (!salaryPeriod)
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
salaryPeriod.salaryOrgs
|
salaryPeriod.salaryOrgEmployees
|
||||||
.filter((x) => x.rootId == rootId)
|
.filter((x) => x.rootId == rootId)
|
||||||
.map(async (x: any) => {
|
.map(async (x: any) => {
|
||||||
x.status = "REPORT";
|
x.status = "REPORT";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue