X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/10348b514ddb450a0ee23df36f7f4c4242989b3e..f1d33e8c42f2da428be80a6909335cf88689c1b3:/SL/DB/Assembly.pm diff --git a/SL/DB/Assembly.pm b/SL/DB/Assembly.pm index 767ba411b..42d155f4b 100644 --- a/SL/DB/Assembly.pm +++ b/SL/DB/Assembly.pm @@ -1,6 +1,3 @@ -# This file has been auto-generated only because it didn't exist. -# Feel free to modify it at will; it will not be overwritten automatically. - package SL::DB::Assembly; use strict; @@ -12,4 +9,18 @@ __PACKAGE__->meta->make_manager_class; __PACKAGE__->meta->initialize; +sub linetotal_sellprice { + 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;