Revision 9a2a4c7f
Von Jan Büren vor fast 3 Jahren hinzugefügt
SL/DB/GLTransaction.pm | ||
---|---|---|
113 | 113 |
require SL::DB::Chart; |
114 | 114 |
die "add_chart_booking needs a transdate" unless $self->transdate; |
115 | 115 |
die "add_chart_booking needs taxincluded" unless defined $self->taxincluded; |
116 |
die "chart missing" unless $params{chart} && ref($params{chart}) eq 'SL::DB::Chart';
|
|
116 |
die "chart missing" unless $params{chart} && ref($params{chart}) eq 'SL::DB::Chart'; |
|
117 | 117 |
die t8('Booking needs at least one debit and one credit booking!') |
118 | 118 |
unless $params{debit} or $params{credit}; # must exist and not be 0 |
119 | 119 |
die t8('Cannot have a value in both Debit and Credit!') |
... | ... | |
212 | 212 |
my $sum = sum map { $_->amount } @{ $self->transactions }; |
213 | 213 |
# compare rounded amount to 0, to get around floating point problems, e.g. |
214 | 214 |
# $sum = -2.77555756156289e-17 |
215 |
push @errors, t8('Out of balance transaction!') unless $::form->round_amount($sum,5) == 0; |
|
215 |
push @errors, t8('Out of balance transaction!') . $sum unless $::form->round_amount($sum,5) == 0;
|
|
216 | 216 |
}; |
217 | 217 |
} else { |
218 | 218 |
push @errors, t8('Empty transaction!'); |
SL/DB/Helper/Payment.pm | ||
---|---|---|
10 | 10 |
); |
11 | 11 |
|
12 | 12 |
require SL::DB::Chart; |
13 |
|
|
14 |
use Carp; |
|
13 | 15 |
use Data::Dumper; |
14 | 16 |
use DateTime; |
15 |
use SL::DATEV qw(:CONSTANTS); |
|
16 |
use SL::Locale::String qw(t8); |
|
17 | 17 |
use List::Util qw(sum); |
18 |
|
|
19 |
use SL::DATEV qw(:CONSTANTS); |
|
18 | 20 |
use SL::DB::Exchangerate; |
19 | 21 |
use SL::DB::Currency; |
20 |
use Carp;
|
|
22 |
use SL::Locale::String qw(t8);
|
|
21 | 23 |
|
22 | 24 |
# |
23 | 25 |
# Public functions not exported by default |
... | ... | |
259 | 261 |
$reference_amount -= abs($amount); |
260 | 262 |
$paid_amount += -1 * $amount * $exchangerate; |
261 | 263 |
$skonto_amount_check -= $skonto_booking->{'skonto_amount'}; |
262 |
};
|
|
264 |
} |
|
263 | 265 |
if ( $params{payment_type} eq 'difference_as_skonto' ) { |
264 | 266 |
die "difference_as_skonto calculated incorrectly, sum of calculated payments doesn't add up to open amount $total_open_amount, reference_amount = $reference_amount\n" unless _round($reference_amount) == 0; |
265 | 267 |
} |
... | ... | |
895 | 897 |
push(@{$self->{payment_select_options}} , { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt') , selected => 1 }); |
896 | 898 |
} else { |
897 | 899 |
if ( ( $self->valid_skonto_amount($self->open_amount) || $self->valid_skonto_amount($open_amount) ) and not $params{sepa} ) { |
900 |
# Will never be reached |
|
901 |
die "This case is as dead as the dead cat. Go to start, don't pick 2,000 \$"; |
|
898 | 902 |
$self->{invoice_amount_suggestion} = $open_amount; |
899 | 903 |
# only suggest difference_as_skonto if open_amount exactly matches skonto_amount |
900 | 904 |
# AND we aren't in SEPA mode |
Auch abrufbar als: Unified diff
Kosmetik, Toten Code identifizieren, Alphabetische Reihenfolge Module