include setting fiscal period in pool conversion

This commit is contained in:
Paul Trowbridge 2021-03-08 15:00:16 -05:00
parent cf82925eca
commit 3b983140b6

View File

@ -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