no message
This commit is contained in:
parent
b2319419c1
commit
07f5b3d570
1 changed files with 247 additions and 5 deletions
|
|
@ -35,6 +35,7 @@ import { EmployeePosType } from "../entities/EmployeePosType";
|
||||||
import { EmployeePosLevel } from "../entities/EmployeePosLevel";
|
import { EmployeePosLevel } from "../entities/EmployeePosLevel";
|
||||||
import { SalaryOrgEmployee } from "../entities/SalaryOrgEmployee";
|
import { SalaryOrgEmployee } from "../entities/SalaryOrgEmployee";
|
||||||
import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee";
|
import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee";
|
||||||
|
import CallAPI from "../interfaces/call-api";
|
||||||
@Route("api/v1/salary/report")
|
@Route("api/v1/salary/report")
|
||||||
@Tags("Report")
|
@Tags("Report")
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
|
|
@ -6278,6 +6279,241 @@ export class ReportController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง 33
|
||||||
|
*
|
||||||
|
* @summary ออกคำสั่ง 33
|
||||||
|
*
|
||||||
|
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||||
|
*/
|
||||||
|
@Post("command/33/resume")
|
||||||
|
async SalaryReport33Resume(
|
||||||
|
@Body() body: { result: { id: string; personId: string }[] },
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
) {
|
||||||
|
await Promise.all(
|
||||||
|
body.result.map(async (v) => {
|
||||||
|
const salary = await this.salaryProfileRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: v.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (salary != null) {
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "org/profile/salary", {
|
||||||
|
profileId: salary.profileId,
|
||||||
|
date: new Date(),
|
||||||
|
amount: salary.positionSalaryAmount,
|
||||||
|
positionSalaryAmount: null,
|
||||||
|
mouthSalaryAmount: null,
|
||||||
|
posNo: salary.orgShortName + salary.posMasterNo,
|
||||||
|
position: salary.position,
|
||||||
|
positionLine: null,
|
||||||
|
positionPathSide: null,
|
||||||
|
positionExecutive: salary.posExecutive,
|
||||||
|
positionType: salary.posType,
|
||||||
|
positionLevel: salary.posLevel,
|
||||||
|
refCommandNo: null,
|
||||||
|
templateDoc: null,
|
||||||
|
})
|
||||||
|
.then(async (x) => {
|
||||||
|
salary.status == "DONE";
|
||||||
|
await this.salaryProfileRepository.save(salary);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง 34
|
||||||
|
*
|
||||||
|
* @summary ออกคำสั่ง 34
|
||||||
|
*
|
||||||
|
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||||
|
*/
|
||||||
|
@Post("command/34/resume")
|
||||||
|
async SalaryReport34Resume(
|
||||||
|
@Body() body: { result: { id: string; personId: string }[] },
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
) {
|
||||||
|
await Promise.all(
|
||||||
|
body.result.map(async (v) => {
|
||||||
|
const salary = await this.salaryProfileRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: v.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (salary != null) {
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "org/profile/salary", {
|
||||||
|
profileId: salary.profileId,
|
||||||
|
date: new Date(),
|
||||||
|
amount: salary.positionSalaryAmount,
|
||||||
|
positionSalaryAmount: null,
|
||||||
|
mouthSalaryAmount: null,
|
||||||
|
posNo: salary.orgShortName + salary.posMasterNo,
|
||||||
|
position: salary.position,
|
||||||
|
positionLine: null,
|
||||||
|
positionPathSide: null,
|
||||||
|
positionExecutive: salary.posExecutive,
|
||||||
|
positionType: salary.posType,
|
||||||
|
positionLevel: salary.posLevel,
|
||||||
|
refCommandNo: null,
|
||||||
|
templateDoc: null,
|
||||||
|
})
|
||||||
|
.then(async (x) => {
|
||||||
|
salary.status == "DONE";
|
||||||
|
await this.salaryProfileRepository.save(salary);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง 35
|
||||||
|
*
|
||||||
|
* @summary ออกคำสั่ง 35
|
||||||
|
*
|
||||||
|
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||||
|
*/
|
||||||
|
@Post("command/35/resume")
|
||||||
|
async SalaryReport35Resume(
|
||||||
|
@Body() body: { result: { id: string; personId: string }[] },
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
) {
|
||||||
|
await Promise.all(
|
||||||
|
body.result.map(async (v) => {
|
||||||
|
const salary = await this.salaryProfileRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: v.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (salary != null) {
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "org/profile/salary", {
|
||||||
|
profileId: salary.profileId,
|
||||||
|
date: new Date(),
|
||||||
|
amount: salary.positionSalaryAmount,
|
||||||
|
positionSalaryAmount: null,
|
||||||
|
mouthSalaryAmount: null,
|
||||||
|
posNo: salary.orgShortName + salary.posMasterNo,
|
||||||
|
position: salary.position,
|
||||||
|
positionLine: null,
|
||||||
|
positionPathSide: null,
|
||||||
|
positionExecutive: salary.posExecutive,
|
||||||
|
positionType: salary.posType,
|
||||||
|
positionLevel: salary.posLevel,
|
||||||
|
refCommandNo: null,
|
||||||
|
templateDoc: null,
|
||||||
|
})
|
||||||
|
.then(async (x) => {
|
||||||
|
salary.status == "DONE";
|
||||||
|
await this.salaryProfileRepository.save(salary);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง 36
|
||||||
|
*
|
||||||
|
* @summary ออกคำสั่ง 36
|
||||||
|
*
|
||||||
|
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||||
|
*/
|
||||||
|
@Post("command/36/resume")
|
||||||
|
async SalaryReport36Resume(
|
||||||
|
@Body() body: { result: { id: string; personId: string }[] },
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
) {
|
||||||
|
await Promise.all(
|
||||||
|
body.result.map(async (v) => {
|
||||||
|
const salary = await this.salaryProfileEmployeeRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: v.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (salary != null) {
|
||||||
|
// await new CallAPI()
|
||||||
|
// .PostData(request, "org/profile/salary", {
|
||||||
|
// profileId: salary.profileId,
|
||||||
|
// date: new Date(),
|
||||||
|
// amount: salary.positionSalaryAmount,
|
||||||
|
// positionSalaryAmount: null,
|
||||||
|
// mouthSalaryAmount: null,
|
||||||
|
// posNo: salary.orgShortName + salary.posMasterNo,
|
||||||
|
// position: salary.position,
|
||||||
|
// positionLine: null,
|
||||||
|
// positionPathSide: null,
|
||||||
|
// positionExecutive: null,
|
||||||
|
// positionType: salary.posType,
|
||||||
|
// positionLevel: salary.posLevel,
|
||||||
|
// refCommandNo: null,
|
||||||
|
// templateDoc: null,
|
||||||
|
// })
|
||||||
|
// .then(async (x) => {
|
||||||
|
salary.status == "DONE";
|
||||||
|
await this.salaryProfileEmployeeRepository.save(salary);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API ออกคำสั่ง 37
|
||||||
|
*
|
||||||
|
* @summary ออกคำสั่ง 37
|
||||||
|
*
|
||||||
|
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||||
|
*/
|
||||||
|
@Post("command/37/resume")
|
||||||
|
async SalaryReport37Resume(
|
||||||
|
@Body() body: { result: { id: string; personId: string }[] },
|
||||||
|
@Request() request: { user: Record<string, any> },
|
||||||
|
) {
|
||||||
|
await Promise.all(
|
||||||
|
body.result.map(async (v) => {
|
||||||
|
const salary = await this.salaryProfileEmployeeRepository.findOne({
|
||||||
|
where: {
|
||||||
|
id: v.id,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (salary != null) {
|
||||||
|
// await new CallAPI()
|
||||||
|
// .PostData(request, "org/profile/salary", {
|
||||||
|
// profileId: salary.profileId,
|
||||||
|
// date: new Date(),
|
||||||
|
// amount: salary.positionSalaryAmount,
|
||||||
|
// positionSalaryAmount: null,
|
||||||
|
// mouthSalaryAmount: null,
|
||||||
|
// posNo: salary.orgShortName + salary.posMasterNo,
|
||||||
|
// position: salary.position,
|
||||||
|
// positionLine: null,
|
||||||
|
// positionPathSide: null,
|
||||||
|
// positionExecutive: null,
|
||||||
|
// positionType: salary.posType,
|
||||||
|
// positionLevel: salary.posLevel,
|
||||||
|
// refCommandNo: null,
|
||||||
|
// templateDoc: null,
|
||||||
|
// })
|
||||||
|
// .then(async (x) => {
|
||||||
|
salary.status == "DONE";
|
||||||
|
await this.salaryProfileEmployeeRepository.save(salary);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API ออกคำสั่ง 33
|
* API ออกคำสั่ง 33
|
||||||
*
|
*
|
||||||
|
|
@ -6294,13 +6530,14 @@ export class ReportController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||||
}
|
}
|
||||||
const salaryOrgs = await this.salaryOrgRepository.find({
|
const salaryOrgs = await this.salaryOrgRepository.find({
|
||||||
where: { id: salary.id },
|
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const salaryRank = await this.salaryProfileRepository.find({
|
const salaryRank = await this.salaryProfileRepository.find({
|
||||||
where: {
|
where: {
|
||||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||||
type: In(["FULLHAFT", "FULL", "HAFT"]),
|
type: In(["FULLHAFT", "FULL", "HAFT"]),
|
||||||
|
status: "PENDING",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -6331,7 +6568,7 @@ export class ReportController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||||
}
|
}
|
||||||
const salaryOrgs = await this.salaryOrgRepository.find({
|
const salaryOrgs = await this.salaryOrgRepository.find({
|
||||||
where: { id: salary.id },
|
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const salaryRank = await this.salaryProfileRepository.find({
|
const salaryRank = await this.salaryProfileRepository.find({
|
||||||
|
|
@ -6339,10 +6576,12 @@ export class ReportController extends Controller {
|
||||||
{
|
{
|
||||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||||
amountSpecial: MoreThan(0),
|
amountSpecial: MoreThan(0),
|
||||||
|
status: "PENDING",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||||
type: "NONE",
|
type: "NONE",
|
||||||
|
status: "PENDING",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|
@ -6374,13 +6613,14 @@ export class ReportController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||||
}
|
}
|
||||||
const salaryOrgs = await this.salaryOrgRepository.find({
|
const salaryOrgs = await this.salaryOrgRepository.find({
|
||||||
where: { id: salary.id },
|
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const salaryRank = await this.salaryProfileRepository.find({
|
const salaryRank = await this.salaryProfileRepository.find({
|
||||||
where: {
|
where: {
|
||||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||||
type: In(["FULLHAFT", "FULL", "HAFT"]),
|
type: In(["FULLHAFT", "FULL", "HAFT"]),
|
||||||
|
status: "PENDING",
|
||||||
isRetired: true,
|
isRetired: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -6412,13 +6652,14 @@ export class ReportController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||||
}
|
}
|
||||||
const salaryOrgs = await this.salaryOrgEmployeeRepository.find({
|
const salaryOrgs = await this.salaryOrgEmployeeRepository.find({
|
||||||
where: { id: salary.id },
|
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const salaryRank = await this.salaryProfileEmployeeRepository.find({
|
const salaryRank = await this.salaryProfileEmployeeRepository.find({
|
||||||
where: {
|
where: {
|
||||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||||
type: In(["FULLHAFT", "FULL", "HAFT"]),
|
type: In(["FULLHAFT", "FULL", "HAFT"]),
|
||||||
|
status: "PENDING",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -6449,13 +6690,14 @@ export class ReportController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||||
}
|
}
|
||||||
const salaryOrgs = await this.salaryOrgEmployeeRepository.find({
|
const salaryOrgs = await this.salaryOrgEmployeeRepository.find({
|
||||||
where: { id: salary.id },
|
where: { salaryPeriodId: salary.id, snapshot: "SNAP2" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const salaryRank = await this.salaryProfileEmployeeRepository.find({
|
const salaryRank = await this.salaryProfileEmployeeRepository.find({
|
||||||
where: {
|
where: {
|
||||||
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
salaryOrgId: In(salaryOrgs.map((x) => x.id)),
|
||||||
amountSpecial: MoreThan(0),
|
amountSpecial: MoreThan(0),
|
||||||
|
status: "PENDING",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue