# safety
 __PACKAGE__->run_before('_check_auth');
 
-__PACKAGE__->run_before('_setup',
+__PACKAGE__->run_before('_recalc',
                         only => [ qw(edit update save) ]);
 
 
 
   $self->order->add_items($item);
 
-  $self->_setup();
+  $self->_recalc();
 
   my $row_as_html = $self->p->render('order/tabs/_row', ITEM => $item);
 
   $item->assign_attributes(%new_attr);
 
 
-  $self->_setup();
+  $self->_recalc();
 
   $self->js
     ->val( '#' . $::form->{qty_dom_id},       $item->qty_as_number)
 }
 
 
+sub action_recalc_amounts_and_taxes {
+  my ($self) = @_;
+
+  $self->_recalc();
+
+  $self->js
+    ->html('#netamount_id', $::form->format_amount(\%::myconfig, $self->order->netamount, -2))
+    ->html('#amount_id',    $::form->format_amount(\%::myconfig, $self->order->amount,    -2))
+    ->remove('.tax_row')
+    ->insertBefore($self->build_tax_rows, '#amount_row_id')
+    ->render($self);
+}
+
 #
 # helpers
 #
 }
 
 
-sub _setup {
+sub _recalc {
   my ($self) = @_;
 
   # bb: todo: currency later
 
 function delete_order_item_row(clicked) {
   var row = $(clicked).parents("tr").first();
   $(row).remove();
+
+  recalc_amounts_and_taxes()
 }
 
 function set_item_values(event) {
   $.post("controller.pl", data, kivi.eval_json_result);
 }
 
+function recalc_amounts_and_taxes() {
+  var data = $('#order_form').serialize();
+  data += '&action=Order/recalc_amounts_and_taxes';
+  data += '&type=' + $('#type').val();
+
+  $.post("controller.pl", data, kivi.eval_json_result);
+}
+
 function display_linetotal(item_id, amount) {
   $('#item_' + item_id).parents("tr").first().find('[name="linetotal"]').html(amount);
 }