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


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

  • 相关阅读:
    【tarjan】【树的直径】【CF】K. Königsberg Bridges
    【组合数学】【恒等式】简单和、交错和
    【组合数学】【恒等式】$sum_{k=0}^{r}C_m^k imes C_{n}^{r-k}=C_{m+n}^r$
    【组合数学】【恒等式】$C_{n}^{r} imes C_{n-r}^{k-r}=C_{n}^{k} imes C_k^{r}$
    【树形DP】D. Serval and Rooted Tree
    【图论】图的欧拉定理
    【图论】网络流解决二分图最大匹配量问题
    【计算几何】atan2函数
    【单峰计数DP】Problem F – Fabricating Sculptures
    Java基础之:自定义泛型
  • 原文地址:https://www.cnblogs.com/laojiefang/p/2359571.html
Copyright © 2011-2022 走看看