swap out iterdef with module, and point to osm_pool
This commit is contained in:
parent
21cb531e56
commit
04276a89cb
@ -4,9 +4,9 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
SELECT
|
SELECT
|
||||||
sum(fb_qty) tot
|
sum(fb_qty) tot
|
||||||
,sum(fb_qty) FILTER (WHERE iter = 'copy') base
|
,sum(fb_qty) FILTER (WHERE iter = 'copy') base
|
||||||
,sum(fb_qty) FILTER (WHERE iterdef->>'type' = 'new basket') newpart
|
,sum(fb_qty) FILTER (WHERE module = 'new basket') newpart
|
||||||
FROM
|
FROM
|
||||||
rlarp.osm_fcpool
|
rlarp.osm_pool
|
||||||
WHERE
|
WHERE
|
||||||
-----------------scenario----------------------------
|
-----------------scenario----------------------------
|
||||||
where_clause
|
where_clause
|
||||||
@ -145,7 +145,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,null cost_usd
|
,null cost_usd
|
||||||
,null units
|
,null units
|
||||||
FROM
|
FROM
|
||||||
rlarp.osm_fcpool
|
rlarp.osm_pool
|
||||||
WHERE
|
WHERE
|
||||||
-----------------scenario----------------------------
|
-----------------scenario----------------------------
|
||||||
where_clause
|
where_clause
|
||||||
@ -153,7 +153,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
AND CASE (SELECT flag FROM flagv)
|
AND CASE (SELECT flag FROM flagv)
|
||||||
WHEN 'scale all' THEN true
|
WHEN 'scale all' THEN true
|
||||||
WHEN 'scale copy' THEN iter = 'copy'
|
WHEN 'scale copy' THEN iter = 'copy'
|
||||||
WHEN 'scale new part' THEN iterdef->>'type' = 'new basket'
|
WHEN 'scale new part' THEN module = 'new basket'
|
||||||
END
|
END
|
||||||
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
AND calc_status||flag <> 'CLOSEDREMAINDER' --exclude short ships when building order adjustments
|
||||||
AND adj_orderdate <= adj_shipdate
|
AND adj_orderdate <= adj_shipdate
|
||||||
@ -496,7 +496,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
)
|
)
|
||||||
--select sum(value_usd), sum(fb_qty) from pricing
|
--select sum(value_usd), sum(fb_qty) from pricing
|
||||||
, ins AS (
|
, ins AS (
|
||||||
INSERT INTO rlarp.osm_fcpool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING *
|
INSERT INTO rlarp.osm_pool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING *
|
||||||
)
|
)
|
||||||
,insagg AS (
|
,insagg AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
Loading…
Reference in New Issue
Block a user