new forecast baseline dates

This commit is contained in:
Paul Trowbridge 2023-03-01 16:01:32 -05:00
parent 68aa1c219a
commit 7d901e7f42

View File

@ -149,11 +149,11 @@ gld AS (
WHERE WHERE
( (
--base period orders booked.... --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 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 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 fs_line = '41010'
AND calc_status <> 'CANCELED' AND calc_status <> 'CANCELED'
@ -303,7 +303,7 @@ gld AS (
LEFT OUTER JOIN gld ss ON LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' BETWEEN ss.sdat AND ss.edat greatest(least(o.sdate,gld.edat),gld.sdat) + interval '1 year' BETWEEN ss.sdat AND ss.edat
WHERE 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 fs_line = '41010'
AND calc_status <> 'CANCELED' AND calc_status <> 'CANCELED'
------exclude actuals for now and use forecast to get the plug for the rest of the year ------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.pseas + 1 --incremented
,o.sdate + interval '1 year' --incremented ,o.sdate + interval '1 year' --incremented
,o.sseas + 1 --incremented ,o.sseas + 1 --incremented
,'b22' "version" ,'b23' "version"
,'copy' iter ,'copy' iter
FROM FROM
baseline o baseline o
LEFT OUTER JOIN gld ON LEFT OUTER JOIN gld ON
o.sdate + interval '1 year' BETWEEN gld.sdat and gld.edat o.sdate + interval '1 year' BETWEEN gld.sdat and gld.edat
WHERE WHERE
o.odate + interval '1 year' >= '2021-06-01' o.odate + interval '1 year' >= '2023-06-01'
) )
--INSERT INTO rlarp.osmf --INSERT INTO rlarp.osmf
SELECT SELECT
@ -715,7 +715,7 @@ FROM
SELECT * FROM baseline SELECT * FROM baseline
UNION ALL UNION ALL
SELECT * FROM incr SELECT * FROM incr
) x ) x;
---identify short ships: causes disconnect with actual sales------------------------------------------------------------------- ---identify short ships: causes disconnect with actual sales-------------------------------------------------------------------
--UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER'; --UPDATE rlarp.osmfs SET iter = 'short ship' WHERE calc_status = 'CLOSED' AND flag = 'REMAINDER';