Advertisement
aivavic

Untitled

Nov 21st, 2019
606
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. return Promise.all([
  2.       UB.Repository('hr_employee')
  3.         .attrs(['datName', 'shortFIO', 'sexType', 'firstName', 'middleName', 'lastName'])
  4.         .selectById(employeeID),
  5.       employeeNumberRs.selectSingle()
  6.     ]).then(([employee, employeeNumber]) => (
  7.       Promise.all([
  8.         UB.Repository('hr_employeePosition')
  9.           .attrs(['departmentID', 'positionID', 'employeeID'])
  10.           .where('dateFrom', '<=', pDate)
  11.           .where('dateTo', '>=', pDate)
  12.           .where('employeeNumberID', '=', (employeeNumber ? employeeNumber.ID : 0))
  13.           .selectSingle()
  14.       ]).then(([employeePosition]) => (
  15.         Promise.all([
  16.           UB.Repository('hr_position')
  17.             .attrs(['nameGen', 'name', 'positionType', 'psCategory.shortName', 'dictStatePayID'])
  18.             .where('mi_data_id', '=', employeePosition ? employeePosition.positionID : 0)
  19.             .where('state', '=', 'ACTIVE')
  20.             .misc({ __mip_ondate: pDate })
  21.             .selectSingle(),
  22.           UB.Repository('hr_publServRang')
  23.             .attrs(['dictRankID.code'])
  24.             .where('employeeID', '=', (employeePosition ? employeePosition.employeeID : 0))
  25.             .where('dateFrom', '<=', pDate)
  26.             .where('dateTo', '>=', pDate)
  27.             .selectSingle()
  28.         ]).then(([ position, servRank ]) => (
  29.           Promise.all([
  30.             UB.Repository('hr_dictStatePay')
  31.               .attrs(['groupN'])
  32.               .selectById((position && position.dictStatePayID) || 0)
  33.           ]).then(([statePay]) => ({
  34.             employee,
  35.             employeeNumber,
  36.             employeePosition,
  37.             position,
  38.             servRank,
  39.             statePay,
  40.             respPosInfo,
  41.             orgToName,
  42.             reportViewCode
  43.           }))
  44.         ))
  45.       ))
  46.     ))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement