查询未指定现金流量的凭证

栏目:k3wise知识作者:金蝶来源:金蝶云社区发布:2024-09-16浏览:1

查询未指定现金流量的凭证

select b.fdate,b.fnumber,sum(a.凭证余额) as 凭证余额,sum(a.流量表余额) as 流量表余额,sum(a.凭证余额)-sum(a.流量表余额)  as 余额


from 

(select a.fvoucherid  ,(case when a.a=0  then a.余额  else 0 end ) as 凭证余额,(case when a.a=1  then a.余额  else 0 end ) as 流量表余额


from 

(select  a.fvoucherid,sum(增加现金流)-sum(减少现金流) as 余额,0 as a from 

(select  a.fvoucherid, (case when a.a=0  then a.famount  else 0  end ) as 增加现金流,

(case when a.a=1  then a.famount  else 0  end ) as 减少现金流

from 


(select  fvoucherid,famount,0 as a from  t_voucherentry where  faccountid  in 

(select  faccountid  from  t_account  where   (fiscash=1 or fisbank=1  or  fiscashflow=1))

and fdc=1

 union  all


select  fvoucherid,famount,1  from  t_voucherentry where  faccountid  in 

(select  faccountid  from  t_account  where   (fiscash=1 or fisbank=1  or  fiscashflow=1))

and fdc=0) a ) a

group by a.fvoucherid



union all


select a.fvoucherid,  sum(a.现金量流入)-sum(a.现金量流出) as 现金流量余额,1 from 


(select a.fvoucherid,(case  when a.a=0  then a.famount  else  0  end ) 现金量流入,

(case  when a.a=1  then a.famount  else  0  end ) 现金量流出

from



  (select  fvoucherid,famount,0  as a   from  t_CashFlowBal  where  fitemid in 

(

SELECT fitemid

FROM t_Item

WHERE (FItemClassID = 9)  and fnumber like 'ci1.01.%'  or fnumber like 'ci2.01.%' or fnumber like 'ci3.01.%'

or fnumber like 'ci4.01')

union all

select  fvoucherid,famount,1  from  t_CashFlowBal  where  fitemid in 

(SELECT fitemid

FROM t_Item

WHERE (FItemClassID = 9)  and fnumber like 'ci1.02.%'  or fnumber like 'ci2.02.%' or fnumber like 'ci3.02.%'

or fnumber like 'ci4.02')) a ) a 

group by a.fvoucherid) a) a

inner join t_voucher b on a.fvoucherid=b.fvoucherid


group by b.fdate,b.fnumber

having sum(a.凭证余额)-sum(a.流量表余额)<>0


查询未指定流量科目的凭证.rar


,有用,一样子找到出错的凭证


很有用,费心了!

查询未指定现金流量的凭证

select b.fdate,b.fnumber,sum(a.凭证余额) as 凭证余额,sum(a.流量表余额) as 流量表余额,sum(a.凭证余额)-sum(a.流量表余额) as ...
点击下载文档
分享:
确认删除?
回到顶部
客服QQ
  • 客服QQ点击这里给我发消息