总账常用的查询SQL

1、凭证
--查询某张凭证记录
select v.* from t_gl_voucher v
inner join t_bd_period p on p.fid=v.fperiodid
inner join T_BD_VoucherTypes vt on v.FVoucherTypeID=vt.fid
inner join t_org_company c on c.fid=v.fcompanyid
where p.fnumber='期间编码'and c.fnumber='公司编码'and vt.fnumber='凭证类型编码' and v.fnumber='凭证号'
--查询某张凭证的对应分录记录
select ve.* from t_gl_voucher v
inner join t_bd_period p on p.fid=v.fperiodid
inner join t_org_company c on c.fid=v.fcompanyid
inner join T_BD_VoucherTypes vt on v.FVoucherTypeID=vt.fid
inner join t_bd_accountview av on ve.faccountid=av.fid
where p.fnumber='期间编码'and c.fnumber='公司编码' and vt.fnumber='凭证类型编码' and v.fnumber='凭证号' and av.fnumber='科目编码' and ve.fseq='分录号'
--查询某张凭证的辅助账记录
select vs.* from t_gl_voucher v
inner join t_bd_period p on p.fid=v.fperiodid
inner join t_org_company c on c.fid=v.fcompanyid
inner join T_BD_VoucherTypes vt on v.FVoucherTypeID=vt.fid
inner join t_gl_voucherentry ve on ve.fbillid=v.fid
inner join t_bd_accountview av on ve.faccountid=av.fid
inner join t_gl_voucherassistrecord vs on vs.fentryid=ve.fid
where p.fnumber='期间编码'and c.fnumber='公司编码' and vt.fnumber='凭证类型编码' and v.fnumber='凭证号' and av.fnumber='科目编码' and ve.fseq='分录号'
--查询某个成本中心被哪些公司哪些期间的凭证所引用
inner join t_gl_voucherassistrecord vs on vs.fentryid=ve.fid
inner join T_BD_VoucherTypes vt on v.FVoucherTypeID=vt.fid
inner join t_bd_period p on p.fid=v.fperiodid
inner join t_org_company c on c.fid=v.fcompanyid
where cc.Fnumber='成本中心编码'
2、现金流量
select cf.* from t_gl_voucher v
inner join T_BD_VoucherTypes vt on v.FVoucherTypeID=vt.fid
inner join t_org_company c on c.fid=v.fcompanyid
inner join t_gl_cashflowrecord cf on cf.fvoucherid=v.fid
where p.fnumber='期间编码'and c.fnumber='公司编码' and vt.fnumber='凭证类型编码' and v.fnumber='凭证号'
3、往来核算
select av.* from t_gl_voucher v
inner join T_BD_VoucherTypes vt on v.FVoucherTypeID=vt.fid
inner join t_gl_voucherassistrecord vs on vs.fentryid=ve.fid
inner join t_bd_period p on p.fid=v.fperiodid
inner join t_org_company c on c.fid=v.fcompanyid
inner join t_gl_acctverify av on av.FVCHASSISTRECORDID=vs.fid
where p.fnumber='期间编码'and c.fnumber='公司编码' and vt.fnumber='凭证类型编码' and v.fnumber='凭证号' and ve.seq='分录号' and vs.fseq='辅助账行号'
select ac.* from t_gl_voucher v
inner join T_BD_VoucherTypes vt on v.FVoucherTypeID=vt.fid
inner join t_gl_voucherassistrecord vs on vs.fentryid=ve.fid
inner join t_bd_period p on p.fid=v.fperiodid
inner join t_org_company c on c.fid=v.fcompanyid
inner join t_gl_acctcussent ac on ac.FVCHASSISTRECORDID=vs.fid
where p.fnumber='期间编码'and c.fnumber='公司编码' and vt.fnumber='凭证类型编码' and v.fnumber='凭证号' and ve.seq='分录号' and vs.fseq='辅助账行号'
4、余额表
--查询某个科目某个期间的科目余额记录(以科目余额(包含未过账本位币)为例,其余科目余额表的表名请参考此贴:总账的相关表
select ab1.* from t_gl_acc
总账常用的查询SQL
声明:除非特别标注,否则均为本站原创文章,转载时请以链接形式注明文章出处。如若本站内容侵犯了原著者的合法权益,可联系本站删除。



