This commit is contained in:
parent
bc4d6c9eb7
commit
a699e40ee7
1 changed files with 119 additions and 10 deletions
|
|
@ -36,9 +36,10 @@ import permission from "../interfaces/permission";
|
||||||
|
|
||||||
import CallAPI from "../interfaces/call-api";
|
import CallAPI from "../interfaces/call-api";
|
||||||
import { isNotEmittedStatement } from "typescript";
|
import { isNotEmittedStatement } from "typescript";
|
||||||
|
import { SalaryFormulaEmployee } from "../entities/SalaryFormulaEmployee";
|
||||||
@Route("api/v1/salary/report")
|
@Route("api/v1/salary/report")
|
||||||
@Tags("Report")
|
@Tags("Report")
|
||||||
@Security("bearerAuth")
|
// @Security("bearerAuth")
|
||||||
@Response(
|
@Response(
|
||||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||||
|
|
@ -56,6 +57,8 @@ export class ReportController extends Controller {
|
||||||
private salaryOrgEmployeeRepository = AppDataSource.getRepository(SalaryOrgEmployee);
|
private salaryOrgEmployeeRepository = AppDataSource.getRepository(SalaryOrgEmployee);
|
||||||
private salaryProfileRepository = AppDataSource.getRepository(SalaryProfile);
|
private salaryProfileRepository = AppDataSource.getRepository(SalaryProfile);
|
||||||
private salaryProfileEmployeeRepository = AppDataSource.getRepository(SalaryProfileEmployee);
|
private salaryProfileEmployeeRepository = AppDataSource.getRepository(SalaryProfileEmployee);
|
||||||
|
private salaryFormulaEmployeeRepository = AppDataSource.getRepository(SalaryFormulaEmployee);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API รายงานอัตราเงินเดือน
|
* API รายงานอัตราเงินเดือน
|
||||||
|
|
@ -3233,7 +3236,32 @@ export class ReportController extends Controller {
|
||||||
|
|
||||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||||
|
|
||||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
//หาคนที่เงินเดือนเท่ากับเงินเดือนสูงสุดในกลุ่ม
|
||||||
|
const filteredProfiles = await Promise.all(
|
||||||
|
_salaryPeriod.map(async (profile) => {
|
||||||
|
const salaryRankMax = await this.salaryEmployeeRankRepository
|
||||||
|
.createQueryBuilder("rank")
|
||||||
|
.leftJoin("rank.salaryEmployee_", "emp")
|
||||||
|
.where("emp.isActive = :isActive", { isActive: true })
|
||||||
|
.andWhere("emp.group = :group", { group: profile.group })
|
||||||
|
.orderBy("rank.step", "DESC")
|
||||||
|
.getOne();
|
||||||
|
|
||||||
|
const match =
|
||||||
|
salaryRankMax != null &&
|
||||||
|
profile.salaryLevel != null &&
|
||||||
|
profile.salaryLevel === salaryRankMax.step &&
|
||||||
|
profile.amount === salaryRankMax.salaryMonth;
|
||||||
|
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
return { profile, salaryRankMax };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const validProfiles = filteredProfiles.filter((item): item is { profile: any, salaryRankMax: any } => item !== null);
|
||||||
|
|
||||||
|
const formattedData = validProfiles.map(({ profile }, index) => {
|
||||||
const fullNameParts = [
|
const fullNameParts = [
|
||||||
profile.child4,
|
profile.child4,
|
||||||
profile.child3,
|
profile.child3,
|
||||||
|
|
@ -3261,16 +3289,21 @@ export class ReportController extends Controller {
|
||||||
" " +
|
" " +
|
||||||
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString())
|
Extension.ToThaiNumber(profile.posMasterNo.toLocaleString())
|
||||||
: "-",
|
: "-",
|
||||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : "-",
|
amount: profile.amount
|
||||||
|
? Extension.ToThaiNumber(profile.amount.toLocaleString())
|
||||||
|
: "-",
|
||||||
positionSalaryAmount: profile.positionSalaryAmount
|
positionSalaryAmount: profile.positionSalaryAmount
|
||||||
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString())
|
||||||
: "-",
|
: "-",
|
||||||
reasonSign: "",
|
reasonSign: "",
|
||||||
score: profile.result ? Extension.ToThaiNumber(profile.result) : "-", //สรุปผลการประเมินฯ ระดับและคะแนน
|
score: profile.result
|
||||||
reason: profile.remark, //เหตุผลที่ไม่สมควรหรือไม่อาจเลื่อนขั้นค่าจ้าง
|
? Extension.ToThaiNumber(profile.result)
|
||||||
|
: "-",
|
||||||
|
reason: profile.remark,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
template: "emp1-07",
|
template: "emp1-07",
|
||||||
reportName: "emp1-07",
|
reportName: "emp1-07",
|
||||||
|
|
@ -3281,6 +3314,7 @@ export class ReportController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * API 08-แบบ ลจ.กทม.3-บัญชีแสดงวันลาในครึ่งปีของลูกจ้าง
|
// * API 08-แบบ ลจ.กทม.3-บัญชีแสดงวันลาในครึ่งปีของลูกจ้าง
|
||||||
// *
|
// *
|
||||||
|
|
@ -5125,7 +5159,32 @@ export class ReportController extends Controller {
|
||||||
});
|
});
|
||||||
// const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
// const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||||
|
|
||||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
//หาคนที่เงินเดือนเท่ากับเงินเดือนสูงสุดในกลุ่ม
|
||||||
|
const filteredProfiles = await Promise.all(
|
||||||
|
_salaryPeriod.map(async (profile) => {
|
||||||
|
const salaryRankMax = await this.salaryEmployeeRankRepository
|
||||||
|
.createQueryBuilder("rank")
|
||||||
|
.leftJoin("rank.salaryEmployee_", "emp")
|
||||||
|
.where("emp.isActive = :isActive", { isActive: true })
|
||||||
|
.andWhere("emp.group = :group", { group: profile.group })
|
||||||
|
.orderBy("rank.step", "DESC")
|
||||||
|
.getOne();
|
||||||
|
|
||||||
|
const match =
|
||||||
|
salaryRankMax != null &&
|
||||||
|
profile.salaryLevel != null &&
|
||||||
|
profile.salaryLevel === salaryRankMax.step &&
|
||||||
|
profile.amount === salaryRankMax.salaryMonth;
|
||||||
|
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
return { profile, salaryRankMax };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const validProfiles = filteredProfiles.filter((item): item is { profile: any, salaryRankMax: any } => item !== null);
|
||||||
|
|
||||||
|
const formattedData = validProfiles.map(({ profile }, index) => {
|
||||||
const fullNameParts = [
|
const fullNameParts = [
|
||||||
profile.child4,
|
profile.child4,
|
||||||
profile.child3,
|
profile.child3,
|
||||||
|
|
@ -5878,7 +5937,32 @@ export class ReportController extends Controller {
|
||||||
|
|
||||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||||
|
|
||||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
//หาคนที่เงินเดือนเท่ากับเงินเดือนสูงสุดในกลุ่ม
|
||||||
|
const filteredProfiles = await Promise.all(
|
||||||
|
_salaryPeriod.map(async (profile) => {
|
||||||
|
const salaryRankMax = await this.salaryEmployeeRankRepository
|
||||||
|
.createQueryBuilder("rank")
|
||||||
|
.leftJoin("rank.salaryEmployee_", "emp")
|
||||||
|
.where("emp.isActive = :isActive", { isActive: true })
|
||||||
|
.andWhere("emp.group = :group", { group: profile.group })
|
||||||
|
.orderBy("rank.step", "DESC")
|
||||||
|
.getOne();
|
||||||
|
|
||||||
|
const match =
|
||||||
|
salaryRankMax != null &&
|
||||||
|
profile.salaryLevel != null &&
|
||||||
|
profile.salaryLevel === salaryRankMax.step &&
|
||||||
|
profile.amount === salaryRankMax.salaryMonth;
|
||||||
|
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
return { profile, salaryRankMax };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const validProfiles = filteredProfiles.filter((item): item is { profile: any, salaryRankMax: any } => item !== null);
|
||||||
|
|
||||||
|
const formattedData = validProfiles.map(({ profile }, index) => {
|
||||||
const fullNameParts = [
|
const fullNameParts = [
|
||||||
profile.child4,
|
profile.child4,
|
||||||
profile.child3,
|
profile.child3,
|
||||||
|
|
@ -6288,7 +6372,32 @@ export class ReportController extends Controller {
|
||||||
|
|
||||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||||
|
|
||||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
//หาคนที่เงินเดือนเท่ากับเงินเดือนสูงสุดในกลุ่ม
|
||||||
|
const filteredProfiles = await Promise.all(
|
||||||
|
_salaryPeriod.map(async (profile) => {
|
||||||
|
const salaryRankMax = await this.salaryEmployeeRankRepository
|
||||||
|
.createQueryBuilder("rank")
|
||||||
|
.leftJoin("rank.salaryEmployee_", "emp")
|
||||||
|
.where("emp.isActive = :isActive", { isActive: true })
|
||||||
|
.andWhere("emp.group = :group", { group: profile.group })
|
||||||
|
.orderBy("rank.step", "DESC")
|
||||||
|
.getOne();
|
||||||
|
|
||||||
|
const match =
|
||||||
|
salaryRankMax != null &&
|
||||||
|
profile.salaryLevel != null &&
|
||||||
|
profile.salaryLevel === salaryRankMax.step &&
|
||||||
|
profile.amount === salaryRankMax.salaryMonth;
|
||||||
|
|
||||||
|
if (!match) return null;
|
||||||
|
|
||||||
|
return { profile, salaryRankMax };
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
const validProfiles = filteredProfiles.filter((item): item is { profile: any, salaryRankMax: any } => item !== null);
|
||||||
|
|
||||||
|
const formattedData = validProfiles.map(({ profile }, index) => {
|
||||||
const fullNameParts = [
|
const fullNameParts = [
|
||||||
profile.child4,
|
profile.child4,
|
||||||
profile.child3,
|
profile.child3,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue