diff --git a/cmd/http/moolah.dat.real b/cmd/http/moolah.dat.real index 321dd12..da67161 100644 --- a/cmd/http/moolah.dat.real +++ b/cmd/http/moolah.dat.real @@ -3088,4 +3088,3 @@ 2023-10-27 GOOD EARTH FOODS OR AssetAccount:Chase:5876 $-173.57 Withdrawal:GOODEARTHFOODSOR - diff --git a/cmd/http/public/transactions.html b/cmd/http/public/transactions.html index cb1f6df..de6d03e 100644 --- a/cmd/http/public/transactions.html +++ b/cmd/http/public/transactions.html @@ -90,20 +90,25 @@ document.getElementById("lastNLines").innerHTML = result } function stage(who, contributesToHouse) { - var benefactor = who - var beneficiary = "AssetAccount:Chase:5876" - if (!contributesToHouse) { - var tmp = beneficiary - beneficiary = benefactor - benefactor = tmp - } - const zeroPad = (num, places) => String(num).padStart(places, '0') var d = new Date() + const zeroPad = (num, places) => String(num).padStart(places, '0') const today = `${d.getFullYear()}-${zeroPad(1+d.getMonth(), 2)}-${zeroPad(d.getDate(), 2)}` + + var who_currency = who.split(":").at(-1).toUpperCase() + + var benefactor = who + var benefactor_value = `-0.00 ${who_currency}` + var beneficiary = "AssetAccount:Chase:5876" + var beneficiary_value = `$0.00` + if (!contributesToHouse) { + beneficiary_value = `$-0.00` + benefactor_value = `0.00 ${who_currency}` + } + console.log(`@${today} ${benefactor} gave to ${beneficiary}`) document.getElementById("lastNLinesTextarea").value += `\n${today} TODO moolah2` - document.getElementById("lastNLinesTextarea").value += `\n ${beneficiary} $0.00` - document.getElementById("lastNLinesTextarea").value += `\n ${benefactor}` + document.getElementById("lastNLinesTextarea").value += `\n ${beneficiary} ${beneficiary_value}` + document.getElementById("lastNLinesTextarea").value += `\n ${benefactor} ${benefactor_value}` }