X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FAssembly.pm;h=2519c1a459f128ffdb60c591f6577354c1ce2f69;hb=5737ce39a18326f1c3ae70a5afcc2d494fb901c7;hp=767ba411bdab020ef179914bd292b17e46b54058;hpb=10348b514ddb450a0ee23df36f7f4c4242989b3e;p=kivitendo-erp.git diff --git a/SL/DB/Assembly.pm b/SL/DB/Assembly.pm index 767ba411b..2519c1a45 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_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;