Stored Procedures [dbo].[RevenueRatingImportDetailInsert]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@inRevenueRatingImportHeaderIDint4
@inBranchAgentIDint4
@inServiceDescriptionvarchar(128)128
@inServiceCodevarchar(10)10
@inCreditmoney8
@inDebitmoney8
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/**
*    Description: This is for Sirva Driver Compensation import. Adds a RevenueRatingImportDetail record based on data
*  sent to us on a download.
*
**/

create procedure [dbo].[RevenueRatingImportDetailInsert]
    @inRevenueRatingImportHeaderID int,
    @inBranchAgentID int,
    @inServiceDescription varchar( 128 ),
    @inServiceCode varchar( 10 ),
    @inCredit money,
    @inDebit money
as
begin

    set nocount on

    -- Insert RevenueRatingImportDetail records attached to a RevenueRatingImportHeader record.
    insert into RevenueRatingImportDetail
    (
        AgentFID,
        AgentPercentage,
        CartonCode,
        Description,
        Discount,
        DistributionAmount,
        DistributionCode,
        GrossAmount,
        InvoiceAmount,
        Quantity,
        Rate,
        RevenueRatingImportHeaderFID,
        RevenueType,
        InvoiceFlag,
        AddBackFlag,
        PointOfServiceFID,
        RateTypeFID,
        Quantity2,
        MilitaryItemCode,
        MilitaryItemCodeQualifier,
        VanlineWaived
    )
    select
        AgentFID = @inBranchAgentID,
        AgentPercentage = null,
        CartonCode = null,
        Description = @inServiceDescription,
        Discount = null,
        DistributionAmount = null,
        DistributionCode = @inServiceCode,
        GrossAmount = null,
        InvoiceAmount =
            case
                when @inDebit > 0 then @inDebit * -1
                else @inCredit
            end,
        Quantity = null,
        Rate = null,
        RevenueRatingImportHeaderFID = @inRevenueRatingImportHeaderID,
        RevenueType = null,
        InvoiceFlag = 0,
        AddBackFlag = 0,
        PointOfServiceFID = null,
        RateTypeFID = null,
        Quantity2 = null,
        MilitaryItemCode = null,
        MilitaryItemCodeQualifier = null,
        VanlineWaived = 0
end
GO
GRANT EXECUTE ON  [dbo].[RevenueRatingImportDetailInsert] TO [MssExec]
GO
Uses