Stored Procedures [dbo].[spAPPG_RunApplyGridForAccountingSystem]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Parameters
NameData TypeMax Length (Bytes)
@SDPriKeyint4
@SDDPriKeyint4
@inCustomerNumbervarchar(15)15
@inVendorNumbervarchar(15)15
@inOrderCustomerNumbervarchar(15)15
@AccountingSystemTypevarchar(2)2
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/*
*    Runs one of the following, based upon the current accounting system type:
*
*    GP: spAPPG_GPRunApplyGrid
*    XL: spAPPG_XLRunApplyGrid
*    Otherwise, spAPPG_RunApplyGrid.
*
*    Supposedly, PM is only activated if the accounting system is GP or XL.
*
*/

CREATE PROCEDURE [dbo].[spAPPG_RunApplyGridForAccountingSystem]
    @SDPriKey int,
    @SDDPriKey int,
    @inCustomerNumber varchar(15) = null,
    @inVendorNumber varchar(15) = null,
    @inOrderCustomerNumber varchar(15) = null,
    @AccountingSystemType varchar(2) = null
as
set nocount on

if( isnull( @AccountingSystemType, '' ) = '' )
begin
    set @AccountingSystemType = dbo.GetAccountingSystemType()
end

if( @AccountingSystemType = 'XL' )
begin
    exec spAPPG_XLRunApplyGrid
        @SDPriKey = @SDPriKey,
        @SDDPriKey = @SDDPriKey,
        @inCustomerNumber = @inCustomerNumber,
        @inVendorNumber = @inVendorNumber,
        @inOrderCustomerNumber = @inOrderCustomerNumber
end
else if( @AccountingSystemType = 'GP' )
begin
    exec spAPPG_GPRunApplyGrid
        @SDPriKey = @SDPriKey,
        @SDDPriKey = @SDDPriKey,
        @inCustomerNumber = @inCustomerNumber,
        @inVendorNumber = @inVendorNumber,
        @inOrderCustomerNumber = @inOrderCustomerNumber
end
else
begin
    exec spAPPG_RunApplyGrid
        @SDPriKey = @SDPriKey,
        @SDDPriKey = @SDDPriKey,
        @inCustomerNumber = @inCustomerNumber,
        @inVendorNumber = @inVendorNumber,
        @inOrderCustomerNumber = @inOrderCustomerNumber
end
GO
GRANT EXECUTE ON  [dbo].[spAPPG_RunApplyGridForAccountingSystem] TO [MssExec]
GO
Uses