SUMSEN

Oracle&Sql爱好者,用友NC管理员

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

 

select pk_glorgbook from bd_glorgbook where glorgbookcode='0100-0001';--0001N510000000006K4X
select no,period,year,dr,pk_voucher from gl_voucher where no='68' and dr='0' and period='01' and year='2014' and 
pk_glorgbook='0001N510000000006K4X';
update gl_voucher set no='69' where pk_voucher='1162N51000000001YHZ3';
update gl_detail set nov='69'where pk_voucher='1162N51000000001YHZ3';

 凭证整理无效,修改凭证号:

select no,period,year,dr,gl_voucher.explanation, pk_voucher from gl_voucher where no in('153','156','154','287' )
and dr='0' and period='04' and year='2014' and pk_glorgbook='0001N510000000006K4X' for update;

 可手工修改凭证:gl_detail有些没有no凭证,只好使用gl_voucher,下面的

select pk_voucher from gl_voucher v where v.pk_glorgbook in  
(select pk_glorgbook from bd_glorgbook where glorgbookcode='012101-0001')
and v.dr=0 and  v.year=2014 and v.period=12 and v.no=55  --1076N510000000004GX8

select d.explanation,d.modifyflag  from gl_detail d where d.pk_voucher='1076N510000000004GX8' for update --YYYYYYYYYYYYYYYY

上面适合临时写

整合

select d.explanation, d.modifyflag,d.detailindex,d.pk_systemv
  from gl_detail d
 where d.pk_voucher in (select pk_voucher
                          from gl_voucher v
                         where v.pk_glorgbook in
                               (select pk_glorgbook
                                  from bd_glorgbook
                                 where glorgbookcode = '012101-0001')--账簿
                           and v.dr = 0
                           and v.year = 2014  --年月凭证号
                           and v.period = 12
                           and v.no = 55 )  
   for update --YYYYYYYYYYYYYYYY

 2016.1.6更新结算中心

从凭证整理看到重复凭证号,之后

select v.explanation ,v.totalcredit,no
from gl_voucher v  
where no in('1','4','202','204' )
and period='01' 
and year='2015' 
and pk_glorgbook='0001N510000000006K4X' 
for update;

 以防万一的截图

posted on 2015-01-05 16:27  sumsen  阅读(537)  评论(0编辑  收藏  举报