X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=WEB-INF%2Ftemplates%2Fexpenses.tpl;h=ed98bb57513efb416cc228691170d061ac80c9e5;hb=a4c1ced936fb1a1b71d4d34479a9c999aef4b338;hp=85d27eaece29e8102b6ead0dffaaaa8aa6012bf5;hpb=6856837ddde5cc90ac5dad2e5d67204036ec3158;p=timetracker.git diff --git a/WEB-INF/templates/expenses.tpl b/WEB-INF/templates/expenses.tpl index 85d27eae..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} -