increment dates
This commit is contained in:
parent
6984b039f2
commit
c4f3abd733
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user