Revision 83914eeb
Von Moritz Bunkus vor fast 17 Jahren hinzugefügt
SL/IS.pm | ||
---|---|---|
645 | 645 |
|
646 | 646 |
if ($form->{"inventory_accno_$i"} || $form->{"assembly_$i"}) { |
647 | 647 |
|
648 |
# adjust parts onhand quantity |
|
649 |
|
|
650 | 648 |
if ($form->{"assembly_$i"}) { |
651 |
|
|
652 |
# do not update if assembly consists of all services |
|
653 |
$query = |
|
654 |
qq|SELECT sum(p.inventory_accno_id) |
|
655 |
FROM parts p |
|
656 |
JOIN assembly a ON (a.parts_id = p.id) |
|
657 |
WHERE a.id = ?|; |
|
658 |
$sth = prepare_execute_query($form, $dbh, $query, conv_i($form->{"id_$i"})); |
|
659 |
|
|
660 |
if ($sth->fetchrow_array) { |
|
661 |
$form->update_balance($dbh, "parts", "onhand", qq|id = ?|, |
|
662 |
$baseqty * -1, $form->{"id_$i"}) |
|
663 |
unless $form->{shipped}; |
|
664 |
} |
|
665 |
$sth->finish; |
|
666 |
|
|
667 | 649 |
# record assembly item as allocated |
668 | 650 |
&process_assembly($dbh, $form, $form->{"id_$i"}, $baseqty); |
669 | 651 |
} else { |
670 |
$form->update_balance($dbh, "parts", "onhand", qq|id = ?|, |
|
671 |
$baseqty * -1, $form->{"id_$i"}) |
|
672 |
unless $form->{shipped}; |
|
673 |
|
|
674 | 652 |
$allocated = &cogs($dbh, $form, $form->{"id_$i"}, $baseqty, $basefactor, $i); |
675 | 653 |
} |
676 | 654 |
} |
... | ... | |
1236 | 1214 |
|
1237 | 1215 |
while (my $ref = $sth->fetchrow_hashref(NAME_lc)) { |
1238 | 1216 |
|
1239 |
if ($ref->{inventory_accno_id} || $ref->{assembly}) { |
|
1240 |
|
|
1241 |
# if the invoice item is not an assemblyitem adjust parts onhand |
|
1242 |
if (!$ref->{assemblyitem}) { |
|
1243 |
|
|
1244 |
# adjust onhand in parts table |
|
1245 |
$form->update_balance($dbh, "parts", "onhand", qq|id = $ref->{parts_id}|, $ref->{qty}); |
|
1246 |
} |
|
1247 |
|
|
1248 |
# loop if it is an assembly |
|
1249 |
next if ($ref->{assembly}); |
|
1250 |
|
|
1217 |
if ($ref->{inventory_accno_id}) { |
|
1251 | 1218 |
# de-allocated purchases |
1252 | 1219 |
$query = |
1253 | 1220 |
qq|SELECT i.id, i.trans_id, i.allocated |
... | ... | |
1825 | 1792 |
} |
1826 | 1793 |
} |
1827 | 1794 |
|
1795 |
$ref->{onhand} *= 1; |
|
1796 |
|
|
1828 | 1797 |
push @{ $form->{item_list} }, $ref; |
1829 | 1798 |
|
1830 | 1799 |
if ($form->{lizenzen}) { |
Auch abrufbar als: Unified diff
Lagerverwaltung implementiert.