BankTransaction new method not_assigned_amount
authorJan Büren <jan@kivitendo.de>
Fri, 1 Mar 2019 13:52:48 +0000 (14:52 +0100)
committerJan Büren <jan@kivitendo.de>
Fri, 1 Mar 2019 15:10:41 +0000 (16:10 +0100)
returns the current open amount of this bank transaction.
Added to POD

SL/DB/BankTransaction.pm

index cdc1818..9c5b560 100644 (file)
@@ -287,6 +287,16 @@ sub _check_string {
     return $match;
 };
 
+
+sub not_assigned_amount {
+  my ($self) = @_;
+
+  my $not_assigned_amount = $self->amount - $self->invoice_amount;
+  die ("undefined state") if (abs($not_assigned_amount) > abs($self->amount));
+
+  return $not_assigned_amount;
+
+}
 1;
 
 __END__
@@ -339,6 +349,11 @@ Usage:
  croak("No linked records at all") unless @{ $bt->linked_invoices() };
 
 
+=item C<not_assigned_amount>
+
+Returns the not open amount of this bank transaction.
+Dies if the return amount is higher than the original amount.
+
 =back
 
 =head1 AUTHOR