Aktualizace příjmů a výdajů, opraveno špatné formatování desetiných čísel
This commit is contained in:
parent
d4b6dec1db
commit
635811ce9c
@ -7,4 +7,4 @@ Datum,Popis,Částka,Měna,Typ
|
||||
2024-06-17,Příspěvek @Onqa6,100,CZK,Příjem
|
||||
2024-06-18,Příspěvek D.Kolaja,111,CZK,Příjem
|
||||
2024-06-18,Příspěvek Luboš Blažek,1000,CZK,Příjem
|
||||
2024-06-18,Platba Contabo,"314,9",CZK,Výdaj
|
||||
2024-06-18,Platba Contabo,-314.90,CZK,Výdaj
|
||||
|
|
29
skript.js
29
skript.js
@ -18,19 +18,32 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const tr = document.createElement('tr');
|
||||
columns.forEach(column => {
|
||||
const td = document.createElement('td');
|
||||
td.textContent = column;
|
||||
td.textContent = column.trim();
|
||||
tr.appendChild(td);
|
||||
});
|
||||
tableBody.appendChild(tr);
|
||||
|
||||
// Debug output
|
||||
console.log('Row:', row);
|
||||
console.log('Columns:', columns);
|
||||
|
||||
// Calculate account balance
|
||||
const amount = parseFloat(columns[2]);
|
||||
const currency = columns[3];
|
||||
if (currency === 'CZK') {
|
||||
accountBalance += amount;
|
||||
} else if (currency === 'EUR') {
|
||||
// For simplicity, assume 1 EUR = 25 CZK (you can adjust the conversion rate)
|
||||
accountBalance += amount * 25;
|
||||
const amount = parseFloat(columns[2].replace(/,/g, '').replace(/[^0-9.-]/g, '')); // Remove any invalid characters and ensure proper decimal handling
|
||||
const currency = columns[3].trim();
|
||||
|
||||
// Debug output
|
||||
console.log('Amount:', amount);
|
||||
console.log('Currency:', currency);
|
||||
|
||||
if (!isNaN(amount)) {
|
||||
if (currency === 'CZK') {
|
||||
accountBalance += amount;
|
||||
} else if (currency === 'EUR') {
|
||||
// For simplicity, assume 1 EUR = 25 CZK (you can adjust the conversion rate)
|
||||
accountBalance += amount * 25;
|
||||
}
|
||||
} else {
|
||||
console.error('Invalid amount:', columns[2]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user