会计科目层次展开报表
小于 1 分钟
示例代码
SELECT AcctCode AS 科目代码
, CASE Postable
WHEN 'N' THEN N'标题'
ELSE N'明细科目'
END AS 属性, Levels AS 层次
, '.' + SPACE(4 * (Levels - 2)) + AcctCode + ' - ' + AcctName AS 名称
, frgnname
, CASE GroupMask
WHEN 1 THEN N'资产'
WHEN 2 THEN N'负债'
WHEN 3 THEN N'共同类'
WHEN 4 THEN N'所有者权益'
WHEN 5 THEN N'成本类'
WHEN 6 THEN N'损益类'
END AS 类型, CurrTotal
FROM OACT
WHERE Advance = 'N'
ORDER BY GroupMask, CAST(GrpLine AS int)