Revision a6a97a5f
Von Bernd Bleßmann vor etwa 4 Jahren hinzugefügt
SL/SEPA.pm | ||
---|---|---|
29 | 29 |
|
30 | 30 |
my $mandate = $params{vc} eq 'customer' ? " AND COALESCE(vc.mandator_id, '') <> '' AND vc.mandate_date_of_signature IS NOT NULL " : ''; |
31 | 31 |
|
32 |
# in query: for customers, use payment terms from invoice, for vendors use |
|
33 |
# payment terms from vendor settings |
|
34 |
# currently there is no option in vendor invoices for setting payment terms, |
|
35 |
# so the vendor settings are always used |
|
36 |
|
|
37 |
my $payment_term_type = $params{vc} eq 'customer' ? "${arap}" : 'vc'; |
|
38 |
|
|
39 | 32 |
# open_amount is not the current open amount according to bookkeeping, but |
40 | 33 |
# the open amount minus the SEPA transfer amounts that haven't been closed yet |
41 | 34 |
my $query = |
... | ... | |
63 | 56 |
GROUP BY sei.${arap}_id) |
64 | 57 |
AS open_transfers ON (${arap}.id = open_transfers.${arap}_id) |
65 | 58 |
|
66 |
LEFT JOIN payment_terms pt ON (${payment_term_type}.payment_id = pt.id)
|
|
59 |
LEFT JOIN payment_terms pt ON (${arap}.payment_id = pt.id)
|
|
67 | 60 |
|
68 | 61 |
WHERE ${arap}.amount > (COALESCE(open_transfers.amount, 0) + ${arap}.paid) |
69 | 62 |
|
... | ... | |
591 | 584 |
Otherwise the function just dies with a short notice of the id. |
592 | 585 |
|
593 | 586 |
=cut |
594 |
|
|
595 |
|
|
596 |
|
|
597 |
|
Auch abrufbar als: Unified diff
SEPA-Überweisungen: Zahlungsbedingungen f. Skonto aus EK-Rechnungen übernehmen …
… und nicht aus den Lieferanten-Stammdaten.
Hier könnte es im VK und EK noch eine Art fallback auf die Zahlungsbedingungen
aus den Kunden-/Lieferanten-Stammdaten geben - so dass diese zusätzlich als
Auswahl angeboten werden, sofern sie nicht in der Rechnung angegeben sind.
Refs #444 (redmine)