new forecast baseline dates

This commit is contained in:
Paul Trowbridge 2023-03-01 16:01:32 -05:00
parent 68aa1c219a
commit 7d901e7f42
1 changed files with 7 additions and 7 deletions

View File

@ -149,11 +149,11 @@ gld AS (
WHERE
(
--base period orders booked....
o.odate BETWEEN '2022-06-01' AND '2023-02-15'
o.odate BETWEEN '2022-06-01' AND '2023-03-01'
--...or any open orders currently booked before cutoff....
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2023-02-15')
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2023-03-01')
--...or anything that shipped in that period
OR ((o.fspr BETWEEN '2301' AND '2309' OR o.fspr = '0000') AND o.sdate < '2023-02-15')
OR ((o.fspr BETWEEN '2301' AND '2309' OR o.fspr = '0000') AND o.sdate < '2023-03-01')
)
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
@ -303,7 +303,7 @@ gld AS (
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' BETWEEN ss.sdat AND ss.edat
WHERE
o.odate BETWEEN '2022-02-15' AND '2022-05-31'
o.odate BETWEEN '2022-03-01' AND '2022-05-31'
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
------exclude actuals for now and use forecast to get the plug for the rest of the year
@ -584,14 +584,14 @@ SELECT
,o.pseas + 1 --incremented
,o.sdate + interval '1 year' --incremented
,o.sseas + 1 --incremented
,'b22' "version"
,'b23' "version"
,'copy' iter
FROM
baseline o
LEFT OUTER JOIN gld ON
o.sdate + interval '1 year' BETWEEN gld.sdat and gld.edat
WHERE
o.odate + interval '1 year' >= '2021-06-01'
o.odate + interval '1 year' >= '2023-06-01'
)
--INSERT INTO rlarp.osmf
SELECT
@ -715,7 +715,7 @@ FROM
SELECT * FROM baseline
UNION ALL
SELECT * FROM incr
) x
) x;
---identify short ships: causes disconnect with actual sales-------------------------------------------------------------------
--UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER';