Revision 3b7bda40
Von Jan Büren vor etwa 10 Jahren hinzugefügt
SL/DB/OrderItem.pm | ||
---|---|---|
6 | 6 |
|
7 | 7 |
use SL::DB::MetaSetup::OrderItem; |
8 | 8 |
use SL::DB::Manager::OrderItem; |
9 |
use SL::DB::DeliveryOrderItemsStock; |
|
9 | 10 |
use SL::DB::Helper::CustomVariables ( |
10 | 11 |
sub_module => 'orderitems', |
11 | 12 |
cvars_alias => 1, |
... | ... | |
66 | 67 |
return ($self->_delivered_qty * $self->sellprice * (1 - $self->discount ) / $price_factor); |
67 | 68 |
} |
68 | 69 |
|
70 |
sub stocked_qty { |
|
71 |
my ($self) = @_; |
|
72 |
|
|
73 |
my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder'); |
|
74 |
my @doi = grep { $_->parts_id == $self->parts_id } map { $_->orderitems } @$d_orders; |
|
75 |
|
|
76 |
return 0 if !@doi; |
|
77 |
|
|
78 |
my $doi_stocks = SL::DB::Manager::DeliveryOrderItemsStock->get_all(query => [delivery_order_item_id => [ map {$_->id} @doi ]]); |
|
79 |
|
|
80 |
require SL::AM; |
|
81 |
return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @{ $doi_stocks }); |
|
82 |
} |
|
83 |
|
|
69 | 84 |
sub taxincluded { |
70 | 85 |
my ($self) = @_; |
71 | 86 |
|
Auch abrufbar als: Unified diff
Übersetzungsspalte verbessert und Berechnungsfuntkion für stocked_qty in Lieferberichte