UFN_ACCOUNTSTRUCTURE
Returns account structure
Return
Return Type |
---|
table |
Parameters
Parameter | Parameter Type | Mode | Description |
---|---|---|---|
@ACCOUNTSYSTEMID | uniqueidentifier | IN |
Definition
Copy
CREATE function dbo.UFN_ACCOUNTSTRUCTURE(@ACCOUNTSYSTEMID uniqueidentifier = null)
returns table
as return
select distinct
TOP 30 T1.ID,
T1.DESCRIPTION,
T1.LENGTH,
T1.SEQUENCE,
T1.ELEMENTTYPECODE,
T1.ELEMENTDEFINITIONCODE,
(case when T2.PDACCOUNTSTRUCTUREID is null then 0 else 1 end) as ISINUSE,
T1.CLOSINGELEMENT
from
dbo.PDACCOUNTSTRUCTURE T1
left join dbo.PDACCOUNTSEGMENTVALUE T2 ON T2.PDACCOUNTSTRUCTUREID = T1.ID
where T1.PDACCOUNTSYSTEMID = isnull(@ACCOUNTSYSTEMID, '4B121C2C-CCE6-440D-894C-EA0DEF80D50B') and
T1.ISBASICGL = 0
order by SEQUENCE