#------------------------------------------------------------
# Copyright (C) 2007 RoyaltyShare, Inc.   All Rights Reserved
#------------------------------------------------------------
package RPS::Report::LabelsWithMultipleContracts;
use strict;
use warnings;

use lib '/app/tools/common/lib';
use Common::FormObject;
use Common::Assert;
use Common::Client;
use Common::Locale;

use lib '/app/tools/rps/lib';
use RPS::DB::Item::ReportQueries;
use RPS::DB::Item::ReportQueries::LabelsWithMultipleContracts;

use base 'RPS::Report';

sub _baseXMLName { 'Label' }

sub _getDBItem() {
    my $self = shift;
    return RPS::DB::Item::ReportQueries::LabelsWithMultipleContracts->GetLabelsWithMultipleContracts();
}

sub _reportColumns {
    my $self = shift;

    return (
        "LabelName"        => "Label",
        "ContractTitle"    => "Contract Title",
        "ClientContractID" => "Contract ID",
        "PayorName"        => "Payor",
        "PayeeName"        => "Payee",
        "DistFee"          => "Distribution Fee",
    );
}

sub _fillInHash {
    my ( $self, $label ) = @_;

    my %data;

    my $locale = Common::Client::Current()->Locale();

    $data{LabelName}        = $label->label_name;
    $data{LabelID}          = $label->label_id;
    $data{ContractTitle}    = $label->contract_title;
    $data{LabelContractID}  = $label->label_contract_id;
    $data{ClientContractID} = $label->client_contract_id;
    $data{PayorName}        = $label->payor_name;
    $data{PayeeName}        = $label->payee_name;
    $data{PayeeID}          = $label->payee_id;
    $data{DistFee}          = $locale->formatNumber( $label->distribution_fee, '.2' );

    return \%data;
}

###
1;    #
###
