UFN_PDACCOUNTSYSTEM_CANDELETE
Account system can be deleted.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_PDACCOUNTSYSTEM_CANDELETE(@ID uniqueidentifier)
returns bit
with execute as caller
as begin
declare @Value bit
set @Value = 1
-- Can never delete the 'Default' system.
if @ID = '4B121C2C-CCE6-440D-894C-EA0DEF80D50B'
begin
set @Value = 0
return @Value
end
-- Check to see if Accounts Exists.
if @Value = 1 and Exists( Select ID from dbo.GLAccount Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.FINANCIALTRANSACTION Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.SALESDEPOSITPROCESS Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.BANKACCOUNT Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.STANDINGORDERSIMPORTPROCESS Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.BATCHAUCTIONITEM Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.BATCHBBNCDONATION Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.BATCHBBNCEVENTREGISTRATION Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.BATCHBBNCMEMBERSHIP Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.NETCOMMUNITYMAPPINGRULE Where DEFAULTPDACCOUNTSYSTEMID = @ID )
begin
set @Value = 0
return @Value
end
if @Value = 1 and Exists( Select ID from dbo.AMPROIMPORTCONFIG Where PDAccountSystemID = @ID )
begin
set @Value = 0
return @Value
end
return @Value
end