Auftrags-Controller: css-Klasse: reformat_number zum Neuformatieren von Zahlen
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 7 Mar 2016 15:41:13 +0000 (16:41 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 11 Mar 2016 11:45:30 +0000 (12:45 +0100)
SL/Controller/Order.pm
templates/webpages/order/tabs/basic_data.html

index 858ff00..1c713a7 100644 (file)
@@ -347,6 +347,7 @@ sub action_add_item {
     ->run('row_table_scroll_down')
     ->run('row_set_keyboard_events_by_id', $item_id)
     ->on('.recalc', 'change', 'recalc_amounts_and_taxes')
+    ->on('.reformat_number', 'change', 'reformat_number')
     ->focus('#add_item_parts_id_name');
 
   $self->_js_redisplay_amounts_and_taxes;
index 41589d7..8574424 100644 (file)
@@ -272,6 +272,10 @@ function delete_order_item_row(clicked) {
   recalc_amounts_and_taxes();
 }
 
+function reformat_number(event) {
+  $(event.target).val(kivi.format_amount(kivi.parse_amount($(event.target).val()), -2));
+}
+
 function recalc_amounts_and_taxes() {
   var data = $('#order_form').serialize();
   data += '&action=Order/recalc_amounts_and_taxes';
@@ -364,6 +368,7 @@ $(function(){
   });
   row_set_keyboard_events($('.row_entry'));
   $('.recalc').change(recalc_amounts_and_taxes);
+  $('.reformat_number').change(reformat_number);
 });
 
 </script>