Merge branch 'dev' into last_price

This commit is contained in:
Paul Trowbridge 2021-04-13 17:44:19 -04:00
commit 89e4983a03
2 changed files with 32 additions and 9 deletions

13
change_log.sql Normal file
View File

@ -0,0 +1,13 @@
WITH l AS (
SELECT DISTINCT logid FROM rlarp.osm_pool
)
SELECT
doc->>'user' as user,
(doc->>'stamp')::timestamptz stamp,
CASE WHEN logid IS NULL THEN 'undone' ELSE '' END flag,
doc->>'tag', doc->>'message',
doc->'scenario'->>'quota_rep_descr' dsm
FROM
rlarp.osm_log
LEFT OUTER JOIN l ON logid = id
LIMIT 1000;

View File

@ -1,15 +1,25 @@
SELECT
calc_status,
flag,
sum(fb_val_loc * r_rate) filter (where fb_qty < 0) overship,
sum(fb_val_loc * r_rate) filter (where fb_qty > 0) undership
calc_status
,flag
,sum(fb_val_loc * r_rate) filter (WHERE version = 'ACTUALS' AND calc_status = 'CLOSED' AND flag = 'REMAINDER' AND fb_qty < 0) overship
,sum(fb_val_loc * r_rate) filter (WHERE version = 'ACTUALS' AND calc_status = 'CLOSED' AND flag = 'REMAINDER' AND fb_qty > 0) undership
,sum(fb_val_loc * r_rate) filter (WHERE version = 'ACTUALS' AND fb_qty = 0) no_units
,sum(fb_val_loc * r_rate) filter (WHERE version = 'ACTUALS' AND dhincr = 'C') credits
,sum(fb_val_loc * r_rate) filter (WHERE version = 'ACTUALS' AND "ddord#" = 0 ) no_units
FROM
rlarp.osm_dev
rlarp.osmf_dev
WHERE
oseas = 2021
AND version = 'ACTUALS'
AND calc_status = 'CLOSED'
AND flag = 'REMAINDER'
(
(
oseas = 2021
AND odate <@ daterange('2020-06-01','2021-04-11')
)
OR sseas = 2021
)
AND fs_line = '41010'
--AND version = 'ACTUALS'
--AND calc_status = 'CLOSED'
--AND flag = 'REMAINDER'
GROUP BY
calc_status,
flag;