|
发表于 2010-5-24 20:31:12
|
显示全部楼层
如果新年度有凭证的话,按此方法反结转会删除新年度的数据。熟悉SQL的朋友,可以参考我的方法
use zw22229
--将凭证从“已记账”恢复为“未审核”或“已审核”(1为“未审核”,2为“已审核”,3为“已记账”)
update gl_pzml set zt=1,sh='',jzr='' where kjqj>=200901 and zt=3
--修改会计期间的结账标志jzbz(0为未结账,1为已结账),使用状态syzt(0为未使用,1为已使用)
update pubkjqj set syzt=0,jzbz=0 where kjnd=2009 and kjqjxh>=1
--清空科目余额
update gl_yeb set ncj=0,ncd=0 where kjnd=2010
update gl_yeb set yj1=0,yd1=0 where kjnd=2010
update gl_yeb set yj2=0,yd2=0 where kjnd=2010
update gl_yeb set yj3=0,yd3=0 where kjnd=2010
update gl_yeb set yj4=0,yd4=0 where kjnd=2010
update gl_yeb set yj5=0,yd5=0 where kjnd=2010
update gl_yeb set yj6=0,yd6=0 where kjnd=2010
update gl_yeb set yj7=0,yd7=0 where kjnd=2010
update gl_yeb set yj8=0,yd8=0 where kjnd=2010
update gl_yeb set yj9=0,yd9=0 where kjnd=2010
update gl_yeb set yj10=0,yd10=0 where kjnd=2010
update gl_yeb set yj11=0,yd11=0 where kjnd=2010
update gl_yeb set yj12=0,yd12=0 where kjnd=2010
update gl_yebk set ncj=0,ncd=0 where kjnd=2010
update gl_yebk set yj1=0,yd1=0 where kjnd=2010
update gl_yebk set yj2=0,yd2=0 where kjnd=2010
update gl_yebk set yj3=0,yd3=0 where kjnd=2010
update gl_yebk set yj4=0,yd4=0 where kjnd=2010
update gl_yebk set yj5=0,yd5=0 where kjnd=2010
update gl_yebk set yj6=0,yd6=0 where kjnd=2010
update gl_yebk set yj7=0,yd7=0 where kjnd=2010
update gl_yebk set yj8=0,yd8=0 where kjnd=2010
update gl_yebk set yj9=0,yd9=0 where kjnd=2010
update gl_yebk set yj10=0,yd10=0 where kjnd=2010
update gl_yebk set yj11=0,yd11=0 where kjnd=2010
update gl_yebk set yj12=0,yd12=0 where kjnd=2010
--更新预记账科目表
--drop table gl_yebk
--select * into gl_yebk from gl_yeb
--还原到上年度会计科目(''为当前年度的会计科目)等
update gl_kmxx set gsdm=2099 where gsdm=''
update gl_kmxx set gsdm='' where gsdm=2099
--还原到上年度项目资料(''为当前年度的会计科目)等
update gl_xmzl set gsdm=2099 where gsdm=''
update gl_xmzl set gsdm='' where gsdm=2009
--还原到上年度现金流量信息(''为当前年度的会计科目)等
update gl_xjllxm set gsdm=2099 where gsdm=''
update gl_xjllxm set gsdm='' where gsdm=2009
--清空项目累计发生额
update gl_xmlje set ncj=0,ncd=0 where kjnd=2010
update gl_xmlje set yj1=0,yd1=0 where kjnd=2010
update gl_xmlje set yj2=0,yd2=0 where kjnd=2010
update gl_xmlje set yj3=0,yd3=0 where kjnd=2010
update gl_xmlje set yj4=0,yd4=0 where kjnd=2010
update gl_xmlje set yj5=0,yd5=0 where kjnd=2010
update gl_xmlje set yj6=0,yd6=0 where kjnd=2010
update gl_xmlje set yj7=0,yd7=0 where kjnd=2010
update gl_xmlje set yj8=0,yd8=0 where kjnd=2010
update gl_xmlje set yj9=0,yd9=0 where kjnd=2010
update gl_xmlje set yj10=0,yd10=0 where kjnd=2010
update gl_xmlje set yj11=0,yd11=0 where kjnd=2010
update gl_xmlje set yj12=0,yd12=0 where kjnd=2010
--清空项目累计发生额(预记账)
--drop table gl_xmljek
--select * into gl_xmljek from gl_xmlje
--清空辅助余额
--update gl_fzye set ncj=0,ncd=0 where kjnd=2010
--update gl_fzye set yj1=0,yd1=0 where kjnd=2010
--update gl_fzye set yj2=0,yd2=0 where kjnd=2010
--update gl_fzye set yj3=0,yd3=0 where kjnd=2010
--update gl_fzye set yj4=0,yd4=0 where kjnd=2010
--update gl_fzye set yj5=0,yd5=0 where kjnd=2010
--update gl_fzye set yj6=0,yd6=0 where kjnd=2010
--update gl_fzye set yj7=0,yd7=0 where kjnd=2010
--update gl_fzye set yj8=0,yd8=0 where kjnd=2010
--update gl_fzye set yj9=0,yd9=0 where kjnd=2010
--update gl_fzye set yj10=0,yd10=0 where kjnd=2010
--update gl_fzye set yj11=0,yd11=0 where kjnd=2010
--update gl_fzye set yj12=0,yd12=0 where kjnd=2010
--清空辅助余额(预记账)
--update gl_fzyek set ncj=0,ncd=0 where kjnd=2010
--update gl_fzyek set yj1=0,yd1=0 where kjnd=2010
--update gl_fzyek set yj2=0,yd2=0 where kjnd=2010
--update gl_fzyek set yj3=0,yd3=0 where kjnd=2010
--update gl_fzyek set yj4=0,yd4=0 where kjnd=2010
--update gl_fzyek set yj5=0,yd5=0 where kjnd=2010
--update gl_fzyek set yj6=0,yd6=0 where kjnd=2010
--update gl_fzyek set yj7=0,yd7=0 where kjnd=2010
--update gl_fzyek set yj8=0,yd8=0 where kjnd=2010
--update gl_fzyek set yj9=0,yd9=0 where kjnd=2010
--update gl_fzyek set yj10=0,yd10=0 where kjnd=2010
--update gl_fzyek set yj11=0,yd11=0 where kjnd=2010
--update gl_fzyek set yj12=0,yd12=0 where kjnd=2010
--其他表还原到上年度
--update pubbizh set gsdm=2018 where gsdm=''
--update pubbizh set gsdm='' where gsdm=2010
--update pubdqzl set gsdm=2018 where gsdm=''
--update pubdqzl set gsdm='' where gsdm=2010
--update pubkszl set gsdm=2018 where gsdm=''
--update pubkszl set gsdm='' where gsdm=2010
--删除科目余额、辅助余额、项目累计发生额等表
delete gl_yeb where kjnd>2009
delete gl_yebk where kjnd>2009
delete gl_fzyek where kjnd>2009
delete gl_fzye where kjnd>2009
delete gl_xmlje where kjnd>2009
delete gl_xmljek where kjnd>2009
--视情况对pubbizh、pubdqzl、pubkszl表中的数据进行修改
--还原到以后年度会计科目(''为当前年度的会计科目)等
--delete gl_kmxx where gsdm=''
--update gl_kmxx set gsdm='' where gsdm=2019
--delete pubbizh where gsdm=''
--update pubbizh set gsdm='' where gsdm=2019
--delete pubdqzl where gsdm=''
--update pubdqzl set gsdm='' where gsdm=2019
--delete pubkszl where gsdm=''
--update pubkszl set gsdm='' where gsdm=2019
--还原到以后年度项目资料(''为当前年度的会计科目)等
--delete gl_xmzl where gsdm=''
--update gl_xmzl set gsdm='' where gsdm=2019
--还原到以后年度现金流量信息(''为当前年度的会计科目)等
--dekete gl_xjllxm where gsdm=''
--update gl_xjllxm set gsdm='' where gsdm=2019 |
|