Created
January 6, 2018 12:57
-
-
Save nicolaslopezj/333cde86eac0c58379e3dbf957ce9bfe to your computer and use it in GitHub Desktop.
Checkea transferencias en el banco de chile
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
/* 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