Auftrags-Controller: freie Preise und Rabatte nach der Eingabe neu formatieren.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 26 Oct 2015 15:15:55 +0000 (16:15 +0100)
committerG. Richardson <information@kivitendo-premium.de>
Mon, 16 Nov 2015 15:15:58 +0000 (16:15 +0100)
SL/Controller/Order.pm
templates/webpages/order/tabs/_row.html
templates/webpages/order/tabs/basic_data.html

index 33628ba..38f511c 100644 (file)
@@ -350,6 +350,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 d8ec4df..08fd81d 100644 (file)
@@ -59,7 +59,7 @@
                         size = 10,
                         style='text-align:right',
                         disabled=(EDIT_PRICE? '' : 1),
-                        class="recalc") %]
+                        class="recalc reformat_number") %]
       </div>
       <div name="not_editable_price" [%- IF EDIT_PRICE %]style="display:none"[%- END %]>
         [%- L.div_tag(ITEM.sellprice_as_number, name="sellprice_text", style='text-align:right') %]
@@ -77,7 +77,7 @@
                         size = 5,
                         style='text-align:right',
                         disabled=(EDIT_DISCOUNT? '' : 1),
-                        class="recalc") %]
+                        class="recalc reformat_number") %]
       </div>
       <div name="not_editable_discount" [%- IF EDIT_DISCOUNT %]style="display:none"[%- END %]>
         [%- L.div_tag(ITEM.discount_as_percent, name="discount_text", style='text-align:right') %]
index c67ed37..ea37faf 100644 (file)
@@ -348,6 +348,10 @@ function update_discount_source(item_id, source, discount_str) {
   kivi.io.close_dialog();
 }
 
+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';
@@ -446,6 +450,7 @@ $(function(){
   });
   row_set_keyboard_events($('.row_entry'));
   $('.recalc').change(recalc_amounts_and_taxes);
+  $('.reformat_number').change(reformat_number);
 });
 
 </script>