Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 4913d646

Von Werner Hahn vor mehr als 1 Jahr hinzugefügt

  • ID 4913d64680b3f12dbae7f2d1319dd2a4b1d2b196
  • Vorgänger 6c86511b
  • Nachfolger f8bc80e1

Dispositionsmanager List umgeschrieben wg Performance

Unterschiede anzeigen:

SL/Controller/DispositionManager.pm
16 16
  my ( $self ) = @_;
17 17

  
18 18
  my $parts = $self->_get_parts;
19

  
19
  my $parts_tmp;
20
  for my $part(@{ $parts }) {
21
    my $openitems = SL::DB::Manager::OrderItem->get_all(where => [ parts_id => $part->id, 'order.closed' => 0 ],
22
                                                         with_objects => ['order'],);
23
    my ($not_delivered, $ordered) = 0;
24
    for my $openitem (@{ $openitems }) {
25
      if($openitem -> order -> type eq 'sales_order') {
26
        $not_delivered += $openitem->qty - $openitem->shipped_qty;
27
      } elsif ( $openitem->order->type eq 'purchase_order' ) {
28
        $ordered += $openitem->qty - $openitem->delivered_qty;
29
      }
30
    }
31
    $part->assign_attributes( gv => $ordered );
32
    push @{ $parts_tmp }, $part;
33
  }
20 34
  $self->_setup_list_action_bar;
21
  $self->render('disposition_manager/list_parts', title => t8('Parts short onhand'), PARTS => $parts);
35
  $self->render('disposition_manager/list_parts', title => t8('Parts short onhand'), PARTS => $parts_tmp);
22 36
}
23 37

  
24 38
sub action_add_to_purchase_basket{
templates/webpages/disposition_manager/list_parts.html
18 18
     </tr>
19 19
    </thead>
20 20
    [% FOREACH part = PARTS %]
21
      [% IF !part.get_open_ordered_qty(part.id) %]
21
      [% IF !part.gv %]
22 22
      <tr class="listrow">
23 23
        <td>[% IF part.makemodels.size %][% L.checkbox_tag('ids[+]', "data-checkall"=1, checked = '1', value=part.id) %][% ELSE %][% 'No Vendor' | $T8 %][% END %]</td>
24 24
        <td>[% HTML.escape(part.partnumber) %]</td>
......
46 46
   </tr>
47 47
  </thead>
48 48
  [% FOREACH part = PARTS %]
49
    [% IF part.get_open_ordered_qty(part.id) %]
49
    [% IF part.gv %]
50 50
    <tr class="listrow">
51 51
      <td>[% HTML.escape(part.partnumber) %]</td>
52 52
      <td>[% HTML.escape(part.description) %] </td>
53 53
      <td class="numeric">[% part.onhand_as_number %]         </td>
54 54
      <td class="numeric">[% part.rop_as_number %]            </td>
55
      <td class="numeric">[% part.get_open_ordered_qty(part.id) %] </td>
55
      <td class="numeric">[% part.gv %] </td>
56 56
    </tr>
57 57
    [% END %]
58 58
  [% END %]

Auch abrufbar als: Unified diff