notes on regional pricing and link in target pricing
This commit is contained in:
parent
704957a2fa
commit
da8e1353f3
@ -60,6 +60,23 @@ incr AS (
|
|||||||
('610','','W',0.02)
|
('610','','W',0.02)
|
||||||
) x(MAJG,ASSC,COLTIER,RATE)
|
) x(MAJG,ASSC,COLTIER,RATE)
|
||||||
)
|
)
|
||||||
|
,chx AS (
|
||||||
|
SELECT * FROM ( VALUES
|
||||||
|
('DIRECT','DIR','Direct'),
|
||||||
|
('DISTRIB DROP SHIP','DRP','Drop'),
|
||||||
|
('DISTRIBUTOR','WHS','Warehouse')
|
||||||
|
) x(xchan, chan, tchan)
|
||||||
|
)
|
||||||
|
,ds AS (
|
||||||
|
SELECT * FROM ( VALUES
|
||||||
|
('B','X','BASE','Base',''),
|
||||||
|
('B','L','BASE LABELED','Base','L'),
|
||||||
|
('B','P','BASE PRINTED','Base','P'),
|
||||||
|
('C','X','COLOR','Color',''),
|
||||||
|
('C','L','COLOR LABELED','Color','L'),
|
||||||
|
('C','P','COLOR PRINTED','Color','P')
|
||||||
|
) x(colgrp, brand, dataseg, tcol, tbrand)
|
||||||
|
)
|
||||||
------------carve out pricing baseline data--------------------
|
------------carve out pricing baseline data--------------------
|
||||||
,p AS (
|
,p AS (
|
||||||
SELECT
|
SELECT
|
||||||
@ -75,6 +92,7 @@ incr AS (
|
|||||||
,o.sizc
|
,o.sizc
|
||||||
,i.suffix
|
,i.suffix
|
||||||
,substring(o.chan,1,1) chgrp
|
,substring(o.chan,1,1) chgrp
|
||||||
|
,o.chan
|
||||||
,o.account
|
,o.account
|
||||||
,o.shipgrp
|
,o.shipgrp
|
||||||
,o.fb_qty units
|
,o.fb_qty units
|
||||||
@ -280,6 +298,7 @@ SELECT
|
|||||||
END
|
END
|
||||||
END
|
END
|
||||||
END rate
|
END rate
|
||||||
|
,ms.avg_price target
|
||||||
--,CASE WHEN sum(val_usd) FILTER (WHERE oseas = 2020) IS NULL
|
--,CASE WHEN sum(val_usd) FILTER (WHERE oseas = 2020) IS NULL
|
||||||
-- THEN CASE WHEN sum(units) FILTER (WHERE oseas = 2021) IS NULL
|
-- THEN CASE WHEN sum(units) FILTER (WHERE oseas = 2021) IS NULL
|
||||||
-- THEN 'unknown'
|
-- THEN 'unknown'
|
||||||
@ -302,6 +321,19 @@ FROM
|
|||||||
AND i.assc = p.assc
|
AND i.assc = p.assc
|
||||||
AND i.coltier = p.coltier
|
AND i.coltier = p.coltier
|
||||||
AND p.glec <> '1RE'
|
AND p.glec <> '1RE'
|
||||||
|
-----convert to target price channels---------
|
||||||
|
LEFT OUTER JOIN chx ON
|
||||||
|
chx.chan = p.chan
|
||||||
|
-----convert to target price product level----
|
||||||
|
LEFT OUTER JOIN ds ON
|
||||||
|
ds.colgrp = p.colgrp
|
||||||
|
AND ds.brand = substring(p.sizc,3,1)
|
||||||
|
LEFT OUTER JOIN pricequote.market_setavgprice ms ON
|
||||||
|
ms.mold = substring(p.product,1,8)
|
||||||
|
AND ms.chan = chx.xchan
|
||||||
|
AND ms.data_segment = ds.dataseg
|
||||||
|
AND ms.season = '2021'
|
||||||
|
AND ms.region = 'ALL'
|
||||||
GROUP BY
|
GROUP BY
|
||||||
p.productt
|
p.productt
|
||||||
,p.product
|
,p.product
|
||||||
@ -317,6 +349,7 @@ GROUP BY
|
|||||||
,p.account
|
,p.account
|
||||||
,p.shipgrp
|
,p.shipgrp
|
||||||
,bl.py_gasp
|
,bl.py_gasp
|
||||||
|
,ms.avg_price
|
||||||
,i.rate
|
,i.rate
|
||||||
)
|
)
|
||||||
--,test_unique AS (
|
--,test_unique AS (
|
||||||
@ -346,8 +379,10 @@ GROUP BY
|
|||||||
,p.py_asp
|
,p.py_asp
|
||||||
,p.last_price
|
,p.last_price
|
||||||
,p.last_order
|
,p.last_order
|
||||||
|
,p.target
|
||||||
,p.rate
|
,p.rate
|
||||||
--need to link in targets pricing and price list for cap purposes---------
|
--need to link in targets pricing and price list for cap purposes---------
|
||||||
|
--also need to link regional price lists so we don't blow past those------
|
||||||
,COALESCE(py_asp,py_gasp) * (1 + rate) fc_price
|
,COALESCE(py_asp,py_gasp) * (1 + rate) fc_price
|
||||||
FROM
|
FROM
|
||||||
poolprice pp
|
poolprice pp
|
||||||
|
Loading…
Reference in New Issue
Block a user