From 79c048aa6a9699c5a994d7e21f4fd3ec8fa29693 Mon Sep 17 00:00:00 2001 From: Niclas Zimmermann Date: Mon, 27 May 2013 15:57:06 +0200 Subject: [PATCH] =?utf8?q?Gewicht=20in=20Druckvorlagen=20verf=C3=BCgbar=20?= =?utf8?q?machen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Nachdem das Gewicht auf allen Masken (Auftrag, Lieferschein, Rechnung) angezeigt wird, steht es nun auch in den Druckvorlagen zur Verfügung. --- SL/DB/Helper/FlattenToForm.pm | 1 + SL/DO.pm | 13 ++++++++++++- SL/IS.pm | 13 ++++++++++++- SL/OE.pm | 13 ++++++++++++- 4 files changed, 37 insertions(+), 3 deletions(-) diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index d5805b0c0..c21df9746 100644 --- a/SL/DB/Helper/FlattenToForm.pm +++ b/SL/DB/Helper/FlattenToForm.pm @@ -59,6 +59,7 @@ sub flatten_to_form { $form->{"id_${idx}"} = $item->parts_id; $form->{"partnumber_${idx}"} = $item->part->partnumber; + $form->{"weight_${idx}"} = $item->part->weight; _copy($item, $form, '', "_${idx}", 0, qw(description project_id ship serialnumber pricegroup_id ordnumber cusordnumber unit subtotal longdescription price_factor_id marge_price_factor approved_sellprice reqdate transdate)); _copy($item, $form, '', "_${idx}", $format_amounts, qw(qty sellprice marge_total marge_percent lastcost)); diff --git a/SL/DO.pm b/SL/DO.pm index 8d71fbcda..76a0ec075 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -813,7 +813,7 @@ sub order_details { qw(runningnumber number description longdescription qty unit partnotes serialnumber reqdate projectnumber projectdescription si_runningnumber si_number si_description - si_warehouse si_bin si_chargenumber si_bestbefore si_qty si_unit); + si_warehouse si_bin si_chargenumber si_bestbefore si_qty si_unit weight lineweight); map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays); @@ -822,6 +822,7 @@ sub order_details { $form->get_lists('price_factors' => 'ALL_PRICE_FACTORS'); my %price_factors = map { $_->{id} => $_->{factor} } @{ $form->{ALL_PRICE_FACTORS} }; + my $totalweight = 0; my $sameitem = ""; foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) { $i = $item->[0]; @@ -857,6 +858,13 @@ sub order_details { push @{ $form->{TEMPLATE_ARRAYS}{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}}; + my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"}; + $totalweight += $lineweight; + push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3); + push @{ $form->{TEMPLATE_ARRAYS}->{weight_nofmt} }, $form->{"weight_$i"}; + push @{ $form->{TEMPLATE_ARRAYS}->{lineweight} }, $form->format_amount($myconfig, $lineweight, 3); + push @{ $form->{TEMPLATE_ARRAYS}->{lineweight_nofmt} }, $lineweight; + if ($form->{"assembly_$i"}) { $sameitem = ""; @@ -910,6 +918,9 @@ sub order_details { for @{ $ic_cvar_configs }; } + $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3); + $form->{totalweight_nofmt} = $totalweight; + $h_pg->finish(); $h_bin_wh->finish(); diff --git a/SL/IS.pm b/SL/IS.pm index ca1d51d5b..8a94ec6b4 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -154,7 +154,7 @@ sub invoice_details { partnotes serialnumber reqdate sellprice listprice netprice discount p_discount discount_sub nodiscount_sub linetotal nodiscount_linetotal tax_rate projectnumber projectdescription - price_factor price_factor_name partsgroup); + price_factor price_factor_name partsgroup weight lineweight); push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; @@ -164,6 +164,7 @@ sub invoice_details { map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays, @payment_arrays); + my $totalweight = 0; foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) { $i = $item->[0]; @@ -280,6 +281,13 @@ sub invoice_details { push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}}); push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}}); + my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"}; + $totalweight += $lineweight; + push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3); + push @{ $form->{TEMPLATE_ARRAYS}->{weight_nofmt} }, $form->{"weight_$i"}; + push @{ $form->{TEMPLATE_ARRAYS}->{lineweight} }, $form->format_amount($myconfig, $lineweight, 3); + push @{ $form->{TEMPLATE_ARRAYS}->{lineweight_nofmt} }, $lineweight; + @taxaccounts = split(/ /, $form->{"taxaccounts_$i"}); $taxrate = 0; $taxdiff = 0; @@ -366,6 +374,9 @@ sub invoice_details { } } + $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3); + $form->{totalweight_nofmt} = $totalweight; + foreach my $item (sort keys %taxaccounts) { $tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2); diff --git a/SL/OE.pm b/SL/OE.pm index 3b3845c50..04f93858f 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1120,7 +1120,7 @@ sub order_details { partnotes serialnumber reqdate sellprice listprice netprice discount p_discount discount_sub nodiscount_sub linetotal nodiscount_linetotal tax_rate projectnumber projectdescription - price_factor price_factor_name partsgroup); + price_factor price_factor_name partsgroup weight lineweight); push @arrays, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; @@ -1128,6 +1128,7 @@ sub order_details { map { $form->{TEMPLATE_ARRAYS}->{$_} = [] } (@arrays, @tax_arrays); + my $totalweight = 0; my $sameitem = ""; foreach $item (sort { $a->[1] cmp $b->[1] } @partsgroup) { $i = $item->[0]; @@ -1242,6 +1243,13 @@ sub order_details { push(@{ $form->{TEMPLATE_ARRAYS}->{projectnumber} }, $projectnumbers{$form->{"project_id_$i"}}); push(@{ $form->{TEMPLATE_ARRAYS}->{projectdescription} }, $projectdescriptions{$form->{"project_id_$i"}}); + my $lineweight = $form->{"qty_$i"} * $form->{"weight_$i"}; + $totalweight += $lineweight; + push @{ $form->{TEMPLATE_ARRAYS}->{weight} }, $form->format_amount($myconfig, $form->{"weight_$i"}, 3); + push @{ $form->{TEMPLATE_ARRAYS}->{weight_nofmt} }, $form->{"weight_$i"}; + push @{ $form->{TEMPLATE_ARRAYS}->{lineweight} }, $form->format_amount($myconfig, $lineweight, 3); + push @{ $form->{TEMPLATE_ARRAYS}->{lineweight_nofmt} }, $lineweight; + my ($taxamount, $taxbase); my $taxrate = 0; @@ -1308,6 +1316,9 @@ sub order_details { } } + $form->{totalweight} = $form->format_amount($myconfig, $totalweight, 3); + $form->{totalweight_nofmt} = $totalweight; + my $tax = 0; foreach $item (sort keys %taxaccounts) { $tax += $taxamount = $form->round_amount($taxaccounts{$item}, 2); -- 2.20.1