From: Sven Schöling Date: Wed, 20 May 2009 09:46:00 +0000 (+0000) Subject: IC.pm->all_parts: Im bom Modus (Einzelteile von Erzeugnissen mit anzeigen) Preisfakto... X-Git-Tag: release-2.6.0rc1~20 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=158bf8557fab92fcacca0924b6a20534d2252184;p=kivitendo-erp.git IC.pm->all_parts: Im bom Modus (Einzelteile von Erzeugnissen mit anzeigen) Preisfaktoren berücksichtigen. Ausserdem das recht seltsame Query umgeschrieben. Fix für Bug 987. --- 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;