เพิ่มข้อมูล "อายุราชการ (กทม.)" #2285
All checks were successful
Build & Deploy on Dev / build (push) Successful in 49s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 49s
This commit is contained in:
parent
5b726e69c8
commit
1696890f74
3 changed files with 10 additions and 2 deletions
|
|
@ -127,6 +127,7 @@ export class ProfileGovernmentHistoryController extends Controller {
|
||||||
dateRetireLaw: record.dateRetireLaw ?? null,
|
dateRetireLaw: record.dateRetireLaw ?? null,
|
||||||
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
|
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
|
||||||
govAge: await calculateGovAge(profile.id, "OFFICER"),
|
govAge: await calculateGovAge(profile.id, "OFFICER"),
|
||||||
|
govAgeBkk: await calculateGovAge(profile.id, "OFFICER", true),
|
||||||
dateAppoint: record.dateAppoint,
|
dateAppoint: record.dateAppoint,
|
||||||
dateStart: record.dateStart,
|
dateStart: record.dateStart,
|
||||||
govAgeAbsent: record.govAgeAbsent,
|
govAgeAbsent: record.govAgeAbsent,
|
||||||
|
|
@ -310,6 +311,7 @@ export class ProfileGovernmentHistoryController extends Controller {
|
||||||
dateRetireLaw: record?.dateRetireLaw ?? null,
|
dateRetireLaw: record?.dateRetireLaw ?? null,
|
||||||
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
|
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
|
||||||
govAge: await calculateGovAge(profileId, "OFFICER"),
|
govAge: await calculateGovAge(profileId, "OFFICER"),
|
||||||
|
govAgeBkk: await calculateGovAge(profileId, "OFFICER", true),
|
||||||
dateAppoint: record?.dateAppoint,
|
dateAppoint: record?.dateAppoint,
|
||||||
dateStart: record?.dateStart,
|
dateStart: record?.dateStart,
|
||||||
govAgeAbsent: record?.govAgeAbsent,
|
govAgeAbsent: record?.govAgeAbsent,
|
||||||
|
|
@ -483,6 +485,7 @@ export class ProfileGovernmentHistoryController extends Controller {
|
||||||
dateRetireLaw: record?.dateRetireLaw ?? null,
|
dateRetireLaw: record?.dateRetireLaw ?? null,
|
||||||
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
|
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart),
|
||||||
govAge: await calculateGovAge(profileId, "OFFICER"),
|
govAge: await calculateGovAge(profileId, "OFFICER"),
|
||||||
|
govAgeBkk: await calculateGovAge(profileId, "OFFICER", true),
|
||||||
dateAppoint: record?.dateAppoint,
|
dateAppoint: record?.dateAppoint,
|
||||||
dateStart: record?.dateStart,
|
dateStart: record?.dateStart,
|
||||||
govAgeAbsent: record?.govAgeAbsent,
|
govAgeAbsent: record?.govAgeAbsent,
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
dateRetireLaw: record.dateRetireLaw ?? null,
|
dateRetireLaw: record.dateRetireLaw ?? null,
|
||||||
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
|
// govAge: record.dateStart == null ? null : calculateAge(record.dateStart),
|
||||||
govAge: await calculateGovAge(profile.id, "EMPLOYEE"),
|
govAge: await calculateGovAge(profile.id, "EMPLOYEE"),
|
||||||
|
govAgeBkk: await calculateGovAge(profile.id, "EMPLOYEE", true),
|
||||||
dateAppoint: record.dateAppoint,
|
dateAppoint: record.dateAppoint,
|
||||||
dateStart: record.dateStart,
|
dateStart: record.dateStart,
|
||||||
govAgeAbsent: record.govAgeAbsent,
|
govAgeAbsent: record.govAgeAbsent,
|
||||||
|
|
@ -292,6 +293,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
|
dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
|
||||||
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
|
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
|
||||||
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
|
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
|
||||||
|
govAgeBkk: await calculateGovAge(profileEmployeeId, "EMPLOYEE", true),
|
||||||
govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
|
govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
|
||||||
govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
|
govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
|
||||||
dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
|
dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
|
||||||
|
|
@ -451,6 +453,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
|
dateRetire: record?.dateRetire ?? null, //วันครบเกษียณอายุ
|
||||||
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
|
// govAge: record?.dateStart == null ? null : calculateAge(record?.dateStart), //อายุราชการ
|
||||||
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
|
govAge: await calculateGovAge(profileEmployeeId, "EMPLOYEE"),
|
||||||
|
govAgeBkk: await calculateGovAge(profileEmployeeId, "EMPLOYEE", true),
|
||||||
govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
|
govAgeAbsent: record?.govAgeAbsent ?? null, // ขาดราชการ
|
||||||
govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
|
govAgePlus: record?.govAgePlus, // อายุราชการเกื้อกูล
|
||||||
dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
|
dateRetireLaw: record?.dateRetireLaw ?? null, // วันที่เกษียฯอายุราชการตามกฎหมาย
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ export function calculateAge(start: Date, end = new Date()) {
|
||||||
return { year, month, day };
|
return { year, month, day };
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function calculateGovAge(profileId: string, type: string) {
|
export async function calculateGovAge(profileId: string, type: string, bkk?: boolean) {
|
||||||
// type = OFFICER , EMPLOYEE
|
// type = OFFICER , EMPLOYEE
|
||||||
const isEmployee = type === "EMPLOYEE";
|
const isEmployee = type === "EMPLOYEE";
|
||||||
|
|
||||||
|
|
@ -107,7 +107,9 @@ export async function calculateGovAge(profileId: string, type: string) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// const firstStartDate = new Date(records[0].date);
|
// const firstStartDate = new Date(records[0].date);
|
||||||
const firstStartDate = profile?.dateAppoint ? profile?.dateAppoint : new Date();
|
const firstStartDate = !bkk
|
||||||
|
? profile?.dateAppoint ? profile?.dateAppoint : new Date()
|
||||||
|
: profile?.dateStart ? profile?.dateStart : new Date() ;
|
||||||
const firstEndDate = endDateFristRec ? new Date(endDateFristRec.dateGovernment) : new Date();
|
const firstEndDate = endDateFristRec ? new Date(endDateFristRec.dateGovernment) : new Date();
|
||||||
|
|
||||||
// console.log("firstStartDate1", firstStartDate);
|
// console.log("firstStartDate1", firstStartDate);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue