专业版T型账户借贷方取数和科目余额表借贷方取数不一致,导致现金流量表期末数据取数异常
【问题描述】
2023年第7期T型账户借、贷方合计不等于科目余额表现金类科目本期发生借、贷方合计,导致现金流量表-现金及现金等价物净增加额取数异常。
【原因分析】
t_CashFlowBal数据异常,2023年7期有6张凭证在T型账户不显示且未指定流量,导致现金流量表取数异常。
【解决方案】
以上方案例为例,先找到出现问题的时间范围,再执行以下语句处理;
可参考以下脚本执行处理:
其中方案一不能修复T型账户借贷方合计问题,但可解决现金流量表取数问题,若需要两个问题同时解决建议采用方案二
方案一:
--创建存储过程
if object_id('cashamountcheck') is not null drop procedure cashamountcheck
go
create procedure cashamountcheck
@startdate datetime,
@enddate datetime
as
begin
select @enddate=dateadd(DD,1,@enddate)
select cc.FYear,cc.FPeriod,dd.FName,cc.FNumber,aa.FAmount 余额表发生额,bb.FAmount 流量表发生额
from
(select a.FVoucherID, SUM((case b.FDC when 1 then 1 else -1 end)*b.FAmount) FAmount
from t_Voucher a
join t_VoucherEntry b on a.FVoucherID=b.FVoucherID
join t_Account c on b.FAccountID=c.FAccountID and c.FAccountID in
(select FAccountID from t_Account where (FIsCash=1 or FIsBank=1 or FIsCashFlow=1) and FDetail=1)
where a.FDate>=@startdate and a.FDate<@enddate
group by a.FVoucherID) aa full join
(Select t.FVoucherID, sum((case when i.fnumber like '%.01' then 1 else -1 end) *t.FAmount) FAmount
From t_Item i, (Select v.FVoucherID,i.Fnumber,Sum(b.FAmountFor) FAmountFor,Sum(b.FAmount) FAmount
from t_CashFlowBal b
inner join t_VoucherEntry e on e.FVoucherID=b.FVoucherID and e.FEntryID=b.FEntryID
inner join t_Item i on b.FItemID=i.FItemID
inner join (Select
FBrNo,FvoucherID,FDate,FYear,FPeriod,
FGroupID,FNumber,FReference,FExplanation,FAttachments,
FEntryCount,FDebitTotal,FCreditTotal,FInternalInd,FChecked,
FPosted,FPreparerID,FCheckerID,FPosterID,FCashierID,
FHandler,FOwnerGroupID,FObjectName,FParameter,FSerialNum,
FTranType,FTransDate,FFrameWorkID,FApproveID,FFootNote,
UUID , FMODIFYTIME
From t_Voucher
) v on e.FVoucherID=v.FVoucherID
Where v.FDate>=@startdate and v.FDate<@enddate
Group By v.FVoucherID, i.FNumber) t
Where Fitemclassid=9 And (t.FNumber Like i.FNumber+'.%' Or t.FNumber=i.FNumber) and i.FLevel=2
group by t.FVoucherID) bb on aa.FVoucherID=bb.FVoucherID
join t_Voucher cc on aa.FVoucherID=cc.FVoucherID
join t_VoucherGroup dd on cc.FGroupID=dd.FGroupID
where isnull(aa.FAmount,0)<>isnull(bb.FAmount,0)
end
---将下面日期范围修改为要检查的凭证日期范围,重新指定查询结果中的凭证
EXECUTE cashamountcheck '2023-07-01','2023-07-31'
方案二:
--将出现问题时间范围内所有凭证的现金流量删除,重新通过T型账户批量指定。
delete t_CashFlowBal where FVoucherID in (
select b.FVoucherID from t_Voucher a join t_VoucherEntry b on a.FVoucherID=b.FVoucherID where FYear=2023 and FPeriod=7
)
【注意事项】
正式账套执行脚本前请先做好备份,建议待在测试账套中核实无误后再在正式账套中执行。
专业版T型账户借贷方取数和科目余额表借贷方取数不一致,导致现金流量表期末数据取数异常
本文2024-09-22 15:54:18发表“kis知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-kis-84469.html