UFN_GLDISTRIBUTION_ACCOUNTEXISTS_2
Checks accountnumber in distribution for existence in specific account system.
Return
Return Type |
---|
bit |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@DISTRIBUTION | xml | IN | |
@REVENUEID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_GLDISTRIBUTION_ACCOUNTEXISTS_2
(
@DISTRIBUTION xml,
@REVENUEID uniqueidentifier
)
returns bit
with execute as caller
as
begin
declare @PDACCOUNTSYSTEMID uniqueidentifier
declare @retval bit = 1
if dbo.UFN_VALID_BASICGL_INSTALLED() != 0
begin
select @PDACCOUNTSYSTEMID = PDACCOUNTSYSTEMID from FINANCIALTRANSACTION where FINANCIALTRANSACTION.ID = @REVENUEID
if @PDACCOUNTSYSTEMID is null
set @PDACCOUNTSYSTEMID = '4B121C2C-CCE6-440D-894C-EA0DEF80D50B'
if exists(select ACCOUNT from UFN_REVENUE_GETGLDISTRIBUTION_FROMITEMLISTXML(@DISTRIBUTION) where ACCOUNT not in (select GLACCOUNT.accountnumber from GLACCOUNT where PDACCOUNTSYSTEMID = @PDACCOUNTSYSTEMID ))
set @retval = 0
end
else
set @retval = 1
return @retval
end