Revision ed438fb5
Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt
SL/DB/AssortmentItem.pm | ||
---|---|---|
12 | 12 |
__PACKAGE__->meta->initialize; |
13 | 13 |
|
14 | 14 |
sub linetotal_sellprice { |
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 ); |
|
15 |
my ($self, %params) = @_; |
|
16 |
|
|
17 |
my $sellprice = $self->part->sellprice; |
|
18 |
if ($params{pricegroup}) { |
|
19 |
my $pricegroup = SL::DB::Manager::Pricegroup->find_by( pricegroup => $params{pricegroup}); |
|
20 |
die "Can't find pricegroup with name " . $params{pricegroup} unless $pricegroup; |
|
21 |
$params{pricegroup_id} = $pricegroup->id if $pricegroup; |
|
22 |
} |
|
23 |
if ($params{pricegroup_id}) { |
|
24 |
my $price = SL::DB::Manager::Price->find_by(pricegroup_id => $params{pricegroup_id}, parts_id => $self->part->id); |
|
25 |
$sellprice = $price->price if $price; |
|
26 |
} |
|
27 |
|
|
28 |
return 0 unless $self->qty > 0 and $sellprice > 0; |
|
29 |
return $self->qty * $sellprice / ( $self->part->price_factor_id ? $self->part->price_factor->factor : 1 ); |
|
19 | 30 |
} |
20 | 31 |
|
21 | 32 |
sub linetotal_lastcost { |
Auch abrufbar als: Unified diff
AssortmentItem - sellprice von pricegroups