#---------------------------------------------------------------
# ____                   _ _         ____  _
#|  _ \ ___  _   _  __ _| | |_ _   _/ ___|| |__   __ _ _ __ ___
#| |_) / _ \| | | |/ _` | | __| | | \___ \| '_ \ / _` | '__/ _ \
#|  _ < (_) | |_| | (_| | | |_| |_| |___) | | | | (_| | | |  __/
#|_| \_\___/ \__, |\__,_|_|\__|\__, |____/|_| |_|\__,_|_|  \___|
#            |___/             |___/
#
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#---------------------------------------------------------------
package BookPub::Sale::Report;
use strict;
use warnings;

use lib '/app/tools/common/lib';
use lib '/app/tools/bookpub/lib';
use BookPub::DB::Item::Book;
use BookPub::Config;
use Common::RSApp;
use Common::Util;
use Common::Assert;
use Common::FormObject;
use Common::Client;

sub new {
    my ( $class, %args ) = @_;

    my $self = bless {}, $class;
    return $self->_init(%args);
}

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

    #    assert(defined $args{periodID});

    $self->{_periodID} = $args{periodID};

    return $self;
}

sub periodID {
    my ($self) = @_;
    return $self->{_periodID};
}

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

    if ( !$self->{_baseDir} ) {
        my $config = BookPub::Config->new();

        my $client = Common::Client::Current();

        $self->{_baseDir} = $config->get('sale_report_dir');
        $self->{_baseDir} .= '/' . $client->ClientNameClean();
    }
    return $self->{_baseDir};
}

sub filePath {
    my ($self) = @_;
    if ( !$self->{_filePath} ) {
        my $baseDir = $self->_baseDir();
        $self->{_filePath} = $baseDir . '/' . $self->fileName();
    }
    return $self->{_filePath};
}

# Abstract methods (that must be implemented):
#
sub fileName {
    assert( 0, 'override' );
}

sub create {
    assert( 0, 'override' );
}

###
1;    #
###
