require SL::DB::Chart;
die "add_chart_booking needs a transdate" unless $self->transdate;
die "add_chart_booking needs taxincluded" unless defined $self->taxincluded;
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 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!')
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
my $sum = sum map { $_->amount } @{ $self->transactions };
# compare rounded amount to 0, to get around floating point problems, e.g.
# $sum = -2.77555756156289e-17