Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision bfdc20dd

Von Kivitendo Admin vor etwa 8 Jahren hinzugefügt

  • ID bfdc20dd50ee85f63474103e3a8370bbd92d6958
  • Vorgänger fc903ee0
  • Nachfolger 6bed383d

AssortmentItem - sellprice von pricegroups

Unterschiede anzeigen:

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