Stored Procedures [dbo].[GetAdminActivatedAccountingSystems]
Properties
PropertyValue
ANSI Nulls OnYes
Quoted Identifier OnYes
Permissions
TypeActionOwning Principal
GrantExecuteMssExec
SQL Script
/**
*
*    Gets the currently activated for admin accounting system types, if any.
*    There can be multiple of these active at any point in time.
*
*    Returns a list of the following values:
*    XL: Admin for the XLedger accounting system is activated.
*    GP: Admin for the Microsoft Dynamics Great Plains accounting system is activated.
*    QB: Admin for the Intuit QuickBooks accounting system is activated.
*/


CREATE PROCEDURE [dbo].[GetAdminActivatedAccountingSystems]
as
set nocount on

declare @theAccountingSystems table
(
    SystemCode char(2)
)

if( dbo.udfHasGPAPI() = 1 )
begin
    insert into @theAccountingSystems( SystemCode )
    select
        SystemCode = 'GP'
    except
    select SystemCode
    from @theAccountingSystems
end

if( isnull( ( select Active from SecModules where [Description] = 'QuickBooks Api' ), 0 ) = 1 )
begin
    insert into @theAccountingSystems( SystemCode )
    select
        SystemCode = 'QB'
    except
    select SystemCode
    from @theAccountingSystems
end

if( exists( select top 1 1 from GlobalSystemOption where name = 'XLedgerExperimentalAdmin' and dbo.GetBooleanVarChar( [Value] ) = 'true' ) )
begin
    insert into @theAccountingSystems( SystemCode )
    select
        SystemCode = 'XL'
    except
    select SystemCode
    from @theAccountingSystems
end

-- Return our final results, if any.
select
    SystemCode
from @theAccountingSystems
order by SystemCode
GO
GRANT EXECUTE ON  [dbo].[GetAdminActivatedAccountingSystems] TO [MssExec]
GO
Uses