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 SELECT
calc_status, calc_status
flag, ,flag
sum(fb_val_loc * r_rate) filter (where 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) overship
sum(fb_val_loc * r_rate) filter (where fb_qty > 0) undership ,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 FROM
rlarp.osm_dev rlarp.osmf_dev
WHERE WHERE
(
(
oseas = 2021 oseas = 2021
AND version = 'ACTUALS' AND odate <@ daterange('2020-06-01','2021-04-11')
AND calc_status = 'CLOSED' )
AND flag = 'REMAINDER' OR sseas = 2021
)
AND fs_line = '41010'
--AND version = 'ACTUALS'
--AND calc_status = 'CLOSED'
--AND flag = 'REMAINDER'
GROUP BY GROUP BY
calc_status, calc_status,
flag; flag;