adjust scale_vp route to create 2 iteration for v and p respectively
This commit is contained in:
parent
c536dee56d
commit
4ba6aaa2d0
@ -315,8 +315,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
SELECT
|
SELECT
|
||||||
(SELECT pincr::numeric FROM target) incr
|
(SELECT pincr::numeric FROM target) incr
|
||||||
,(SELECT sum(fb_val_loc * r_rate) FROM volume) base
|
,(SELECT sum(fb_val_loc * r_rate) FROM volume) base
|
||||||
,(SELECT pincr::numeric FROM target)/(SELECT sum(fb_val_loc) FROM volume) factor
|
,((SELECT pincr::numeric FROM target) - (SELECT sum(fb_val_loc * r_rate) FROM volume))/(SELECT sum(fb_val_loc * r_rate) FROM volume) factor
|
||||||
,(select SUM(fb_qty) from volume) tvol
|
|
||||||
)
|
)
|
||||||
--select * from pscale
|
--select * from pscale
|
||||||
,pricing AS (
|
,pricing AS (
|
||||||
@ -381,10 +380,10 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,b.ddqtsi --0
|
,b.ddqtsi --0
|
||||||
,b.fgqshp --0
|
,b.fgqshp --0
|
||||||
,b.diqtsh --0
|
,b.diqtsh --0
|
||||||
,b.fb_qty
|
,0 fb_qty
|
||||||
,b.fb_cst_loc
|
,0 fb_cst_loc
|
||||||
,b.fb_cst_loc_cur
|
,0 fb_cst_loc_cur
|
||||||
,b.fb_cst_loc_fut
|
,0 fb_cst_loc_fut
|
||||||
,b.fb_val_loc*s.factor fb_val_loc
|
,b.fb_val_loc*s.factor fb_val_loc
|
||||||
,b.fb_val_loc_pl*s.factor fb_val_loc_pl
|
,b.fb_val_loc_pl*s.factor fb_val_loc_pl
|
||||||
,b.calc_status --0
|
,b.calc_status --0
|
||||||
@ -395,11 +394,11 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,b.adj_orderdate
|
,b.adj_orderdate
|
||||||
,b.adj_requestdate
|
,b.adj_requestdate
|
||||||
,b.adj_shipdate
|
,b.adj_shipdate
|
||||||
,b.version --calculated
|
,'replace_version' "version" --calculated
|
||||||
,b.iter --calculated
|
,'replace_source'||' price' iter
|
||||||
-----------------------ui columns--------------------------------
|
-----------------------ui columns--------------------------------
|
||||||
,b.iterdet
|
,'replace_iterdet' iterdet
|
||||||
,b.iterdef
|
,$$replace_iterdef$$::jsonb iterdef
|
||||||
,b.order_season
|
,b.order_season
|
||||||
,b.order_month
|
,b.order_month
|
||||||
,b.ship_season
|
,b.ship_season
|
||||||
@ -426,16 +425,16 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,b.director_descr
|
,b.director_descr
|
||||||
,(b.fb_val_loc*s.factor)::numeric value_loc
|
,(b.fb_val_loc*s.factor)::numeric value_loc
|
||||||
,(b.fb_val_loc*s.factor*r_rate)::numeric value_usd
|
,(b.fb_val_loc*s.factor*r_rate)::numeric value_usd
|
||||||
,b.cost_loc
|
,0 cost_loc
|
||||||
,b.cost_usd
|
,0 cost_usd
|
||||||
,b.units
|
,0 units
|
||||||
FROM
|
FROM
|
||||||
volume b
|
volume b
|
||||||
CROSS JOIN pscale s
|
CROSS JOIN pscale s
|
||||||
)
|
)
|
||||||
--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 RETURNING *
|
INSERT INTO rlarp.osm_fcpool (SELECT * FROM pricing UNION ALL SELECT * FROM volume) RETURNING *
|
||||||
)
|
)
|
||||||
,insagg AS (
|
,insagg AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
Loading…
Reference in New Issue
Block a user