This commit is contained in:
kittapath 2025-01-17 10:40:19 +07:00
parent 09f0918482
commit 4dcaa92f63
2 changed files with 21 additions and 9 deletions

View file

@ -8,7 +8,12 @@ import { ProfileEmployee } from "../entities/ProfileEmployee";
import { ProfileGovernment, UpdateProfileGovernment } from "../entities/ProfileGovernment";
import { EmployeePosition } from "../entities/EmployeePosition";
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
import { calculateAge, calculateGovAge, calculateRetireDate, setLogDataDiff } from "../interfaces/utils";
import {
calculateAge,
calculateGovAge,
calculateRetireDate,
setLogDataDiff,
} from "../interfaces/utils";
import permission from "../interfaces/permission";
import { OrgRevision } from "../entities/OrgRevision";
@Route("api/v1/org/profile-employee/government")
@ -103,15 +108,16 @@ export class ProfileGovernmentEmployeeController extends Controller {
const data = {
org: org, //สังกัด
position: record.position, //ตำแหน่ง
posLevel: record.posType == null && record.posLevel == null
? null
: `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ
posLevel:
record.posType == null && record.posLevel == null
? null
: `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ
posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate),
dateRetireLaw: record.dateRetireLaw ?? null,
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
govAge: await calculateGovAge(profile.id,"EMPLOYEE"),
govAge: await calculateGovAge(profile.id, "EMPLOYEE"),
dateAppoint: record.dateAppoint,
dateStart: record.dateStart,
govAgeAbsent: record.govAgeAbsent,
@ -206,7 +212,10 @@ export class ProfileGovernmentEmployeeController extends Controller {
const data = {
org: org, //สังกัด
position: record.position, //ตำแหน่ง
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
posLevel:
record.posLevel == null
? null
: `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ
posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ
@ -215,7 +224,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId,"EMPLOYEE"),
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
@ -299,7 +308,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
reasonSameDate: record.reasonSameDate, //เหตุผลที่วันที่ไม่ตรงกัน
dateRetire: record.dateRetire ?? null, //วันครบเกษียณอายุ
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart), //อายุราชการ
govAge: await calculateGovAge(profileEmployeeId,"EMPLOYEE"),
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
govAgeAbsent: record.govAgeAbsent ?? null, // ขาดราชการ
govAgePlus: record.govAgePlus, // อายุราชการเกื้อกูล
dateRetireLaw: record.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย

View file

@ -202,7 +202,10 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
const data = {
org: org, //สังกัด
position: record.position, //ตำแหน่ง
posLevel: record.posLevel == null ? null : record.posLevel.posLevelName, //ระดับ
posLevel:
record.posLevel == null
? null
: `${record.posType.posTypeShortName}${record.posLevel.posLevelName}`, //ระดับ
posMasterNo: posMaster == null ? null : `${orgShortName} ${posMaster.posMasterNo}`, //เลขที่ตำแหน่ง
posType: record.posType == null ? null : record.posType.posTypeName, //ประเภท
dateLeave: record.birthDate == null ? null : calculateRetireDate(record.birthDate), //วันเกษียณ