X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fic.pl;h=48280d71f84c682ac0ddae1194a6f89ddc4eea7c;hb=772ec8725a6da1fd25a9e256d16e44b4c5231904;hp=8c915f4001c2b1cbf46351b5f09da8a79eb03c79;hpb=fef43fa5867d3389a5e967dd758545b7a3904f00;p=kivitendo-erp.git diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 8c915f400..48280d71f 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -1136,7 +1136,7 @@ sub generate_report { model => $locale->text('Model') . ": '$form->{model}'", drawing => $locale->text('Drawing') . ": '$form->{drawing}'", microfiche => $locale->text('Microfiche') . ": '$form->{microfiche}'", - l_soldtotal => $locale->text('soldtotal'), + l_soldtotal => $locale->text('Qty in Selected Records'), ean => $locale->text('EAN') . ": '$form->{ean}'", ); @@ -1171,7 +1171,7 @@ sub generate_report { } if ($form->{l_linetotal}) { - $form->{l_onhand} = "Y"; + $form->{l_qty} = "Y"; $form->{l_linetotalsellprice} = "Y" if $form->{l_sellprice}; $form->{l_linetotallastcost} = $form->{searchitems} eq 'assembly' && !$form->{bom} ? "" : 'Y' if $form->{l_lastcost}; $form->{l_linetotallistprice} = "Y" if $form->{l_listprice}; @@ -1191,13 +1191,24 @@ sub generate_report { || $form->{ordered} || $form->{rfq} || $form->{quoted}) { - $form->{l_onhand} = "Y"; +# $form->{l_onhand} = "Y"; } else { $form->{l_linetotalsellprice} = ""; $form->{l_linetotallastcost} = ""; } } + # soldtotal doesn't make sense with more than one bsooqr option. + # so reset it to sold (the most common option), and issue a warning + my @bsooqr = qw(sold bought onorder ordered rfq quoted); + if ($form->{l_subtotal} && 1 < grep { $form->{$_} } @bsooqr) { + my $enabled = first { $form->{$_} } @bsooqr; + $form->{$_} = '' for @bsooqr; + $form->{$enabled} = 'Y'; + + push @options, $::locale->text('Subtotal cannot distinguish betweens record types. Only one of the selected record types will be displayed: #1', $optiontexts{$enabled}); + } + IC->all_parts(\%myconfig, \%$form); my @columns = qw( @@ -1290,12 +1301,12 @@ sub generate_report { $ref->{lastcost} *= $ref->{exchangerate} / $ref->{price_factor}; # use this for assemblies - my $onhand = $ref->{onhand}; + my $soldtotal = $ref->{soldtotal}; if ($ref->{assemblyitem}) { $row->{partnumber}{align} = 'right'; - $row->{onhand}{data} = 0; - $onhand = 0 if ($form->{sold}); + $row->{soldtotal}{data} = 0; + $soldtotal = 0 if ($form->{sold}); } my $edit_link = build_std_url('action=edit', 'id=' . E($ref->{id}), 'callback'); @@ -1313,11 +1324,11 @@ sub generate_report { if (!$ref->{assemblyitem}) { foreach my $col (@subtotal_columns) { - $totals{$col} += $onhand * $ref->{$col}; - $subtotals{$col} += $onhand * $ref->{$col}; + $totals{$col} += $soldtotal * $ref->{$col}; + $subtotals{$col} += $soldtotal * $ref->{$col}; } - $subtotals{onhand} += $onhand; + $subtotals{soldtotal} += $soldtotal; } # set module stuff @@ -1348,11 +1359,11 @@ sub generate_report { my $row = { map { $_ => { 'class' => 'listsubtotal', } } @columns }; if (($form->{searchitems} ne 'assembly') || !$form->{bom}) { - $row->{onhand}->{data} = $form->format_amount(\%myconfig, $subtotals{onhand}); + $row->{soldtotal}->{data} = $form->format_amount(\%myconfig, $subtotals{soldtotal}); } map { $row->{"linetotal$_"}->{data} = $form->format_amount(\%myconfig, $subtotals{$_}, 2) } @subtotal_columns; - map { $subtotals{$_} = 0 } ('onhand', @subtotal_columns); + map { $subtotals{$_} = 0 } ('soldtotal', @subtotal_columns); $report->add_data($row); @@ -2042,6 +2053,9 @@ sub ajax_autocomplete { sub back_to_record { _check_io_auth(); + + delete @{$::form}{qw(action action_add action_back_to_record back_sub description item notes partnumber sellprice taxaccount2 unit vc)}; + $::auth->restore_form_from_session($::form->{previousform}, clobber => 1); $::form->{rowcount}--; $::form->{action} = 'display_form';