自從用了K/3的現(xiàn)金流量表,財務(wù)出報表時經(jīng)常發(fā)現(xiàn)K/3的現(xiàn)金流量表余額與科目余額表現(xiàn)金類科目的余額總和不相等,??在T型賬戶上檢查只能檢查到一些比較明顯的問題,一些細(xì)節(jié)問題還是檢查不出來,有時一個細(xì)節(jié)的問題要查找一兩天,比較典型的兩個問題是:1.在流量指定界面,[對方分錄科目]列出現(xiàn)空白行 2.還是在流量指定界面,[本位幣]列的余額不等于上方現(xiàn)金科目的金額.經(jīng)過多賬套的測試,可以肯定的講,這是系統(tǒng)的BUG.目前用V12.1,希望下一個版本此問題能得以解決.為了方便財務(wù)部同事能自己查找原因,寫了SQL代碼輔助找原因,取數(shù)原理是將現(xiàn)金流量表的收入-支出的值與憑證的現(xiàn)金類科目的借方-貸方的值作差異比較.代碼與效果圖如下:
--以下代碼是針對現(xiàn)金流量表主表
create?proc [dbo].[現(xiàn)金流量表故障分析表]
@FYear int,
@FPeriod int
as
select b.FNumber as 憑證號,FAmount1 流量表金額,FAmount2 憑證金額,FAmount1-FAmount2 差額
from (
??select d.FName%2B-%2Bltrim(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%2B-%2Bltrim(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
2022-02-17
現(xiàn)金流最終的期末金額是否等于資產(chǎn)負(fù)債表上的本期貨幣資金數(shù)?
您好!通常是等于的,但是如果有限制性的現(xiàn)金如放在其他貨幣資金的保證金類存在,那么就會存在不等的情況,其差額就是其他貨幣資金金額