X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAR.pm;h=4f150673beb12fda4eea126036edb3165193bdf2;hb=d86c9e0ef9579462801d72442a1ce29b6980bdc4;hp=2ca302258d9d0d0a2a17e382f875357d49b730d6;hpb=c954dea7c1b814d66b8c31d04fa70a1bbbcce71e;p=kivitendo-erp.git diff --git a/SL/AR.pm b/SL/AR.pm index 2ca302258..4f150673b 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -312,17 +312,12 @@ sub _post_transaction { # safety check datev export if ($::instance_conf->get_datev_check_on_ar_transaction) { - my $transdate = $::form->{transdate} ? DateTime->from_lxoffice($::form->{transdate}) : undef; - $transdate ||= DateTime->today; - my $datev = SL::DATEV->new( - exporttype => DATEV_ET_BUCHUNGEN, - format => DATEV_FORMAT_KNE, dbh => $dbh, trans_id => $form->{id}, ); - $datev->export; + $datev->generate_datev_data; if ($datev->errors) { die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors; @@ -604,6 +599,20 @@ SQL push @values, like($form->{parts_description}); } + if ($form->{show_marked_as_closed}) { + $query .= ' + LEFT JOIN ( + SELECT SUM(acc_trans.amount) AS amount, trans_id + FROM acc_trans + LEFT JOIN chart ON chart.id = chart_id + WHERE chart.link ILIKE ? + GROUP BY trans_id + ) AS paid_difference ON (paid_difference.trans_id = a.id) + '; + unshift @values, '%AR_paid%'; + $where .= ' AND COALESCE(paid_difference.amount, 0) + a.paid != 0'; + } + my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'CT', 'trans_id_field' => 'c.id', 'filter' => $form,