require SL::DB::Chart;
die "add_chart_booking needs a transdate" unless $self->transdate;
die "add_chart_booking needs taxincluded" unless defined $self->taxincluded;
- die "chart missing" unless $params{chart} && ref($params{chart}) eq 'SL::DB::Chart';
+ die "chart missing" unless $params{chart} && ref($params{chart}) eq 'SL::DB::Chart';
die t8('Booking needs at least one debit and one credit booking!')
unless $params{debit} or $params{credit}; # must exist and not be 0
die t8('Cannot have a value in both Debit and Credit!')
my $sum = sum map { $_->amount } @{ $self->transactions };
# compare rounded amount to 0, to get around floating point problems, e.g.
# $sum = -2.77555756156289e-17
- push @errors, t8('Out of balance transaction!') unless $::form->round_amount($sum,5) == 0;
+ push @errors, t8('Out of balance transaction!') . $sum unless $::form->round_amount($sum,5) == 0;
};
} else {
push @errors, t8('Empty transaction!');
);
require SL::DB::Chart;
+
+use Carp;
use Data::Dumper;
use DateTime;
-use SL::DATEV qw(:CONSTANTS);
-use SL::Locale::String qw(t8);
use List::Util qw(sum);
+
+use SL::DATEV qw(:CONSTANTS);
use SL::DB::Exchangerate;
use SL::DB::Currency;
-use Carp;
+use SL::Locale::String qw(t8);
#
# Public functions not exported by default
$reference_amount -= abs($amount);
$paid_amount += -1 * $amount * $exchangerate;
$skonto_amount_check -= $skonto_booking->{'skonto_amount'};
- };
+ }
if ( $params{payment_type} eq 'difference_as_skonto' ) {
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;
}
push(@{$self->{payment_select_options}} , { payment_type => 'with_skonto_pt', display => t8('with skonto acc. to pt') , selected => 1 });
} else {
if ( ( $self->valid_skonto_amount($self->open_amount) || $self->valid_skonto_amount($open_amount) ) and not $params{sepa} ) {
+ # Will never be reached
+ die "This case is as dead as the dead cat. Go to start, don't pick 2,000 \$";
$self->{invoice_amount_suggestion} = $open_amount;
# only suggest difference_as_skonto if open_amount exactly matches skonto_amount
# AND we aren't in SEPA mode