Compare commits
3 Commits
fb7fdc7959
...
a4d34ec83a
Author | SHA1 | Date | |
---|---|---|---|
|
a4d34ec83a | ||
|
e49c051383 | ||
|
f83746b892 |
@ -178,10 +178,10 @@ target AS (select incr_qty qincr)
|
|||||||
,c_currency --master data
|
,c_currency --master data
|
||||||
,c_rate --master data
|
,c_rate --master data
|
||||||
,units*s.factor
|
,units*s.factor
|
||||||
,value_loc*s.factor
|
,value_loc*s.factor value_loc
|
||||||
,value_usd*s.factor
|
,value_usd*s.factor value_usd
|
||||||
,cost_loc*s.factor
|
,cost_loc*s.factor cost_loc
|
||||||
,cost_usd*s.factor
|
,cost_usd*s.factor cost_usd
|
||||||
,calc_status --0
|
,calc_status --0
|
||||||
,flag --0
|
,flag --0
|
||||||
,order_date --history date mix
|
,order_date --history date mix
|
||||||
|
@ -12,7 +12,7 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
where_clause
|
where_clause
|
||||||
-----------------additional params-------------------
|
-----------------additional params-------------------
|
||||||
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 order_date <= ship_date
|
||||||
|
|
||||||
)
|
)
|
||||||
,flagv AS (
|
,flagv AS (
|
||||||
@ -176,11 +176,11 @@ target AS (select target_vol vincr, target_prc pincr)
|
|||||||
,r_rate --master data
|
,r_rate --master data
|
||||||
,c_currency --master data
|
,c_currency --master data
|
||||||
,c_rate --master data
|
,c_rate --master data
|
||||||
,units*s.factor
|
,units*s.factor units
|
||||||
,value_loc*s.factor
|
,value_loc*s.factor value_loc
|
||||||
,value_usd*s.factor
|
,value_usd*s.factor value_usd
|
||||||
,cost_loc*s.factor
|
,cost_loc*s.factor cost_loc
|
||||||
,cost_usd*s.factor
|
,cost_usd*s.factor cost_usd
|
||||||
,calc_status --0
|
,calc_status --0
|
||||||
,flag --0
|
,flag --0
|
||||||
,order_date --history date mix
|
,order_date --history date mix
|
||||||
@ -225,8 +225,6 @@ FROM
|
|||||||
END mod_price
|
END mod_price
|
||||||
)
|
)
|
||||||
--select * from pscale
|
--select * from pscale
|
||||||
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc*s.factor END)::numeric value_loc
|
|
||||||
,(CASE WHEN s.factor = 0 THEN b.units * s.mod_price/b.r_rate ELSE b.value_loc_pl*s.factor END)::numeric value_loc_pl
|
|
||||||
,pricing AS (
|
,pricing AS (
|
||||||
SELECT
|
SELECT
|
||||||
fspr
|
fspr
|
||||||
@ -291,25 +289,28 @@ FROM
|
|||||||
)
|
)
|
||||||
,insagg AS (
|
,insagg AS (
|
||||||
SELECT
|
SELECT
|
||||||
|
---------customer info-----------------
|
||||||
bill_cust_descr
|
bill_cust_descr
|
||||||
,billto_group
|
,billto_group
|
||||||
,ship_cust_descr
|
,ship_cust_descr
|
||||||
,shipto_group
|
,shipto_group
|
||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director_descr
|
,director
|
||||||
,segm
|
,segm
|
||||||
,mod_chan
|
,chan
|
||||||
,mod_chansub
|
,chansub
|
||||||
|
---------product info------------------
|
||||||
,majg_descr
|
,majg_descr
|
||||||
,ming_descr
|
,ming_descr
|
||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,brand
|
--,brand
|
||||||
,part_family
|
--,part_family
|
||||||
,part_group
|
,part_group
|
||||||
,branding
|
,branding
|
||||||
,color
|
--,color
|
||||||
,part_descr
|
,part_descr
|
||||||
|
---------dates-------------------------
|
||||||
,order_season
|
,order_season
|
||||||
,order_month
|
,order_month
|
||||||
,ship_season
|
,ship_season
|
||||||
@ -319,6 +320,7 @@ SELECT
|
|||||||
,promo
|
,promo
|
||||||
,version
|
,version
|
||||||
,iter
|
,iter
|
||||||
|
--------values-------------------------
|
||||||
,sum(value_loc) value_loc
|
,sum(value_loc) value_loc
|
||||||
,sum(value_usd) value_usd
|
,sum(value_usd) value_usd
|
||||||
,sum(cost_loc) cost_loc
|
,sum(cost_loc) cost_loc
|
||||||
@ -327,25 +329,28 @@ SELECT
|
|||||||
FROM
|
FROM
|
||||||
ins
|
ins
|
||||||
GROUP BY
|
GROUP BY
|
||||||
|
---------customer info-----------------
|
||||||
bill_cust_descr
|
bill_cust_descr
|
||||||
,billto_group
|
,billto_group
|
||||||
,ship_cust_descr
|
,ship_cust_descr
|
||||||
,shipto_group
|
,shipto_group
|
||||||
,quota_rep_descr
|
,quota_rep_descr
|
||||||
,director_descr
|
,director
|
||||||
,segm
|
,segm
|
||||||
,mod_chan
|
,chan
|
||||||
,mod_chansub
|
,chansub
|
||||||
|
---------product info------------------
|
||||||
,majg_descr
|
,majg_descr
|
||||||
,ming_descr
|
,ming_descr
|
||||||
,majs_descr
|
,majs_descr
|
||||||
,mins_descr
|
,mins_descr
|
||||||
,brand
|
--,brand
|
||||||
,part_family
|
--,part_family
|
||||||
,part_group
|
,part_group
|
||||||
,branding
|
,branding
|
||||||
,color
|
--,color
|
||||||
,part_descr
|
,part_descr
|
||||||
|
---------dates-------------------------
|
||||||
,order_season
|
,order_season
|
||||||
,order_month
|
,order_month
|
||||||
,ship_season
|
,ship_season
|
||||||
|
Loading…
Reference in New Issue
Block a user