Revision 9c9e5cc5
Von Till Zöller vor fast 8 Jahren hinzugefügt
SL/SEPA.pm | ||
---|---|---|
35 | 35 |
|
36 | 36 |
my $payment_term_type = $params{vc} eq 'customer' ? "${arap}" : 'vc'; |
37 | 37 |
|
38 |
# Flag for direct debit. For SEPA bank transfers vendors flagged |
|
39 |
# with »direct debit« should not be shown. Similarly for SEPA bank |
|
40 |
# collections: only customers flagged with it should be shown. |
|
41 |
my $tf = $params{vc} eq 'customer' ? 'FALSE' : 'TRUE'; |
|
42 |
|
|
38 | 43 |
# open_amount is not the current open amount according to bookkeeping, but |
39 | 44 |
# the open amount minus the SEPA transfer amounts that haven't been closed yet |
40 | 45 |
my $query = |
... | ... | |
46 | 51 |
vc.name AS vcname, vc.language_id, ${arap}.duedate as duedate, ${arap}.direct_debit, |
47 | 52 |
vc.${vc_vc_id} as vc_vc_id, |
48 | 53 |
|
49 |
COALESCE(vc.iban, '') <> '' AND COALESCE(vc.bic, '') <> '' ${mandate} AS vc_bank_info_ok, |
|
54 |
COALESCE(vc.iban, '') <> '' AND COALESCE(vc.bic, '') <> '', vc.direct_debit <> ${tf} ${mandate} AS vc_bank_info_ok,
|
|
50 | 55 |
|
51 | 56 |
${arap}.amount - ${arap}.paid - COALESCE(open_transfers.amount, 0) AS open_amount, |
52 | 57 |
COALESCE(open_transfers.amount, 0) AS transfer_amount, |
... | ... | |
64 | 69 |
|
65 | 70 |
LEFT JOIN payment_terms pt ON (${payment_term_type}.payment_id = pt.id) |
66 | 71 |
|
67 |
WHERE ${arap}.amount > (COALESCE(open_transfers.amount, 0) + ${arap}.paid) |
|
72 |
WHERE (${arap}.amount > (COALESCE(open_transfers.amount, 0) + ${arap}.paid)) |
|
73 |
AND (${arap}.direct_debit <> ${tf}) |
|
68 | 74 |
|
69 | 75 |
ORDER BY lower(vc.name) ASC, lower(${arap}.invnumber) ASC |
70 | 76 |
|; |
Auch abrufbar als: Unified diff
Ausblenden von Lieferanten mit/Kunden ohne Lastschriften aus SEPA-Überweisungen