X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAR.pm;h=2841743965fc432c39f08ec9a3b558ca9fa775ca;hb=3a7079558f44e4b80670327e70b565c8caf52a0e;hp=65ab4ce016f33ba7b15b0023433e082f79e57d8a;hpb=cff0e9be7e6925c22dab7cb0b52ab9e23af0d56a;p=kivitendo-erp.git diff --git a/SL/AR.pm b/SL/AR.pm index 65ab4ce01..284174396 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -302,8 +302,6 @@ sub post_transaction { exporttype => DATEV_ET_BUCHUNGEN, format => DATEV_FORMAT_KNE, dbh => $dbh, - from => $transdate, - to => $transdate, trans_id => $form->{id}, ); @@ -460,15 +458,16 @@ sub ar_transactions { my $query = qq|SELECT DISTINCT a.id, a.invnumber, a.ordnumber, a.cusordnumber, a.transdate, | . qq| a.duedate, a.netamount, a.amount, a.paid, | . - qq| a.invoice, a.datepaid, a.terms, a.notes, a.shipvia, | . + qq| a.invoice, a.datepaid, a.notes, a.shipvia, | . qq| a.shippingpoint, a.storno, a.storno_id, a.globalproject_id, | . qq| a.marge_total, a.marge_percent, | . - qq| a.transaction_description, | . + qq| a.transaction_description, a.direct_debit, | . qq| pr.projectnumber AS globalprojectnumber, | . qq| c.name, c.customernumber, c.country, c.ustid, b.description as customertype, | . qq| c.id as customer_id, | . qq| e.name AS employee, | . qq| e2.name AS salesman, | . + qq| dc.dunning_description, | . qq| tz.description AS taxzone, | . qq| pt.description AS payment_terms, | . qq{ ( SELECT ch.accno || ' -- ' || ch.description @@ -483,6 +482,7 @@ sub ar_transactions { qq|LEFT JOIN contacts cp ON (a.cp_id = cp.cp_id) | . qq|LEFT JOIN employee e ON (a.employee_id = e.id) | . qq|LEFT JOIN employee e2 ON (a.salesman_id = e2.id) | . + qq|LEFT JOIN dunning_config dc ON (a.dunning_config_id = dc.id) | . qq|LEFT JOIN project pr ON (a.globalproject_id = pr.id)| . qq|LEFT JOIN tax_zones tz ON (tz.id = a.taxzone_id)| . qq|LEFT JOIN payment_terms pt ON (pt.id = a.payment_id)| . @@ -551,6 +551,14 @@ sub ar_transactions { $where .= " AND a.transdate <= ?"; push(@values, $form->{transdateto}); } + if ($form->{duedatefrom}) { + $where .= " AND a.duedate >= ?"; + push(@values, $form->{duedatefrom}); + } + if ($form->{duedateto}) { + $where .= " AND a.duedate <= ?"; + push(@values, $form->{duedateto}); + } if ($form->{open} || $form->{closed}) { unless ($form->{open} && $form->{closed}) { $where .= " AND a.amount <> a.paid" if ($form->{open}); @@ -573,6 +581,15 @@ sub ar_transactions { } }; + my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'CT', + 'trans_id_field' => 'c.id', + 'filter' => $form, + ); + if ($cvar_where) { + $where .= qq| AND ($cvar_where)|; + push @values, @cvar_values; + } + my @a = qw(transdate invnumber name); push @a, "employee" if $form->{l_employee}; my $sortdir = !defined $form->{sortdir} ? 'ASC' : $form->{sortdir} ? 'ASC' : 'DESC';