total up forecast pool by month

This commit is contained in:
Paul Trowbridge 2021-07-12 15:35:15 -04:00
parent 1c5b17daa0
commit caa83b8a98

View File

@ -19,48 +19,48 @@ ORDER BY
order_month asc order_month asc
------------------------------------------short ships------------------------------------- --------------------------------------------short ships-------------------------------------
SELECT --SELECT
version, -- version,
iter, -- iter,
oseas, -- oseas,
SUM(FB_VAL_LOC::numeric *r_rate::Numeric) -- SUM(FB_VAL_LOC::numeric *r_rate::Numeric)
FROM --FROM
RLARP.osmf_dev -- RLARP.osmf_dev
WHERE --WHERE
--oseas = 2020 -- --oseas = 2020
fs_line = '41010' -- fs_line = '41010'
--AND odate < '2020-04-01' -- --AND odate < '2020-04-01'
--AND CALC_STATUS <> 'CANCELED' -- --AND CALC_STATUS <> 'CANCELED'
AND NOT (calc_status = 'CLOSED' AND flag = 'REMAINDER') -- AND NOT (calc_status = 'CLOSED' AND flag = 'REMAINDER')
GROUP BY --GROUP BY
version, -- version,
iter, -- iter,
oseas -- oseas
--
select distinct version from rlarp.osm_pool -- select distinct version from rlarp.osm_pool
--
--
--
--
SELECT --SELECT
oseas, -- oseas,
to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month, -- to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon') order_month,
r_currency, -- r_currency,
r_rate, -- r_rate,
sum(fb_val_loc) value_loc -- sum(fb_val_loc) value_loc
FROM --FROM
rlarp.osmf_dev o -- rlarp.osmf_dev o
WHERE --WHERE
oseas >= 2020 -- oseas >= 2020
--AND fs_line = '41010' -- --AND fs_line = '41010'
--AND odate < '2020-04-01' -- --AND odate < '2020-04-01'
GROUP BY --GROUP BY
oseas, -- oseas,
to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon'), -- to_char(CASE WHEN extract(month FROM o.odate) >= 6 THEN -5 ELSE 7 END + extract(month FROM o.odate),'FM00')||' - '||to_char(o.odate,'TMMon'),
r_currency, -- r_currency,
r_rate -- r_rate
--glec -- --glec
ORDER BY --ORDER BY
oseas asc, -- oseas asc,
order_month asc -- order_month asc