From 158bf8557fab92fcacca0924b6a20534d2252184 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Wed, 20 May 2009 09:46:00 +0000 Subject: [PATCH] =?utf8?q?IC.pm->all=5Fparts:=20Im=20bom=20Modus=20(Einzel?= =?utf8?q?teile=20von=20Erzeugnissen=20mit=20anzeigen)=20Preisfaktoren=20b?= =?utf8?q?er=C3=BCcksichtigen.=20Ausserdem=20das=20recht=20seltsame=20Quer?= =?utf8?q?y=20umgeschrieben.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fix für Bug 987. --- SL/IC.pm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/SL/IC.pm b/SL/IC.pm index bc13d3678..0925a2b12 100644 --- a/SL/IC.pm +++ b/SL/IC.pm @@ -965,17 +965,21 @@ sub all_parts { map { $_->{onhand} *= 1 } @{ $form->{parts} }; + # post processing for assembly parts lists (bom) + # for each part get the assembly parts and add them into the partlist. my @assemblies; - # include individual items for assemblies if ($form->{searchitems} eq 'assembly' && $form->{bom}) { $query = qq|SELECT p.id, p.partnumber, p.description, a.qty AS onhand, p.unit, p.bin, p.sellprice, p.listprice, p.lastcost, p.rop, p.weight, p.priceupdate, - p.image, p.drawing, p.microfiche - FROM parts p, assembly a - WHERE (p.id = a.parts_id) AND (a.id = ?)|; + p.image, p.drawing, p.microfiche, + pfac.factor + FROM parts p + INNER JOIN assembly a ON (p.id = a.parts_id) + $joins{pfac} + WHERE a.id = ?|; $sth = prepare_query($form, $dbh, $query); foreach $item (@{ $form->{parts} }) { @@ -984,6 +988,7 @@ sub all_parts { while ($ref = $sth->fetchrow_hashref(NAME_lc)) { $ref->{assemblyitem} = 1; + map { $ref->{$_} /= $ref->{factor} || 1 } qw(sellprice listprice lastcost); push(@assemblies, $ref); } $sth->finish; -- 2.20.1