From 18370bbe58d4be9b478c12494fbf6eaf475e0d18 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Fri, 30 Apr 2021 11:25:55 +0200 Subject: [PATCH] fix - kaufmaenisch runden --- .../forms/alexander/sub_positionen.xhtml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen.xhtml index 29325e9..2783f4a 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/sub_positionen.xhtml @@ -182,7 +182,7 @@ if (!isNaN(amount) ) { // round - amount = Math.round(amount * 100) / 100; + amount=runden(amount) // is tax a number? if (!isNaN(inputtax.val())) { @@ -194,14 +194,14 @@ brutto=amount; } // round brutto - brutto = Math.round(brutto * 100) / 100; + brutto=runden(brutto); total = total + brutto; // round total - total = Math.round(total * 100) / 100; + total=runden(total); netto = netto + amount; // round net - netto = Math.round(netto * 100) / 100; + netto = runden(netto); // update netto column @@ -223,7 +223,7 @@ // compute total tax var total_tax=total-netto; - total_tax = Math.round(total_tax * 100) / 100; + total_tax = runden(total_tax); // update total netto and tax netto=convertToCurrency(netto); @@ -238,11 +238,12 @@ $("[data-id='orderlist_summary']", ".imixs-orderitems").append(total); $("[data-id='orderlist_summary_net']", ".imixs-orderitems").empty(); $("[data-id='orderlist_summary_net']", ".imixs-orderitems").append(netto); - - - } + function runden(x) { + return Math.round((x*100).toFixed(2))/100; + } + function convertToNumber(currency) { // has ,? if (currency && currency.indexOf(',')>-1) {