further isolate odd orders, create change log
This commit is contained in:
parent
fee1b9202f
commit
3854bed603
13
change_log.sql
Normal file
13
change_log.sql
Normal 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;
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user