Merge branch 'develop' of github.com:Frappet/bma-ehr-salary into develop
This commit is contained in:
commit
45202755ff
2 changed files with 193 additions and 431 deletions
|
|
@ -4733,21 +4733,23 @@ export class ReportController extends Controller {
|
|||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
const _salaryPeriod = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
type: Not("NONE"),
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
|
@ -4771,17 +4773,14 @@ export class ReportController extends Controller {
|
|||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
template: "emp2-11",
|
||||
reportName: "emp2-11",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
|
|
@ -4841,28 +4840,31 @@ export class ReportController extends Controller {
|
|||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
const salaryProfile = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
isRetired: true,
|
||||
isNext: true,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!salaryProfile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const formattedData = salaryProfile.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
|
|
@ -4879,17 +4881,19 @@ export class ReportController extends Controller {
|
|||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
template: "emp2-13",
|
||||
reportName: "emp2-13",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
|
|
@ -5112,28 +5116,30 @@ export class ReportController extends Controller {
|
|||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
const salaryProfile = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
isNext: true,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!salaryProfile) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const formattedData = salaryProfile.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
|
|
@ -5150,17 +5156,19 @@ export class ReportController extends Controller {
|
|||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
template: "emp2-17",
|
||||
reportName: "emp2-17",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
|
|
@ -5565,7 +5573,7 @@ export class ReportController extends Controller {
|
|||
}
|
||||
|
||||
return new HttpSuccess({
|
||||
template: "emp2-24",
|
||||
template: "blank",
|
||||
reportName: "emp2-24",
|
||||
});
|
||||
}
|
||||
|
|
@ -5578,20 +5586,90 @@ export class ReportController extends Controller {
|
|||
*/
|
||||
@Get("emp2-25/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp2_25(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
//งวดปีปัจจุบัน
|
||||
const salaryPeriodOCT = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
if (!salaryPeriodOCT) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
|
||||
const salaryPeriodAPR = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
period: "APR",
|
||||
year: salaryPeriodOCT.year,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriodAPR) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
|
||||
//งวดปีก่อนหน้า
|
||||
const perviousYearAPR = await this.salaryPeriodRepository.findOne({
|
||||
where:{
|
||||
period: "APR",
|
||||
year: salaryPeriodOCT.year-1,
|
||||
},
|
||||
});
|
||||
if (!perviousYearAPR) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า");
|
||||
}
|
||||
|
||||
const perviousYearOCT = await this.salaryPeriodRepository.findOne({
|
||||
where:{
|
||||
period: "OCT",
|
||||
year: salaryPeriodOCT.year-1,
|
||||
},
|
||||
});
|
||||
if (!perviousYearOCT) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือนก่อนหน้า");
|
||||
}
|
||||
|
||||
//ปีก่อนหน้า
|
||||
const salaryProfilePerviousAPR = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
salaryPeriodId: perviousYearAPR.id,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!salaryProfilePerviousAPR) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const salaryProfilePerviousOCT = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
salaryPeriodId: perviousYearOCT.id,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!salaryProfilePerviousOCT) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
//ปีปัจุบัน
|
||||
const salaryProfileCurrentAPR = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
|
|
@ -5601,13 +5679,46 @@ export class ReportController extends Controller {
|
|||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
if (!salaryProfileCurrentAPR) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
const salaryProfileCurrentOCT = await this.salaryProfileEmployeeRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP2",
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!salaryProfileCurrentOCT) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = salaryProfileCurrentOCT[0] == null ? "" : salaryProfileCurrentOCT[0].root;
|
||||
|
||||
const formattedData = salaryProfileCurrentOCT.map((profile, index) => {
|
||||
//งวดปีก่อนหน้า
|
||||
const matchedAPRProfileOld = salaryProfilePerviousAPR.find(aprProfile_old => aprProfile_old.citizenId === profile.citizenId);
|
||||
const matchedOCTProfileOld = salaryProfilePerviousOCT.find(octProfile_old => octProfile_old.citizenId === profile.citizenId);
|
||||
const amountUseAPR_Old = matchedAPRProfileOld ? matchedAPRProfileOld.amountUse : 0;
|
||||
const amountUseOCT_Old = matchedOCTProfileOld ? matchedOCTProfileOld.amountUse : 0;
|
||||
const amountUseOld = amountUseAPR_Old + amountUseOCT_Old;
|
||||
|
||||
//งวดปีปัจจุบัน
|
||||
const matchedAPRProfile = salaryProfileCurrentAPR.find(aprProfile => aprProfile.citizenId === profile.citizenId);
|
||||
const matchedOCTProfile = salaryProfileCurrentOCT.find(octProfile => octProfile.citizenId === profile.citizenId);
|
||||
const amountUseAPR = matchedAPRProfile ? matchedAPRProfile.amountUse : 0;
|
||||
const amountUseOCT = matchedOCTProfile ? matchedOCTProfile.amountUse : 0;
|
||||
const amountUse = amountUseAPR + amountUseOCT;
|
||||
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
|
|
@ -5624,22 +5735,26 @@ export class ReportController extends Controller {
|
|||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
position: profile.position,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
positionSalaryAmount: profile.positionSalaryAmount ? Extension.ToThaiNumber(profile.positionSalaryAmount.toLocaleString()) : null,
|
||||
amountUseOld: amountUseOld ? Extension.ToThaiNumber(amountUseOld.toLocaleString()) : null,
|
||||
amountUse: amountUse ? Extension.ToThaiNumber(amountUse.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
template: "emp2-25",
|
||||
reportName: "emp2-25",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriodOCT.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,353 +0,0 @@
|
|||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Patch,
|
||||
Route,
|
||||
Security,
|
||||
Tags,
|
||||
Body,
|
||||
Path,
|
||||
Request,
|
||||
Example,
|
||||
SuccessResponse,
|
||||
Response,
|
||||
Query,
|
||||
} from "tsoa";
|
||||
import { AppDataSource } from "../database/data-source";
|
||||
import HttpSuccess from "../interfaces/http-success";
|
||||
import HttpStatusCode from "../interfaces/http-status";
|
||||
import HttpError from "../interfaces/http-error";
|
||||
import { In, Not, IsNull, MoreThan } from "typeorm";
|
||||
import { Salarys } from "../entities/Salarys";
|
||||
import { SalaryRanks } from "../entities/SalaryRanks";
|
||||
import { PosType } from "../entities/PosType";
|
||||
import { PosLevel } from "../entities/PosLevel";
|
||||
import { SalaryPeriod } from "../entities/SalaryPeriod";
|
||||
import { SalaryOrg } from "../entities/SalaryOrg";
|
||||
import { SalaryProfile } from "../entities/SalaryProfile";
|
||||
import Extension from "../interfaces/extension";
|
||||
import { SalaryEmployee } from "../entities/SalaryEmployee";
|
||||
import { SalaryRankEmployee } from "../entities/SalaryRankEmployee";
|
||||
import { EmployeePosType } from "../entities/EmployeePosType";
|
||||
import { EmployeePosLevel } from "../entities/EmployeePosLevel";
|
||||
import { SalaryOrgEmployee } from "../entities/SalaryOrgEmployee";
|
||||
import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee";
|
||||
@Route("api/v1/salary/report/tum")
|
||||
@Tags("Tum")
|
||||
@Security("bearerAuth")
|
||||
@Response(
|
||||
HttpStatusCode.INTERNAL_SERVER_ERROR,
|
||||
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
|
||||
)
|
||||
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
|
||||
export class TumReportController extends Controller {
|
||||
private salaryPeriodRepository = AppDataSource.getRepository(SalaryPeriod);
|
||||
private salaryRepository = AppDataSource.getRepository(Salarys);
|
||||
private salaryEmployeeRepository = AppDataSource.getRepository(SalaryEmployee);
|
||||
private salaryRankRepository = AppDataSource.getRepository(SalaryRanks);
|
||||
private salaryEmployeeRankRepository = AppDataSource.getRepository(SalaryRankEmployee);
|
||||
private poTypeRepository = AppDataSource.getRepository(PosType);
|
||||
private poTypeEmployeeRepository = AppDataSource.getRepository(EmployeePosType);
|
||||
private posLevelRepository = AppDataSource.getRepository(PosLevel);
|
||||
private posLevelEmployeeRepository = AppDataSource.getRepository(EmployeePosLevel);
|
||||
private salaryOrgRepository = AppDataSource.getRepository(SalaryOrg);
|
||||
private salaryOrgEmployeeRepository = AppDataSource.getRepository(SalaryOrgEmployee);
|
||||
private salaryProfileRepository = AppDataSource.getRepository(SalaryProfile);
|
||||
private salaryProfileEmployeeRepository = AppDataSource.getRepository(SalaryProfileEmployee);
|
||||
|
||||
/**
|
||||
* API 11-รายชื่อลูกจ้างประจำผู้มีผลการประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานอยู่ในระดับดีเด่น
|
||||
*
|
||||
* @summary 11-รายชื่อลูกจ้างประจำผู้มีผลการประเมินประสิทธิภาพและประสิทธิผลการปฏิบัติงานอยู่ในระดับดีเด่น
|
||||
*
|
||||
*/
|
||||
@Get("emp2-11/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp2_11(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
];
|
||||
|
||||
const fullName = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API 13-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ที่เกษียณอายุราชการ
|
||||
*
|
||||
* @summary 13-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ ที่เกษียณอายุราชการ
|
||||
*
|
||||
*/
|
||||
@Get("emp2-13/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp2_13(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
];
|
||||
|
||||
const fullName = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API 17-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง)
|
||||
*
|
||||
* @summary 17-บัญชีรายละเอียดแสดงการเลื่อนขั้นค่าจ้างและให้ลูกจ้างประจำกรุงเทพมหานครได้รับอัตราค่าจ้างสูงกว่าอัตราค่าจ้างขั้นสูงของตำแหน่งที่ได้รับแต่งตั้งในแต่ละระดับ (แนบท้ายคำสั่ง)
|
||||
*
|
||||
*/
|
||||
@Get("emp2-17/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp2_17(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
];
|
||||
|
||||
const fullName = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* API 25-แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร
|
||||
*
|
||||
* @summary 25-แบบฟอร์มบัญชีถือจ่ายอัตราค่าจ้างลูกจ้างประจำกรุงเทพมหานคร
|
||||
*
|
||||
*/
|
||||
@Get("emp2-25/{rootId}/{salaryPeriodId}")
|
||||
async SalaryReportEmp2_25(@Path() rootId: string, @Path() salaryPeriodId: string) {
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: {
|
||||
id: salaryPeriodId,
|
||||
},
|
||||
});
|
||||
if (!salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
|
||||
}
|
||||
const _salaryPeriod = await this.salaryProfileRepository.find({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: {
|
||||
salaryOrg: {
|
||||
snapshot: "SNAP1",
|
||||
rootId: rootId,
|
||||
salaryPeriodId: salaryPeriodId,
|
||||
},
|
||||
},
|
||||
order: {
|
||||
orgShortName: "ASC",
|
||||
posMasterNo: "ASC",
|
||||
},
|
||||
});
|
||||
|
||||
if (!_salaryPeriod) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
}
|
||||
|
||||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
profile.child1,
|
||||
profile.root,
|
||||
`${profile.prefix}${profile.firstName} ${profile.lastName}`,
|
||||
];
|
||||
|
||||
const fullName = fullNameParts
|
||||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
posLevel: profile.posLevel,
|
||||
posNumber:
|
||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||
reason: null,
|
||||
};
|
||||
});
|
||||
|
||||
return new HttpSuccess({
|
||||
template: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
agency: agency,
|
||||
data: formattedData,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue