# Task 0429: UMRP / UPP minimum-price enforcement plan Prepared October 10, 2026; revised the same day to keep MAP and UMRP separate. **Approved by Phil 2026-10-10 12:13 PM MT: all 13 decisions as recommended, with scope limited to slice A.** No code, migration or CI yet (task is in `ready`, awaiting build go-ahead). Baseline: `origin/staging` `10ebcbe3c0`. ## Approved scope (slice A only) 1. **M0:** add a nullable `umrp_price` column to every warehouse stock table and to the new-warehouse stock-table template. It's version-tracked, global across warehouses like `map_price`, and editable in the stock file and batch import. 2. **Pricing dialog check:** warn or block when a sale, flyer or purchase-promo price is below the UMRP (decision 2). 3. **Bulk paths:** `umrp_price` is handled wherever `map_price` is: bulk update, bulk insert/import and warehouse copy (Phil, 12:14 PM). 4. **Register warning:** warn when a line's per-each net price is at or below the UMRP. Warning only, no block (decisions 3 and 4). **Out of scope:** `umrp_policies`, `umrp_overrides`, `umrp_item_prices`, coupon capping, reports and register blocking. `map_price` stays the advertised price only and isn't touched. ## 1. Research: what UMRP/UPP policies require | Topic | What real policies say | Source | |---|---|---| | **MAP vs UMRP (the key distinction)** | **MAP (Minimum Advertised Price)** limits only the price we *advertise or display*: web listings, flyers, emails, cart or chat prices. We can still *sell* below MAP to a customer in the store or through quotes and negotiation. **UMRP/UPP (Unilateral Minimum Resale/Retail Price)** limits the *net price actually charged* on the invoice, after every discount, coupon or rebate, no matter how it's advertised. So MAP is a marketing and web control, while UMRP is a point-of-sale control. One item can have a MAP, a UMRP, both or neither, and the two numbers can differ. That's why they're separate fields: `map_price` and `umrp_price`. | Star group; S&B; Verona | | Advertised vs sold | MAP/IMAP limits the **advertised** price only. Star/APW/Bakers Pride (Middleby group) says MAP "do[es] not apply to the price at which products are actually sold". UMRP/UPP limits the **net sold** price. S&B: "A MAP program is focused on the advertised price while a Unilateral Pricing Policy is concerned about the actual selling price." | [Star group MAP/MRICP](https://star-mfg.com/wp-content/uploads/2023/01/2021_GROUP_MAP_POLICY_JAN_2021_FINAL-01212021.pdf), [S&B UPP](https://www.phastekperformance.com/content/warranty/S&B%20Filters%20Unilateral%20Pricing%20Policy%20for%20Dealers%20&%20WDs%20Revised%209-24-2020.pdf) | | Internet cart price | Star's MRICP covers the final online checkout, chat and emailed prices: no more than 52% off list for listed lines. That's a formula (percent of list), not a fixed dollar amount. | Star group | | Discounts and coupons | Coupons, rebates, free accessories and paying the customer's sales tax all count as discounts, and they're violations if they put the **net** price below UMRP. | [Verona/EuroChef UMRP](https://www.veronaappliances.com/wp-content/uploads/2025/08/Eurochef-Verona-UMRP-Policy.pdf), [CSF UPP](https://news.csfrace.com/wp-content/uploads/2020/08/CSF-UPP.pdf) | | Store-wide promos | A store-wide percent-off is allowed only if UMRP items are explicitly excluded or still net at or above UMRP. | [Trevarrow UMRP Q&A](https://www.trevarrowinc.com/wp-content/uploads/2019/05/UMRP-POLICY-QA-all-brands-DRAFT-2019-b.pdf) | | Bundles | No single bundle price that hides the UMRP item. A bundle must total at least the sum of its items' minimums, or the vendor's own bundle price. | Verona; [SW-Motech UPP](https://media.sw-motech.us/uploads/SWM_USA_UPP_d7d55ced08.pdf); CSF | | Exceptions | Display units more than a year after the vendor's invoice date, marked "DISPLAY UNIT" on the invoice (Trevarrow). Free shipping or installation is sometimes allowed (S&B). Some policies have separate distributor-to-dealer and retail minimums (Air Lift). | Trevarrow; S&B; [Air Lift UPP](https://dealer.airliftcompany.com/dealer-resources/upp-policy) | | Effective dates | Prices come from the vendor's current price list. Verona gives at least 30 days' notice of changes, SW-Motech about 5 days. Promo windows can suspend the policy (PizzaMaster). Violations are judged against the price **in effect at the time of sale**. | Verona; SW-Motech; [PizzaMaster IMAP](https://mpmfoodequipment.com/Content/policy/MPM_IMAP_Policy.pdf); Trevarrow | | Price lists | Vendors publish UMRP as a column in the list price book, e.g. Perlick's "UMRP Price List". Our AutoQuotes catalog already imports `MapMrpPrice` and `MapMrpEndDate` (`app/services/procurement/auto_quotes_catalog_upsert.rb:86-87` → `aq_catalog.map_mrp_price/map_mrp_end_date`, `db/structure.sql:20980-20981`). | [Perlick UMRP list](https://mapledistributing.com/wp-content/uploads/2023/02/MD-Perlick-Price-List_email.pdf) | | Price matching | Policies treat matching a competitor below UMRP as a violation: the net price is what counts. Air Lift also prohibits "in-store-only" prices meant to get around the policy. | Air Lift; CSF | | Penalties | The vendor cuts off supply (Verona: 3 months, then indefinitely), not fines. That's why a warning plus override can be acceptable, as long as overrides are visible. | Verona; Trevarrow | | Legal | These policies are unilateral (Colgate doctrine). We must not "agree" with vendors or other dealers on prices. The system should record the vendor's published minimum and our own decision, never coordinate it. Some states (e.g. Maryland) are stricter. | [Bona Law on Colgate](https://www.bonalaw.com/insights/legal-resources/the-colgate-doctrine-and-resale-price-maintenance-agreements-what-is-the-difference-under-the-antitrust-laws), [Leegin](https://supreme.justia.com/cases/federal/us/551/877/) | **Family Stores vs Standard:** both run this same codebase against separate databases. Family Stores sells retail and consumer brands (more MAP/IMAP), while Standard is foodservice equipment (more UMRP plus internet cart price). The plan keeps behavior per database and per vendor policy, with no hard-coded tenant branches (compare the "SPECIFICALLY FOR FAMILY STORES" blocks at `app/models/inventory_item.rb:681,692`, which we should not repeat). ## 2. Best practices - Check the **net** line price (after line discount, coupon allocation and quantity breaks), not the list or shelf price. - Use the UMRP in effect on the sale date. Keep a history so we can answer "was this sale compliant on that date?" - Separate data entry (vendor price file import) from enforcement (warn or block per policy). - Keep MAP (advertised) and UMRP (sold) as separate fields and separate rules. - The default action is a warning with a reason code. Blocking is opt-in per vendor policy. An override needs a permission and is always logged. - Show the number before someone types a price: put a "UMRP $X" chip next to the price fields so people don't trip the check. - Report exceptions every week. Unreviewed overrides are the real risk. ## 3. Unit-of-measure verification and the per-each formula Verified on `origin/staging` `10ebcbe3c0`. **Stock prices are per each.** `list_price`, `sale_price`, `fs_price` (flyer) and `ps_price` (purchase promo) are stored once per stock item (`app/models/warehouseinfo.rb:636-678`). The register multiplies them by `case_qty` to price the selling unit: `ROUND((list_price * :case_qty), 2)` (`app/models/order_item.rb:313`) and `ROUND((COALESCE(cust_price_override, LEAST(sale_price, cust_price, st_codeprice_ng)) * :case_qty), 2) sold_price` (`order_item.rb:330-343`). Quantity breaks also count eaches: `ABS(:order_qty) * :case_qty >= qty_brk` (`order_item.rb:324`). The Pricing dialog fields (`PriceDialog.tsx:299-314`) write those same stock columns, so **Pricing dialog prices are per each, and `umrp_price` is stored per each too.** The dialog check compares them directly: `price > 0 AND price < umrp_price`. **Line prices are per selling unit.** In `orderitem` (`db/structure.sql:39812`) and `invitemhist` (`db/structure.sql:24021-24058`), `case_qty` is the number of eaches in the line's unit of measure, `order_qty` is the number of those units, and `sold_price` is the price per unit of measure. The model comment says so directly: "the sold_price will be the price per ord, calculating the UM qty … UM:12 ORD:1 the sold_price would be $12 … the sold price is basically the price per UM" (`order_item.rb:243-248`). The line discount is `sold_disc` (a percent), and the extension is `sold_price*order_qty - sold_price*order_qty*(sold_disc/100)` (`order_item.rb:557`). `orderitem` has no separate UM-code column. The unit is fully described by `case_qty`. **Existing precedent (task-0404 below-cost sales):** cost is per each, so line cost = `(cost + freight) * order_qty * COALESCE(NULLIF(case_qty,0),1)` and profit = `extension - that` (`app/controllers/branch_control_panel_v2_controller.rb:1084-1092`, again at `:2866-2868`). Older reports use the same idea without the zero guard (`app/models/salesman.rb:2277`, `app/models/stock_item.rb:110`). ### Formula ``` units_each = COALESCE(NULLIF(case_qty, 0), 1) -- same zero guard as task-0404 net_each = sold_price * (1 - COALESCE(sold_disc, 0) / 100) / units_each -- equivalent when order_qty <> 0: extension / (order_qty * units_each) violation = umrp_price > 0 AND net_each < umrp_price (warn) at_minimum = umrp_price > 0 AND net_each = umrp_price (informational warn, decision 4) ``` Compare after rounding `net_each` to 4 decimals, so a case price that rounds to the cent doesn't trigger a false warning (e.g. $10.00 a case of 3 = $3.3333 each). **Phil's example:** a case of 12 sold at $120 gives `case_qty=12`, `sold_price=120`, `sold_disc=0`, so `net_each = 120/12 = $10.00`. Against a UMRP of $12 that's a violation, and the line shows a warning. ### Edge cases | Case | Handling | |---|---| | Each UM | `case_qty = 1`, so `net_each = sold_price × (1 − disc)`. | | Case UM | `case_qty = N`, so divide by N (formula above). | | Broken case (selling eaches from a case) | Entered as `case_qty = 1`, `order_qty = eaches`. The formula already gives the each price, so no special case is needed. | | Zero `case_qty` | Model validation requires `case_qty > 0` (`order_item.rb:23`). Legacy or history rows may have 0, which is treated as 1 like task-0404. | | `order_qty` 0 or negative (credits/returns) | Use the `sold_price` form, not the `extension` form. Never warn on credit/return lines (negative `order_qty`). | | Quantity-break discount | Already in `sold_disc` (set by `OrderItem.price`, `order_item.rb:384-398`), so it's included. | | Manual `sold_disc` edits | Included, since the formula uses the stored `sold_disc`. | | Kits/bundles | POS has no kit entity. Bundles are separate lines or add-ons (`useEditRow/AddonDialog.tsx`), and each product line is checked on its own (decision 7). | | Services / comment lines | Skip lines where `good_service = 'S'` or `item_type <> 'product'`. | | Order-level coupon | Not included in slice A (coupon capping, decision 6, is a later slice). The invoice re-check uses line net only. Documented as a known gap. | | No `umrp_price` / 0 | No check. | ## 4. Slice A design **M0 migration (both Standard and Family Stores databases; dev/review first):** - For each warehouse stock table (`Warehouseinfo` → `stock_table_name`): `ALTER TABLE ADD COLUMN IF NOT EXISTS umrp_price numeric;` (nullable, no default, so it's instant in Postgres). Reversible with `DROP COLUMN`. - Add `umrp_price numeric,` next to `map_price` in the stock-table DDL template (`app/models/warehouseinfo.rb:678`) so new warehouses get the column. - Update `db/structure.sql`. - Not in `Stock::PT_ATTRS_TO_SKIP` (`app/models/stock.rb:6`), so paper_trail versions it. **Wiring (everywhere `map_price` is listed):** `BatchStockUpdateFormatter::GLOBAL_KEYS` (`app/lib/batch_stock_update_formatter.rb:6-10`), `StockItemsController#update_params` and `GLOBAL_PERMITTED_PARAMS` (`stock_items_controller.rb:1714-1727`), `stock_items_helper.rb:94-101`, batch import columns (`batch_imports_controller.rb:39,107`), the stock file field list (`stock_file/Index.tsx:1549`) labeled "UMRP (min sold price)", and the stock read query (`app/models/stock.rb:964`) so the register gets it. **Bulk update / bulk insert paths (Phil, 12:14 PM: `umrp_price` must be handled wherever `map_price` is).** I searched current `origin/staging` (`4e3e878007`) and every `db/*.sql` file. **No SQL/PLpgSQL function named `bulk_update`/`bulk_insert` (or any stock bulk function) exists**: the only `bulk_*` hits are unrelated (ESL tags, rebates, requisitions, financial entries, RFID scans, inventory totals), and no SQL function references `map_price`. The stock bulk paths are Ruby, and each one gets `umrp_price` next to `map_price`: | Path | What it does | Change | |---|---|---| | `BatchStockUpdate.update` (`app/lib/batch_stock_update.rb:269-296`) | Bulk update across warehouses with `upsert_all` and hand-built `StockVersion` rows (`:298`) | Takes columns from `BatchStockUpdateFormatter`, so add `umrp_price` to `GLOBAL_KEYS` (`app/lib/batch_stock_update_formatter.rb:6-10`). It then updates every warehouse and gets versioned by `build_versions`. | | Batch Updates column list (`app/controllers/batch_updates_controller.rb:28`) | Columns offered in the bulk-update UI | Add `"umrp_price"` after `"map_price"`. **Don't** add it to `aqColumns` (`:39`), because the AutoQuotes MAP field isn't UMRP (decision 12). | | Batch import / bulk insert (`app/controllers/batch_imports_controller.rb:39,107`) | Column list and permitted params for importing new stock rows | Add `umrp_price` to both. | | Stock-file field constraints (`app/javascript/apps/stock/stock_file/stockFileFieldConstraints.ts`) | Client-side numeric validation for stock fields | Validate `umrp_price` the same way as `map_price` (a finite number ≥ 0, blank allowed). | | Warehouse copy inserts: `Stock.copy_missing_items` (`app/models/stock.rb:193-214`) and `copy_missing_catalog_stock_rows` (`:234-285`, `insert_all`) | Copy every column between warehouse stock tables | No list change needed, since they copy all columns not in `WAREHOUSE_SPECIFIC_STOCK_SYNC_COLUMNS` (`:220-224`), so `umrp_price` copies as a catalog value. They require the **same column count** in every stock table (`:198-200`), so M0 must reach every stock table at once (use `StockFactory.stock_tables`, as the map_price migration did in `db/migrate/20240329201218_add_map_price_to_stock_tables.rb`). | | `db/structure.sql` (10 stock tables listing `map_price`, e.g. `:52282`) | Schema dump | Regenerated by the migration so each stock table has `umrp_price`. | | Seeds (`lib/tasks/pos_app/seed/rfid.rake:195,908,1301`) | Dev seed data | Optional: seed `umrp_price` for dev/review test items. | **Bulk-path tests:** - `BatchStockUpdate` test: a bulk update with `umrp_price` changes every selected warehouse and writes a `StockVersion` with the `umrp_price` change. A second row without `umrp_price` leaves it untouched. - Batch import controller test: an import with a `umrp_price` column persists it, and a non-numeric value is rejected. - `batch_updates_controller#stock_columns` test: `umrp_price` is in `columns` and not in `aqColumns`. - `Stock.copy_missing_items` / `copy_missing_catalog_stock_rows` test: the copied row keeps `umrp_price`, and the column-count check still passes after M0. - Migration test/check: after M0, every table in `StockFactory.stock_tables` has `umrp_price`, and the new-warehouse template creates it. - Vitest for the `stockFileFieldConstraints` `umrp_price` rule. **Pricing dialog:** - Show read-only UMRP and MAP columns. - When saving, for each changed warehouse row, if `sale_price`, `fs_price` or `ps_price` is above 0 and below `umrp_price`, show a confirmation listing each row, field and gap. Users with `overrideUmrp` can confirm and enter a reason. Users without it are blocked. - The server repeats the check in `StockItemsController#update_prices` (`stock_items_controller.rb:1163`) **before** enqueueing `StockTablePricesUpdateJob`, plus `PricingController#update_prices` (`pricing_controller.rb:322`). - With no overrides table in slice A, the override reason is recorded in the paper_trail version metadata (`whodunnit` plus a reason in the version's `object_changes`/meta). Phil can revisit this if he wants a table. **Register warning:** - `OrderItemsController#update` (`order_items_controller.rb:112`) and `order_entry_json` return `umrp_warning: {umrp_each, net_each, case_qty}` when `net_each <= umrp_price`. - The order entry row (`apps/sales/salesman_order_entry/OrderItemTable.tsx`) shows an orange "Below vendor minimum $X/ea" chip, or "At vendor minimum" when they're equal. - `Order#invoice_order` (`app/models/order.rb:439`) logs a warning but doesn't block. **Permission:** `overrideUmrp`, granted to managers and pricing admins (decision 13). **Verification:** the bulk-path tests above, plus model/unit tests for `net_each` (each, case, broken case, zero case_qty, discount, credit), a controller test for the pre-enqueue check, Vitest for the dialog warning and row chip, a review server, and `verify-pos doctor --task task-0429` plus the stock-file and order-entry flows with `--attach`. ## 5. Migration list (slice A) | # | Migration | Databases | |---|---|---| | M0 | `ADD COLUMN IF NOT EXISTS umrp_price numeric` (nullable) on every table in `StockFactory.stock_tables` (all at once, since warehouse copy checks column counts), plus the same column in the `warehouseinfo.rb` new-stock-table template | Standard and Family Stores (dev/review first) | | — | Permission `overrideUmrp` (seeded the way existing permissions are) | Both | No other tables. `map_price` is untouched. ## 6. Decisions (approved by Phil, 2026-10-10 12:13 PM MT, all as recommended) 1. Per-item UMRP lives in a `umrp_price` stock column now. An effective-dated table comes later only if needed. 2. Pricing dialog: block without `overrideUmrp`; with it, warn and require a reason. 3. Register: warning only in this slice. 4. Warn at equal (informational) and below. 5. The register check uses the net unit price per each, after line discount (coupon allocation comes in a later slice). 6. Coupon capping for UMRP lines is approved for a later slice (not slice A). 7. Bundles: check each component line, no block. 8. Customer-specific prices and price codes below UMRP: warn when saved (later slice), and list them in reports (later). 9. Display/demo units: a per-policy flag plus a line reason code (later, needs policies). 10. MAP is never enforced at the register. 11. Same code for Family Stores and Standard, with no tenant branches. 12. UMRP comes from the vendor price-file import. AutoQuotes `map_mrp_price` goes into a field only per vendor policy, after a preview. 13. `overrideUmrp` goes to store managers and pricing admins only.