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/Reclamation.pm
954 954
    $item->description($texts->{description});
955 955
    $item->longdescription($texts->{longdescription});
956 956

  
957
    my $price_source = SL::PriceSource->new(record_item => $item, record => $self->reclamation);
958

  
959
    my $price_src;
960
    if ($item->part->is_assortment) {
961
    # add assortment items with price 0, as the components carry the price
962
      $price_src = $price_source->price_from_source("");
963
      $price_src->price(0);
964
    } else {
965
      $price_src = $price_source->best_price
966
                 ? $price_source->best_price
967
                 : $price_source->price_from_source("");
968
      $price_src->price($::form->round_amount($price_src->price / $self->reclamation->exchangerate, 5)) if $self->reclamation->exchangerate;
969
      $price_src->price(0) if !$price_source->best_price;
970
    }
971

  
957
    my ($price_src, undef) = SL::Model::Record->get_best_price_and_discount_source($self->reclamation, $item, ignore_given => 1);
972 958
    $item->sellprice($price_src->price);
973 959
    $item->active_price_source($price_src);
974 960

  
......
1442 1428

  
1443 1429
  $item->assign_attributes(%$attr);
1444 1430

  
1445
  my $part         = SL::DB::Part->new(id => $attr->{parts_id})->load;
1446
  my $price_source = SL::PriceSource->new(record_item => $item, record => $record);
1431
  my $part = SL::DB::Part->new(id => $attr->{parts_id})->load;
1432
  $item->qty(1.0)          if !$item->qty;
1447 1433
  $item->unit($part->unit) if !$item->unit;
1448 1434

  
1449
  my $price_src;
1450
  if ( $part->is_assortment ) {
1451
    # add assortment items with price 0, as the components carry the price
1452
    $price_src = $price_source->price_from_source("");
1453
    $price_src->price(0);
1454
  } elsif (defined $item->sellprice) {
1455
    $price_src = $price_source->price_from_source("");
1456
    $price_src->price($item->sellprice);
1457
  } else {
1458
    $price_src = $price_source->best_price
1459
               ? $price_source->best_price
1460
               : $price_source->price_from_source("");
1461
    if ($record->exchangerate) {
1462
      $price_src->price($::form->round_amount($price_src->price / $record->exchangerate, 5));
1463
    }
1464
    $price_src->price(0) if !$price_source->best_price;
1465
  }
1466

  
1467
  my $discount_src;
1468
  if (defined $item->discount) {
1469
    $discount_src = $price_source->discount_from_source("");
1470
    $discount_src->discount($item->discount);
1471
  } else {
1472
    $discount_src = $price_source->best_discount
1473
                  ? $price_source->best_discount
1474
                  : $price_source->discount_from_source("");
1475
    $discount_src->discount(0) if !$price_source->best_discount;
1476
  }
1435
  my ($price_src, $discount_src) = SL::Model::Record->get_best_price_and_discount_source($record, $item, ignore_given => 0);
1477 1436

  
1478 1437
  my %new_attr;
1479 1438
  $new_attr{part}                   = $part;

Auch abrufbar als: Unified diff