金蝶K/3现金流量表余额不正确校验方法(更新)(

阅读: 评论:0

金蝶K/3现金流量表余额不正确校验方法(更新)(

金蝶K/3现金流量表余额不正确校验方法(更新)(

自从用了K/3的现金流量表,财务出报表时经常发现K/3的现金流量表余额与科目余额表现金类科目的余额总和不相等,  在T型账户上检查只能检查到一些比较明显的问题,一些细节问题还是检查不出来,有时一个细节的问题要查找一两天,比较典型的两个问题是:1.在流量指定界面,[对方分录科目]列出现空白行 2.还是在流量指定界面,[本位币]列的余额不等于上方现金科目的金额.经过多账套的测试,可以肯定的讲,这是系统的BUG.目前用V12.1,希望下一个版本此问题能得以解决.为了方便财务部同事能自己查找原因,写了SQL代码辅助找原因,取数原理是将现金流量表的收入-支出的值与凭证的现金类科目的借方-贷方的值作差异比较.代码与效果图如下:
--以下代码是针对现金流量表主表 create proc [dbo].[现金流量表故障分析表]
@FYear int,
@FPeriod int
as
select b.FNumber as 凭证号,FAmount1 流量表金额,FAmount2 凭证金额,FAmount1-FAmount2 差额
from (
  select d.FName+'-'+ltrim(b.FNumber) FNumber,
    sum(case
      when c.FNumber like 'CI[1-4].01%' then a.famount
      when c.FNumber like 'CI[1-4].02%' then -a.famount
      else 0
      end) FAmount1
  from t_CashFlowBal a
    join t_Voucher b on a.FVoucherID=b.FVoucherID and a.FItemID>0
    join t_Item c on a.FItemID=c.FItemID and c.FItemClassID=9
    join t_VoucherGroup d on b.FGroupID=d.FGroupID
  where b.FYear=@FYear and b.FPeriod=@FPeriod
  group by b.FNumber,d.FName
  ) a
  right join (
    select d.FName+'-'+ltrim(a.FNumber) FNumber,
      sum(case b.FDC when 1 then b.FAmount else -b.FAmount end) FAmount2
    from t_Voucher a
      join t_VoucherEntry b on a.FVoucherID=b.FVoucherID
      join t_VoucherGroup d on a.FGroupID=d.FGroupID
    where a.FYear=@FYear and a.FPeriod=@FPeriod
    and b.FAccountID IN(select FAccountID from t_Account where  (FIsCash=1 or FIsBank=1 or FIsCashFlow=1) and FDetail=1)
    group by a.FNumber,d.FName
    ) b
      on a.FNumber=b.FNumber
where isnull(FAmount1,FAmount2)<>0
union all
select '合计',FAmount1 流量表金额,FAmount2 凭证金额,FAmount1-FAmount2 差额
from (
  select
    sum(case
      when c.FNumber like 'CI[1-4].01%' then a.famount
      when c.FNumber like 'CI[1-4].02%' then -a.famount
      else 0
      end) FAmount1
  from t_CashFlowBal a
    join t_Voucher b on a.FVoucherID=b.FVoucherID and FItemID>0
    join t_Item c on a.FItemID=c.FItemID and c.FItemClassID=9
  where b.FYear=@FYear and b.FPeriod=@FPeriod
  ) a
  cross join (
    select
      sum(case b.FDC when 1 then b.FAmount else -b.FAmount end) FAmount2
    from t_Voucher a
      join t_VoucherEntry b on a.FVoucherID=b.FVoucherID
    where a.FYear=@FYear and a.FPeriod=@FPeriod
    and b.FAccountID IN(select FAccountID from t_Account where  (FIsCash=1 or FIsBank=1 or FIsCashFlow=1) and FDetail=1)
    ) b
GO

本文发布于:2024-03-05 17:36:54,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/1709701982124105.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23