X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAR.pm;h=405a7f2fca050b6525921f5c110af0f888a652f4;hb=b47574cb2bdd79d3c172f67d94d3eada4bd3f981;hp=3ee8e0d92d0cbe5e8b6a2ab41710ec711f5e47a1;hpb=464f44accd46ed0b2e1f7e2459f53337a6720a7f;p=kivitendo-erp.git diff --git a/SL/AR.pm b/SL/AR.pm index 3ee8e0d92..405a7f2fc 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -183,6 +183,8 @@ sub post_transaction { do_query($form, $dbh, $query, $form->{paid}, $form->{paid} ? conv_date($form->{datepaid}) : undef, conv_i($form->{id})); } + $form->new_lastmtime('ar'); + # add paid transactions for my $i (1 .. $form->{paidaccounts}) { @@ -461,12 +463,13 @@ sub ar_transactions { 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 @@ -481,6 +484,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)| . @@ -549,6 +553,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}); @@ -760,6 +772,8 @@ sub storno { $query = qq|UPDATE ar SET paid = amount + paid, storno = 't' WHERE id = ?|; do_query($form, $dbh, $query, $id); + $form->new_lastmtime('ar') if $id == $form->{id}; + # now copy acc_trans entries $query = qq|SELECT a.*, c.link FROM acc_trans a LEFT JOIN chart c ON a.chart_id = c.id WHERE a.trans_id = ? ORDER BY a.acc_trans_id|; my $rowref = selectall_hashref_query($form, $dbh, $query, $id);