From 043050cb6d383b9dd9cbbc61f08de80a5d933660 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 12 Jun 2007 14:09:00 +0000 Subject: [PATCH] Eingangsrechnungen: Wirklich das Datum der zuletzt erstellten Rechnung benutzen, nicht das maximale Datum. --- SL/IR.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SL/IR.pm b/SL/IR.pm index 12add2af1..22c1a2866 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -725,11 +725,11 @@ sub retrieve_invoice { my ($query, $sth, $ref, $q_invdate); if (!$form->{id}) { - $q_invdate = qq|, COALESCE((SELECT MAX(transdate) FROM ar), current_date) AS invdate|; + $q_invdate = qq|, COALESCE((SELECT transdate FROM ar WHERE id = (SELECT MAX(id) FROM ar)), current_date) AS invdate|; if ($form->{vendor_id}) { my $vendor_id = $dbh->quote($form->{vendor_id} * 1); $q_invdate .= - qq|, COALESCE((SELECT MAX(transdate) FROM ar), current_date) + + qq|, COALESCE((SELECT transdate FROM ar WHERE id = (SELECT MAX(id) FROM ar)), current_date) + COALESCE((SELECT pt.terms_netto FROM vendor v LEFT JOIN payment_terms pt ON (v.payment_id = pt.id) -- 2.20.1