X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=WEB-INF%2Ftemplates%2Fexpenses.tpl;h=ed98bb57513efb416cc228691170d061ac80c9e5;hb=756657a71e251b65d8191636e33e5e4ea32767af;hp=d210507999b28999f44dc1708c1a29ca295a5ea8;hpb=9082c911245bc87179d1668a0098f473ecb8bf76;p=timetracker.git diff --git a/WEB-INF/templates/expenses.tpl b/WEB-INF/templates/expenses.tpl index d2105079..ed98bb57 100644 --- a/WEB-INF/templates/expenses.tpl +++ b/WEB-INF/templates/expenses.tpl @@ -86,6 +86,7 @@ function recalculateCost() { var comment_control = document.getElementById("item_name"); var cost_control = document.getElementById("cost"); + var replaceDecimalMark = ("." != "{$user->decimal_mark}"); // Calculate cost. var dropdown = document.getElementById("predefined_expense"); @@ -98,8 +99,15 @@ function recalculateCost() { var quantity = quantity_control.value; if (isNaN(quantity)) cost_control.value = ""; - else - cost_control.value = (quantity_control.value * defined_expenses[dropdown.selectedIndex - 1][2]).toFixed(2); + else { + var expenseCost = defined_expenses[dropdown.selectedIndex - 1][2]; + if (replaceDecimalMark) + expenseCost = expenseCost.replace("{$user->decimal_mark}", "."); + var newCost = (quantity_control.value * expenseCost).toFixed(2); + if (replaceDecimalMark) + newCost = newCost.replace(".", "{$user->decimal_mark}"); + cost_control.value = newCost; + } } } @@ -128,7 +136,6 @@ function recalculateCost() { {/if} {if $predefined_expenses} -