diff --git a/build/convert_pool_all.sql b/build/convert_pool_all.sql index 4e21c17..08dd8ef 100644 --- a/build/convert_pool_all.sql +++ b/build/convert_pool_all.sql @@ -359,6 +359,39 @@ WHERE AND COALESCE(S.DSM,'') <> CR.QUOTA_REP; +-------------------set fiscal period-------------------------------------- + +UPDATE + rlarp.osmfs_dev f +SET + fspr = gld.fspr +FROM + ( + SELECT + N1COMP COMP + ,N1CCYY FSYRq + ,KPMAXP PERDS + ,N1FSPP PERD + ,to_char(N1FSYP,'FM0000') FSPR + ,N1SD01 SDAT + ,N1ED01 EDAT + ,to_char(N1ED01,'yymm') CAPR + ,N1ED01 - N1SD01 +1 NDAYS + ,CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(YEAR FROM N1ED01) + 1 ELSE EXTRACT(YEAR FROM N1ED01) END SSYR + ,to_char(CASE WHEN EXTRACT(MONTH FROM N1ED01) >= 6 THEN EXTRACT(MONTH FROM N1ED01) -5 ELSE EXTRACT(MONTH FROM N1ED01) +7 END,'00') SSPR + FROM + LGDAT.GLDATREF + INNER JOIN LGDAT.GLDATE ON + KPCOMP = N1COMP AND + KPCCYY = N1CCYY + WHERE + N1COMP = 93 + --AND DIGITS(N1FSYP) = '1901' + ) gld +WHERE + f.sdate BETWEEN gld.sdat AND gld.edat + AND coalesce(f.fspr,'') <> gld.fspr; + UPDATE rlarp.osmfS_dev SET