Revision eb81ab34
Von Werner Hahn vor mehr als 1 Jahr hinzugefügt
SL/DB/Manager/Part.pm | ||
---|---|---|
91 | 91 |
return %qty_by_id; |
92 | 92 |
} |
93 | 93 |
|
94 |
sub get_open_ordered_qty { |
|
95 |
my $class = shift; |
|
96 |
my $part_id = shift; |
|
97 |
return () unless $part_id; |
|
98 |
my $openitems = SL::DB::Manager::OrderItem->get_all(where => [ parts_id => $part_id, 'order.closed' => 0 ], |
|
99 |
with_objects => ['order'],); |
|
100 |
return () unless $openitems; |
|
101 |
my %ordered; |
|
102 |
my %delivered; |
|
103 |
my $open = 0; |
|
104 |
my $ordered_qty = 0; |
|
105 |
my $delivered_qty = 0; |
|
106 |
for my $openitem (@{ $openitems }) { |
|
107 |
if($openitem->order->type eq 'purchase_order') { |
|
108 |
$ordered_qty += $openitem->qty; |
|
109 |
$delivered_qty += $openitem->delivered_qty; |
|
110 |
} |
|
111 |
} |
|
112 |
if( $ordered_qty - $delivered_qty > 0 ) { |
|
113 |
$open = $ordered_qty - $delivered_qty; |
|
114 |
%ordered = ($part_id => $open); |
|
115 |
} else { |
|
116 |
$open = $ordered_qty - $delivered_qty; |
|
117 |
%ordered = ($part_id => $open); |
|
118 |
} |
|
119 |
return %ordered; |
|
120 |
} |
|
121 |
|
|
94 | 122 |
sub _sort_spec { |
95 | 123 |
( |
96 | 124 |
default => [ 'partnumber', 1 ], |
SL/DB/Part.pm | ||
---|---|---|
279 | 279 |
return $result{ $self->id }; |
280 | 280 |
} |
281 | 281 |
|
282 |
sub get_open_ordered_qty { |
|
283 |
my $self = shift; |
|
284 |
my %result = SL::DB::Manager::Part->get_open_ordered_qty($self->id); |
|
285 |
|
|
286 |
return $result{ $self->id }; |
|
287 |
} |
|
288 |
|
|
282 | 289 |
sub available_units { |
283 | 290 |
shift->unit_obj->convertible_units; |
284 | 291 |
} |
templates/webpages/disposition_manager/list_parts.html | ||
---|---|---|
18 | 18 |
</tr> |
19 | 19 |
</thead> |
20 | 20 |
[% FOREACH part = PARTS %] |
21 |
[% IF !part.get_ordered_qty(part.id) %] |
|
21 |
[% IF !part.get_open_ordered_qty(part.id) %]
|
|
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 |
<td>[% HTML.escape(part.partnumber) %] </td>
|
|
24 |
<td>[% HTML.escape(part.partnumber) %]</td> |
|
25 | 25 |
<td>[% HTML.escape(part.description) %]</td> |
26 | 26 |
<td class="numeric">[% part.onhand_as_number %]</td> |
27 | 27 |
<td class="numeric">[% part.rop_as_number %] </td> |
... | ... | |
46 | 46 |
</tr> |
47 | 47 |
</thead> |
48 | 48 |
[% FOREACH part = PARTS %] |
49 |
[% IF part.get_ordered_qty(part.id) %] |
|
49 |
[% IF part.get_open_ordered_qty(part.id) %]
|
|
50 | 50 |
<tr class="listrow"> |
51 |
<td>[% HTML.escape(part.partnumber) %] </td>
|
|
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_ordered_qty(part.id) %] </td> |
|
55 |
<td class="numeric">[% part.get_open_ordered_qty(part.id) %] </td>
|
|
56 | 56 |
</tr> |
57 | 57 |
[% END %] |
58 | 58 |
[% END %] |
Auch abrufbar als: Unified diff
Dispositionsmangaer: Part um get_open_ordered_qty erweitert
Eine Funktion die die offene bestellte Menge zurückliefert. Ersetzt
get_ordered_qty, die die bestellten menge von offenen Aufträgen liefert
auch wenn diese Position schon geliefert wurde.