--SQL反结账语句,专业版测试成功--
declare @y int
declare @p int
set @y =2017 --修改为账套当前会计年度--
set @p =11 --修改为账套当前会计期间--
Delete from t_Balance Where FYear = @y And FPeriod = @p
Delete from t_QuantityBalance Where FYear = @y And FPeriod = @p
Delete from t_ProfitAndLoss Where FYear = @y And FPeriod = @p
Delete t_subsys where Fnumber = ‘Gl‘ and Fyear = @y and Fperiod = @p
Update t_subsys set Fused = -1 , FPeriodSynch = -1 , FCheckout = 0 where Fsubsysid = 1 and Fyear= @y and Fperiod = @p-1
if exists (select * from sysobjects where id = object_id(N‘t_scAccumulation‘) and OBJECTPROPERTY(id, N‘IsUserTable‘) = 1)
Delete from t_scAccumulation Where FYear = @y And FPeriod = @p-1
Update t_SystemProfile Set FValue = @p-1 Where FCategory = ‘GL‘ And FKey = ‘CurrentPeriod‘
Update t_SystemProfile Set FValue = @y Where FCategory = ‘GL‘ And FKey = ‘CurrentYear‘
--修改允许负库存出库参数(0为不允许,1为允许,专业版)--
Update t_systemprofile set fvalue=0 where fcategory=‘IC‘ and fkey=‘UnderStock‘
--修改允许负库存结账(0为不允许,1为允许,专业版)--
update t_systemprofile set fvalue = 0 where fcategory = ‘IC‘ and fkey = ‘UnderStockCalculate‘
--清理用户配置信息,专业版--
delete from t_userprofile
--库存更新控制,Fvalue = 0 单据审核后更新,Fvalue = 1 单据保存后更新,专业版--
Update t_systemprofile set FValue=0 where FCategory=‘IC‘ and FKey=‘UPSTOCKWHENSAVE‘