#867 (13)
This commit is contained in:
parent
ba00ce14d2
commit
3fcce9c15c
1 changed files with 11 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ import { RequestWithUser } from "../middlewares/user";
|
||||||
import { Command } from "../entities/Command";
|
import { Command } from "../entities/Command";
|
||||||
import { ProfileSalary } from "../entities/ProfileSalary";
|
import { ProfileSalary } from "../entities/ProfileSalary";
|
||||||
import { Profile } from "../entities/Profile";
|
import { Profile } from "../entities/Profile";
|
||||||
|
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||||
export function calculateAge(start: Date, end = new Date()) {
|
export function calculateAge(start: Date, end = new Date()) {
|
||||||
if (start.getTime() > end.getTime()) return null;
|
if (start.getTime() > end.getTime()) return null;
|
||||||
|
|
||||||
|
|
@ -86,11 +87,19 @@ export async function calculateGovAge(profileId: string, type: string) {
|
||||||
|
|
||||||
return { years, months, days };
|
return { years, months, days };
|
||||||
};
|
};
|
||||||
const profile = await AppDataSource.getRepository(Profile).findOne({
|
let profile:any;
|
||||||
|
profile = await AppDataSource.getRepository(Profile).findOne({
|
||||||
where:{
|
where:{
|
||||||
id:profileId
|
id:profileId
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if(isEmployee){
|
||||||
|
profile = await AppDataSource.getRepository(ProfileEmployee).findOne({
|
||||||
|
where:{
|
||||||
|
id:profileId
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
// const firstStartDate = new Date(records[0].date);
|
// const firstStartDate = new Date(records[0].date);
|
||||||
const firstStartDate = profile?.dateAppoint ? profile?.dateAppoint : new Date();
|
const firstStartDate = profile?.dateAppoint ? profile?.dateAppoint : new Date();
|
||||||
const firstEndDate = endDateFristRec ? new Date(endDateFristRec.dateGovernment) : new Date();
|
const firstEndDate = endDateFristRec ? new Date(endDateFristRec.dateGovernment) : new Date();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue