link in new target prices to quote review

This commit is contained in:
Paul Trowbridge 2025-07-27 14:38:04 -04:00
parent 62ca1fcdf1
commit 73608b3e33

View File

@ -30,6 +30,7 @@ lq AS MATERIALIZED (
,lq.shipto
,lq.qchan
,lq.qcustomer
,CASE lq.qchan WHEN 'DIR' THEN bc.tier ELSE sc.tier END customer_tier
,lq.part
,lq.qoptions
,lq.partbuilt
@ -55,6 +56,7 @@ lq AS MATERIALIZED (
,lq.lowerpricelimit
,lq.upperpricelimit
,(lq.upperpricelimit + lq.lowerpricelimit) / 2 midrange
,nt.price qtarget_price
,i.partgroup part_group
-- ,pricing->'product'->>'itemrel' item_fit
,i.mpck pltq
@ -116,6 +118,12 @@ lq AS MATERIALIZED (
lq.units_each >= pl.vb_f
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
lq.qstat ~ 'Submitted'
)