Revision a6a97a5f
Von Bernd Bleßmann vor etwa 4 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
338 | 338 |
|
339 | 339 |
my $self = shift; |
340 | 340 |
|
341 |
my $is_sales = ref($self) eq 'SL::DB::Invoice'; |
|
342 |
|
|
343 |
my $skonto_date; |
|
344 |
|
|
345 |
if ( $is_sales ) { |
|
346 |
return undef unless ref $self->payment_terms; |
|
347 |
return undef unless $self->payment_terms->terms_skonto > 0; |
|
348 |
$skonto_date = DateTime->from_object(object => $self->transdate)->add(days => $self->payment_terms->terms_skonto); |
|
349 |
} else { |
|
350 |
return undef unless ref $self->vendor->payment_terms; |
|
351 |
return undef unless $self->vendor->payment_terms->terms_skonto > 0; |
|
352 |
$skonto_date = DateTime->from_object(object => $self->transdate)->add(days => $self->vendor->payment_terms->terms_skonto); |
|
353 |
}; |
|
354 |
|
|
355 |
return $skonto_date; |
|
341 |
return undef unless ref $self->payment_terms; |
|
342 |
return undef unless $self->payment_terms->terms_skonto > 0; |
|
343 |
return DateTime->from_object(object => $self->transdate)->add(days => $self->payment_terms->terms_skonto); |
|
356 | 344 |
}; |
357 | 345 |
|
358 | 346 |
sub reference_account { |
... | ... | |
442 | 430 |
sub percent_skonto { |
443 | 431 |
my $self = shift; |
444 | 432 |
|
445 |
my $is_sales = ref($self) eq 'SL::DB::Invoice'; |
|
446 |
|
|
447 | 433 |
my $percent_skonto = 0; |
448 | 434 |
|
449 |
if ( $is_sales ) { |
|
450 |
return undef unless ref $self->payment_terms; |
|
451 |
return undef unless $self->payment_terms->percent_skonto > 0; |
|
452 |
$percent_skonto = $self->payment_terms->percent_skonto; |
|
453 |
} else { |
|
454 |
return undef unless ref $self->vendor->payment_terms; |
|
455 |
return undef unless $self->vendor->payment_terms->terms_skonto > 0; |
|
456 |
$percent_skonto = $self->vendor->payment_terms->percent_skonto; |
|
457 |
}; |
|
435 |
return undef unless ref $self->payment_terms; |
|
436 |
return undef unless $self->payment_terms->percent_skonto > 0; |
|
437 |
$percent_skonto = $self->payment_terms->percent_skonto; |
|
458 | 438 |
|
459 | 439 |
return $percent_skonto; |
460 | 440 |
}; |
... | ... | |
540 | 520 |
# TODO: check whether there are negative values in invoice / acc_trans ... credited items |
541 | 521 |
|
542 | 522 |
# don't check whether skonto applies, because user may want to override this |
543 |
# return undef unless $self->percent_skonto; # for is_sales |
|
544 |
# return undef unless $self->vendor->payment_terms->percent_skonto; # for purchase |
|
523 |
# return undef unless $self->percent_skonto; |
|
545 | 524 |
|
546 | 525 |
my $is_sales = ref($self) eq 'SL::DB::Invoice'; |
547 | 526 |
|
... | ... | |
905 | 884 |
=item C<percent_skonto> |
906 | 885 |
|
907 | 886 |
Returns the configured skonto percentage of the payment terms of an invoice, |
908 |
e.g. 0.02 for 2%. Payment terms come from invoice settings for ar, from vendor |
|
909 |
settings for ap. |
|
887 |
e.g. 0.02 for 2%. Payment terms come from invoice settingssettings for ap. |
|
910 | 888 |
|
911 | 889 |
=item C<amount_less_skonto> |
912 | 890 |
|
913 |
If the invoice has a payment term (via ar for sales, via vendor for purchase),
|
|
891 |
If the invoice has a payment term, |
|
914 | 892 |
calculate the amount to be paid in the case of skonto. This doesn't check, |
915 | 893 |
whether skonto applies (i.e. skonto doesn't wasn't exceeded), it just subtracts |
916 | 894 |
the configured percentage (e.g. 2%) from the total amount. |
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)