Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix(erp): stop the public quote share page 500ing, and name the rate kind
Sidwebworksd2253e89d05f
diff --git a/.claude/rules/numeric-precision.md b/.claude/rules/numeric-precision.mdindex eba3cd2d16..1266a983f5 100644--- a/.claude/rules/numeric-precision.md+++ b/.claude/rules/numeric-precision.md@@ -116,12 +116,12 @@ is module-private so the two percent kinds can never drift apart):| Exchange rate | min 0, max 5 | "1.0852", "0.00781" — a plain multiplier, not a percent and not a currency. Intl's decimal default caps at 3, which truncates a stored rate on blur || Quantity | min 0, max 5 | "3", "4.33333", "0.00125" — no "<0.01" placeholder || Money (settlement) | max = min = `currency.decimalPlaces` | "$300.00", "$3.50", "$0.00", "¥63", "BHD 0.563" — what someone PAYS: an invoice total, line amount, payment, tax amount. A currency cannot settle a fraction of its smallest unit, so its decimals are both floor and CEILING; a stored 300.33323 displays "$300.33" and storage keeps the rest. PADDED, because fixed-width money is the accounting convention |-| Price (per-unit rate) | min = `currency.decimalPlaces`, max = `SCALE` | "$300.00", "$3.50" — pads exactly like money, so a price column stays aligned — but the currency's decimals are only its FLOOR. Above them it carries the storage scale: "$0.164", "$0.00123", "$12.34567". A price is what you MULTIPLY BY, not what you settle, and a 2-decimal ceiling silently turned a real $0.00123 fastener price into $0.00 ([#1203](https://github.com/crbnos/carbon/issues/1203)). Every ERP splits these — Xero settles at 2 and takes 4 on `UnitAmount` (opt-in `unitdp=4`), QuickBooks Desktop shows 5 in the Rate column, SAP reaches sub-cent prices with a price unit (per 100/1000) — and none of them widens settlement values. `INPUT_STEP.price` is the scale step, since `money`'s cent step would snap away exactly the digits this keeps |+| Rate (per-unit price/cost) | min = `currency.decimalPlaces`, max = `SCALE` | "$300.00", "$3.50" — pads exactly like money, so a price column stays aligned — but the currency's decimals are only its FLOOR. Above them it carries the storage scale: "$0.164", "$0.00123", "$12.34567". A price is what you MULTIPLY BY, not what you settle, and a 2-decimal ceiling silently turned a real $0.00123 fastener price into $0.00 ([#1203](https://github.com/crbnos/carbon/issues/1203)). Every ERP splits these — Xero settles at 2 and takes 4 on `UnitAmount` (opt-in `unitdp=4`), QuickBooks Desktop shows 5 in the Rate column, SAP reaches sub-cent prices with a price unit (per 100/1000) — and none of them widens settlement values. `INPUT_STEP.rate` is the scale step, since `money`'s cent step would snap away exactly the digits this keeps || ↳ trailing-zero preference | min 0 when set | `companySettings.showCurrencyTrailingZeros` (default true) turned OFF drops the non-significant zeros — "$300", "$3.5". DISPLAY and IN-APP only, and it covers EDITABLE fields too: `useCurrencyFormatter` and `MotionMoney` read it once via `useCurrencyMinDecimals`, and `~/components/Form`'s `Number`/`NumberControlled` wrappers (`CurrencyNumber.tsx`) apply it to any `style: "currency"` `formatOptions` — never a call site, which is why the ~80 `INPUT_FORMAT.money/price(...)` calls still pass two arguments. Overriding the MINIMUM is safe on an input even though `formatOptions` is part of the storage round-trip: react-aria commits `parse(format(x))` and only the MAXIMUM can change that. Documents render through the pure `formatMoney` and stay padded — a customer-facing invoice is where fixed-width money matters most — and an unauthenticated context (the public quote share page) has no settings to read, so it pads too |-| Editable currency (`INPUT_FORMAT.money` / `.price`) | same as its kind above | an input formats with the SAME digits it displays with, padding included — an empty cost reads "$0.00". react-aria's blur commit is literally `setNumberValue(parse(format(x)))`, so this is not decoration — it is what a typed amount is STORED at. `.money` commits 300.22121 as 300.22 in USD and 63.4 as 63 in JPY; `.price` commits 0.00123 as 0.00123, which is the whole point of the price kind |+| Editable currency (`INPUT_FORMAT.money` / `.rate`) | same as its kind above | an input formats with the SAME digits it displays with, padding included — an empty cost reads "$0.00". react-aria's blur commit is literally `setNumberValue(parse(format(x)))`, so this is not decoration — it is what a typed amount is STORED at. `.money` commits 300.22121 as 300.22 in USD and 63.4 as 63 in JPY; `.rate` commits 0.00123 as 0.00123, which is the whole point of the rate kind |Call sites pick a kind (`formatMoney/Price/Percent/Quantity`, the-`useCurrencyFormatter` (with `price`/`compact`/`wholeUnits` naming the+`useCurrencyFormatter` (with `rate`/`compact`/`wholeUnits` naming thekind)/`usePercentFormatter`/`useQuantityFormatter` hooks — the first two are the same function) — never `minimumFractionDigits`/`maximumFractionDigits` inline (`no-inline-fraction-digits`), and module-localdiff --git a/apps/erp/app/components/Form/ConversionFactor.tsx b/apps/erp/app/components/Form/ConversionFactor.tsxindex 7b99377477..1c9d1ecd76 100644--- a/apps/erp/app/components/Form/ConversionFactor.tsx+++ b/apps/erp/app/components/Form/ConversionFactor.tsx@@ -22,6 +22,7 @@ import {NumberInputStepper,VStack} from "@carbon/react";+import { SCALE_FORMAT } from "@carbon/utils";import { Trans, useLingui } from "@lingui/react/macro";import type { ElementRef } from "react";import { forwardRef, useEffect, useMemo, useRef, useState } from "react";@@ -83,6 +84,12 @@ const ConversionFactor = forwardRef<const [open, setOpen] = useState(false);const initialValue = useRef(defaultValue);+ // A conversion factor is a RATE, not a settlement amount: inventoryQty =+ // purchaseQty x factor, and the modal also shows its inverse. A bare+ // NumberField falls to Intl's 3-digit decimal default, which stored 1/3 as+ // 0.333 and 0.16455 as 0.165 — a permanent error on every receipt of that+ // item, even though the columns are bare NUMERIC. SCALE_FORMAT is the+ // storage scale, and react-aria commits parse(format(x)).const [conversionFactor, setConversionFactor] = useState(initialValue.current);@@ -249,6 +256,7 @@ const ConversionFactor = forwardRef<<NumberFieldvalue={1 / conversionFactor}onChange={onPurchaseUnitChange}+ formatOptions={SCALE_FORMAT}><NumberInputGroup className="relative"><NumberInput />@@ -287,6 +295,7 @@ const ConversionFactor = forwardRef<<NumberFieldvalue={conversionFactor}onChange={onInventoryUnitChange}+ formatOptions={SCALE_FORMAT}><NumberInputGroup className="relative"><NumberInput />diff --git a/apps/erp/app/components/Form/TaxFields.tsx b/apps/erp/app/components/Form/TaxFields.tsxindex abb6612178..e7ac06fd4f 100644--- a/apps/erp/app/components/Form/TaxFields.tsx+++ b/apps/erp/app/components/Form/TaxFields.tsx@@ -146,8 +146,8 @@ export function TaxFields({value={percent}minValue={0}maxValue={1}- step={INPUT_STEP.rate}- formatOptions={INPUT_FORMAT.rate}+ step={INPUT_STEP.percent}+ formatOptions={INPUT_FORMAT.percent}isReadOnly={isReadOnly}onChange={(value) =>onChange(taxPairFromPercent(subtotal, value, currencyDecimals))diff --git a/apps/erp/app/components/MotionMoney.tsx b/apps/erp/app/components/MotionMoney.tsxindex 886cda2e0d..20be9958fb 100644--- a/apps/erp/app/components/MotionMoney.tsx+++ b/apps/erp/app/components/MotionMoney.tsx@@ -1,4 +1,4 @@-import { moneyFormatOptions } from "@carbon/utils";+import { moneyFormatOptions, SCALE } from "@carbon/utils";import { useLocale } from "@react-aria/i18n";import MotionNumber from "motion-number";import { useCurrencyMinDecimals } from "~/hooks/useCurrencies";@@ -10,6 +10,10 @@ type MotionMoneyProps = {* once per component with `useCurrencyDecimals` and pass it down, rather* than calling that hook per amount (it mounts a fetcher). */decimalPlaces: number;+ /** A per-unit RATE ("Unit Price") rather than a settlement amount ("Total",+ * "Subtotal", "Tax"). Still pads to the currency's decimals, but they+ * become a floor, not a ceiling — see priceFormatOptions in the same doc. */+ rate?: boolean;className?: string;};@@ -25,6 +29,7 @@ const MotionMoney = ({value,currency,decimalPlaces,+ rate,className}: MotionMoneyProps) => {const { locale } = useLocale();@@ -36,7 +41,8 @@ const MotionMoney = ({format={{...moneyFormatOptions(decimalPlaces, {currency,- minDecimalPlaces: minDecimals+ minDecimalPlaces: minDecimals,+ maxDecimalPlaces: rate ? Math.max(decimalPlaces, SCALE) : undefined}),notation: "standard" as const}}diff --git a/apps/erp/app/hooks/useCurrencyFormatter.tsx b/apps/erp/app/hooks/useCurrencyFormatter.tsxindex d539d557df..36866d204e 100644--- a/apps/erp/app/hooks/useCurrencyFormatter.tsx+++ b/apps/erp/app/hooks/useCurrencyFormatter.tsx@@ -1,8 +1,9 @@-import { moneyFormatOptions, priceFormatOptions } from "@carbon/utils";+import { useRouteData } from "@carbon/react";+import { moneyFormatOptions, rateFormatOptions } from "@carbon/utils";import { useLocale } from "@react-aria/i18n";import { useMemo } from "react";+import { path } from "~/utils/path";import { useCurrencyDecimals, useCurrencyMinDecimals } from "./useCurrencies";-import { useUser } from "./useUser";/** Everything a call site is allowed to override, and nothing else.*@@ -20,11 +21,11 @@ export type CurrencyFormatterOptions = {/** Drop the fraction entirely — a report that deliberately shows whole units.* Combined with `compact` this is "$1M" rather than "$1.2M". */wholeUnits?: boolean;- /** A per-unit PRICE rather than a settlement amount: still padded to the- * currency's decimals, but allowed to exceed them up to the storage scale,- * so a $0.00123 fastener price displays as it is stored rather than as- * "$0.00". Matches what the price INPUT commits — see priceFormatOptions. */- price?: boolean;+ /** A RATE rather than a settlement amount — a per-unit price or cost. Still+ * padded to the currency's decimals, but allowed to exceed them up to the+ * storage scale, so a $0.00123 fastener price displays as it is stored+ * rather than as "$0.00". Matches what INPUT_FORMAT.rate commits. */+ rate?: boolean;};/**@@ -38,12 +39,20 @@ export type CurrencyFormatterOptions = {* non-significant zeros by turning `showCurrencyTrailingZeros` off; that* preference is read here once (useCurrencyMinDecimals) rather than at 55 call sites.*- * Callers pick a KIND, never a digit count: `wholeUnits` for a report that shows- * whole amounts, `compact` for a "$1.2M" dashboard tile.+ * Callers pick a KIND, never a digit count: `rate` for a per-unit price (the+ * currency's decimals become a floor, not a ceiling), `wholeUnits` for a report+ * that shows whole amounts, `compact` for a "$1.2M" dashboard tile.*/export function useCurrencyFormatter(options?: CurrencyFormatterOptions) {- const { company } = useUser();- const baseCurrency = company?.baseCurrencyCode ?? "USD";+ // NOT useUser(): that THROWS when the authenticated route isn't mounted, and+ // this hook is used on the public quote share page, where it 500'd the whole+ // render. The company is only ever the FALLBACK currency here — an+ // unauthenticated caller always passes `currency` explicitly — so read the+ // route data directly and let it be absent.+ const authenticatedData = useRouteData<{+ company?: { baseCurrencyCode?: string | null };+ }>(path.to.authenticatedRoot);+ const baseCurrency = authenticatedData?.company?.baseCurrencyCode ?? "USD";const { locale } = useLocale();const currency = options?.currency ?? baseCurrency;const currencyDecimals = useCurrencyDecimals(currency);@@ -53,7 +62,7 @@ export function useCurrencyFormatter(options?: CurrencyFormatterOptions) {// identity meant the memo never hit: a new Intl.NumberFormat on every render,// and — since the formatter is itself a dep of the `columns` memo in several// tables — a full column rebuild with it. Depend on the primitive fields.- const { decimalPlaces, compact, wholeUnits, price } = options ?? {};+ const { decimalPlaces, compact, wholeUnits, rate } = options ?? {};return useMemo(() => {// `wholeUnits` is a digit count of zero, expressed as the intent rather than@@ -61,8 +70,8 @@ export function useCurrencyFormatter(options?: CurrencyFormatterOptions) {const decimals = wholeUnits ? 0 : (decimalPlaces ?? currencyDecimals);const min = wholeUnits ? 0 : minDecimals;return new Intl.NumberFormat(locale, {- ...(price && !wholeUnits- ? priceFormatOptions(currency, decimals, min)+ ...(rate && !wholeUnits+ ? rateFormatOptions(currency, decimals, min): moneyFormatOptions(decimals, { currency, minDecimalPlaces: min })),...(compact? { notation: "compact" as const, compactDisplay: "short" as const }@@ -76,6 +85,6 @@ export function useCurrencyFormatter(options?: CurrencyFormatterOptions) {decimalPlaces,compact,wholeUnits,- price+ rate]);}diff --git a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsx b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsxindex 51b1c2d33b..5fdc561c96 100644--- a/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsx+++ b/apps/erp/app/modules/accounting/ui/JournalEntries/JournalLineRow.tsx@@ -104,7 +104,7 @@ const JournalLineRow = ({<NumberFieldvalue={line.debit ?? 0}onChange={handleDebitChange}- formatOptions={INPUT_FORMAT.price(currencyCode, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(currencyCode, currencyDecimals)}minValue={0}isDisabled={isDisabled}isReadOnly={isDisabled}@@ -119,7 +119,7 @@ const JournalLineRow = ({<NumberFieldvalue={line.credit ?? 0}onChange={handleCreditChange}- formatOptions={INPUT_FORMAT.price(currencyCode, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(currencyCode, currencyDecimals)}minValue={0}isDisabled={isDisabled}isReadOnly={isDisabled}diff --git a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsxindex 9a68a92c99..e3c16ec3f3 100644--- a/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/PurchaseInvoice/PurchaseInvoiceLineForm.tsx@@ -287,7 +287,7 @@ const PurchaseInvoiceLineForm = ({decimalPlaces: currencyDecimals});const priceFormatter = useCurrencyFormatter({- price: true,+ rate: true,currency: invoiceCurrency,decimalPlaces: currencyDecimals});@@ -644,7 +644,7 @@ const PurchaseInvoiceLineForm = ({name="supplierUnitPrice"label={t`Supplier Unit Price`}value={itemData.supplierUnitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(invoiceCurrency,currencyDecimals)}@@ -857,7 +857,7 @@ const PurchaseInvoiceLineForm = ({label={t`Unit Price`}isOptional={false}value={indirectData.supplierUnitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(invoiceCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsxindex 7025c0f7d1..aeed46cb0b 100644--- a/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx+++ b/apps/erp/app/modules/invoicing/ui/SalesInvoice/SalesInvoiceLineForm.tsx@@ -377,7 +377,7 @@ const SalesInvoiceLineForm = ({decimalPlaces: currencyDecimals});const priceFormatter = useCurrencyFormatter({- price: true,+ rate: true,currency: routeData?.salesInvoice?.currencyCode ?? company.baseCurrencyCode,decimalPlaces: currencyDecimals});@@ -599,7 +599,7 @@ const SalesInvoiceLineForm = ({name="unitPrice"label={t`Unit Price`}value={itemData.unitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(invoiceCurrency,currencyDecimals)}@@ -817,7 +817,7 @@ const SalesInvoiceLineForm = ({label={t`Unit Price`}isOptional={false}value={assetData.unitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(invoiceCurrency,currencyDecimals)}@@ -873,8 +873,8 @@ const SalesInvoiceLineForm = ({value={assetData.taxPercent}minValue={0}maxValue={1}- step={INPUT_STEP.rate}- formatOptions={INPUT_FORMAT.rate}+ step={INPUT_STEP.percent}+ formatOptions={INPUT_FORMAT.percent}onChange={(value) =>setAssetData((d) => ({...d,diff --git a/apps/erp/app/modules/items/ui/Consumables/ConsumableForm.tsx b/apps/erp/app/modules/items/ui/Consumables/ConsumableForm.tsxindex 9f7cc324ff..3ee42e47db 100644--- a/apps/erp/app/modules/items/ui/Consumables/ConsumableForm.tsx+++ b/apps/erp/app/modules/items/ui/Consumables/ConsumableForm.tsx@@ -192,7 +192,7 @@ const ConsumableForm = ({<Numbername="unitCost"label={t`Unit Cost`}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsxindex 70d7193d5d..d23ccdd05c 100644--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx@@ -1184,7 +1184,7 @@ function OperationForm({label={t`Minimum Cost`}minValue={0}value={processData.operationMinimumCost}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}onChange={(newValue) =>setProcessData((d) => ({...d,@@ -1197,7 +1197,7 @@ function OperationForm({label={t`Unit Cost`}minValue={0}value={processData.operationUnitCost}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}onChange={(newValue) =>setProcessData((d) => ({...d,diff --git a/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsxindex 71afa48abf..fb6d2c9bd8 100644--- a/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx+++ b/apps/erp/app/modules/items/ui/Item/ItemCostingForm.tsx@@ -82,7 +82,7 @@ const ItemCostingForm = ({ initialValues }: ItemCostingFormProps) => {<Numbername="unitCost"label={t`Unit Cost`}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}helperText={replenishmentSystem === "Make"? undefineddiff --git a/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsxindex 0299e720ef..03e594f2a0 100644--- a/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsx+++ b/apps/erp/app/modules/items/ui/Item/ItemManufacturingForm.tsx@@ -64,7 +64,7 @@ const ItemManufacturingForm = ({name="scrapPercentage"label={t`Scrap Percent`}termId="item-scrap-percent"- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}/><Numbername="leadTime"diff --git a/apps/erp/app/modules/items/ui/Item/ItemSalePriceForm.tsx b/apps/erp/app/modules/items/ui/Item/ItemSalePriceForm.tsxindex e8c6ef87f6..df50bd67c6 100644--- a/apps/erp/app/modules/items/ui/Item/ItemSalePriceForm.tsx+++ b/apps/erp/app/modules/items/ui/Item/ItemSalePriceForm.tsx@@ -44,7 +44,7 @@ const ItemSalePriceForm = ({ initialValues }: ItemSalePriceFormProps) => {name="unitSalePrice"label={t`Unit Sale Price`}minValue={0}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(company?.baseCurrencyCode ?? "USD",currencyDecimals)}diff --git a/apps/erp/app/modules/items/ui/Item/SupplierPartForm.tsx b/apps/erp/app/modules/items/ui/Item/SupplierPartForm.tsxindex ad12c3ebeb..d880c87bc6 100644--- a/apps/erp/app/modules/items/ui/Item/SupplierPartForm.tsx+++ b/apps/erp/app/modules/items/ui/Item/SupplierPartForm.tsx@@ -191,7 +191,7 @@ const SupplierPartForm = ({name="unitPrice"label={t`Unit Price`}minValue={0}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -269,7 +269,7 @@ function PurchaseHistory({}) {const { t } = useLingui();const priceFormatter = useCurrencyFormatter({- price: true,+ rate: true,currency: baseCurrency});if (history.length === 0) return null;@@ -366,7 +366,8 @@ function PriceBreaks({}) {const currencyDecimals = useCurrencyDecimals(baseCurrency);const { t } = useLingui();- const formatter = useCurrencyFormatter();+ // unitPrice is a RATE, not a settlement amount — see numeric-precision.md+ const formatter = useCurrencyFormatter({ rate: true });const removeRow = useCallback((index: number) => {@@ -395,7 +396,7 @@ function PriceBreaks({() => ({quantity: EditableNumber(noOpMutation),unitPrice: EditableNumber(noOpMutation, {- formatOptions: INPUT_FORMAT.price(baseCurrency, currencyDecimals)+ formatOptions: INPUT_FORMAT.rate(baseCurrency, currencyDecimals)})}),[noOpMutation, baseCurrency, currencyDecimals]diff --git a/apps/erp/app/modules/items/ui/Materials/MaterialForm.tsx b/apps/erp/app/modules/items/ui/Materials/MaterialForm.tsxindex 9e84df54b1..460ab46236 100644--- a/apps/erp/app/modules/items/ui/Materials/MaterialForm.tsx+++ b/apps/erp/app/modules/items/ui/Materials/MaterialForm.tsx@@ -321,7 +321,7 @@ const MaterialForm = ({<Numbername="unitCost"label={t`Unit Cost`}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/items/ui/Parts/PartForm.tsx b/apps/erp/app/modules/items/ui/Parts/PartForm.tsxindex f032f4d16b..41f5ea8273 100644--- a/apps/erp/app/modules/items/ui/Parts/PartForm.tsx+++ b/apps/erp/app/modules/items/ui/Parts/PartForm.tsx@@ -341,7 +341,7 @@ const PartForm = ({ initialValues, type = "card", onClose }: PartFormProps) => {<Numbername="unitCost"label={t`Unit Cost`}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/items/ui/Tools/ToolForm.tsx b/apps/erp/app/modules/items/ui/Tools/ToolForm.tsxindex 7ec4986833..5c04fd4d60 100644--- a/apps/erp/app/modules/items/ui/Tools/ToolForm.tsx+++ b/apps/erp/app/modules/items/ui/Tools/ToolForm.tsx@@ -333,7 +333,7 @@ const ToolForm = ({ initialValues, type = "card", onClose }: ToolFormProps) => {<Numbername="unitCost"label={t`Unit Cost`}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsxindex d4f3c5492c..d24e19440b 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx@@ -842,7 +842,7 @@ function MaterialForm({label={t`Unit Cost`}value={itemData.unitCost}minValue={0}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}/>)}</div>diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsxindex 96a1d8d8aa..f3140b75cf 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx@@ -3004,7 +3004,7 @@ function OperationForm({label={t`Minimum Cost`}minValue={0}value={processData.operationMinimumCost}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}onChange={(newValue) =>setProcessData((d) => ({...d,@@ -3017,7 +3017,7 @@ function OperationForm({label={t`Unit Cost`}minValue={0}value={processData.operationUnitCost}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}onChange={(newValue) =>setProcessData((d) => ({...d,@@ -3367,7 +3367,7 @@ function OperationForm({label={t`Labor Rate`}minValue={0}value={processData.laborRate}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -3384,7 +3384,7 @@ function OperationForm({label={t`Machine Rate`}minValue={0}value={processData.machineRate}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -3401,7 +3401,7 @@ function OperationForm({label={t`Overhead Rate`}minValue={0}value={processData.overheadRate}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsxindex 3a9a267ff6..ecb1165ee4 100644--- a/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx+++ b/apps/erp/app/modules/purchasing/ui/PurchaseOrder/PurchaseOrderLineForm.tsx@@ -307,7 +307,7 @@ const PurchaseOrderLineForm = ({decimalPlaces: currencyDecimals});const priceFormatter = useCurrencyFormatter({- price: true,+ rate: true,currency: orderCurrency,decimalPlaces: currencyDecimals});@@ -713,7 +713,7 @@ const PurchaseOrderLineForm = ({name="supplierUnitPrice"label={t`Unit Price`}value={itemData.supplierUnitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(orderCurrency,currencyDecimals)}@@ -958,7 +958,7 @@ const PurchaseOrderLineForm = ({label={t`Unit Price`}isOptional={false}value={indirectData.supplierUnitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(orderCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsxindex 2fba3557ca..ab313ef23f 100644--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcessForm.tsx@@ -120,7 +120,7 @@ const SupplierProcessForm = ({<Numbername="minimumCost"label={t`Minimum Cost`}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsx b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsxindex dd34c2ec8f..972d26e85f 100644--- a/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsx+++ b/apps/erp/app/modules/purchasing/ui/Supplier/SupplierProcesses.tsx@@ -68,7 +68,8 @@ const SupplierProccesses = ({ processes }: SupplierProccessesProps) => {const customColumns = useCustomColumns<SupplierProcess>("supplierProcess");- const formatter = useCurrencyFormatter();+ // minimumCost is a RATE — its own edit form (SupplierProcessForm) already uses INPUT_FORMAT.rate+ const formatter = useCurrencyFormatter({ rate: true });const columns = useMemo<ColumnDef<SupplierProcess>[]>(() => {const defaultColumns: ColumnDef<SupplierProcess>[] = [@@ -141,7 +142,7 @@ const SupplierProccesses = ({ processes }: SupplierProccessesProps) => {const editableComponents = useMemo(() => ({minimumCost: EditableNumber(onCellEdit, {- formatOptions: INPUT_FORMAT.price(baseCurrency, currencyDecimals)+ formatOptions: INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}),leadTime: EditableNumber(onCellEdit)}),diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLinePricing.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLinePricing.tsxindex b1e4e341e4..2a22b15aa0 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLinePricing.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteLinePricing.tsx@@ -93,6 +93,10 @@ const SupplierQuoteLinePricing = ({routeData?.presentationCurrency?.decimalPlaces ?? configuredDecimals;const formatter = useCurrencyFormatter();+ // The inventory-unit price (unitPrice / conversionFactor) is a RATE, not a+ // settlement amount — `formatter` above is also used for an extended total+ // (unitPrice*qty + shipping + tax), so it can't just take rate:true.+ const inventoryPriceFormatter = useCurrencyFormatter({ rate: true });const presentationCurrencyFormatter = useCurrencyFormatter({currency: quoteCurrency});@@ -261,7 +265,7 @@ const SupplierQuoteLinePricing = ({<Td key={quantity.toString()}><EditableNumberCellvalue={price}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(quoteCurrency,currencyDecimals)}@@ -295,7 +299,9 @@ const SupplierQuoteLinePricing = ({<Td key={index} className="group-hover:bg-muted/50"><VStack spacing={0}><span>- {formatter.format(price / (line.conversionFactor ?? 1))}+ {inventoryPriceFormatter.format(+ price / (line.conversionFactor ?? 1)+ )}</span></VStack></Td>@@ -388,7 +394,7 @@ const SupplierQuoteLinePricing = ({<Td key={index} className="group-hover:bg-muted/50"><EditableNumberCellvalue={taxPercent}- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}minValue={0}maxValue={1}isEditable={isEditable}diff --git a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsx b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsxindex 5bb7299754..2ce43ad372 100644--- a/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsx+++ b/apps/erp/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteToOrderDrawer.tsx@@ -456,7 +456,7 @@ const LinePricingOptions = ({aria-label={t`Unit Price`}minValue={0}value={overridePricing.supplierUnitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(quoteCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/quality/ui/Calibrations/GaugeCalibrationRecordForm.tsx b/apps/erp/app/modules/quality/ui/Calibrations/GaugeCalibrationRecordForm.tsxindex b5e3862a45..0867325bf2 100644--- a/apps/erp/app/modules/quality/ui/Calibrations/GaugeCalibrationRecordForm.tsx+++ b/apps/erp/app/modules/quality/ui/Calibrations/GaugeCalibrationRecordForm.tsx@@ -325,7 +325,7 @@ const GaugeCalibrationRecordForm = ({<Numbername="humidity"label={t`Humidity`}- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}/><Inputname="measurementStandard"diff --git a/apps/erp/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx b/apps/erp/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsxindex 175eb46854..453e94a866 100644--- a/apps/erp/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx+++ b/apps/erp/app/modules/resources/ui/WorkCenters/WorkCenterForm.tsx@@ -125,7 +125,7 @@ const WorkCenterForm = ({name="laborRate"label={t`Labor Rate (Hourly)`}termId="work-center-labor-rate"- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -134,7 +134,7 @@ const WorkCenterForm = ({name="machineRate"label={t`Machine Rate (Hourly)`}termId="work-center-machine-rate"- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -143,7 +143,7 @@ const WorkCenterForm = ({name="overheadRate"label={t`Overhead Rate (Hourly)`}termId="work-center-overhead-rate"- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsx b/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsxindex b7d4203c8d..4c595561a0 100644--- a/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsx+++ b/apps/erp/app/modules/sales/ui/Customer/CustomerForm.tsx@@ -196,8 +196,8 @@ const CustomerForm = ({termId="customer-default-tax-percent"minValue={0}maxValue={1}- step={INPUT_STEP.rate}- formatOptions={INPUT_FORMAT.rate}+ step={INPUT_STEP.percent}+ formatOptions={INPUT_FORMAT.percent}/><Input name="website" label={t`Website`} />diff --git a/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsx b/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsxindex b3638f6941..97e273c1dd 100644--- a/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsx+++ b/apps/erp/app/modules/sales/ui/Pricing/PriceOverrideForm.tsx@@ -275,7 +275,8 @@ function PriceBreaks({companyId?: string;}) {const { t } = useLingui();- const formatter = useCurrencyFormatter();+ // overridePrice is a per-unit RATE (customerItemPriceOverrideBreak), not a settlement amount+ const formatter = useCurrencyFormatter({ rate: true });const currencyDecimals = useCurrencyDecimals(baseCurrency);const [historyBreakId, setHistoryBreakId] = useState<string | null>(null);@@ -358,7 +359,7 @@ function PriceBreaks({() => ({quantity: EditableNumber(noOpMutation),overridePrice: EditableNumber(noOpMutation, {- formatOptions: INPUT_FORMAT.price(baseCurrency, currencyDecimals)+ formatOptions: INPUT_FORMAT.rate(baseCurrency, currencyDecimals)})}),[noOpMutation, baseCurrency]diff --git a/apps/erp/app/modules/sales/ui/Pricing/PricingRuleForm.tsx b/apps/erp/app/modules/sales/ui/Pricing/PricingRuleForm.tsxindex f96428c8ad..9b85cb27de 100644--- a/apps/erp/app/modules/sales/ui/Pricing/PricingRuleForm.tsx+++ b/apps/erp/app/modules/sales/ui/Pricing/PricingRuleForm.tsx@@ -139,8 +139,8 @@ const PricingRuleForm = ({ initialValues, onClose }: PricingRuleFormProps) => {label={t`Amount`}minValue={0}maxValue={1}- step={INPUT_STEP.rate}- formatOptions={INPUT_FORMAT.rate}+ step={INPUT_STEP.percent}+ formatOptions={INPUT_FORMAT.percent}/>) : (<Numberdiff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsxindex c859a0519b..07d41a992b 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx@@ -831,7 +831,7 @@ function MaterialForm({label={t`Unit Cost`}value={itemData.unitCost}minValue={0}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}/>)}</div>diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsxindex e1ff4ead14..3fb16647cf 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx@@ -2011,7 +2011,7 @@ function OperationForm({label={t`Minimum Cost`}minValue={0}value={processData.operationMinimumCost}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}onChange={(newValue) =>setProcessData((d) => ({...d,@@ -2024,7 +2024,7 @@ function OperationForm({label={t`Unit Cost`}minValue={0}value={processData.operationUnitCost}- formatOptions={INPUT_FORMAT.price(baseCurrency, currencyDecimals)}+ formatOptions={INPUT_FORMAT.rate(baseCurrency, currencyDecimals)}onChange={(newValue) =>setProcessData((d) => ({...d,@@ -2369,7 +2369,7 @@ function OperationForm({label={t`Labor Rate`}minValue={0}value={processData.laborRate}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -2386,7 +2386,7 @@ function OperationForm({label={t`Machine Rate`}minValue={0}value={processData.machineRate}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -2403,7 +2403,7 @@ function OperationForm({label={t`Overhead Rate`}minValue={0}value={processData.overheadRate}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineCosting.tsxindex a27ac17e6a..bd1d0630d7 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineCosting.tsx@@ -49,7 +49,7 @@ const QuoteLineCosting = ({const formatter = useCurrencyFormatter();const unitCostFormatter = useCurrencyFormatter({- price: true,+ rate: true,decimalPlaces: unitPricePrecision});diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsxindex e40157f3bc..b76a867f22 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLineForm.tsx@@ -496,8 +496,8 @@ const QuoteLineForm = ({label={t`Tax Percent`}minValue={0}maxValue={1}- step={INPUT_STEP.rate}- formatOptions={INPUT_FORMAT.rate}+ step={INPUT_STEP.percent}+ formatOptions={INPUT_FORMAT.percent}/><CustomFormFields table="quoteLine" />diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsxindex dbd6413b7e..9fe412a0f1 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx@@ -183,7 +183,7 @@ const QuoteLinePricing = ({const formatter = useCurrencyFormatter();const percentFormatter = usePercentFormatter();const unitPriceFormatter = useCurrencyFormatter({- price: true,+ rate: true,currency: routeData?.quote?.currencyCode ?? baseCurrency,decimalPlaces: unitPricePrecision});@@ -796,7 +796,7 @@ const QuoteLinePricing = ({<Td key={index} className="group-hover:bg-muted/50"><EditableNumberCellvalue={editableFields.unitCost}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -836,7 +836,7 @@ const QuoteLinePricing = ({{cost > 0 ? (<EditableNumberCellvalue={markup}- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}minValue={0}isEditable={isEditable}onChange={(value) =>@@ -899,7 +899,7 @@ const QuoteLinePricing = ({<VStack spacing={0}><EditableNumberCellvalue={markupValue / 100}- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}minValue={0}isEditable={isEditable}onChange={(value) =>@@ -937,7 +937,7 @@ const QuoteLinePricing = ({<Td key={quantity.toString()}><EditableNumberCellvalue={price}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,unitPricePrecision)}@@ -966,7 +966,7 @@ const QuoteLinePricing = ({<Td key={index}><EditableNumberCellvalue={discount}- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}minValue={0}maxValue={1}isEditable={isEditable}@@ -1258,7 +1258,7 @@ const QuoteLinePricing = ({<Td key={index} className="group-hover:bg-muted/50"><EditableNumberCellvalue={taxPercent}- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}minValue={0}isEditable={isEditable}onChange={(value) => {diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricingHistory.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricingHistory.tsxindex 22020ecbaa..4d7b3e51ba 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricingHistory.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricingHistory.tsx@@ -66,7 +66,7 @@ const QuoteLinePricingHistory = ({const defaultTab = hasOrderLines ? "salesOrderLines" : "quoteLines";const [customers] = useCustomers();const priceFormatter = useCurrencyFormatter({- price: true,+ rate: true,currency: baseCurrency});diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsxindex 3f3b89f8f5..399895f0e5 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteToOrderDrawer.tsx@@ -722,7 +722,7 @@ const LinePricingOptions = ({? overridePricing.convertedNetUnitPrice: overridePricing.netUnitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(quoteCurrency,currencyDecimals)}diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsxindex ac9eea34d7..7603d53c9d 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx@@ -659,7 +659,7 @@ const SalesOrderLineForm = ({<NumberControlledname="unitPrice"value={itemData.unitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -799,8 +799,8 @@ const SalesOrderLineForm = ({label={t`Tax Percent`}minValue={0}maxValue={1}- step={INPUT_STEP.rate}- formatOptions={INPUT_FORMAT.rate}+ step={INPUT_STEP.percent}+ formatOptions={INPUT_FORMAT.percent}/><Numbername="shippingCost"@@ -895,7 +895,7 @@ const SalesOrderLineForm = ({label={t`Unit Price`}isOptional={false}value={assetData.unitPrice}- formatOptions={INPUT_FORMAT.price(+ formatOptions={INPUT_FORMAT.rate(baseCurrency,currencyDecimals)}@@ -970,8 +970,8 @@ const SalesOrderLineForm = ({value={assetData.taxPercent}minValue={0}maxValue={1}- step={INPUT_STEP.rate}- formatOptions={INPUT_FORMAT.rate}+ step={INPUT_STEP.percent}+ formatOptions={INPUT_FORMAT.percent}onChange={(value) =>setAssetData((d) => ({...d,diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsxindex 715a7bdd9d..ea2d87f5fa 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderSummary.tsx@@ -568,6 +568,7 @@ function LineItems({value={line.convertedUnitPrice ?? 0}currency={currencyCode}decimalPlaces={currencyDecimals}+ rate/></Td></Tr>diff --git a/apps/erp/app/routes/x+/settings+/sales.tsx b/apps/erp/app/routes/x+/settings+/sales.tsxindex e999d2e172..4baf353759 100644--- a/apps/erp/app/routes/x+/settings+/sales.tsx+++ b/apps/erp/app/routes/x+/settings+/sales.tsx@@ -715,7 +715,7 @@ function CategoryMarkupsCard({<Numbername={key}label=""- formatOptions={INPUT_FORMAT.rate}+ formatOptions={INPUT_FORMAT.percent}minValue={0}/></div>diff --git a/packages/checks/src/conformance/no-inline-fraction-digits.test.ts b/packages/checks/src/conformance/no-inline-fraction-digits.test.tsindex 6015219356..a2a5064b65 100644--- a/packages/checks/src/conformance/no-inline-fraction-digits.test.ts+++ b/packages/checks/src/conformance/no-inline-fraction-digits.test.ts@@ -36,7 +36,7 @@ describe("no-inline-fraction-digits", () => {});it("allows named kinds", () => {- const src = "formatOptions={INPUT_FORMAT.rate}";+ const src = "formatOptions={INPUT_FORMAT.percent}";expect(noInlineFractionDigits.scan("a.tsx", src)).toHaveLength(0);});});diff --git a/packages/documents/src/pdf/PurchaseOrderPDF.tsx b/packages/documents/src/pdf/PurchaseOrderPDF.tsxindex fd2da26a7c..d142bb80f1 100644--- a/packages/documents/src/pdf/PurchaseOrderPDF.tsx+++ b/packages/documents/src/pdf/PurchaseOrderPDF.tsx@@ -8,7 +8,11 @@ import {resolveTemplate} from "../template";import type { AccountsPayableBillingAddress, PDF } from "../types";-import { getMoneyFormatter, resolveRegistrationLine } from "../utils/shared";+import {+ getMoneyFormatter,+ getRateFormatter,+ resolveRegistrationLine+} from "../utils/shared";import type { PurchaseOrderData } from "./blocks/purchaseOrder";import {buildPurchaseOrderVars,@@ -55,6 +59,9 @@ const PurchaseOrderPDF = ({const currencyCode =purchaseOrder.currencyCode ?? company.baseCurrencyCode ?? "USD";const numberFormatter = getMoneyFormatter(locale, currencyDecimals);+ // The unit-price COLUMN is a rate, not a settlement amount — see+ // getRateFormatter. Totals/tax/shipping stay on numberFormatter.+ const rateFormatter = getRateFormatter(locale, currencyDecimals);const headerTitle = purchaseOrder?.purchaseOrderId? `${title}: ${purchaseOrder.purchaseOrderId}`@@ -98,6 +105,7 @@ const PurchaseOrderPDF = ({sections,currencyCode,numberFormatter,+ rateFormatter,vars,headerOptions};diff --git a/packages/documents/src/pdf/SalesInvoicePDF.tsx b/packages/documents/src/pdf/SalesInvoicePDF.tsxindex 01096a4236..412332a0c0 100644--- a/packages/documents/src/pdf/SalesInvoicePDF.tsx+++ b/packages/documents/src/pdf/SalesInvoicePDF.tsx@@ -8,7 +8,11 @@ import {resolveTemplate} from "../template";import type { AccountsReceivableBillingAddress, PDF } from "../types";-import { getMoneyFormatter, resolveRegistrationLine } from "../utils/shared";+import {+ getMoneyFormatter,+ getRateFormatter,+ resolveRegistrationLine+} from "../utils/shared";import type { SalesInvoiceData, SalesInvoiceLocations } from "./blocks";import { buildSalesInvoiceVars, salesInvoiceBlockRegistry } from "./blocks";import { Template } from "./components";@@ -57,6 +61,9 @@ const SalesInvoicePDF = ({}: SalesInvoicePDFProps) => {const currencyCode = salesInvoice.currencyCode ?? company.baseCurrencyCode;const numberFormatter = getMoneyFormatter(locale, currencyDecimals);+ // The unit-price COLUMN is a rate, not a settlement amount — see+ // getRateFormatter. Totals/tax/shipping stay on numberFormatter.+ const rateFormatter = getRateFormatter(locale, currencyDecimals);const { blocks, theme, settings, headerSectionId, footerSectionId } =resolveTemplate("salesInvoice", template);@@ -101,6 +108,7 @@ const SalesInvoicePDF = ({sections,currencyCode,numberFormatter,+ rateFormatter,vars,headerOptions};diff --git a/packages/documents/src/pdf/SalesOrderPDF.tsx b/packages/documents/src/pdf/SalesOrderPDF.tsxindex 06dfb3ad6e..318ef12f74 100644--- a/packages/documents/src/pdf/SalesOrderPDF.tsx+++ b/packages/documents/src/pdf/SalesOrderPDF.tsx@@ -8,7 +8,11 @@ import {resolveTemplate} from "../template";import type { AccountsReceivableBillingAddress, PDF } from "../types";-import { getMoneyFormatter, resolveRegistrationLine } from "../utils/shared";+import {+ getMoneyFormatter,+ getRateFormatter,+ resolveRegistrationLine+} from "../utils/shared";import type { SalesOrderData, SalesOrderLocations } from "./blocks/salesOrder";import {buildSalesOrderVars,@@ -56,6 +60,9 @@ const SalesOrderPDF = ({}: SalesOrderPDFProps) => {const currencyCode = salesOrder.currencyCode ?? company.baseCurrencyCode;const numberFormatter = getMoneyFormatter(locale, currencyDecimals);+ // The unit-price COLUMN is a rate, not a settlement amount — see+ // getRateFormatter. Totals/tax/shipping stay on numberFormatter.+ const rateFormatter = getRateFormatter(locale, currencyDecimals);const { blocks, theme, settings, headerSectionId, footerSectionId } =resolveTemplate("salesOrder", template);@@ -96,6 +103,7 @@ const SalesOrderPDF = ({sections,currencyCode,numberFormatter,+ rateFormatter,vars,headerOptions};diff --git a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/LineItemsBlock.tsxindex b4367ea0a3..6820f4f955 100644--- a/packages/documents/src/pdf/blocks/LineItemsBlock.tsx+++ b/packages/documents/src/pdf/blocks/LineItemsBlock.tsx@@ -24,8 +24,14 @@ export function LineItemsBlock({data: SalesInvoiceData;}) {const tw = useTw();- const { salesInvoiceLines, thumbnails, numberFormatter, theme, locale } =- data;+ const {+ salesInvoiceLines,+ thumbnails,+ numberFormatter,+ rateFormatter,+ theme,+ locale+ } = data;const opts = { ...DEFAULT_LINE_ITEMS_OPTIONS, ...block.options };const overflow = itemTextOverflowStyle(opts);let rowIndex = 0;@@ -138,7 +144,7 @@ export function LineItemsBlock({<Text style={tw("w-1/6 text-center text-gray-600")}>{line.invoiceLineType === "Comment"? ""- : numberFormatter.format(line.convertedUnitPrice ?? 0)}+ : rateFormatter.format(line.convertedUnitPrice ?? 0)}</Text><Text style={tw("w-1/6 text-center text-gray-800 font-medium")}>{line.invoiceLineType === "Comment"diff --git a/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsxindex 3c9e0f94a5..289bfdca01 100644--- a/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsx+++ b/packages/documents/src/pdf/blocks/purchaseOrder/LineItemsBlock.tsx@@ -38,6 +38,7 @@ export function LineItemsBlock({purchaseOrderLines,thumbnails,numberFormatter,+ rateFormatter,theme,locale} = data;@@ -159,7 +160,7 @@ export function LineItemsBlock({<Text style={tw("w-[12%] text-center text-gray-600")}>{line.purchaseOrderLineType === "Comment"? ""- : numberFormatter.format(line.supplierUnitPrice ?? 0)}+ : rateFormatter.format(line.supplierUnitPrice ?? 0)}</Text><Text style={tw("w-[12%] text-center text-gray-600")}>{line.purchaseOrderLineType === "Comment"diff --git a/packages/documents/src/pdf/blocks/purchaseOrder/types.ts b/packages/documents/src/pdf/blocks/purchaseOrder/types.tsindex 102766a781..100430d2a0 100644--- a/packages/documents/src/pdf/blocks/purchaseOrder/types.ts+++ b/packages/documents/src/pdf/blocks/purchaseOrder/types.ts@@ -28,6 +28,8 @@ export interface PurchaseOrderData {sections: Record<string, ResolvedSection>;currencyCode: string | null;numberFormatter: Intl.NumberFormat;+ /** Unit-price COLUMN only — a rate, not a settlement amount. */+ rateFormatter: Intl.NumberFormat;vars: Record<string, string>;headerOptions: HeaderOptions;}diff --git a/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx b/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsxindex f2927f56ea..cc0a8f4957 100644--- a/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx+++ b/packages/documents/src/pdf/blocks/salesOrder/LineItemsBlock.tsx@@ -24,7 +24,14 @@ export function LineItemsBlock({data: SalesOrderData;}) {const tw = useTw();- const { salesOrderLines, thumbnails, numberFormatter, theme, locale } = data;+ const {+ salesOrderLines,+ thumbnails,+ numberFormatter,+ rateFormatter,+ theme,+ locale+ } = data;const opts = { ...DEFAULT_LINE_ITEMS_OPTIONS, ...block.options };const overflow = itemTextOverflowStyle(opts);let rowIndex = 0;@@ -137,7 +144,7 @@ export function LineItemsBlock({<Text style={tw("w-1/6 text-center text-gray-600")}>{line.salesOrderLineType === "Comment"? ""- : numberFormatter.format(line.convertedUnitPrice ?? 0)}+ : rateFormatter.format(line.convertedUnitPrice ?? 0)}</Text><Text style={tw("w-1/6 text-center text-gray-800 font-medium")}>{line.salesOrderLineType === "Comment"diff --git a/packages/documents/src/pdf/blocks/salesOrder/types.ts b/packages/documents/src/pdf/blocks/salesOrder/types.tsindex 4f95241e1b..1a9597025f 100644--- a/packages/documents/src/pdf/blocks/salesOrder/types.ts+++ b/packages/documents/src/pdf/blocks/salesOrder/types.ts@@ -34,6 +34,8 @@ export interface SalesOrderData {sections: Record<string, import("../../../template").ResolvedSection>;currencyCode: string | null;numberFormatter: Intl.NumberFormat;+ /** Unit-price COLUMN only — a rate, not a settlement amount. */+ rateFormatter: Intl.NumberFormat;vars: Record<string, string>;headerOptions: HeaderOptions;}diff --git a/packages/documents/src/pdf/blocks/types.ts b/packages/documents/src/pdf/blocks/types.tsindex 9dc600c36f..ee9e43c497 100644--- a/packages/documents/src/pdf/blocks/types.ts+++ b/packages/documents/src/pdf/blocks/types.ts@@ -44,6 +44,8 @@ export interface SalesInvoiceData {/** Precomputed display helpers (built once in the driver). */currencyCode: string | null;numberFormatter: Intl.NumberFormat;+ /** Unit-price COLUMN only — a rate, not a settlement amount. */+ rateFormatter: Intl.NumberFormat;/** Merge-field values, keyed by token (e.g. `invoice.number`). */vars: Record<string, string>;/** Resolved header layout (from the global header section's config). */diff --git a/packages/documents/src/utils/shared.ts b/packages/documents/src/utils/shared.tsindex 006c945cfb..23a683e025 100644--- a/packages/documents/src/utils/shared.ts+++ b/packages/documents/src/utils/shared.ts@@ -1,7 +1,8 @@import {DEFAULT_CURRENCY_DECIMALS,formatPercent,- moneyFormatOptions+ moneyFormatOptions,+ SCALE} from "@carbon/utils";import type { ResolvedSection } from "../template";import { DEFAULT_REGISTRATION_NUMBER, interpolateString } from "../template";@@ -102,3 +103,21 @@ export const getMoneyFormatter = (currency: currency ?? undefined}));++/** A per-unit RATE for documents — same padding as getMoneyFormatter, but the+ * currency's decimals are a FLOOR, not a ceiling: a printed $0.164 unit price+ * stays $0.164 instead of rounding to $0.16. Use for a unit-price COLUMN;+ * totals, tax, and shipping on the same document stay on getMoneyFormatter,+ * since those are settlement amounts, not rates. */+export const getRateFormatter = (+ locale: string,+ decimalPlaces?: number | null,+ currency?: string | null+) =>+ new Intl.NumberFormat(+ locale,+ moneyFormatOptions(decimalPlaces ?? DEFAULT_CURRENCY_DECIMALS, {+ currency: currency ?? undefined,+ maxDecimalPlaces: SCALE+ })+ );diff --git a/packages/utils/AGENTS.md b/packages/utils/AGENTS.mdindex 1871cfa1a8..e5653b7782 100644--- a/packages/utils/AGENTS.md+++ b/packages/utils/AGENTS.md@@ -39,7 +39,7 @@ pnpm --filter @carbon/utils typecheck| `datetime` | Server-side date derivation with mandatory explicit timezone: `timestamp()`, `today(tz)`, `now(tz)`, `businessDay(instant, tz)`, `weekBounds(tz, offset?, anchor?)` (DST-safe Monday→Sunday instant bounds), `weekNumber(date)`. DST/exotic-zone stress suite in `datetime.test.ts` (gap/overlap disambiguation, midnight-skipping zones, 167/169h weeks, ±30/45-min offsets). Mirrored for Deno at `packages/database/supabase/functions/lib/datetime.ts` — keep in sync || `hash` | The repo's stable content hashes — `fnv1a32`/`fnv1a64` (cache and idempotency keys) and `getBucket`. Browser-safe; never add `node:crypto` here || `math` | `clamp`/`lerp`/`inverseLerp`, plus the whole numeric-precision API re-exported from the edge-runtime module: `SCALE`, `EPSILON`, `round`, `scrapAllowance`, `applyRate`, `deriveRate`, `isBalanced`, `assertBalanced`, `RoundingMode` (re-exported from `precision.ts`) |-| `format` | The ONLY place display/input digit counts are chosen: `moneyFormatOptions` (settlement — the currency's decimals are floor AND ceiling), `priceFormatOptions` (per-unit — those decimals are only the floor, ceiling is `SCALE`), the `PERCENT_FORMAT` / `PERCENT_POINTS_FORMAT` / `SCALE_FORMAT` constants, `cldrCurrencyDecimals`, their `format*` helpers, and `INPUT_FORMAT` / `INPUT_STEP` for editable fields. Call sites pick a KIND, never a digit count |+| `format` | The ONLY place display/input digit counts are chosen: `moneyFormatOptions` (settlement — the currency's decimals are floor AND ceiling), `rateFormatOptions` (per-unit RATE — those decimals are only the floor, ceiling is `SCALE`), the `PERCENT_FORMAT` / `PERCENT_POINTS_FORMAT` / `SCALE_FORMAT` constants, `cldrCurrencyDecimals`, their `format*` helpers, and `INPUT_FORMAT` / `INPUT_STEP` for editable fields. Call sites pick a KIND, never a digit count || `string` | Slugify, truncate, camelCase/titleCase conversions || `revalidate` | `isSearchParamOnlyNavigation` — shared by both apps' shell `shouldRevalidate` || `status` | Status resolution, status color mapping |diff --git a/packages/utils/src/format.test.ts b/packages/utils/src/format.test.tsindex 842d039a28..f672234d8c 100644--- a/packages/utils/src/format.test.ts+++ b/packages/utils/src/format.test.ts@@ -6,7 +6,7 @@ import {INPUT_FORMAT,INPUT_STEP,moneyFormatOptions,- priceFormatOptions+ rateFormatOptions} from "./format";describe("formatPercent", () => {@@ -52,7 +52,7 @@ describe("formatMoney", () => {});it("money and price agree until the currency's decimals run out", () => {- const price = new Intl.NumberFormat("en-US", INPUT_FORMAT.price("USD", 2));+ const price = new Intl.NumberFormat("en-US", INPUT_FORMAT.rate("USD", 2));const money = new Intl.NumberFormat("en-US", INPUT_FORMAT.money("USD", 2));// A settlement amount and a per-unit price of the same value look alike...for (const v of [0, 300, 18.75]) {@@ -81,7 +81,7 @@ describe("INPUT_STEP", () => {it("is never coarser than the scale the field holds", () => {// A step coarser than the stored scale SNAPS on commit: step 0.0001 turned// a typed 6.255% into 6.25%, silently, before anything could format it.- expect(INPUT_STEP.rate).toBe(1e-5);+ expect(INPUT_STEP.percent).toBe(1e-5);expect(INPUT_STEP.quantity).toBe(1e-5);expect(INPUT_STEP.exchangeRate).toBe(1e-5);});@@ -90,8 +90,8 @@ describe("INPUT_STEP", () => {// 3 percent-digits == 5 fraction decimals; each must be a whole multiple// of the step, or react-aria snaps it away.for (const percent of [0.0625, 0.06255, 0.12345, 0.05, 0.001]) {- expect(Math.round(percent / INPUT_STEP.rate)).toBeCloseTo(- percent / INPUT_STEP.rate,+ expect(Math.round(percent / INPUT_STEP.percent)).toBeCloseTo(+ percent / INPUT_STEP.percent,9);}@@ -104,11 +104,11 @@ describe("INPUT_STEP", () => {});});-describe("priceFormatOptions — the price kind (issue #1203)", () => {+describe("rateFormatOptions — the price kind (issue #1203)", () => {const fmt = (v: number, currency = "USD", decimals = 2) =>new Intl.NumberFormat("en-US",- priceFormatOptions(currency, decimals)+ rateFormatOptions(currency, decimals)).format(v);it("still PADS to the currency's decimals — a price column stays aligned", () => {@@ -140,7 +140,7 @@ describe("priceFormatOptions — the price kind (issue #1203)", () => {"en-US",moneyFormatOptions(2, { currency: "USD" }));- const price = new Intl.NumberFormat("en-US", priceFormatOptions("USD", 2));+ const price = new Intl.NumberFormat("en-US", rateFormatOptions("USD", 2));// identical where the value fits the currencyfor (const v of [0, 3.5, 300, 1234.5]) {expect(price.format(v)).toBe(money.format(v));@@ -150,15 +150,15 @@ describe("priceFormatOptions — the price kind (issue #1203)", () => {expect(price.format(0.164)).toBe("$0.164");});- it("INPUT_FORMAT.price is that kind, so a typed price commits at its width", () => {+ it("INPUT_FORMAT.rate is that kind, so a typed price commits at its width", () => {// react-aria commits parse(format(x)); this is what #1203 was about.- const opts = INPUT_FORMAT.price("USD", 2);+ const opts = INPUT_FORMAT.rate("USD", 2);expect(opts.maximumFractionDigits).toBe(5);expect(opts.minimumFractionDigits).toBe(2);});- it("INPUT_STEP.price cannot snap away the digits the format keeps", () => {- expect(INPUT_STEP.price).toBe(1e-5);+ it("INPUT_STEP.rate cannot snap away the digits the format keeps", () => {+ expect(INPUT_STEP.rate).toBe(1e-5);expect(INPUT_STEP.money(2)).toBe(0.01);});});diff --git a/packages/utils/src/format.ts b/packages/utils/src/format.tsindex c548f827cf..0bcfcd48fe 100644--- a/packages/utils/src/format.ts+++ b/packages/utils/src/format.ts@@ -7,8 +7,8 @@ export type MoneyFormatOptions = {currency?: string;/** Drops the non-significant zeros when 0. See below. */minDecimalPlaces?: number;- /** Raises the CEILING above the currency's decimals — see priceFormatOptions.- * Settlement amounts never pass this; only per-unit prices do. */+ /** Raises the CEILING above the currency's decimals — see rateFormatOptions.+ * Settlement amounts never pass this; only RATES do. */maxDecimalPlaces?: number;};@@ -81,7 +81,8 @@ export function moneyFormatOptions(};}-/** A per-unit PRICE. Same kind as money and it PADS the same way — a price+/** A RATE — a per-unit price, cost, or any value you MULTIPLY BY rather+ * than settle. Same kind as money and it PADS the same way — a price* column still reads "$300.00", "$3.50" — but the currency's decimals are only* its FLOOR, not its ceiling. Above that it carries the storage scale.*@@ -102,7 +103,7 @@ export function moneyFormatOptions(* `parse(format(x))`, so the ceiling here is what a typed price is STORED at.* A 2-decimal ceiling is what issue #1203 reports — the columns already hold* five decimals and the input was rounding them away before the save. */-export function priceFormatOptions(+export function rateFormatOptions(currency: string,decimalPlaces: number,minDecimalPlaces?: number@@ -170,7 +171,7 @@ export const SCALE_FORMAT: Intl.NumberFormatOptions = Object.freeze({/** Editable inputs MUST use these: react-aria's blur commit runs parse(format(x)),* making the input formatter part of the storage round-trip. */export const INPUT_FORMAT = {- rate: PERCENT_FORMAT,+ percent: PERCENT_FORMAT,percentPoints: PERCENT_POINTS_FORMAT,quantity: SCALE_FORMAT,exchangeRate: SCALE_FORMAT,@@ -182,10 +183,11 @@ export const INPUT_FORMAT = {* JPY's 0 a typed 63.4 commits as 63. */money: (currency: string, decimalPlaces: number, minDecimalPlaces?: number) =>moneyFormatOptions(decimalPlaces, { currency, minDecimalPlaces }),- /** A per-unit price INPUT. The ceiling is the storage scale, not the- * currency's — react-aria commits parse(format(x)), so this is what lets a- * typed 0.00123 reach the column instead of committing as 0.00 (#1203). */- price: priceFormatOptions+ /** A RATE input — a per-unit price or cost. The ceiling is the storage scale,+ * not the currency's: react-aria commits parse(format(x)), so this is what+ * lets a typed 0.00123 reach the column instead of committing as 0.00+ * (#1203). MONEY is the settlement counterpart and caps at the currency. */+ rate: rateFormatOptions};const SCALE_STEP = 1 / 10 ** SCALE;@@ -194,17 +196,17 @@ const SCALE_STEP = 1 / 10 ** SCALE;* committed value to the nearest multiple of `step`, so a step coarser than* the field's scale truncates it — take the step from here or omit the prop. */export const INPUT_STEP = {- rate: SCALE_STEP,+ percent: SCALE_STEP,quantity: SCALE_STEP,exchangeRate: SCALE_STEP,/** Money steps in its own smallest unit (1 for JPY, 0.01 for USD) — a* settlement amount cannot move by less than the currency settles in. */money: (decimalPlaces: number) => 1 / 10 ** decimalPlaces,- /** A price steps at the storage scale, because its FORMAT reaches that far- * (priceFormatOptions). react-aria snaps the committed value to a multiple of- * `step`, so `money`'s cent step on a price field would truncate exactly the+ /** A rate steps at the storage scale, because its FORMAT reaches that far+ * (rateFormatOptions). react-aria snaps the committed value to a multiple of+ * `step`, so `money`'s cent step on a rate field would truncate exactly the* digits the format was widened to keep. */- price: SCALE_STEP+ rate: SCALE_STEP};export function formatMoney(