Lines 515-520
sub lines {
Link Here
|
515 |
); |
515 |
); |
516 |
} |
516 |
} |
517 |
|
517 |
|
|
|
518 |
=head3 normalize_balance |
519 |
|
520 |
$account->normalize_balance(); |
521 |
|
522 |
Find outstanding credits and use them to pay outstanding debits |
523 |
|
524 |
=cut |
525 |
|
526 |
sub normalize_balance { |
527 |
my ($self) = @_; |
528 |
|
529 |
my $outstanding_debits = $self->outstanding_debits; |
530 |
my $outstanding_credits = $self->outstanding_credits; |
531 |
|
532 |
while ( $outstanding_debits->total_outstanding > 0 |
533 |
and my $credit = $outstanding_credits->next ) |
534 |
{ |
535 |
# there's both outstanding debits and credits |
536 |
$credit->apply( { debits => $outstanding_debits } ); # applying credit, no special offset |
537 |
|
538 |
$outstanding_debits = $self->outstanding_debits; |
539 |
|
540 |
} |
541 |
|
542 |
return $self; |
543 |
} |
544 |
|
518 |
1; |
545 |
1; |
519 |
|
546 |
|
520 |
=head2 Name mappings |
547 |
=head2 Name mappings |
521 |
- |
|
|