#------------------------------------------------------------
# Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved
# $Id$
#------------------------------------------------------------
package RPS::DB::Item::ArtistContractDeduction;

use strict;
use warnings;

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

use Common::DB::Item;
use base 'Common::DB::Item';

use constant kTable => 'artist_contract_deduction';
use constant kDB    => Common::DB::Item::kClientDB();

sub GetByArtistContractIDAndMode {
    my ( $class, $contractID, $mode ) = @_;
    assert($contractID);
    assert($mode);

    # my $dbo = Common::RSApp::GetClientDB();

    my $sql =
        "SELECT * FROM artist_contract_deduction"
      . " WHERE artist_contract_id = "
      . $class->quote($contractID)
      . " AND contract_mode = "
      . $class->quote($mode)
      . " ORDER BY artist_contract_deduction_id";

    return $class->GetAll($sql);
}

sub GetByArtistContractID {
    my ( $class, $contractID ) = @_;
    assert($contractID);

    # my $dbo = Common::RSApp::GetClientDB();

    my $sql =
      "SELECT * FROM artist_contract_deduction"
      . " WHERE artist_contract_id = "
      . $class->($contractID)
      . " ORDER BY artist_contract_deduction_id";

    return $class->GetAll($sql);
}

1;

