26  
泰格指定从某天开始启用供应商结算,以前的数据不管
作者: 吴翔宇 于 2020年06月30日 发布在分类 / 软件 / 泰格 / 至尊 下,并于 2020年07月06日 编辑

/*指定从某天开始启用供应商结算,以前的数据不管*/

declare @date datetime

set @date = '2019-12-01'    /*从这天开始正式启用供应商结算,以前的数据不管*/

set @date = dateadd(dd, -1, @date)
truncate table settle_sup_ttl
truncate table settle_sup_period
truncate table settle_supsheet_fifo
truncate table settle_sup_takeout

insert settle_sup_period
select convert(char(8), @date, 112), @date, convert(char(10), @date, 120) + ' 23:59:59'

insert settle_sup_ttl
select convert(char(8), @date, 112), supcust_no, item_no, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, branch_no
  from wh_inout_flow
 where trans_no = 'A'
 group by supcust_no, item_no, branch_no

--把这个日期之前的所有入库单、退货单都修改为已经付款, 如果要改就一口气执行到最底下,若不改执行时删除下面这段
update x set paid_amt = sheet_amt
  from ac_payrec_flow x
 inner join v_sup_ac_sheet v on v.sheet_no = x.voucher_no
 where v.work_date < @date




 推荐知识

 历史版本

修改日期 修改人 备注
2020-07-06 11:13:06[当前版本] 吴翔宇 20200706
2020-06-30 09:46:50 吴翔宇 20200630

慧邦知识分享平台 - free.V4.3.0-439 - 免费版