zoukankan      html  css  js  c++  java
  • 使用SQL语句在K3里进行反结帐

    使用SQL语句在K3里进行反结帐- -

                                          

    使用SQL语句在K3里进行反结帐

    Declare @CurYear Int, --当前年份
    @CurPeriod int, --当前会计期间
    @staryear int, --启用年份
    @starperiod int, --启用期间
    @totalmonth int --每个会计年度的总的期间数


    使用SQL语句在K3里进行反结帐

    Declare @CurYear Int, --当前年份
    @CurPeriod int, --当前会计期间
    @staryear int, --启用年份
    @starperiod int, --启用期间
    @totalmonth int --每个会计年度的总的期间数
    Select @CurPeriod=FValue From t_Systemprofile Where FKey='CurrentPeriod' And FCategory='IC'
    Select @CurYear=FValue From t_Systemprofile Where FKey='CurrentYear' And FCategory='IC'

    Select @staryear=FValue From t_Systemprofile Where FKey='StartYear' And FCategory='IC'
    Select @starperiod=FValue From t_Systemprofile Where FKey='StartPeriod' And FCategory='IC'
    Select @totalmonth=FValue From t_Systemprofile Where FKey='PeriodCount' And FCategory='gl'

    --Select * From t_systemprofile Where fcategory='ic'

    if @CurPeriod=@starperiod and @CurYear=@staryear-----如果目前为启用期间不能反结账
    begin
    print '目前为启用期间不需要反结账'
    end
    else 


    if @CurPeriod <>1------中间期间
    begin
    Update t_systemprofile Set FValue=@CurPeriod-1 Where FKey='CurrentPeriod' and fcategory='IC'
    Delete Icbal Where FPeriod=@CurPeriod And Fyear=@CurYear
    Delete IcInvbal Where FPeriod=@CurPeriod And Fyear=@CurYear
    Delete Poinvbal Where FPeriod=@CurPeriod And Fyear=@CurYear
    print '反结账后目前物流处于'+convert(varchar(10),@CurYear)+'年第'+convert(varchar(10),@CurPeriod-1)+'期'
    end
    else---------下一年转到上年
    begin
    Update t_systemprofile Set FValue=@totalmonth Where FKey='CurrentPeriod' and fcategory='IC'
    Update t_systemprofile Set FValue=@CurYear-1 Where FKey='CurrentYear' and fcategory='IC'
    Delete Icbal Where FPeriod=@CurPeriod And Fyear=@CurYear
    Delete IcInvbal Where FPeriod=@CurPeriod And Fyear=@CurYear
    Delete Poinvbal Where FPeriod=@CurPeriod And Fyear=@CurYear
    print '反结账后目前物流处于'+convert(varchar(10),@CurYear-1)+'年第

    '++convert(varchar(10),@totalmonth)+'期'
    end


    注:请将对应的账套执行以下语句进行反结账,执行一次反结一期,请谨慎使用,如
    果使用了计划价核算的账套(可能存在计划价调价),不能使用以下语句反结账.

  • 相关阅读:
    JQuery -- this 和 $(this) 的区别
    js动态生成表格
    Sublime 3 如何使用列编辑模式
    新版Sublime text3注册码被移除的解决办法
    Sublime text 3 格式化HTML/css/js/json代码 插件
    mingw64 构建 Geos
    C++调用Python浅析
    linux下挂载VHD等虚拟磁盘文件
    linux 下Qt WebEngine 程序打包简单记录
    C++ UTF8和UTF16互转代码
  • 原文地址:https://www.cnblogs.com/laojiefang/p/2359571.html
Copyright © 2011-2022 走看看