diff --git a/static/report.js b/static/report.js index 891ff3b..ef86e74 100644 --- a/static/report.js +++ b/static/report.js @@ -60,18 +60,25 @@ function renderTotals(report, settings) { var totals = report.totals; totalsBox.textContent = ""; - [ - ["Formue", totals.formue_ore], - ["Gevinst", totals.gevinst_ore], - ["Tap", totals.tap_ore], - ["Brukt inngangsverdi", totals.brukt_ore], - ["Netto", totals.netto_ore], - ["Inntekt", totals.inntekt_ore], - ["Skatt (" + settings.tax_rate_percent + " %)", totals.skatt_ore], - ["Formuesskatt", totals.formuesskatt_ore], - ["Forvaltningskostnad", totals.admin_cost_ore] - ].forEach(function (pair) { - totalsBox.appendChild(figure(pair[0], Skuld.formatKroner(pair[1]))); + var figures = [ + ["Formue", Skuld.formatKroner(totals.formue_ore)], + ["Gevinst", Skuld.formatKroner(totals.gevinst_ore)], + ["Tap", Skuld.formatKroner(totals.tap_ore)], + ["Brukt inngangsverdi", Skuld.formatKroner(totals.brukt_ore)], + ["Netto", Skuld.formatKroner(totals.netto_ore)], + ["Inntekt", Skuld.formatKroner(totals.inntekt_ore)], + ["Skatt (" + settings.tax_rate_percent + " %)", Skuld.formatKroner(totals.skatt_ore)], + ["Formuesskatt", Skuld.formatKroner(totals.formuesskatt_ore)], + ["Forvaltningskostnad", Skuld.formatSats(totals.admin_cost_sats) + " sats"] + ]; + if (totals.admin_cost_ore) { + figures.push([ + "Forvaltningskostnad trekt frå", + Skuld.formatKroner(totals.admin_cost_ore) + ]); + } + figures.forEach(function (pair) { + totalsBox.appendChild(figure(pair[0], pair[1])); }); var price = report.year_end_price_ore