Auftrags-Controller: gelieferte Menge in Auftragsposition anzeigen.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 13 Aug 2018 14:59:10 +0000 (16:59 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 13 Aug 2018 14:59:10 +0000 (16:59 +0200)
SL/Controller/Order.pm
templates/webpages/order/tabs/_row.html
templates/webpages/order/tabs/basic_data.html

index 901cc0e..ff0ec7f 100644 (file)
@@ -22,6 +22,7 @@ use SL::DB::RecordLink;
 
 use SL::Helper::CreatePDF qw(:all);
 use SL::Helper::PrintOptions;
+use SL::Helper::ShippedQty;
 
 use SL::Controller::Helper::GetModels;
 
@@ -1466,6 +1467,11 @@ sub pre_render {
     $item->active_discount_source($price_source->discount_from_source($item->active_discount_source));
   }
 
+  if (any { $self->type eq $_ } (sales_order_type(), purchase_order_type())) {
+    # calculate shipped qtys here to prevent calling calculate for every item via the items method
+    SL::Helper::ShippedQty->new->calculate($self->order)->write_to_objects;
+  }
+
   if ($self->order->number && $::instance_conf->get_webdav) {
     my $webdav = SL::Webdav->new(
       type     => $self->type,
index 6528c6c..967c94b 100644 (file)
       [%- END -%]
       [%- L.button_tag("kivi.Order.show_longdescription_dialog(this)", LxERP.t8("L")) %]
     </td>
+    [%- IF (TYPE == "sales_order" || TYPE == "purchase_order") -%]
+    <td nowrap>
+      [%- L.div_tag(LxERP.format_amount(ITEM.shipped_qty, 2, 0) _ ' ' _ ITEM.unit, name="shipped_qty", class="numeric") %]
+    </td>
+    [%- END -%]
     <td nowrap>
       [%- L.input_tag("order.orderitems[].qty_as_number",
                       ITEM.qty_as_number,
index 870e4aa..8e4776c 100644 (file)
                 <th id="partnumber_header_id"  class="listheading" nowrap width="15"><a href='#' onClick='javascript:kivi.Order.reorder_items("partnumber")'> [%- 'Partnumber'  | $T8 %]</a></th>
                 <th id="partclass_header_id"   class="listheading" nowrap width="2">[%- 'Type'  | $T8 %]</th>
                 <th id="description_header_id" class="listheading" nowrap           ><a href='#' onClick='javascript:kivi.Order.reorder_items("description")'>[%- 'Description' | $T8 %]</a></th>
+                [%- IF (SELF.type == "sales_order" || SELF.type == "purchase_order") -%]
+                <th id="shipped_qty_header_id" class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("shipped_qty")'>[%- 'Delivered'   | $T8 %]</a></th>
+                [%- END -%]
                 <th id="qty_header_id"         class="listheading" nowrap width="5" ><a href='#' onClick='javascript:kivi.Order.reorder_items("qty")'>        [%- 'Qty'         | $T8 %]</a></th>
                 <th class="listheading" nowrap width="5" >[%- 'Price Factor' | $T8 %] </th>
                 <th class="listheading" nowrap width="5" >[%- 'Unit'         | $T8 %] </th>