X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FSEPA.pm;h=2b5738d6e74e2882aee35c10d7bac996c088b03a;hb=4ce378dcdff892ab7aa0124873ebb29206539184;hp=f2599a8b681b08562f34b4c7e9c357b14cb5221c;hpb=5ede0770885e493389494cf3be00511962d823a8;p=kivitendo-erp.git diff --git a/SL/SEPA.pm b/SL/SEPA.pm index f2599a8b6..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 @@ -326,6 +326,17 @@ sub list_exports { $joins_sub{$arap} = 1; } + if ($filter->{message_id}) { + push @values, '%' . $filter->{message_id} . '%'; + push @where, <{vc}) { push @where_sub, "vc.name ILIKE ?"; push @values_sub, '%' . $filter->{vc} . '%'; @@ -370,6 +381,9 @@ sub list_exports { (SELECT SUM(sei.amount) FROM sepa_export_items sei WHERE (sei.sepa_export_id = se.id)) AS sum_amounts, + (SELECT string_agg(semi.message_id, ', ') + FROM sepa_export_message_ids semi + WHERE semi.sepa_export_id = se.id) AS message_ids, e.name AS employee FROM sepa_export se LEFT JOIN (