From 768b390e74168805a487348aaf2da6b3aea558bc Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 29 Apr 2013 13:09:31 +0200 Subject: [PATCH] =?utf8?q?Einkaufsrechnung=20buchen=20bei=20Bestandsmethod?= =?utf8?q?e:=20Kontenverkn=C3=BCpfung=20aus=20Buchungsgruppen,=20nicht=20a?= =?utf8?q?us=20parts?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/IR.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.20.1