From 56a48a8428b904f32b1e637951059710faeba6bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Mon, 6 Jan 2014 13:44:47 +0100 Subject: [PATCH] Zwischensummen bei Lieferscheinen MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Nummerierung korrekt wie in Aufträgen modifizieren behebt #2396 --- SL/DO.pm | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/SL/DO.pm b/SL/DO.pm index d83c49b3e..bc651c8ed 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -725,6 +725,8 @@ sub order_details { my @partsgroup = (); my $partsgroup; my $position = 0; + my $subtotal_header = 0; + my $subposition = 0; my (@project_ids, %projectnumbers, %projectdescriptions); @@ -797,8 +799,6 @@ sub order_details { next if (!$form->{"id_$i"}); - $position++; - if ($item->[1] ne $sameitem) { push(@{ $form->{description} }, qq|$item->[1]|); $sameitem = $item->[1]; @@ -809,6 +809,19 @@ sub order_details { $form->{"qty_$i"} = $form->parse_amount($myconfig, $form->{"qty_$i"}); # add number, description and qty to $form->{number}, .... + if ($form->{"subtotal_$i"} && !$subtotal_header) { + $subtotal_header = $i; + $position = int($position); + $subposition = 0; + $position++; + } elsif ($subtotal_header) { + $subposition += 1; + $position = int($position); + $position = $position.".".$subposition; + } else { + $position = int($position); + $position++; + } my $price_factor = $price_factors{$form->{"price_factor_id_$i"}} || { 'factor' => 1 }; @@ -826,6 +839,10 @@ sub order_details { push @{ $form->{TEMPLATE_ARRAYS}{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}}; + if ($form->{"subtotal_$i"} && $subtotal_header && ($subtotal_header != $i)) { + $subtotal_header = 0; + } + my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"}; $totalweight += $lineweight; push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3); -- 2.20.1