แก้รอบเงินเดือนเดือนลูกจ้าง
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;
|
||||
keyword?: string;
|
||||
type?: any;
|
||||
isRetire?: boolean | null;
|
||||
isRetire?: string | null;
|
||||
},
|
||||
) {
|
||||
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", {
|
||||
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({
|
||||
salaryOrgId: salaryOrg.id,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
isActive: true,
|
||||
},
|
||||
order: { effectiveDate: "DESC" },
|
||||
relations: ["salaryOrgs"],
|
||||
relations: ["salaryOrgEmployees"],
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบรอบการขึ้นเงินเดือน");
|
||||
|
|
@ -66,28 +66,28 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
|
||||
const data = {
|
||||
group1id:
|
||||
salaryPeriod.salaryOrgs.find(
|
||||
salaryPeriod.salaryOrgEmployees.find(
|
||||
(x) =>
|
||||
x.group == "GROUP1" &&
|
||||
x.rootId == body.rootId &&
|
||||
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
||||
) == null
|
||||
? null
|
||||
: salaryPeriod.salaryOrgs.find(
|
||||
: salaryPeriod.salaryOrgEmployees.find(
|
||||
(x) =>
|
||||
x.group == "GROUP1" &&
|
||||
x.rootId == body.rootId &&
|
||||
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
||||
)?.id,
|
||||
group2id:
|
||||
salaryPeriod.salaryOrgs.find(
|
||||
salaryPeriod.salaryOrgEmployees.find(
|
||||
(x) =>
|
||||
x.group == "GROUP2" &&
|
||||
x.rootId == body.rootId &&
|
||||
x.snapshot == body.snapshot.toLocaleUpperCase(),
|
||||
) == null
|
||||
? null
|
||||
: salaryPeriod.salaryOrgs.find(
|
||||
: salaryPeriod.salaryOrgEmployees.find(
|
||||
(x) =>
|
||||
x.group == "GROUP2" &&
|
||||
x.rootId == body.rootId &&
|
||||
|
|
@ -765,7 +765,7 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
pageSize: number;
|
||||
keyword?: string;
|
||||
type?: any;
|
||||
isRetire?: boolean | null;
|
||||
isRetire?: string | null;
|
||||
},
|
||||
) {
|
||||
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", {
|
||||
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({
|
||||
salaryOrgId: salaryOrg.id,
|
||||
})
|
||||
|
|
@ -1461,12 +1467,12 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
async OfficerApprove(@Path() periodId: string, rootId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
relations: ["salaryOrgEmployees"],
|
||||
});
|
||||
if (!salaryPeriod)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
salaryPeriod.salaryOrgEmployees
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x: any) => {
|
||||
x.status = "WAITHEAD1";
|
||||
|
|
@ -1487,13 +1493,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
async HeadApprove(@Path() periodId: string, rootId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
relations: ["salaryOrgEmployees"],
|
||||
});
|
||||
if (!salaryPeriod)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
|
||||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
salaryPeriod.salaryOrgEmployees
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x: any) => {
|
||||
x.status = "WAITOWNER1";
|
||||
|
|
@ -1514,13 +1520,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
async OwnerApprove(@Path() periodId: string, rootId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
relations: ["salaryOrgEmployees"],
|
||||
});
|
||||
if (!salaryPeriod)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
|
||||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
salaryPeriod.salaryOrgEmployees
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x: any) => {
|
||||
x.status = "REPORT";
|
||||
|
|
@ -1548,13 +1554,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
relations: ["salaryOrgEmployees"],
|
||||
});
|
||||
if (!salaryPeriod)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
|
||||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
salaryPeriod.salaryOrgEmployees
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x: any) => {
|
||||
x.status = "WAITHEAD2";
|
||||
|
|
@ -1583,13 +1589,13 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgs"],
|
||||
relations: ["salaryOrgEmployees"],
|
||||
});
|
||||
if (!salaryPeriod)
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลรอบผังเงินเดือนนี้");
|
||||
|
||||
await Promise.all(
|
||||
salaryPeriod.salaryOrgs
|
||||
salaryPeriod.salaryOrgEmployees
|
||||
.filter((x) => x.rootId == rootId)
|
||||
.map(async (x: any) => {
|
||||
x.status = "REPORT";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue