From: Moritz Bunkus Date: Mon, 29 Apr 2013 11:09:31 +0000 (+0200) Subject: Einkaufsrechnung buchen bei Bestandsmethode: Kontenverknüpfung aus Buchungsgruppen... X-Git-Tag: release-3.1.0beta1~447 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=768b390e74168805a487348aaf2da6b3aea558bc;p=kivitendo-erp.git Einkaufsrechnung buchen bei Bestandsmethode: Kontenverknüpfung aus Buchungsgruppen, nicht aus parts --- diff --git a/SL/IR.pm b/SL/IR.pm index 97205b2e3..73b3e14ed 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -216,14 +216,16 @@ sub post_invoice { # check if we sold the item already and # make an entry for the expense and inventory + my $taxzone = $form->{taxzone_id} * 1; $query = qq|SELECT i.id, i.qty, i.allocated, i.trans_id, i.base_qty, - p.inventory_accno_id, p.expense_accno_id, a.transdate - FROM invoice i, ar a, parts p + bg.inventory_accno_id, bg.expense_accno_id_${taxzone} AS expense_accno_id, a.transdate + FROM invoice i, ar a, parts p, buchungsgruppen bg WHERE (i.parts_id = p.id) AND (i.parts_id = ?) AND ((i.base_qty + i.allocated) > 0) AND (i.trans_id = a.id) + AND (p.buchungsgruppen_id = bg.id) ORDER BY transdate|; # ORDER BY transdate guarantees FIFO