Neuen Artikeltyp Sortiment eingeführt - sql und rose
[kivitendo-erp.git] / SL / DB / AssortmentItem.pm
1 # This file has been auto-generated only because it didn't exist.
2 # Feel free to modify it at will; it will not be overwritten automatically.
3
4 package SL::DB::AssortmentItem;
5
6 use strict;
7
8 use SL::DB::MetaSetup::AssortmentItem;
9 use SL::DB::Manager::AssortmentItem;
10 use Rose::DB::Object::Helpers qw(clone);
11
12 __PACKAGE__->meta->initialize;
13
14 sub linetotal {
15   my ($self) = @_;
16
17   return 0 unless $self->qty > 0 and $self->part->sellprice > 0;
18   return $self->qty * $self->part->sellprice / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 );
19 }
20
21 sub linetotal_lastcost {
22   my ($self) = @_;
23
24   return 0 unless $self->qty > 0 and $self->part->lastcost > 0;
25   return $self->qty * $self->part->lastcost / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 );
26 }
27
28 1;