no message
This commit is contained in:
parent
928d806313
commit
2446c755e6
2 changed files with 38 additions and 30 deletions
|
|
@ -61,6 +61,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||
.leftJoinAndSelect("current_holder.profileLeaves", "profileLeaves")
|
||||
.leftJoinAndSelect("current_holder.profileAssessments", "profileAssessments")
|
||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||
|
|
@ -191,11 +192,9 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
const isSpecial = specialPosition ? specialPosition.isSpecial : null;
|
||||
|
||||
const latestProfileAssessment = item.current_holder.profileAssessments
|
||||
? item.current_holder.profileAssessments.sort((a:any, b:any) => b.date - a.date)[0]
|
||||
: null;
|
||||
const pointSumtotal = latestProfileAssessment
|
||||
? latestProfileAssessment.pointSumTotal
|
||||
? item.current_holder.profileAssessments.sort((a: any, b: any) => b.date - a.date)[0]
|
||||
: null;
|
||||
const pointSumtotal = latestProfileAssessment ? latestProfileAssessment.pointSumTotal : null;
|
||||
return {
|
||||
id: item.id,
|
||||
profileId: item.current_holder.id,
|
||||
|
|
@ -239,8 +238,8 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
? true
|
||||
: false,
|
||||
isSuspension: item.current_holder.dateRetire == null ? false : true,
|
||||
isAbsent: false,
|
||||
isLeave: false,
|
||||
isAbsent: item.current_holder.profileDisciplines.length > 0 ? true : false,
|
||||
isLeave: item.current_holder.profileLeaves.length > 0 ? true : false,
|
||||
isRetired:
|
||||
item.current_holder.birthDate == null ||
|
||||
calculateRetireDate(item.current_holder.birthDate).getFullYear() != body.year
|
||||
|
|
@ -287,6 +286,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
||||
.leftJoinAndSelect("current_holder.profileSalarys", "profileSalarys")
|
||||
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||
.leftJoinAndSelect("current_holder.profileLeaves", "profileLeaves")
|
||||
.leftJoinAndSelect("current_holder.profileAssessments", "profileAssessments")
|
||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||
|
|
@ -401,10 +401,10 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
datePeriodStart.getMonth() - 6,
|
||||
),
|
||||
);
|
||||
const latestProfileAssessment = item.current_holder.profileAssessments
|
||||
? item.current_holder.profileAssessments.sort((a: any, b: any) => b.date - a.date)[0]
|
||||
: null;
|
||||
const pointSumtotal = latestProfileAssessment ? latestProfileAssessment.pointSumTotal : null;
|
||||
const latestProfileAssessment = item.current_holder.profileAssessments
|
||||
? item.current_holder.profileAssessments.sort((a: any, b: any) => b.date - a.date)[0]
|
||||
: null;
|
||||
const pointSum = latestProfileAssessment ? latestProfileAssessment.pointSum : null;
|
||||
return {
|
||||
profileId: item.current_holder.id,
|
||||
salaryLevel: item.current_holder.salaryLevel,
|
||||
|
|
@ -435,7 +435,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
child3: item.orgChild3?.orgChild3Name ? item.orgChild3.orgChild3Name : null,
|
||||
child4Id: item.orgChild4Id,
|
||||
child4: item.orgChild4?.orgChild4Name ? item.orgChild4.orgChild4Name : null,
|
||||
result: pointSumtotal,
|
||||
result: pointSum,
|
||||
duration: null,
|
||||
isPunish:
|
||||
item.current_holder.profileDisciplines.filter(
|
||||
|
|
@ -450,8 +450,8 @@ export class OrganizationUnauthorizeController extends Controller {
|
|||
? true
|
||||
: false,
|
||||
isSuspension: item.current_holder.dateRetire == null ? false : true,
|
||||
isAbsent: false,
|
||||
isLeave: false,
|
||||
isAbsent: item.current_holder.profileDisciplines.length > 0 ? true : false,
|
||||
isLeave: item.current_holder.profileLeaves.length > 0 ? true : false,
|
||||
isRetired:
|
||||
item.current_holder.birthDate == null ||
|
||||
calculateRetireDate(item.current_holder.birthDate).getFullYear() != body.year
|
||||
|
|
|
|||
|
|
@ -17,21 +17,31 @@ export function calculateAge(start: Date, end = new Date()) {
|
|||
// end.getDate();
|
||||
// }
|
||||
|
||||
if (day < 0) {
|
||||
month -= 1;
|
||||
day += new Date(end.getFullYear(), end.getMonth(), 0).getDate();
|
||||
}
|
||||
|
||||
if (month < 0) {
|
||||
month += 12;
|
||||
year -= 1;
|
||||
}
|
||||
if (day < 0) {
|
||||
month -= 1;
|
||||
day += new Date(end.getFullYear(), end.getMonth(), 0).getDate();
|
||||
}
|
||||
|
||||
if (month < 0) {
|
||||
month += 12;
|
||||
year -= 1;
|
||||
}
|
||||
|
||||
return { year, month, day };
|
||||
}
|
||||
|
||||
export function calculateRetireDate(birthDate: Date) {
|
||||
// let _birthDate = birthDate;
|
||||
|
||||
// _birthDate.setFullYear(_birthDate.getFullYear() + 60); var year = d.getFullYear();
|
||||
var d = birthDate;
|
||||
var year = d.getFullYear();
|
||||
var month = d.getMonth();
|
||||
var day = d.getDate();
|
||||
var c = new Date(year + 60, month, day);
|
||||
return c;
|
||||
}
|
||||
export function calculateRetireLaw(birthDate: Date) {
|
||||
let dd = birthDate.getDate();
|
||||
let mm = birthDate.getMonth();
|
||||
let yy = birthDate.getFullYear();
|
||||
|
|
@ -39,23 +49,21 @@ export function calculateRetireDate(birthDate: Date) {
|
|||
let flag = true;
|
||||
|
||||
switch (mm) {
|
||||
case 10:
|
||||
case 9:
|
||||
if (dd >= 2) flag = false;
|
||||
break;
|
||||
case 11:
|
||||
case 10:
|
||||
flag = false;
|
||||
break;
|
||||
case 12:
|
||||
case 11:
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (flag) return new Date(`${yy + 60}-09-30T00:00:00.000+07:00`);
|
||||
if (flag == true) return new Date(`${yy + 60}-09-30T00:00:00.000+07:00`);
|
||||
|
||||
return new Date(`${yy + 61}-09-30T00:00:00.000+07:00`);
|
||||
}
|
||||
export function calculateRetireLaw(birthDate: Date) {
|
||||
let yy = birthDate.getFullYear();
|
||||
return new Date(`${yy + 60}-09-30T00:00:00.000+07:00`);
|
||||
}
|
||||
|
||||
export function calculateRetireYear(birthDate: Date) {
|
||||
let dd = birthDate.getDate();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue