Revision e04af795
Von Jan Büren vor fast 3 Jahren hinzugefügt
SL/DB/Helper/Payment.pm | ||
---|---|---|
51 | 51 |
# we force caller input for amount and skonto amount |
52 | 52 |
Common::check_params(\%params, qw(amount skonto_amount)); |
53 | 53 |
# secondly we dont want to handle credit notes and purchase credit notes |
54 |
croak("Cannot use 'free skonto' for credit or debit notes") if ($params{amount} <= 0 || $params{skonto_amount} <= 0);
|
|
54 |
croak("Cannot use 'free skonto' for credit or debit notes") if ($params{amount} < 0 || $params{skonto_amount} <= 0); |
|
55 | 55 |
# both amount have to be rounded |
56 | 56 |
$params{skonto_amount} = _round($params{skonto_amount}); |
57 | 57 |
$params{amount} = _round($params{amount}); |
58 |
# lastly skonto_amount has to be smaller than the open invoice amount or payment amount ;-)
|
|
59 |
if ($params{skonto_amount} > abs($self->open_amount) || $params{skonto_amount} > $params{amount}) {
|
|
60 |
croak("Skonto amount higher than the payment or invoice amount");
|
|
58 |
# lastly skonto_amount has to be smaller or equal than the open invoice amount
|
|
59 |
if ($params{skonto_amount} > _round($self->open_amount)) {
|
|
60 |
croak("Skonto amount:" . $params{skonto_amount} . " higher than the payment or open invoice amount:" . $self->open_amount);
|
|
61 | 61 |
} |
62 | 62 |
} |
63 | 63 |
|
... | ... | |
147 | 147 |
# as long as there is no automatic tax, payments are always booked with |
148 | 148 |
# taxkey 0 |
149 | 149 |
|
150 |
unless ( $params{payment_type} eq 'difference_as_skonto' ) { |
|
150 |
unless ( $rounded_params_amount == 0 || $params{payment_type} eq 'difference_as_skonto' ) {
|
|
151 | 151 |
# cases with_skonto_pt, free_skonto and without_skonto |
152 | 152 |
|
153 | 153 |
# for case with_skonto_pt we need to know the corrected amount at this |
Auch abrufbar als: Unified diff
Payment-Helper: free_skonto erweitert: skonto_amount == open_amount