用友的凭证update

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;

 以防万一的截图

原文地址:https://www.cnblogs.com/sumsen/p/4203933.html