select gl_balance.year, bd_accsubj.dispname, sum(gl_balance.debitamount) 收入, sum(gl_balance.creditamount) 支出 from gl_balance, bd_accsubj, bd_glorgbook where gl_balance.pk_accsubj = bd_accsubj.pk_accsubj and bd_glorgbook.pk_glorgbook = gl_balance.pk_glorgbook and bd_glorgbook.glorgbookcode in ('030101-0001','030201-0001','030301-0001','030401-0001','032901-0001') and bd_accsubj.subjcode like '5502%' and gl_balance.period<>'00' and gl_balance.year=2014 group by ROLLUP(( gl_balance.year, bd_accsubj.dispname )) order by bd_accsubj.dispname
因为报表是汇总的,可是没有管理费用的明细,汇算清缴需要,因此搞出来
27个集团分公司
and bd_glorgbook.glorgbookcode in( '010101-0001','010201-0001','010301-0001','010401-0001','010501-0001','010601-0001',
'010701-0001','010801-0001','011001-0001','011101-0001','011201-0001','011501-0001','011601-0001','011701-0001','011801-0001',
'011901-0001','012101-0001','012601-0001','012901-0001','013001-0001','013101-0001','013201-0001','013501-0001',
'015101-0001','015201-0001','015301-0001','015501-0001')
gl_balance表必须凭证审核记账之后才能取到数字,否则上图的支出就没有数