treat dishes and hangers differently

This commit is contained in:
Paul Trowbridge 2025-01-09 16:57:36 -05:00
parent 9378660b82
commit 97beed28fd

View File

@ -72,15 +72,25 @@ lq AS MATERIALIZED (
ELSE lq.upperpricelimit * 1.15
END END END
ELSE
--at least 8 pallets is lower limit
CASE WHEN units_each >= 08*mpck THEN lq.lowerpricelimit
--at least 2 pallets is mid range
ELSE CASE WHEN units_each >= 2*mpck THEN (lq.upperpricelimit + lq.lowerpricelimit) / 2
--at least 1 pallet is upper range
ELSE CASE WHEN units_each >= 1*mpck THEN lq.upperpricelimit
--less than a pallet is upper + 15%
ELSE lq.upperpricelimit * 1.15
END END END
CASE WHEN i.pricegroup ~ '(Hanger|Dish)' THEN
--at least 1 pallets is lower limit
CASE WHEN units_each >= 01*mpck THEN lq.lowerpricelimit
--at least 2 pallets is mid range
ELSE CASE WHEN units_each >= 0.5*mpck THEN (lq.upperpricelimit + lq.lowerpricelimit) / 2
--less than a pallet is upper + 15%
ELSE lq.upperpricelimit
END END
ELSE
--at least 8 pallets is lower limit
CASE WHEN units_each >= 08*mpck THEN lq.lowerpricelimit
--at least 2 pallets is mid range
ELSE CASE WHEN units_each >= 2*mpck THEN (lq.upperpricelimit + lq.lowerpricelimit) / 2
--at least 1 pallet is upper range
ELSE CASE WHEN units_each >= 1*mpck THEN lq.upperpricelimit
--less than a pallet is upper + 15%
ELSE lq.upperpricelimit * 1.15
END END END
END
END guidance
-- ,(pricing->'guidance'->>'ltp')::numeric ltp
-- ,(pricing->'guidance'->>'optimization')::numeric optimization