Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision a3e1833a

Von Bernd Bleßmann vor 7 Monaten hinzugefügt

  • ID a3e1833a242501fd7c0ab4349a1185175d8e12dc
  • Vorgänger 9b93901e
  • Nachfolger a0c6ec81

Auftrags-/Lieferschein-/Reklamation-Controller: Preis-/Rabattquellen mit S:M:Record

Unterschiede anzeigen:

SL/Controller/DeliveryOrder.pm
1055 1055
    $item->description($texts->{description});
1056 1056
    $item->longdescription($texts->{longdescription});
1057 1057

  
1058
    my $price_source = SL::PriceSource->new(record_item => $item, record => $self->order);
1059

  
1060
    my $price_src;
1061
    if ($item->part->is_assortment) {
1062
    # add assortment items with price 0, as the components carry the price
1063
      $price_src = $price_source->price_from_source("");
1064
      $price_src->price(0);
1065
    } else {
1066
      $price_src = $price_source->best_price
1067
                 ? $price_source->best_price
1068
                 : $price_source->price_from_source("");
1069
      $price_src->price(
1070
        $::form->round_amount($price_src->price / $self->order->exchangerate, 5)
1071
      ) if $self->order->exchangerate;
1072
      $price_src->price(0) if !$price_source->best_price;
1073
    }
1074

  
1058
    my ($price_src, undef) = SL::Model::Record->get_best_price_and_discount_source($self->order, $item, ignore_given => 1);
1075 1059
    $item->sellprice($price_src->price);
1076 1060
    $item->active_price_source($price_src);
1077 1061

  
......
1681 1665

  
1682 1666
  $item->assign_attributes(%$attr);
1683 1667

  
1684
  my $part         = SL::DB::Part->new(id => $attr->{parts_id})->load;
1685
  my $price_source = SL::PriceSource->new(
1686
    record_item => $item,
1687
    record => $record,
1688
  );
1689

  
1668
  my $part = SL::DB::Part->new(id => $attr->{parts_id})->load;
1669
  $item->qty(1.0)          if !$item->qty;
1690 1670
  $item->unit($part->unit) if !$item->unit;
1691 1671

  
1692
  my $price_src;
1693
  if ( $part->is_assortment ) {
1694
    # add assortment items with price 0, as the components carry the price
1695
    $price_src = $price_source->price_from_source("");
1696
    $price_src->price(0);
1697
  } elsif (defined $item->sellprice) {
1698
    $price_src = $price_source->price_from_source("");
1699
    $price_src->price($item->sellprice);
1700
  } else {
1701
    $price_src = $price_source->best_price
1702
               ? $price_source->best_price
1703
               : $price_source->price_from_source("");
1704
    $price_src->price(0) if !$price_source->best_price;
1705
  }
1706

  
1707
  my $discount_src;
1708
  if (defined $item->discount) {
1709
    $discount_src = $price_source->discount_from_source("");
1710
    $discount_src->discount($item->discount);
1711
  } else {
1712
    $discount_src = $price_source->best_discount
1713
                  ? $price_source->best_discount
1714
                  : $price_source->discount_from_source("");
1715
    $discount_src->discount(0) if !$price_source->best_discount;
1716
  }
1672
  my ($price_src, $discount_src) = SL::Model::Record->get_best_price_and_discount_source($record, $item, ignore_given => 0);
1717 1673

  
1718 1674
  my %new_attr;
1719 1675
  $new_attr{part}                   = $part;

Auch abrufbar als: Unified diff