Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mdawaffe
Last active August 1, 2017 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdawaffe/1b5f0952c1a2a1010ec63b1225eb5c6b to your computer and use it in GitHub Desktop.
Save mdawaffe/1b5f0952c1a2a1010ec63b1225eb5c6b to your computer and use it in GitHub Desktop.
Print Trinet/HR Passport Paystubs

Trinet Paystubs

Prints all your paystubs from Trinet one by one. When saving PDFs, the date is used as the filename.

To Use

  1. Log in to HR Passport.
  2. Myself → My Payroll → Earnings Statements
  3. (Click "View All Paychecks" at the bottom of the page if such a link exists)
  4. Paste the contents of this gist's script.js into your browser's console.
  5. Run printPayStubs() in your browser's console.
  6. You'll probably see your browser's popup blocker. If you do, set it to allow all popups on the HR Passport domain. Then run printPayStubs() again.
function printPayStubs() {
let details = document.querySelectorAll( 'td.detail' )
let queue = []
for ( let detail of details ) {
let datePieces = detail.parentNode.querySelector( 'td:nth-of-type(2)' ).textContent.split( '/' )
let date = datePieces[2] + '-' + datePieces[0] + '-' + datePieces[1]
let URL = detail.querySelector( 'a' ).onclick.toString().match( /(\/Link2HR.eng.+?)'/ )[1]
queue.push( next => {
let payStub = window.open( URL )
payStub.addEventListener( 'load', function() {
payStub.document.title = date // For the sake of the PDF's filename
payStub.print()
payStub.close()
next()
}, false )
} )
}
function run() {
let printPayStub = queue.shift()
if ( printPayStub ) {
printPayStub( run )
}
}
run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment