link in new target prices to quote review
This commit is contained in:
parent
62ca1fcdf1
commit
73608b3e33
@ -30,6 +30,7 @@ lq AS MATERIALIZED (
|
|||||||
,lq.shipto
|
,lq.shipto
|
||||||
,lq.qchan
|
,lq.qchan
|
||||||
,lq.qcustomer
|
,lq.qcustomer
|
||||||
|
,CASE lq.qchan WHEN 'DIR' THEN bc.tier ELSE sc.tier END customer_tier
|
||||||
,lq.part
|
,lq.part
|
||||||
,lq.qoptions
|
,lq.qoptions
|
||||||
,lq.partbuilt
|
,lq.partbuilt
|
||||||
@ -55,6 +56,7 @@ lq AS MATERIALIZED (
|
|||||||
,lq.lowerpricelimit
|
,lq.lowerpricelimit
|
||||||
,lq.upperpricelimit
|
,lq.upperpricelimit
|
||||||
,(lq.upperpricelimit + lq.lowerpricelimit) / 2 midrange
|
,(lq.upperpricelimit + lq.lowerpricelimit) / 2 midrange
|
||||||
|
,nt.price qtarget_price
|
||||||
,i.partgroup part_group
|
,i.partgroup part_group
|
||||||
-- ,pricing->'product'->>'itemrel' item_fit
|
-- ,pricing->'product'->>'itemrel' item_fit
|
||||||
,i.mpck pltq
|
,i.mpck pltq
|
||||||
@ -116,6 +118,12 @@ lq AS MATERIALIZED (
|
|||||||
lq.units_each >= pl.vb_f
|
lq.units_each >= pl.vb_f
|
||||||
AND lq.units_each < pl.vb_t
|
AND lq.units_each < pl.vb_t
|
||||||
)
|
)
|
||||||
|
LEFT OUTER JOIN pricequote.target_prices nt ON
|
||||||
|
nt.stlc = i.stlc
|
||||||
|
AND nt.ds = lq.v1ds
|
||||||
|
AND nt.chan = lq.qchan
|
||||||
|
AND nt.tier = CASE lq.qchan WHEN 'DIR' THEN bc.tier ELSE sc.tier END
|
||||||
|
AND floor(lq.units_each/i.mpck)::int <@ nt.vol
|
||||||
WHERE
|
WHERE
|
||||||
lq.qstat ~ 'Submitted'
|
lq.qstat ~ 'Submitted'
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user