2021-04-13 16:01:00 -04:00
|
|
|
SELECT
|
2021-04-13 17:44:06 -04:00
|
|
|
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
|
2021-04-13 16:01:00 -04:00
|
|
|
FROM
|
2021-04-13 17:44:06 -04:00
|
|
|
rlarp.osmf_dev
|
2021-04-13 16:01:00 -04:00
|
|
|
WHERE
|
2021-04-13 17:44:06 -04:00
|
|
|
(
|
|
|
|
(
|
|
|
|
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'
|
2021-04-13 16:01:00 -04:00
|
|
|
GROUP BY
|
|
|
|
calc_status,
|
|
|
|
flag;
|