From: G. Richardson Date: Sun, 7 Aug 2016 20:37:22 +0000 (+0200) Subject: Assembly - linetotal Helperfunktionen X-Git-Tag: release-3.5.4~1903 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=3b249feb1cf3b3dd91dfa3038ef8f694db251988;p=kivitendo-erp.git Assembly - linetotal Helperfunktionen --- diff --git a/SL/DB/Assembly.pm b/SL/DB/Assembly.pm index 767ba411b..a77e34b54 100644 --- a/SL/DB/Assembly.pm +++ b/SL/DB/Assembly.pm @@ -12,4 +12,18 @@ __PACKAGE__->meta->make_manager_class; __PACKAGE__->meta->initialize; +sub linetotal { + my ($self) = @_; + + return 0 unless $self->qty > 0 and $self->part->sellprice > 0; + return $self->qty * $self->part->sellprice / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 ); +} + +sub linetotal_lastcost { + my ($self) = @_; + + return 0 unless $self->qty > 0 and $self->part->lastcost > 0; + return $self->qty * $self->part->lastcost / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 ); +} + 1;