Revision a3e1833a
Von Bernd Bleßmann vor 7 Monaten hinzugefügt
SL/Controller/Order.pm | ||
---|---|---|
1079 | 1079 |
$item->qty(1) if !$item->qty; |
1080 | 1080 |
$item->unit($item->part->unit); |
1081 | 1081 |
|
1082 |
my ($price_src, $discount_src) = get_best_price_and_discount_source($record, $item, 0);
|
|
1082 |
my ($price_src, $discount_src) = SL::Model::Record->get_best_price_and_discount_source($record, $item, ignore_given => 0);
|
|
1083 | 1083 |
|
1084 | 1084 |
$self->js |
1085 | 1085 |
->val ('#add_item_unit', $item->unit) |
... | ... | |
1393 | 1393 |
$item->description($texts->{description}); |
1394 | 1394 |
$item->longdescription($texts->{longdescription}); |
1395 | 1395 |
|
1396 |
my ($price_src, $discount_src) = get_best_price_and_discount_source($self->order, $item, 1); |
|
1397 |
|
|
1396 |
my ($price_src, $discount_src) = SL::Model::Record->get_best_price_and_discount_source($self->order, $item, ignore_given => 1); |
|
1398 | 1397 |
$item->sellprice($price_src->price); |
1399 | 1398 |
$item->active_price_source($price_src); |
1400 | 1399 |
$item->discount($discount_src->discount); |
... | ... | |
1972 | 1971 |
$item->qty(1.0) if !$item->qty; |
1973 | 1972 |
$item->unit($item->part->unit) if !$item->unit; |
1974 | 1973 |
|
1975 |
my ($price_src, $discount_src) = get_best_price_and_discount_source($record, $item, 0);
|
|
1974 |
my ($price_src, $discount_src) = SL::Model::Record->get_best_price_and_discount_source($record, $item, ignore_given => 0);
|
|
1976 | 1975 |
|
1977 | 1976 |
my %new_attr; |
1978 | 1977 |
$new_attr{description} = $item->part->description if ! $item->description; |
... | ... | |
2774 | 2773 |
return $texts; |
2775 | 2774 |
} |
2776 | 2775 |
|
2777 |
sub get_best_price_and_discount_source { |
|
2778 |
my ($record, $item, $ignore_given) = @_; |
|
2779 |
|
|
2780 |
my $price_source = SL::PriceSource->new(record_item => $item, record => $record); |
|
2781 |
|
|
2782 |
my $price_src; |
|
2783 |
if ( $item->part->is_assortment ) { |
|
2784 |
# add assortment items with price 0, as the components carry the price |
|
2785 |
$price_src = $price_source->price_from_source(""); |
|
2786 |
$price_src->price(0); |
|
2787 |
} elsif (!$ignore_given && defined $item->sellprice) { |
|
2788 |
$price_src = $price_source->price_from_source(""); |
|
2789 |
$price_src->price($item->sellprice); |
|
2790 |
} else { |
|
2791 |
$price_src = $price_source->best_price |
|
2792 |
? $price_source->best_price |
|
2793 |
: $price_source->price_from_source(""); |
|
2794 |
$price_src->price($::form->round_amount($price_src->price / $record->exchangerate, 5)) if $record->exchangerate; |
|
2795 |
$price_src->price(0) if !$price_source->best_price; |
|
2796 |
} |
|
2797 |
|
|
2798 |
my $discount_src; |
|
2799 |
if (!$ignore_given && defined $item->discount) { |
|
2800 |
$discount_src = $price_source->discount_from_source(""); |
|
2801 |
$discount_src->discount($item->discount); |
|
2802 |
} else { |
|
2803 |
$discount_src = $price_source->best_discount |
|
2804 |
? $price_source->best_discount |
|
2805 |
: $price_source->discount_from_source(""); |
|
2806 |
$discount_src->discount(0) if !$price_source->best_discount; |
|
2807 |
} |
|
2808 |
|
|
2809 |
return ($price_src, $discount_src); |
|
2810 |
} |
|
2811 |
|
|
2812 | 2776 |
sub nr_key { |
2813 | 2777 |
my ($self) = @_; |
2814 | 2778 |
|
Auch abrufbar als: Unified diff
Auftrags-/Lieferschein-/Reklamation-Controller: Preis-/Rabattquellen mit S:M:Record