This commit is contained in:
Paul Trowbridge 2020-03-11 02:54:22 +00:00
commit 13d71fff21

View File

@ -145,11 +145,11 @@ gld AS (
WHERE
(
--base period orders booked....
o.odate BETWEEN '2019-06-01' AND '2020-01-31'
o.odate BETWEEN '2019-06-01' AND '2020-02-29'
--...or any open orders currently booked before cutoff....
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-02-01')
OR (o.calc_status IN ('OPEN','BACKORDER') and o.odate < '2020-03-01')
--...or anything that shipped in that period
OR o.fspr BETWEEN '2001' AND '2008'
OR o.fspr BETWEEN '2001' AND '2009'
)
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
@ -289,7 +289,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 '2019-02-01' AND '2019-05-31'
o.odate BETWEEN '2019-03-01' AND '2019-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
@ -429,7 +429,7 @@ gld AS (
LEFT OUTER JOIN gld ss ON
greatest(least(o.sdate,gld.edat),gld.sdat) BETWEEN ss.sdat AND ss.edat
WHERE
o.odate BETWEEN '2020-02-01' AND '2020-05-31'
o.odate BETWEEN '2020-03-01' AND '2020-05-31'
AND fs_line = '41010'
AND calc_status <> 'CANCELED'
GROUP BY