年结数据不一致问题
库存年度结转后年初数与去年年末数不符
问题名称
库存年度结转后年初数与去年年末数不符
问题现象
启用库存与存货两模块,库存结转至06年后,2006期初数与2005年度帐中收发存期末结
存数不一致
问题原因
由于在12月月末结帐时,存在未审核单据,直接使用 update 语句对rdrecord的审核人
chandler进行更新造成的。 但是,只更新了chanler字段,其中审核日期(dveridate)
依然为null值。在结转前又没有重新整理现存量造成的。结转后的差值就是这部分的数量,
可以通过如下语句查询:
select cwhcode,cinvcode,cbatch,sum(case when brdflag=1 then iquantity else -iquantity end) as
i--dveridate,autoid,brdflag,cvouchtype,cwhcode,cinvcode,cbatch,iquantity,isoutquantity,* --into #temlwb from rdrecord a join rdrecords b on a.id=b.id where dveridate is null and chandler is not null and cbustype<>'假退料' group by
cwhcode,cinvcode,cbatch
解决
由于在12月月末结帐时,存在未审核单据,直接使用 update 语句对rdrecord的审核人
chandler进行更新造成的。 但是,只更新了chanler字段,其中审核日期(dveridate)
依然为null值。在结转前又没有重新整理现存量造成的。结转后的差值就是这部分的数量,
可以通过如下语句查询:
select cwhcode,cinvcode,cbatch,sum(case when brdflag=1 then iquantity else -iquantity end) as
i--dveridate,autoid,brdflag,cvouchtype,cwhcode,cinvcode,cbatch,iquantity,isoutquantity,* --into #temlwb from rdrecord a join rdrecords b on a.id=b.id where dveridate is null and chandler is not null and cbustype<>'假退料' group by
cwhcode,cinvcode,cbatch
由于用户数据采用的是审核时更改现存量的方式,且仓库都存在货位管理,这样结转下来的
数据中的货位表也是混乱的。 建议,通过在2005年度中,将属于如下范围的数据进行修改:
select dveridate,chandler,* from rdrecord where isnull(Rdrecord.dveridate,'')='' and chandler is not null and cbustype<>'假退料' 修改语句如下: update rdrecord set
chandler=null where isnull(Rdrecord.dveridate,'')='' and chandler is not null and cbustype<>'假退料' 之后,进行在2005年的软件中,审核单据,有货位要求的指定货位。
然后整理现存量。重新进行年度结转。