From a7ecfa3864929b68bb90d4d3385e5b5bffbe9f33 Mon Sep 17 00:00:00 2001 From: Niclas Zimmermann Date: Fri, 17 May 2013 16:38:35 +0200 Subject: [PATCH] =?utf8?q?Grundstein=20f=C3=BCr=20Gewicht=20in=20Auftrag/L?= =?utf8?q?ieferschein/Rechnung?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In allen VK- und EK-Masken soll bald auch das Gewicht angezeigt werden. Grundsätzlich ist das mit diesem Commit schon für alle VK-Masken möglich, allerdings sind noch kleine Verbesserungen nötig. --- SL/IS.pm | 2 +- bin/mozilla/io.pl | 19 ++++++++++++++++--- templates/webpages/is/form_footer.html | 11 +++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/SL/IS.pm b/SL/IS.pm index 9ecc64818..ca1d51d5b 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -1949,7 +1949,7 @@ sub retrieve_item { p.unit, p.assembly, p.bin, p.onhand, p.notes AS partnotes, p.notes AS longdescription, p.not_discountable, p.formel, p.payment_id AS part_payment_id, - p.price_factor_id, + p.price_factor_id, p.weight, pfac.factor AS price_factor, diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 4db8256c2..ca3d0504e 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -141,7 +141,7 @@ sub display_row { } # column_index - my @header_sort = qw(runningnumber partnumber description ship qty unit sellprice_pg sellprice discount linetotal); + my @header_sort = qw(runningnumber partnumber description ship qty unit weight sellprice_pg sellprice discount linetotal); my @HEADER = ( { id => 'runningnumber', width => 5, value => $locale->text('No.'), display => 1, }, { id => 'partnumber', width => 8, value => $locale->text('Number'), display => 1, }, @@ -150,6 +150,7 @@ sub display_row { { id => 'qty', width => 5, value => $locale->text('Qty'), display => 1, }, { id => 'price_factor', width => 5, value => $locale->text('Price Factor'), display => !$is_delivery_order, }, { id => 'unit', width => 5, value => $locale->text('Unit'), display => 1, }, + { id => 'weight', width => 5, value => $locale->text('Weight'), display => 1, }, { id => 'serialnr', width => 10, value => $locale->text('Serial No.'), display => 0, }, { id => 'projectnr', width => 10, value => $locale->text('Project'), display => 0, }, { id => 'sellprice', width => 15, value => $locale->text('Price'), display => !$is_delivery_order, }, @@ -187,12 +188,13 @@ sub display_row { my $deliverydate = $locale->text('Required by'); # special alignings - my %align = map { $_ => 'right' } qw(qty ship right sellprice_pg discount linetotal stock_in_out); + my %align = map { $_ => 'right' } qw(qty ship right sellprice_pg discount linetotal stock_in_out weight); my %nowrap = map { $_ => 1 } qw(description unit); $form->{marge_total} = 0; $form->{sellprice_total} = 0; $form->{lastcost_total} = 0; + $form->{totalweight} = 0; my %projectnumber_labels = (); my @projectnumber_values = (""); @@ -205,6 +207,8 @@ sub display_row { _update_ship() if ($is_s_p_order); _update_custom_variables(); + my $totalweight = 0; + my $defaults = AM->get_defaults(); # rows my @ROWS; @@ -228,6 +232,7 @@ sub display_row { if ((!$form->{"prices_$i"}) || ($form->{"new_pricegroup_$i"} == $form->{"old_pricegroup_$i"})) { $form->{"sellprice_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units) || 1; $form->{"lastcost_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units) || 1; + $form->{"weight_$i"} *= AM->convert_unit($form->{"selected_unit_$i"}, $form->{"unit_old_$i"}, $all_units) || 1; $form->{"unit_old_$i"} = $form->{"selected_unit_$i"}; } my $this_unit = $form->{"unit_$i"}; @@ -325,6 +330,8 @@ sub display_row { $column_data{linetotal} = $form->format_amount(\%myconfig, $linetotal, 2); $column_data{bin} = $form->{"bin_$i"}; + $column_data{weight} = $form->format_amount(\%myconfig, $form->{"qty_$i"} * $form->{"weight_$i"}, 3) . ' ' . $defaults->{weightunit}; + if ($is_delivery_order) { $column_data{stock_in_out} = calculate_stock_in_out($i); } @@ -389,6 +396,9 @@ sub display_row { if $form->{"id_$i"} && ($form->{type} =~ /^sales_/ || $form->{type} =~ /invoice/) ; # / marge calculations ending +# Calculate total weight + $totalweight += ($form->{"qty_$i"} * $form->{"weight_$i"}); + # calculate onhand if ($form->{"id_$i"}) { my $part = IC->get_basic_part_info(id => $form->{"id_$i"}); @@ -416,7 +426,7 @@ sub display_row { map { ($cgi->hidden("-name" => $_, "-value" => $form->{$_})); } map { $_."_$i" } (qw(orderitems_id bo pricegroup_old price_old id inventory_accno bin partsgroup partnotes income_accno expense_accno listprice assembly taxaccounts ordnumber transdate cusordnumber - longdescription basefactor marge_absolut marge_percent marge_price_factor), @hidden_vars) + longdescription basefactor marge_absolut marge_percent marge_price_factor weight), @hidden_vars) ); map { $form->{"${_}_base"} += $linetotal } (split(/ /, $form->{"taxaccounts_$i"})); @@ -429,6 +439,8 @@ sub display_row { push @ROWS, { ROW1 => \@ROW1, ROW2 => \@ROW2, HIDDENS => \@HIDDENS, colspan => $colspan, error => $form->{"row_error_$i"}, }; } + $form->{totalweight} = $totalweight; + print $form->parse_html_template('oe/sales_order', { ROWS => \@ROWS, HEADER => \@HEADER, }); @@ -1789,6 +1801,7 @@ sub _update_part_information { my $info = $form->{PART_INFORMATION}->{$form->{"id_${i}"}} || { }; $form->{"partunit_${i}"} = $info->{unit}; + $form->{"weight_$i"} = $info->{weight}; } $main::lxdebug->leave_sub(); diff --git a/templates/webpages/is/form_footer.html b/templates/webpages/is/form_footer.html index 52179c295..f40dc27c6 100644 --- a/templates/webpages/is/form_footer.html +++ b/templates/webpages/is/form_footer.html @@ -43,6 +43,17 @@ [%- END %] + + + + + + +
[% 'Total weight' | $T8 %] + [% LxERP.format_amount(totalweight) %] [% HTML.escape(weightunit) %] + +
+ -- 2.20.1