From d919a7dcc958edf6c7cd2546690347ea9c157f6e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 26 Jan 2021 13:05:52 +0100 Subject: [PATCH] all_parts Erzeugnis EK als separate Spalte im Bericht MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Problem: Bei der Mischauswahl von Waren und Erzeugnissen in dem Bericht erscheinen dann Waren mit dem EK des Erzeugnisses, der ggf. 0 sein kann. Das irritiert stark, deswegen lieber eine extra Spalte für den Erzeugnis-Fall spendieren und den EK bei Waren als Spalte so lassen. --- SL/IC.pm | 4 +--- bin/mozilla/ic.pl | 9 ++++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/SL/IC.pm b/SL/IC.pm index ca03e5144..d9714683c 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -272,8 +272,6 @@ sub all_parts { insertdate => 'itime::DATE', ); - if ($form->{l_assembly} && $form->{l_lastcost}) { - @simple_l_switches = grep { $_ ne 'lastcost' } @simple_l_switches; } my $make_token_builder = sub { @@ -402,7 +400,7 @@ sub all_parts { FROM assembly a_lc LEFT JOIN parts p_lc ON (a_lc.parts_id = p_lc.id) LEFT JOIN price_factors pfac_lc ON (p_lc.price_factor_id = pfac_lc.id) - WHERE (a_lc.id = p.id)) AS lastcost|; + WHERE (a_lc.id = p.id)) AS assembly_lastcost|; $table_prefix{$q_assembly_lastcost} = ' '; # special case makemodel search diff --git a/bin/mozilla/ic.pl b/bin/mozilla/ic.pl index 7b77ecda8..f00ce0873 100644 --- a/bin/mozilla/ic.pl +++ b/bin/mozilla/ic.pl @@ -177,6 +177,7 @@ sub generate_report { 'insertdate' => { 'text' => $locale->text('Insert Date'), }, 'invnumber' => { 'text' => $locale->text('Invoice Number'), }, 'lastcost' => { 'text' => $locale->text('Last Cost'), }, + 'assembly_lastcost' => { 'text' => $locale->text('Assembly Last Cost'), }, 'linetotallastcost' => { 'text' => $locale->text('Extended'), }, 'linetotallistprice' => { 'text' => $locale->text('Extended'), }, 'linetotalsellprice' => { 'text' => $locale->text('Extended'), }, @@ -321,6 +322,7 @@ sub generate_report { $column_defs{sellprice}{text} = $locale->text('Price'); $form->{l_lastcost} = "" } + $form->{l_assembly_lastcost} = "Y" if $form->{l_assembly} && $form->{l_lastcost}; if ($form->{description}) { $description = $form->{description}; @@ -388,7 +390,7 @@ sub generate_report { my @columns = qw( partnumber type_and_classific description notes partsgroup warehouse bin make model onhand rop soldtotal unit listprice - linetotallistprice sellprice linetotalsellprice lastcost linetotallastcost + linetotallistprice sellprice linetotalsellprice lastcost assembly_lastcost linetotallastcost priceupdate weight image drawing microfiche invnumber ordnumber quonumber transdate name serialnumber deliverydate ean projectnumber projectdescription insertdate shop @@ -416,7 +418,7 @@ sub generate_report { %column_defs = (%column_defs, %column_defs_cvars, %column_defs_pricegroups); map { $column_defs{$_}->{visible} ||= $form->{"l_$_"} ? 1 : 0 } @columns; - map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal shop), @pricegroup_columns; + map { $column_defs{$_}->{align} = 'right' } qw(onhand sellprice listprice lastcost assembly_lastcost linetotalsellprice linetotallastcost linetotallistprice rop weight soldtotal shop), @pricegroup_columns; my @hidden_variables = ( qw(l_subtotal l_linetotal searchitems itemstatus bom l_pricegroups insertdatefrom insertdateto), @@ -501,6 +503,7 @@ sub generate_report { $ref->{sellprice} *= $ref->{exchangerate} / $ref->{price_factor}; $ref->{listprice} *= $ref->{exchangerate} / $ref->{price_factor}; $ref->{lastcost} *= $ref->{exchangerate} / $ref->{price_factor}; + $ref->{assembly_lastcost} *= $ref->{exchangerate} / $ref->{price_factor}; # use this for assemblies my $soldtotal = $bsooqr_mode ? $ref->{soldtotal} : $ref->{onhand}; @@ -515,7 +518,7 @@ sub generate_report { $row->{partnumber}->{link} = $edit_link; $row->{description}->{link} = $edit_link; - foreach (qw(sellprice listprice lastcost)) { + foreach (qw(sellprice listprice lastcost assembly_lastcost)) { $row->{$_}{data} = $form->format_amount(\%myconfig, $ref->{$_}, 2); $row->{"linetotal$_"}{data} = $form->format_amount(\%myconfig, $ref->{onhand} * $ref->{$_}, 2); } -- 2.20.1