Last active
December 22, 2022 13:56
-
-
Save chrisjangl/71deae62e47a9f6ac291062e7c9a5ad1 to your computer and use it in GitHub Desktop.
Revisions
-
chrisjangl revised this gist
Dec 22, 2022 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -41,3 +41,10 @@ for (var i = 0; i < rows.length; i++) { } console.log(contributions) // total the contributions for (amount of [...contributions]) { if (amount[1]) { total = total + Number(amount[1].replace("$", "")) } } -
chrisjangl revised this gist
Jan 3, 2022 . No changes.There are no files selected for viewing
-
chrisjangl created this gist
Jan 3, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ // get all rows that we're interested in (each represent 1 paycheck) let rows = document.getElementById('check-listings-table').querySelectorAll('tbody tr[role="row"]'); // instantiate the array we'll use for all contributions var contributions = []; // loop over each row for (var i = 0; i < rows.length; i++) { // we never actually use this... let row = rows[i]; // get the date of the paycheck let paycheckDate = rows[i].querySelectorAll('td')[2].innerHTML; // info about the paycheck is paired to a button click on the paycheck row let expandButton = rows[i].querySelectorAll('input.ess-view'); expandButton[1].click(); // assign each paycheck category, we can loop over each as needed let earnings = rows[i].nextElementSibling.querySelector('td.extraDetailsRow').querySelectorAll('table')[0], taxes = rows[i].nextElementSibling.querySelector('td.extraDetailsRow').querySelectorAll('table')[1], deductions = rows[i].nextElementSibling.querySelector('td.extraDetailsRow').querySelectorAll('table')[2], netPay = rows[i].nextElementSibling.querySelector('td.extraDetailsRow').querySelectorAll('table')[3]; var FSA; // there may or may not be a contribution for any given paycheck, // so we'll need to loop over each deduction to see if it's an FSA deduction for(item of [...deductions.querySelectorAll('tr')]) { if ("FSA" === item.children[0].innerHTML) { FSA = item.children[1].innerHTML; } } let contribution = [paycheckDate, FSA] contributions.push(contribution); // close the paycheck info row on the screen expandButton[1].click(); } console.log(contributions)