Auftrags-Controller: Nach Hinzufügen eines Artikels neue Umsätze und Steuern anzeigen.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 10 Aug 2015 15:20:45 +0000 (17:20 +0200)
committerG. Richardson <information@kivitendo-premium.de>
Mon, 16 Nov 2015 15:15:56 +0000 (16:15 +0100)
SL/Controller/Order.pm
templates/webpages/order/tabs/_tax_row.html [new file with mode: 0644]
templates/webpages/order/tabs/basic_data.html

index 62ef862..ba56e66 100644 (file)
@@ -171,6 +171,10 @@ sub action_set_item_values {
     ->val( '#' . $::form->{sellprice_dom_id}, $item->sellprice_as_number)
     ->val( '#' . $::form->{discount_dom_id},  $item->discount_as_percent)
     ->run('display_linetotal', $::form->{item_id}, $::form->format_amount(\%::myconfig, $item->{linetotal}, -2))
+    ->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);
 }
 
@@ -250,6 +254,17 @@ sub build_shipto_select {
   );
 }
 
+sub build_tax_rows {
+  my ($self) = @_;
+
+  my $rows_as_html;
+  foreach my $tax (@{ $self->{taxes} }) {
+    $rows_as_html .= $self->p->render('order/tabs/_tax_row', TAX => $tax);
+  }
+  return $rows_as_html;
+}
+
+
 sub _make_order {
   my ($self) = @_;
 
diff --git a/templates/webpages/order/tabs/_tax_row.html b/templates/webpages/order/tabs/_tax_row.html
new file mode 100644 (file)
index 0000000..010da3f
--- /dev/null
@@ -0,0 +1,9 @@
+[%- USE T8 %]
+[%- USE HTML %]
+[%- USE LxERP %]
+[%- USE L %]
+
+<tr class="tax_row">
+  <th align="right">[%- TAX.tax.taxdescription %] [% TAX.tax.rate_as_percent %]%</th>
+  <td align="right">[%- LxERP.format_amount(TAX.amount, 2, 0) %]</td>
+</tr>
index 736520a..fda5f10 100644 (file)
           [%- IF NOT taxincluded %]
           <tr>
             <th align="right">[%- 'Subtotal' | $T8 %]</th>
-            <td align="right">[%- SELF.order.netamount_as_number %]</td>
+            <td align="right">
+              [%- L.div_tag(SELF.order.netamount_as_number, id='netamount_id') %]
+            </td>
           </tr>
           [%- END %]
           [%- FOREACH tax = SELF.taxes %]
-          <tr>
-            <th align="right">[%- tax.tax.description %] [% tax.tax.rate_as_percent %]%</th>
-            <td align="right">[%- LxERP.format_amount(tax.amount, 2, 0) %]</td>
-          </tr>
+            [%- PROCESS order/tabs/_tax_row.html TAX=tax %]
           [%- END %]
-          <tr>
+          <tr id="amount_row_id">
             <th align="right">[%- 'Total' | $T8 %]</th>
-            <td align="right">[%- SELF.order.amount_as_number %]</td>
+            <td align="right">
+              [%- L.div_tag(SELF.order.amount_as_number, id='amount_id') %]
           </tr>
         </table>
       </td>