From 7317b8d9828cad7fd033d73589d7e9665fb397c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 5 Oct 2015 11:44:58 +0200 Subject: [PATCH] OrderItem tote Funktionen entfernt --- SL/DB/OrderItem.pm | 53 +--------------------------------------------- 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/SL/DB/OrderItem.pm b/SL/DB/OrderItem.pm index 8ae5e0bdd..1eb524734 100644 --- a/SL/DB/OrderItem.pm +++ b/SL/DB/OrderItem.pm @@ -40,58 +40,7 @@ sub shipped_qty { return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi); } -sub delivered_qty { - my ($self) = @_; - - return $self->_delivered_qty; -} - -sub _delivered_qty { - my ($self) = @_; - - return $self->{delivered_qty} if $self->{delivered_qty}; - - my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder'); - - my @d_orders_delivered = grep { $_->delivered } @$d_orders; - - my @doi_delivered = grep { $_->parts_id == $self->parts_id } map { $_->orderitems } @d_orders_delivered; - - require SL::AM; - $self->{delivered_qty} = sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @doi_delivered); - - return $self->{delivered_qty}; -} - -sub value_of_goods { - my ($self) = @_; - - my $price_factor = $self->price_factor || 1; - - $self->_delivered_qty; - return ($self->_delivered_qty * $self->sellprice * (1 - $self->discount ) / $price_factor); -} - -sub stocked_qty { - my ($self) = @_; - - my $d_orders = $self->order->linked_records(direction => 'to', to => 'SL::DB::DeliveryOrder'); - my @doi = grep { $_->parts_id == $self->parts_id } map { $_->orderitems } @$d_orders; - - return 0 if !@doi; - - my $doi_stocks = SL::DB::Manager::DeliveryOrderItemsStock->get_all(query => [delivery_order_item_id => [ map {$_->id} @doi ]]); - - require SL::AM; - return sum(map { AM->convert_unit($_->unit => $self->unit) * $_->qty } @{ $doi_stocks }); -} - -sub taxincluded { - my ($self) = @_; - - return SL::DB::Manager::Order->find_by(id => $self->trans_id)->taxincluded ? $::locale->text('WARN: Tax included value!') : ''; -} - sub record { goto &order } 1; + -- 2.20.1