increment dates

This commit is contained in:
Paul Trowbridge 2021-04-04 23:18:18 -04:00
parent 6984b039f2
commit c4f3abd733

View File

@ -145,11 +145,11 @@ gld AS (
WHERE WHERE
( (
--base period orders booked.... --base period orders booked....
o.odate BETWEEN '2019-06-01' AND '2020-02-29' o.odate BETWEEN '2020-06-01' AND '2021-04-11'
--...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 < '2020-03-01') OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2021-04-11')
--...or anything that shipped in that period --...or anything that shipped in that period
OR o.fspr BETWEEN '2001' AND '2009' OR o.fspr BETWEEN '2101' AND '2011'
) )
AND fs_line = '41010' AND fs_line = '41010'
AND calc_status <> 'CANCELED' AND calc_status <> 'CANCELED'
@ -289,11 +289,11 @@ 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 '2019-03-01' AND '2019-05-31' o.odate BETWEEN '2020-04-12' AND '2020-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
AND false --AND false
GROUP BY GROUP BY
o.fspr o.fspr
,plnt ,plnt
@ -432,6 +432,8 @@ gld AS (
o.odate BETWEEN '2020-03-01' AND '2020-05-31' o.odate BETWEEN '2020-03-01' AND '2020-05-31'
AND fs_line = '41010' AND fs_line = '41010'
AND calc_status <> 'CANCELED' AND calc_status <> 'CANCELED'
------dont pull forecast for a baseline this time around--
AND false
GROUP BY GROUP BY
o.fspr o.fspr
,plnt ,plnt
@ -555,14 +557,14 @@ SELECT
,o.rseas + 1 --incremented ,o.rseas + 1 --incremented
,o.sdate + interval '1 year' --incremented ,o.sdate + interval '1 year' --incremented
,o.sseas + 1 --incremented ,o.sseas + 1 --incremented
,'b21' "version" ,'b22' "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' >= '2020-06-01' o.odate + interval '1 year' >= '2021-06-01'
) )
INSERT INTO rlarp.osmf_dev INSERT INTO rlarp.osmf_dev
SELECT * FROM incr SELECT * FROM incr
@ -573,4 +575,4 @@ SELECT * FROM baseline;
--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';
---identify goofy ship dates: causes disconnect with sales when splicing in a forecast that has this problem------------------- ---identify goofy ship dates: causes disconnect with sales when splicing in a forecast that has this problem-------------------
--UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate; --UPDATE rlarp.osmfs SET iter = 'bad date' WHERE adj_shipdate < adj_orderdate;