From 957896de327365e3d83e3f0d6525af02849c483d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 2 Aug 2007 07:09:22 +0000 Subject: [PATCH] =?utf8?q?Syntaxhighlightingerleichterung=20f=C3=BCr=20Ema?= =?utf8?q?cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- bin/mozilla/ic.pl | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index abd36a84d..86bddaa70 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1736,10 +1736,11 @@ sub generate_report { # fresh row, for inserting later my $row = { map { $_ => { 'data' => $ref->{$_} } } @columns }; - $ref->{exchangerate} = 1 unless $ref->{exchangerate}; - $ref->{sellprice} *= $ref->{exchangerate}; - $ref->{listprice} *= $ref->{exchangerate}; - $ref->{lastcost} *= $ref->{exchangerate}; + $ref->{exchangerate} ||= 1; + $ref->{price_factor} ||= 1; + $ref->{sellprice} *= $ref->{exchangerate} / $ref->{price_factor}; + $ref->{listprice} *= $ref->{exchangerate} / $ref->{price_factor}; + $ref->{lastcost} *= $ref->{exchangerate} / $ref->{price_factor}; # use this for assemblies my $onhand = $ref->{onhand}; @@ -1986,6 +1987,7 @@ sub form_header { my ($notdiscountableok, $notdiscountable); my ($formula, $formula_label, $imagelinks, $obsolete, $shopok, $shop); + $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); map({ $form->{$_} = $form->format_amount(\%myconfig, $form->{$_}, -2) } qw(sellprice listprice lastcost gv)); @@ -2326,6 +2328,22 @@ sub form_header { $unit_select .= AM->unit_select_html($units, "unit", $form->{"unit"}); } + my $price_factor; + if (0 < scalar @{ $form->{ALL_PRICE_FACTORS} }) { + my @values = ('', map { $_->{id} } @{ $form->{ALL_PRICE_FACTORS} }); + my %labels = map { $_->{id} => $_->{description} } @{ $form->{ALL_PRICE_FACTORS} }; + + $price_factor = + qq|| + . $locale->text('Price Factor') + . qq|| + . NTI($cgi->popup_menu('-name' => 'price_factor_id', + '-default' => $form->{price_factor_id}, + '-values' => \@values, + '-labels' => \%labels)) + . qq||; + } + $form->{fokus} = "ic.partnumber"; $form->header; @@ -2439,6 +2457,7 @@ sub form_header { {sellprice}> $lastcost + $price_factor | . $locale->text('Unit') . qq| $unit_select @@ -2892,7 +2911,7 @@ sub save { # now take it apart and restore original values foreach my $item (split /&/, $previousform) { - my ($key, $value) = split /=/, $item, 2; + my ($key, $value) = split m/=/, $item, 2; $value =~ s/%26/&/g; $form->{$key} = $value; } -- 2.20.1