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