Spaces:
Running

intento2 / app.js
alcantarm's picture
Update app.js
a91baac verified
Raw History Blame Contribute Delete
1.31 kB
document.addEventListener('DOMContentLoaded', () => {
const CLP = new Intl.NumberFormat('es-CL', { style:'currency', currency:'CLP', maximumFractionDigits:0 });
const input = document.getElementById('invoice-input');
const budgetInput = document.getElementById('budget-input');
const tbody = document.getElementById('tbody');
const budgetTbody = document.getElementById('budget-tbody-right');
const total = document.getElementById('total');
const errorEl = document.getElementById('error');
const budgetError = document.getElementById('budget-error');
const processBtn = document.getElementById('process-btn');
const resetBtn = document.getElementById('reset-btn');
const summary = document.getElementById('summary');
const recordsTbody = document.getElementById('records-tbody');
const docs = [];
const records = [];
let budgetFile = null;
function fmtDate(iso) { return new Date(iso).toLocaleString(); }
function randomAmount(min,max){ return Math.floor(Math.random()*(max-min+1))+min; }
function randomFolio(){ return 'F'+Math.floor(100000+Math.random()*900000); }
function renderDocs(){
total.textContent = `${docs.length} en total`;
tbody.innerHTML = '';
if(!docs.length){
tbody.innerHTML = `<tr><td colspan="5" style="text-align:center;color:var(--