#!/usr/bin/perl
#------------------------------------------------------------
# Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
use strict;

use Getopt::Std;

use lib '/app/tools/common/lib';
use lib '/app/tools/bookpub/lib';
use BookPub::Sale::Report::Exceptions::AllFiles;

#use BookPub::Sale::Report::Royalty;

use Common::NumericFormat;
use Common::Log;
use Common::RSApp;

# Allow tuning of the verbosity of our output.
#
my $gVerbosityLevel = 1;

#$|++;
#open(STDERR, ">>/app/shared/sale_report/report.log") unless (-t STDIN && -t STDOUT);
Common::Log::Print(" - running with args '@ARGV'");

my %opt;
getopts( 'c:', \%opt );

my $client_id = $opt{c};

usage("missing client_id") unless ( defined $client_id );

my $appSingleton = Common::RSApp->new( clientID => $client_id );

my $report = BookPub::Sale::Report::Exceptions::AllFiles->new();
$report->create();

sub usage {
    my $err = shift;

    print "$err\n\n" if ($err);

    print <<EOF;
usage: $0 [-re] -c CLIENT_ID -p PERIOD_ID

-c CLIENT_ID : is the client ID
EOF

    exit;
}

