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

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 => 'user_input_dist_fee';
use constant kDB => Common::DB::Item::kClientDB();


sub GetDistFeeBySale 
{
    my ($class,%args) = @_;
    my $sql = "select d.dist_fee_pct from user_input_dist_fee d,sale s where d.file_id=".$args{file_id} . " and s.file_id=d.file_id and d.associated_format=s.format_type";
    my $dbo = Common::RSApp::GetClientDB();
    my $sth = $dbo->DoCmd($sql);
    return undef if($sth->rows==0);
    my $response = $sth->fetchrow();
    return $response;

}



1;


