Last active
March 2, 2017 00:03
-
-
Save Jwsonic/d7a1ef60d06b511b184a0a7c33b067e7 to your computer and use it in GitHub Desktop.
CC stuff
This file contains 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 characters
const money = t => parseFloat(t.trim().replace(/[^0-9\.]+/g,"")); | |
const pending = $('#sortTable tr').toArray().reduce((acc, node) => { | |
const trNode = $(node); | |
if(trNode.find('td.date').text() === 'Pending') { | |
return acc + money(trNode.find('td.amount').text()); | |
} | |
return acc; | |
}, 0); | |
const balance = money($('.balance .value .nowrap').first().text()); | |
const toPay = (balance - pending).toFixed(2); | |
$('#main').append(`<textarea id="copyme">${toPay}</textarea>`); | |
$('#copyme').select(); | |
document.execCommand('copy'); | |
window.location.pathname = '/CCServicing/MakePayment.do' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment