#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::Statement::Label::StatementTransactionList;

use strict;
use warnings;
use Carp;

use Data::Dumper;

use lib '/app/tools/common/lib';
use Common::Assert;

use lib '/app/tools/rps/lib';

use RPS::Statement::Label::StatementTransaction;
use RPS::DB::Item::LabelRoyaltyTransactionItem;

use Common::FormObject;
use base 'Common::FormObject';

sub _init {
    my ( $self, %args ) = @_;

    $self->SUPER::_init(%args);

    my $statementID = $args{labelRoyaltyStatementID};

    $self->{LabelStatementTransaction} = [];
    if ($statementID) {
        my $collection = RPS::DB::Item::LabelRoyaltyTransactionItem->GetByLabelRoyaltyStatementID($statementID);

        while ( $collection->hasNext() ) {
            my $obj = $collection->next();

            my $trans = RPS::Statement::Label::StatementTransaction->new( _dbItem => $obj, );

            push @{ $self->{LabelStatementTransaction} }, $trans;
        }
    }

    return $self;
}

sub getList {
    my ($self) = @_;

    return $self->{LabelStatementTransaction};
}

1;
