increment dates
This commit is contained in:
parent
6984b039f2
commit
c4f3abd733
@ -145,11 +145,11 @@ gld AS (
|
||||
WHERE
|
||||
(
|
||||
--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 (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 o.fspr BETWEEN '2001' AND '2009'
|
||||
OR o.fspr BETWEEN '2101' AND '2011'
|
||||
)
|
||||
AND fs_line = '41010'
|
||||
AND calc_status <> 'CANCELED'
|
||||
@ -289,11 +289,11 @@ 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 '2019-03-01' AND '2019-05-31'
|
||||
o.odate BETWEEN '2020-04-12' AND '2020-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
|
||||
AND false
|
||||
--AND false
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,plnt
|
||||
@ -432,6 +432,8 @@ gld AS (
|
||||
o.odate BETWEEN '2020-03-01' AND '2020-05-31'
|
||||
AND fs_line = '41010'
|
||||
AND calc_status <> 'CANCELED'
|
||||
------dont pull forecast for a baseline this time around--
|
||||
AND false
|
||||
GROUP BY
|
||||
o.fspr
|
||||
,plnt
|
||||
@ -555,14 +557,14 @@ SELECT
|
||||
,o.rseas + 1 --incremented
|
||||
,o.sdate + interval '1 year' --incremented
|
||||
,o.sseas + 1 --incremented
|
||||
,'b21' "version"
|
||||
,'b22' "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' >= '2020-06-01'
|
||||
o.odate + interval '1 year' >= '2021-06-01'
|
||||
)
|
||||
INSERT INTO rlarp.osmf_dev
|
||||
SELECT * FROM incr
|
||||
|
Loading…
Reference in New Issue
Block a user