X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/cc14c2da6eef443c7affa5aaddae20c9f8cbb1dd..6c63020409f486043d63c3a324db96a4a162ff67:/SL/SEPA.pm diff --git a/SL/SEPA.pm b/SL/SEPA.pm index 94579179b..2b5738d6e 100644 --- a/SL/SEPA.pm +++ b/SL/SEPA.pm @@ -49,7 +49,7 @@ sub retrieve_open_invoices { FROM ${arap} LEFT JOIN ${vc} vc ON (${arap}.${vc}_id = vc.id) - LEFT JOIN (SELECT sei.${arap}_id, SUM(sei.amount) AS amount + LEFT JOIN (SELECT sei.${arap}_id, SUM(sei.amount) + SUM(COALESCE(sei.skonto_amount,0)) AS amount FROM sepa_export_items sei LEFT JOIN sepa_export se ON (sei.sepa_export_id = se.id) WHERE NOT se.closed