Skip to content

Instantly share code, notes, and snippets.

@nicolaslopezj
Created January 6, 2018 12:57
Show Gist options
  • Save nicolaslopezj/333cde86eac0c58379e3dbf957ce9bfe to your computer and use it in GitHub Desktop.
Save nicolaslopezj/333cde86eac0c58379e3dbf957ce9bfe to your computer and use it in GitHub Desktop.
Checkea transferencias en el banco de chile
/* global $ */
function marcar(amountToTransfer, fecha, bchile) {
let total = 0
$('.linea1tablaSB input[type=checkbox]').map(function() {
const input = $(this)
const tr = input.parent().parent()
const fileNameTr = tr.prev().prev()
const fileName = fileNameTr.find('td:not([align=right]) strong').text()
const date = fileName.split(' ')[2] + ' ' + fileName.split(' ')[3]
const cuenta = $(tr.find('td')[5]).find('div:first').text().trim()
const isBChile = cuenta.includes('-')
const amount = Number($(tr.find('td')[8]).text().trim().replace(/\./g, ''))
if (amount + total <= amountToTransfer && bchile === isBChile && fecha === date) {
// input.prop('checked', true);
input.click()
total += amount
}
})
console.log('total', total);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment