update report
This commit is contained in:
parent
3b9002f505
commit
74644cc70c
1 changed files with 138 additions and 89 deletions
|
|
@ -334,58 +334,82 @@ export class ReportController extends Controller {
|
||||||
.orderBy(`registryOfficer.${sortBy}`, sort)
|
.orderBy(`registryOfficer.${sortBy}`, sort)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
|
||||||
const mapData = lists.map((x) => ({
|
const mapData = await Promise.all(lists.map(async(x) => {
|
||||||
profileId: x.profileId,
|
const position = await AppDataSource.query("CALL GetProfileSalaryPosition(?)", [x.profileId])
|
||||||
citizenId: x.citizenId,
|
const _position = position.length > 0 ? position[0] : [];
|
||||||
prefix: x.prefix,
|
const lastPosition = _position.length > 0 ? _position[_position.length - 1] : null; // last row
|
||||||
firstName: x.firstName,
|
const mapPosition = lastPosition
|
||||||
lastName: x.lastName,
|
? [{
|
||||||
isProbation: x.isProbation,
|
Years: lastPosition.Years ? Math.floor(Number(lastPosition.Years)) : 0,
|
||||||
isLeave: x.isLeave,
|
Months: lastPosition.Months ? Math.floor(Number(lastPosition.Months)) : 0,
|
||||||
isRetirement: x.isRetirement,
|
Daysday: lastPosition.Days ? Math.floor(Number(lastPosition.Days)) : 0,
|
||||||
leaveType: x.leaveType,
|
}]
|
||||||
posMasterNo: x.posMasterNo,
|
: [];
|
||||||
orgRootId: x.orgRootId,
|
const posLevel = await AppDataSource.query("CALL GetProfileSalaryLevel(?)", [x.profileId])
|
||||||
orgChild1Id: x.orgChild1Id,
|
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
|
||||||
orgChild2Id: x.orgChild2Id,
|
const lastPosLevel= _posLevel.length > 0 ? _posLevel[_posLevel.length - 1] : null;
|
||||||
orgChild3Id: x.orgChild3Id,
|
const mapPosLevel = lastPosLevel
|
||||||
orgChild4Id: x.orgChild4Id,
|
? [{
|
||||||
orgRootName: x.orgRootName,
|
Years: lastPosLevel.Years ? Math.floor(Number(lastPosLevel.Years)) : 0,
|
||||||
orgChild1Name: x.orgChild1Name,
|
Months: lastPosLevel.Months ? Math.floor(Number(lastPosLevel.Months)) : 0,
|
||||||
orgChild2Name: x.orgChild2Name,
|
Daysday: lastPosLevel.Days ? Math.floor(Number(lastPosLevel.Days)) : 0,
|
||||||
orgChild3Name: x.orgChild3Name,
|
}]
|
||||||
orgChild4Name: x.orgChild4Name,
|
: [];
|
||||||
org: x.org,
|
return {
|
||||||
searchShortName: x.searchShortName,
|
profileId: x.profileId,
|
||||||
posExecutiveName: x.posExecutiveName,
|
citizenId: x.citizenId,
|
||||||
position: x.position,
|
prefix: x.prefix,
|
||||||
posTypeName: x.posTypeName,
|
firstName: x.firstName,
|
||||||
posLevelName: x.posLevelName,
|
lastName: x.lastName,
|
||||||
gender: x.gender,
|
isProbation: x.isProbation,
|
||||||
relationship: x.relationship,
|
isLeave: x.isLeave,
|
||||||
dateAppoint: x.dateAppoint,
|
isRetirement: x.isRetirement,
|
||||||
dateRetire: x.dateRetire,
|
leaveType: x.leaveType,
|
||||||
dateRetireLaw: x.dateRetireLaw,
|
posMasterNo: x.posMasterNo,
|
||||||
birthdate: x.birthdate,
|
orgRootId: x.orgRootId,
|
||||||
degree: x.degree,
|
orgChild1Id: x.orgChild1Id,
|
||||||
age: x.age,
|
orgChild2Id: x.orgChild2Id,
|
||||||
currentPosition: null,
|
orgChild3Id: x.orgChild3Id,
|
||||||
lengthPosition: null,
|
orgChild4Id: x.orgChild4Id,
|
||||||
positionDate: {
|
orgRootName: x.orgRootName,
|
||||||
Years: x.Years,
|
orgChild1Name: x.orgChild1Name,
|
||||||
Months: x.Months,
|
orgChild2Name: x.orgChild2Name,
|
||||||
Days: x.Days,
|
orgChild3Name: x.orgChild3Name,
|
||||||
},
|
orgChild4Name: x.orgChild4Name,
|
||||||
posExcutiveDate: {
|
org: x.org,
|
||||||
Years: x.posExecutiveYears,
|
searchShortName: x.searchShortName,
|
||||||
Months: x.posExecutiveMonths,
|
posExecutiveName: x.posExecutiveName,
|
||||||
Days: x.posExecutiveDays,
|
position: x.position,
|
||||||
},
|
posTypeName: x.posTypeName,
|
||||||
posLevelDate: {
|
posLevelName: x.posLevelName,
|
||||||
Years: x.levelYears,
|
gender: x.gender,
|
||||||
Months: x.levelMonths,
|
relationship: x.relationship,
|
||||||
Days: x.levelDays,
|
dateAppoint: x.dateAppoint,
|
||||||
},
|
dateRetire: x.dateRetire,
|
||||||
|
dateRetireLaw: x.dateRetireLaw,
|
||||||
|
birthdate: x.birthdate,
|
||||||
|
degree: x.degree,
|
||||||
|
age: x.age,
|
||||||
|
currentPosition: null,
|
||||||
|
lengthPosition: null,
|
||||||
|
// positionDate: {
|
||||||
|
// Years: x.Years,
|
||||||
|
// Months: x.Months,
|
||||||
|
// Days: x.Days,
|
||||||
|
// },
|
||||||
|
// posExcutiveDate: {
|
||||||
|
// Years: x.posExecutiveYears,
|
||||||
|
// Months: x.posExecutiveMonths,
|
||||||
|
// Days: x.posExecutiveDays,
|
||||||
|
// },
|
||||||
|
// posLevelDate: {
|
||||||
|
// Years: x.levelYears,
|
||||||
|
// Months: x.levelMonths,
|
||||||
|
// Days: x.levelDays,
|
||||||
|
// },
|
||||||
|
positionDate: mapPosition,
|
||||||
|
posLevelDate: mapPosLevel
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
data: mapData,
|
data: mapData,
|
||||||
|
|
@ -654,43 +678,68 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
.orderBy(`registryEmployee.${sortBy}`, sort)
|
.orderBy(`registryEmployee.${sortBy}`, sort)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
const mapData = lists.map((x) => ({
|
|
||||||
profileId: x.profileEmployeeId,
|
const mapData = await Promise.all(lists.map(async(x) => {
|
||||||
citizenId: x.citizenId,
|
const position = await AppDataSource.query("CALL GetProfileEmployeeSalaryPosition(?)", [x.profileEmployeeId])
|
||||||
prefix: x.prefix,
|
const _position = position.length > 0 ? position[0] : [];
|
||||||
firstName: x.firstName,
|
const lastPosition = _position.length > 0 ? _position[_position.length - 1] : null;
|
||||||
lastName: x.lastName,
|
const mapPosition = lastPosition
|
||||||
isProbation: x.isProbation,
|
? [{
|
||||||
isLeave: x.isLeave,
|
Years: lastPosition.Years ? Math.floor(Number(lastPosition.Years)) : 0,
|
||||||
isRetirement: x.isRetirement,
|
Months: lastPosition.Months ? Math.floor(Number(lastPosition.Months)) : 0,
|
||||||
leaveType: x.leaveType,
|
Daysday: lastPosition.Days ? Math.floor(Number(lastPosition.Days)) : 0,
|
||||||
posMasterNo: x.posMasterNo,
|
}]
|
||||||
orgRootId: x.orgRootId,
|
: [];
|
||||||
orgChild1Id: x.orgChild1Id,
|
const posLevel = await AppDataSource.query("CALL GetProfileEmployeeSalaryLevel(?)", [x.profileEmployeeId])
|
||||||
orgChild2Id: x.orgChild2Id,
|
const _posLevel = posLevel.length > 0 ? posLevel[0] : [];
|
||||||
orgChild3Id: x.orgChild3Id,
|
const lastPosLevel= _posLevel.length > 0 ? _posLevel[_posLevel.length - 1] : null;
|
||||||
orgChild4Id: x.orgChild4Id,
|
const mapPosLevel = lastPosLevel
|
||||||
orgRootName: x.orgRootName,
|
? [{
|
||||||
orgChild1Name: x.orgChild1Name,
|
Years: lastPosLevel.Years ? Math.floor(Number(lastPosLevel.Years)) : 0,
|
||||||
orgChild2Name: x.orgChild2Name,
|
Months: lastPosLevel.Months ? Math.floor(Number(lastPosLevel.Months)) : 0,
|
||||||
orgChild3Name: x.orgChild3Name,
|
Daysday: lastPosLevel.Days ? Math.floor(Number(lastPosLevel.Days)) : 0,
|
||||||
orgChild4Name: x.orgChild4Name,
|
}]
|
||||||
org: x.org,
|
: [];
|
||||||
searchShortName: x.searchShortName,
|
return {
|
||||||
position: x.position,
|
profileId: x.profileEmployeeId,
|
||||||
posTypeName: x.posTypeName,
|
citizenId: x.citizenId,
|
||||||
posLevelName: x.posLevelName,
|
prefix: x.prefix,
|
||||||
gender: x.gender,
|
firstName: x.firstName,
|
||||||
relationship: x.relationship,
|
lastName: x.lastName,
|
||||||
dateAppoint: x.dateAppoint,
|
isProbation: x.isProbation,
|
||||||
dateRetire: x.dateRetire,
|
isLeave: x.isLeave,
|
||||||
dateRetireLaw: x.dateRetireLaw,
|
isRetirement: x.isRetirement,
|
||||||
birthdate: x.birthdate,
|
leaveType: x.leaveType,
|
||||||
degree: x.degree,
|
posMasterNo: x.posMasterNo,
|
||||||
age: x.age,
|
orgRootId: x.orgRootId,
|
||||||
currentPosition: null,
|
orgChild1Id: x.orgChild1Id,
|
||||||
lengthPosition: null,
|
orgChild2Id: x.orgChild2Id,
|
||||||
}));
|
orgChild3Id: x.orgChild3Id,
|
||||||
|
orgChild4Id: x.orgChild4Id,
|
||||||
|
orgRootName: x.orgRootName,
|
||||||
|
orgChild1Name: x.orgChild1Name,
|
||||||
|
orgChild2Name: x.orgChild2Name,
|
||||||
|
orgChild3Name: x.orgChild3Name,
|
||||||
|
orgChild4Name: x.orgChild4Name,
|
||||||
|
org: x.org,
|
||||||
|
searchShortName: x.searchShortName,
|
||||||
|
position: x.position,
|
||||||
|
posTypeName: x.posTypeName,
|
||||||
|
posLevelName: x.posLevelName,
|
||||||
|
gender: x.gender,
|
||||||
|
relationship: x.relationship,
|
||||||
|
dateAppoint: x.dateAppoint,
|
||||||
|
dateRetire: x.dateRetire,
|
||||||
|
dateRetireLaw: x.dateRetireLaw,
|
||||||
|
birthdate: x.birthdate,
|
||||||
|
degree: x.degree,
|
||||||
|
age: x.age,
|
||||||
|
currentPosition: null,
|
||||||
|
lengthPosition: null,
|
||||||
|
positionDate: mapPosition,
|
||||||
|
posLevelDate: mapPosLevel
|
||||||
|
}
|
||||||
|
}));
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
data: mapData,
|
data: mapData,
|
||||||
total: total,
|
total: total,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue