From ca6d3683af4249001ee78aebd725aae6382645b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Tue, 7 Apr 2015 13:45:37 +0200 Subject: [PATCH] PriceSource: versteckte Preise in Lieferscheinen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Beim Anlegen von Lieferscheinen wird jetzt auch der Preis kurz versteckt ermittelt und mitgespeichert, damit beim Umwandeln in Rechnungen keine Überraschungen passieren. --- bin/mozilla/do.pl | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index aae537f2c..3f624181f 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -424,11 +424,32 @@ sub update_delivery_order { } else { + my $sellprice = $form->parse_amount(\%myconfig, $form->{"sellprice_$i"}); + map { $form->{"${_}_$i"} = $form->{item_list}[0]{$_} } keys %{ $form->{item_list}[0] }; $form->{"marge_price_factor_$i"} = $form->{item_list}->[0]->{price_factor}; + + if ($sellprice) { + $form->{"sellprice_$i"} = $sellprice; + } else { + my $record = _make_record(); + my $price_source = SL::PriceSource->new(record_item => $record->items->[$i-1], record => $record); + my $best_price = $price_source->best_price; + my $best_discount = $price_source->best_discount; + + if ($best_price) { + $::form->{"sellprice_$i"} = $best_price->price; + $::form->{"active_price_source_$i"} = $best_price->source; + } + if ($best_discount) { + $::form->{"discount_$i"} = $best_discount->discount; + $::form->{"active_discount_source_$i"} = $best_discount->source; + } + } + $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"}); - $form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}); + $form->{"lastcost_$i"} = $form->format_amount(\%myconfig, $form->{"lastcost_$i"}); $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"}); } -- 2.20.1