X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=inline;f=WEB-INF%2Ftemplates%2Fexpense_edit.tpl;h=953f78d5e210582b8ce5c76347c1f522c9959b45;hb=46e93b281cb1460848b14c9e6109789b7949072b;hp=00b1ae539be3d6540d8185e5b301ee74cc48de49;hpb=79617794bc7e8d41291caf0ec7ef8be2b0a917b3;p=timetracker.git diff --git a/WEB-INF/templates/expense_edit.tpl b/WEB-INF/templates/expense_edit.tpl index 00b1ae53..953f78d5 100644 --- a/WEB-INF/templates/expense_edit.tpl +++ b/WEB-INF/templates/expense_edit.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; + } } } @@ -142,6 +150,12 @@ function recalculateCost() {