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
Quote line price trace per quantity break; restore bg-card on editors (#1802)
Brad Barbinaee0038220e5
diff --git a/.ai/lessons.md b/.ai/lessons.mdindex 902d42404a..cf60f1e01e 100644--- a/.ai/lessons.md+++ b/.ai/lessons.md@@ -2648,6 +2648,40 @@ tiebreak (a label, a sort order, then the id). Never rely on insertion order sur**Applies to:** any list ordered by `createdAt` whose rows are written together — RPCs,Kysely transactions, `insertInto(...).values([...])`, seeds.+## A JS array bound for a jsonb column must be stringified on the Kysely path++**Context:** `quoteLinePrice.priceTrace` (a `PriceTraceStep[]`) is written both through+supabase-js (PostgREST) and through Kysely (`rewriteQuoteLinePrices`,+`saveQuoteLineWithPrices`, `get-method`).++**Problem:** node-postgres and deno-postgres serialise a parameter by its JS type, not the+column's: an object becomes JSON, but an array becomes a Postgres array literal (`{a,b}`),+which a jsonb column rejects. supabase-js sends JSON either way, so the same row "works" on+one path and fails on the other — and typecheck sees nothing, since `Json` admits arrays.++**Rule:** On a Kysely write, `JSON.stringify` any jsonb value that can be an array (or a bare+string). In Deno use `toJson` / `toJsonColumns` (`functions/lib/json.ts`).++**Applies to:** every `insertInto` / `updateTable` that sets a jsonb column — `priceTrace`,+`configuration`, notes, `customFields`, any copied row spread from a supabase-js read.++## Demo datasets state percentages the way people write them; the tier converts++**Context:** `PricingRuleSpec.amount` is documented and validated as percent points+(0–100], but tier 02 inserted it into `pricingRule.amount` unchanged.++**Problem:** the pricing engine multiplies by a fraction (`price × amount`), so every demo+"5% discount" was a 500% discount and drove prices to the ≥ 0 floor. It surfaced only when+the price trace showed the step — the validator checked the dataset's own convention, not+the column's.++**Rule:** When a dataset field and the column it lands in use different units, convert in+the tier at the insert, next to a comment naming both units — and check any new percent+field against how the engine reads the column, not against the dataset type.++**Applies to:** `packages/database/src/datasets/tiers/*` — `pricingRule.amount`, and any+other fraction-valued column (`discountPercent`, `taxPercent`, rates).+## Single fetch re-runs every matched loader on every navigation**Context:** A click on a BOM node under a part (`/x/part/:itemId/make/:makeMethodId.data`)diff --git a/.claude/rules/quote-discount-system.md b/.claude/rules/quote-discount-system.mdindex 99c5613fa3..36047d3ba7 100644--- a/.claude/rules/quote-discount-system.md+++ b/.claude/rules/quote-discount-system.md@@ -72,8 +72,43 @@ Standalone rules, `id` default `id('pr')`, scoped to a company. Columns: `name`,`applyRulesOnTop=false` skips discounts and markups but still applies theconfiguration prices (`applyPriceRules(..., { configurationOnly: true })`).- Final price clamped to ≥ 0.- Each step is recorded as a `PriceTraceStep` (`{ step, source, amount, adjustment?, ruleId? }`)- into `priceTrace`. The winning rule's id lands on `quoteLine.pricingRuleId`.+ Each step is recorded as a `PriceTraceStep` (`{ step, source, amount, adjustment?, ruleId? }`).+ The trace is a **snapshot stored with the price** — pricing rules are edited+ in place, so re-running today's rules cannot explain yesterday's price.+ - `quoteLinePrice.priceTrace` (migration `20261001125824`), one per quantity+ break. Written by every system-pricing path: the three+ `build*PriceRows` builders, `recalculateQuoteLinePrices`, the grid's+ Markup % (`recalculate-price` route, `priceTracesByQuantity`) and+ per-category markup edits, and `repriceQuoteLineFromRules`. A typed price+ (`priceSource = 'manual'`) writes `null`. `rewriteQuoteLinePrices` does+ NOT carry an omitted trace over (it explains the unit price, which every+ caller restates) — except the precision rebuild, which passes the stored+ one. Kysely writes `JSON.stringify` it (a JS array would go out as a+ Postgres array literal). `get-method` `quoteToQuote` copies it.+ `withBasePriceSource` renames the Base Price step's source+ (`QUOTE_BASE_PRICE_SOURCES`: "Cost + Markup", "Supplier Price"), since+ `resolvePrice` names every base the item's sale price.+ - `salesOrderLine.priceTrace`, posted by `SalesOrderLineForm` (typing a+ price posts `"null"`), set by `createReplacementSalesOrder`, and copied+ by `convert` from the converted break via `quoteToOrderPriceTrace`+ (`functions/lib/price-trace.ts`), which appends the quote line discount so+ the trace ends at the order line's net price.+ - `quoteLine.priceTrace` is dead — one trace cannot describe several breaks.+ Nothing fills it; `get-method` `quoteToQuote` copies it (always null).+ `getQuoteLinePriceTraces` (`x+/quote+/$quoteId.$lineId.price-trace.tsx`+ loader, `shouldRevalidate` false — it is expensive, so the grid loads it+ only on modal open, after a reprice, and once on mount for a line with an+ untraced system price) returns each break's stored `trace` plus a+ `currentTrace`: today's+ pipeline re-run from the base the row's builder starts from (cost-plus+ rollup with the row's markups / configured sale price for Make to Order,+ supplier break for Purchase to Order, item sale price for Pull from+ Inventory); none for a `manual` row. It calls+ `buildCostEffects(..., { refreshBuyCosts: false })` so the read never writes+ `quoteMaterial.unitCost`. The route's action, `repriceQuoteLineFromRules`,+ stores each `currentTrace` and its final price in one+ `upsertQuoteLinePrices` transaction. It refuses a non-Draft quote itself+ (`QuoteLockedError`) because it is also an MCP tool.`upsertQuoteLinePrices(db, companyId, quoteId, lineId, prices)` deletes andre-inserts rows **inside one Kysely transaction** (so a failed insert rolls the@@ -117,7 +152,16 @@ it.- `pricingRuleValidator` in `sales.models.ts`; Percentage `amount` must be ≤ 1.- UI: `ui/Quotes/QuoteLinePricing.tsx` (per-quantity discount/markup editing) andthe `ui/Pricing/` folder (`PricingRuleForm`, `PricingRulesTable`, `PriceOverrideForm`,- `PriceTracePopover`).+ `PriceTraceModal`). `PriceTraceModal` (calculator icon → modal; sales order line,+ price list) renders `PriceTraceTable`; the quote grid's Unit Price row shows a+ calculator `IconButton` only when `hasPriceAdjustments` finds an override, rule or+ configuration step in some break's stored trace (from the grid's own price+ rows — no request) or fetched current trace, and opens+ `QuoteLinePriceTraceModal`: one `PriceTraceTable` per quantity from the+ stored trace (today's calculation for a row priced before traces were+ recorded), a "repricing gives X" note when today's final price differs at the+ line's precision (`repricedUnitPrice`, `sales.utils.ts`), and a **Reprice with current rules** button on a Draft+ quote.- Every path that turns a cost rollup into a quote line price runs it through`resolvePrice` as `existingBasePrice` with the line's `configuration`: the serverbuilders and `recalculateQuoteLinePrices`, and the pricing grid's **Markup %** and@@ -145,6 +189,7 @@ it.**wrong** — they were dropped in 2024. Markup now lives in `categoryMarkups` (rollup)and `pricingRule` (engine).- `quoteLinePrice` has **no `id`** — PK is `(quoteLineId, quantity)`.-- Sales orders/invoices: `salesOrderLine` now carries `pricingRuleId` + `priceTrace`- (so rule provenance *does* propagate to orders), but invoice lines do not. Quote→order+- Sales orders/invoices: `salesOrderLine` carries `pricingRuleId` + `priceTrace`+ (the trace propagates from the quote through `convert`; nothing writes+ `pricingRuleId`), but invoice lines do not. Quote→orderconversion goes through the `convert` edge function (`convertQuoteToOrder`).diff --git a/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsx b/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsxindex 2a4253cc52..c677fad862 100644--- a/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsx+++ b/apps/erp/app/modules/inventory/ui/Traceability/ExpiryTracePopover.tsx@@ -33,7 +33,7 @@ import { path } from "~/utils/path";/*** Steps a tracked entity's expirationDate can flow through. Mirrors the* shape of {@link PriceTraceStep} (sales/types) so the popover layout- * stays consistent with PriceTracePopover.+ * stays consistent with PriceTraceModal.** - "Source" : where this entity was created (Receipt / Production /* Split / Manual).@@ -88,7 +88,7 @@ type ExpiryTracePopoverProps = {/*** Hover-style popover that explains how the expirationDate column was- * resolved. Same layout as PriceTracePopover so users get a single+ * resolved. Same layout as PriceTraceModal so users get a single* mental model for "trace" UIs.** Steps are derived from the row's attributes JSONB plus optionaldiff --git a/apps/erp/app/modules/resources/ui/Training/TrainingHeader.tsx b/apps/erp/app/modules/resources/ui/Training/TrainingHeader.tsxindex 3e68dcd948..2bca8a9532 100644--- a/apps/erp/app/modules/resources/ui/Training/TrainingHeader.tsx+++ b/apps/erp/app/modules/resources/ui/Training/TrainingHeader.tsx@@ -28,6 +28,7 @@ import { usePanels } from "~/components/Layout";import ConfirmDelete from "~/components/Modals/ConfirmDelete";import { usePermissions, useRouteData } from "~/hooks";import type { Training } from "~/modules/resources";+import { useDocumentStore } from "~/stores";import { path } from "~/utils/path";import TrainingStatus from "./TrainingStatus";@@ -42,6 +43,10 @@ const TrainingHeader = () => {const { t } = useLingui();const permissions = usePermissions();const { toggleExplorer, toggleProperties } = usePanels();+ // Live title from the editor's locked title block, so the header updates as+ // the user types (before the loader revalidates).+ const liveTitle = useDocumentStore((s) => s.liveTitle);+ const displayName = liveTitle ?? routeData?.training?.name ?? "";const deleteDisclosure = useDisclosure();const publishFetcher = useFetcher<{}>();@@ -71,11 +76,11 @@ const TrainingHeader = () => {variant="ghost"/><Heading size="h4" className="flex items-center gap-2">- <span>{routeData?.training?.name}</span>+ <span>{displayName}</span>{/* @ts-expect-error TS2322 */}<TrainingStatus status={routeData?.training?.status} /></Heading>- <Copy text={routeData?.training?.name ?? ""} />+ <Copy text={displayName} /><DropdownMenu><DropdownMenuTrigger asChild><IconButtondiff --git a/apps/erp/app/modules/sales/AGENTS.md b/apps/erp/app/modules/sales/AGENTS.mdindex c418b1c6a8..b3fcda9360 100644--- a/apps/erp/app/modules/sales/AGENTS.md+++ b/apps/erp/app/modules/sales/AGENTS.md@@ -8,6 +8,7 @@ Quotes (with cost rollup and pricing), sales orders, sales RFQs, customer manage- **Quote** — detailed cost estimate with line items, each having a make method (BOM + routing) and quantity-break pricing. Statuses: Draft → Pending → Sent → Ordered / Lost / Cancelled.- **Quote Revision** — `quote.revisionId`. Unlike a PO (amended in place), a quote revision is a **new `quote` row** created by `copyQuote` → the `get-method` edge function (`quoteToQuote`, `asRevision: true`), keeping the same `quoteId` with `revisionId = max + 1`, sharing the source `opportunityId`. Each revision gets its **own `externalLink`** row, whose `documentId` is revision-qualified (`Q000001-1`) because `externalLink` is UNIQUE on `(documentId, documentType, companyId)` — an unqualified id collides with the original's link. `deleteQuote` does not remove the link row, so that insert uses `onConflict … doUpdateSet` to reuse the orphan a deleted revision left behind. Displayed as `Q000001-1` when > 0 via `getQuoteDisplayId` (`@carbon/documents/utils`) on the PDF, email, share page, and filenames; two-tone in-app rendering uses `<RevisionSuffix>` (`~/components`).- **Quote Line Pricing** — per-quantity-break pricing. PK is `(quoteLineId, quantity)` — no `id` column. `discountPercent` is a **fraction 0–1** (not 0–100). Generated columns compute net/converted prices. **Lead time can be PREDICTED from the shop schedule** rather than typed: the calendar-clock button on the Lead Time row opens `QuoteLeadTimeModal`, which POSTs `$quoteId.$lineId.lead-time.tsx` → `runQuoteLeadTimeWhatIf` (`@carbon/planning`) and applies one constraint's value to every break at once. The write goes through the grid's `onUpdateLeadTimes` (`quoteLinePrice.leadTime`, one state update for every break — never a loop over `onUpdatePrice`, which snapshots state per call; a failed row is rolled back and the modal stays open) — no new persistence, so `resolvePreservedQuoteLinePriceFields` is untouched.+- **Price trace** — how a price was reached (base → overrides → rules → final), a snapshot stored WITH the price because rules are edited in place: `quoteLinePrice.priceTrace` per quantity break, `salesOrderLine.priceTrace` per order line (copied from the quote by `convert`). Typed (manual) prices store `null`. The calculator icon opens it in a modal; on a quote line `getQuoteLinePriceTraces` also returns today's `currentTrace`, and `repriceQuoteLineFromRules` stores it. See `.claude/rules/quote-discount-system.md`.- **Pricing Rules** — company-scoped Discount/Markup/Configuration rules. Discounts are non-stacking (highest-priority wins); Markups stack and compound in priority order. A **Configuration** rule targets exactly ONE configurable item (`itemId` in the form → `itemIds: [id]`, amount 0, no item group — `normalizePricingRule` in `sales.service.ts`) and carries `configurationPrices` (JSONB `{ key, value, amount, label? }[]` — list option / `"true"` for a boolean / `null` = per unit of a numeric value; `label` is the parameter's label at save time, used by the price trace; validated by `pricingRuleConfigurationPriceValidator` in `sales.utils.ts`, which stays out of the `sales.models` import graph so the engine tests can load it). `toMatchedRule` parses a rule row for the engine; `applyPriceRules` (`sales.utils.ts`) adds those signed surcharges to the starting price before the discount, given the line's `configuration`. An override with `applyRulesOnTop = false` still takes them (`configurationOnly`) — they price the options, not the part. Every other rule type stores `configurationPrices` as null.- **Line configuration** — `quoteLine.configuration` and `salesOrderLine.configuration` (keyed by `configurationParameter.key`; the `convert` edge function copies it quote → order). Jobs made for an order line use `resolveJobConfiguration` (`sales.utils.ts`): the order line's configuration, else the quote line's; when the order line was configured differently from its quote the job is built with `itemToJob` + that configuration instead of copying the quote's method (an unset value — absent, null or blank — compares equal). A configured Make to Order quote line is priced from the part's unit sale price (not the cost rollup) when it has one, so it matches the order line — `configuredQuoteBasePrice`; a row with markups someone chose stays cost-plus. The sales order line form keeps its configurator in `useItemConfiguration` + `ItemConfigureButton` (`~/components/Configurator/ItemConfigurator`), which loads parameters through `getConfigurationParameters` and ignores a stale load for an item no longer selected.- **Price Overrides** — customer-specific or type-specific price overrides with quantity breaks via `customerItemPriceOverride` / `customerItemPriceOverrideBreak`. Precedence: customer > customer-type > all-customers > base price.diff --git a/apps/erp/app/modules/sales/sales.models.test.ts b/apps/erp/app/modules/sales/sales.models.test.tsindex fb221d7bcb..1f5c126254 100644--- a/apps/erp/app/modules/sales/sales.models.test.ts+++ b/apps/erp/app/modules/sales/sales.models.test.ts@@ -18,7 +18,8 @@ vi.mock("@lingui/core/macro", () => ({: String(strings)}));-const { quoteLineValidator, quoteValidator } = await import("./sales.models");+const { quoteLineValidator, quoteValidator, salesOrderLineValidator } =+ await import("./sales.models");// `quote.internalNotes` is a `json` column that the sales-order conversion// copies through Kysely. A bare string stored there (which `notes: z.any()`@@ -55,6 +56,42 @@ describe("quoteValidator.notes", () => {});});+describe("salesOrderLineValidator priceTrace", () => {+ const line = {+ salesOrderId: "so1",+ salesOrderLineType: "Part",+ itemId: "item1",+ methodType: "Pull from Inventory",+ locationId: "loc1",+ taxPercent: "0"+ };+ const trace = [+ { step: "Base Price", source: "Item Unit Sale Price", amount: 100 },+ { step: "Final Price", source: "Resolved", amount: 100 }+ ];++ const parse = (priceTrace?: string) =>+ salesOrderLineValidator.parse(+ priceTrace === undefined ? line : { ...line, priceTrace }+ ).priceTrace;++ it("keeps a posted trace", () => {+ expect(parse(JSON.stringify(trace))).toEqual(trace);+ });++ it('clears the trace when "null" is posted for a typed price', () => {+ expect(parse("null")).toBeNull();+ });++ it("leaves the stored trace alone when the field is not posted", () => {+ expect(parse()).toBeUndefined();+ });++ it("rejects a trace that is not a list of steps", () => {+ expect(() => parse(JSON.stringify({ step: "Base Price" }))).toThrow();+ });+});+// quoteLinePrice is keyed by (quoteLineId, quantity), so two equal breaks on a// line would share one price row and edit together.describe("quoteLineValidator.quantity", () => {diff --git a/apps/erp/app/modules/sales/sales.models.ts b/apps/erp/app/modules/sales/sales.models.tsindex d93b8ca772..304f31b446 100644--- a/apps/erp/app/modules/sales/sales.models.ts+++ b/apps/erp/app/modules/sales/sales.models.ts@@ -358,6 +358,16 @@ const parseJsonField = (value: unknown) => {}};+// One step of how a price was resolved — the shape of PriceTraceStep (types.ts).+export const priceTraceStepValidator = z.object({+ step: z.string(),+ source: z.string(),+ amount: z.number(),+ adjustment: z.number().optional(),+ ruleId: z.string().optional(),+ label: z.string().optional()+});+// A Configuration rule prices one configurable item's parameter values// (`configurationPrices`) and has no discount or markup of its own.export const pricingRuleTypes = [@@ -971,6 +981,12 @@ export const salesOrderLineValidator = zconfiguration: z.preprocess(parseJsonField,z.record(z.string(), z.any()).nullable().optional()+ ),+ // How unitPrice was resolved, posted as JSON; "null" clears it when the+ // price was typed rather than resolved.+ priceTrace: z.preprocess(+ parseJsonField,+ z.array(priceTraceStepValidator).nullable().optional())}).refine((data) => (data.salesOrderLineType === "Part" ? data.itemId : true), {diff --git a/apps/erp/app/modules/sales/sales.server.ts b/apps/erp/app/modules/sales/sales.server.tsindex 8017611e95..e8a02e5890 100644--- a/apps/erp/app/modules/sales/sales.server.ts+++ b/apps/erp/app/modules/sales/sales.server.ts@@ -237,7 +237,14 @@ export async function saveQuoteLineWithPrices(args: {if (priceRows.length > 0) {await trx.insertInto("quoteLinePrice")- .values(priceRows as never)+ .values(+ // Kysely sends a JS array as a Postgres array literal; jsonb needs+ // JSON text.+ priceRows.map((row) => ({+ ...row,+ priceTrace: row.priceTrace ? JSON.stringify(row.priceTrace) : null+ })) as never+ ).execute();}});diff --git a/apps/erp/app/modules/sales/sales.service.ts b/apps/erp/app/modules/sales/sales.service.tsindex 6c5c1f9d98..1aa75b0202 100644--- a/apps/erp/app/modules/sales/sales.service.ts+++ b/apps/erp/app/modules/sales/sales.service.ts@@ -79,7 +79,11 @@ import type {salesRfqValidator,selectedLinesValidator} from "./sales.models";-import { costCategoryKeys, OPEN_SALES_ORDER_STATUSES } from "./sales.models";+import {+ costCategoryKeys,+ isQuoteLocked,+ OPEN_SALES_ORDER_STATUSES+} from "./sales.models";import type { CategoryMarkups, QuoteLinePriceSource } from "./sales.utils";import {applyPriceRules,@@ -87,8 +91,10 @@ import {configuredQuoteBasePrice,decideRecalcPricing,getEffectiveDefaultMarkups,+ QUOTE_BASE_PRICE_SOURCES,resolvePreservedQuoteLinePriceFields,- toMatchedRule+ toMatchedRule,+ withBasePriceSource} from "./sales.utils";import type {OverrideEntry,@@ -100,6 +106,7 @@ import type {PriceSource,PriceTraceStep,Quotation,+ QuoteLinePriceTrace,SalesOrder,SalesRFQ} from "./types";@@ -4053,6 +4060,9 @@ type QuoteLinePriceInput = {shippingCost?: number;categoryMarkups?: Record<string, number>;priceSource?: "system" | "manual";+ // How unitPrice was resolved. Unlike the fields above, an omitted trace is+ // NOT carried over: it explains the unit price, which every caller restates.+ priceTrace?: PriceTraceStep[] | null;};export async function upsertQuoteLinePrices(@@ -4070,6 +4080,7 @@ export async function upsertQuoteLinePrices(shippingCost?: number;categoryMarkups?: Record<string, number>;priceSource?: "system" | "manual";+ priceTrace?: PriceTraceStep[] | null;}[]) {return db@@ -4101,6 +4112,8 @@ async function rewriteQuoteLinePrices(unitPrice: Number(price.unitPrice),leadTime: Number(price.leadTime),discountPercent: Number(price.discountPercent),+ // A precision rebuild only re-rounds the price; its explanation stands.+ priceTrace: (price.priceTrace as PriceTraceStep[] | null) ?? null,createdBy: price.createdBy}));@@ -4156,6 +4169,9 @@ async function rewriteQuoteLinePrices(companyId,quoteId,unitPrice: round(p.unitPrice, quoteLine.unitPricePrecision),+ // Kysely sends a JS array as a Postgres array literal; jsonb needs+ // JSON text.+ priceTrace: p.priceTrace ? JSON.stringify(p.priceTrace) : null,// Explicit value wins, omitted value is preserved from the stored row....resolvePreservedQuoteLinePriceFields(p, {leadTime: existing ? Number(existing.leadTime) : undefined,@@ -4194,7 +4210,8 @@ async function rewriteQuoteLinePrices(async function buildCostEffects(client: SupabaseClient<Database>,- quoteLineId: string+ quoteLineId: string,+ { refreshBuyCosts = true }: { refreshBuyCosts?: boolean } = {}) {const operationsResult = await client.from("quoteOperation")@@ -4204,7 +4221,8 @@ async function buildCostEffects(const operations = operationsResult.data ?? [];// Refresh Buy material costs from supplier price breaks; resolveBuyUnitCost- // leaves a typed cost alone.+ // leaves a typed cost alone. A read-only caller skips the write — the cost+ // effects below price Buy materials from the same breaks either way.const buyMaterials = await client.from("quoteMaterial").select("id, itemId, unitCost, unitCostSource")@@ -4216,7 +4234,7 @@ async function buildCostEffects(];const priceMap = await getSupplierPriceBreaksForItems(client, buyItemIds);- for (const mat of buyMaterials.data ?? []) {+ for (const mat of refreshBuyCosts ? (buyMaterials.data ?? []) : []) {if (mat.unitCostSource === "manual") continue;const price = resolveBuyUnitCost(mat, 1, priceMap);if (price !== mat.unitCost) {@@ -4501,6 +4519,7 @@ export type QuoteLinePriceRow = {discountPercent: number;categoryMarkups?: Record<string, number>;priceSource?: string;+ priceTrace?: PriceTraceStep[] | null;};type BuildPriceRowsResult = {@@ -4626,27 +4645,31 @@ export async function buildMakeToOrderPriceRows(defaultMarkups: effectiveDefaults});- const finalPrice = itemId- ? (- await resolvePrice(client, companyId, {- itemId,- quantity: qty,- customerId,- existingBasePrice: basePrice ?? rollupPrice,- configuration- })- ).finalPrice- : rollupPrice;+ const resolved = itemId+ ? await resolvePrice(client, companyId, {+ itemId,+ quantity: qty,+ customerId,+ existingBasePrice: basePrice ?? rollupPrice,+ configuration+ })+ : null;priceRows.push({quoteId,quoteLineId,companyId,quantity: qty,- unitPrice: round(finalPrice, precision),+ unitPrice: round(resolved?.finalPrice ?? rollupPrice, precision),// A row priced from the sale price is not cost-plus.categoryMarkups: basePrice === null ? effectiveDefaults : {},priceSource: "system",+ priceTrace: resolved+ ? withBasePriceSource(+ resolved.trace,+ basePrice === null ? QUOTE_BASE_PRICE_SOURCES.costPlus : null+ )+ : null,exchangeRate,createdBy: userId,leadTime: 0,@@ -4742,6 +4765,7 @@ export async function buildPullFromInventoryPriceRows(companyId,quantity: qty,unitPrice: round(resolved.finalPrice, precision),+ priceTrace: resolved.trace,exchangeRate,createdBy: userId,leadTime: 0,@@ -4842,6 +4866,10 @@ export async function buildPurchaseToOrderPriceRows(companyId,quantity: qty,unitPrice: round(resolved.finalPrice, precision),+ priceTrace: withBasePriceSource(+ resolved.trace,+ QUOTE_BASE_PRICE_SOURCES.supplier+ ),exchangeRate,createdBy: userId,leadTime: 0,@@ -4975,6 +5003,7 @@ export async function recalculateQuoteLinePrices(quantity: number;unitPrice: number;categoryMarkups: Record<string, number>;+ priceTrace: PriceTraceStep[] | null;}[] = [];for (const row of existingPrices.data) {const qty = row.quantity;@@ -5015,24 +5044,28 @@ export async function recalculateQuoteLinePrices(defaultMarkups: effectiveDefaults});- const finalPrice =+ const resolved =itemId && companyId- ? (- await resolvePrice(client, companyId, {- itemId,- quantity: qty,- customerId,- existingBasePrice: basePrice ?? rollupPrice,- configuration- })- ).finalPrice- : rollupPrice;+ ? await resolvePrice(client, companyId, {+ itemId,+ quantity: qty,+ customerId,+ existingBasePrice: basePrice ?? rollupPrice,+ configuration+ })+ : null;repricedRows.push({quantity: qty,- unitPrice: round(finalPrice, precision),+ unitPrice: round(resolved?.finalPrice ?? rollupPrice, precision),// A row priced from the sale price is not cost-plus.- categoryMarkups: basePrice === null ? markups : {}+ categoryMarkups: basePrice === null ? markups : {},+ priceTrace: resolved+ ? withBasePriceSource(+ resolved.trace,+ basePrice === null ? QUOTE_BASE_PRICE_SOURCES.costPlus : null+ )+ : null});}@@ -5045,6 +5078,7 @@ export async function recalculateQuoteLinePrices(unitPrice: row.unitPrice,categoryMarkups: row.categoryMarkups,priceSource: "system",+ priceTrace: row.priceTrace,updatedBy: userId}).eq("quoteLineId", quoteLineId)@@ -5063,6 +5097,233 @@ export async function recalculateQuoteLinePrices(return { error: null };}+// Explains each quantity's price on a quote line. `trace` is the snapshot+// written with the price — how it was actually reached, whatever the rules say+// now. `currentTrace` re-runs today's pipeline from the base the row's builder+// starts from — the cost-plus rollup (or a configured part's sale price) for+// Make to Order, the supplier price break for Purchase to Order, the item's+// sale price for Pull from Inventory — so the UI can show what repricing would+// change. A manual row has neither: a person stated that price and no rule+// touched it. Read-only — null data when the line is not this quote's in this+// company.+export async function getQuoteLinePriceTraces(+ client: SupabaseClient<Database>,+ companyId: string,+ quoteId: string,+ quoteLineId: string+): Promise<{+ data: QuoteLinePriceTrace[] | null;+ error: PostgrestError | null;+}> {+ const [lineResult, quoteResult, pricesResult] = await Promise.all([+ client+ .from("quoteLine")+ .select("itemId, methodType, configuration")+ .eq("id", quoteLineId)+ .eq("quoteId", quoteId)+ .eq("companyId", companyId)+ .maybeSingle(),+ client+ .from("quote")+ .select("customerId")+ .eq("id", quoteId)+ .eq("companyId", companyId)+ .maybeSingle(),+ client+ .from("quoteLinePrice")+ .select("quantity, unitPrice, priceSource, categoryMarkups, priceTrace")+ .eq("quoteLineId", quoteLineId)+ .eq("companyId", companyId)+ .order("quantity")+ ]);++ const error = lineResult.error ?? quoteResult.error ?? pricesResult.error;+ if (error) return { data: null, error };+ if (!lineResult.data || !quoteResult.data) return { data: null, error: null };++ const itemId = lineResult.data.itemId;+ const methodType = lineResult.data.methodType;+ const customerId = quoteResult.data.customerId ?? undefined;+ const configuration = asConfiguration(lineResult.data.configuration);+ const rows = pricesResult.data ?? [];++ const stored = (row: (typeof rows)[number]): QuoteLinePriceTrace => ({+ quantity: row.quantity,+ unitPrice: row.unitPrice,+ priceSource: row.priceSource as QuoteLinePriceSource,+ trace: (row.priceTrace as PriceTraceStep[] | null) ?? null,+ currentTrace: null+ });++ if (!itemId) return { data: rows.map(stored), error: null };++ // The base price each system row starts from today, and what it is; an+ // undefined amount lets resolvePrice read the item's sale price, as the Pull+ // from Inventory builder does.+ type BasePrice = { amount: number | undefined; source: string | null };+ let basePriceFor: (row: (typeof rows)[number]) => BasePrice = () => ({+ amount: undefined,+ source: null+ });++ if (methodType === "Make to Order") {+ const [settingsResult, salePrice, costEffects] = await Promise.all([+ client+ .from("companySettings")+ .select("quoteLineCategoryMarkups")+ .eq("id", companyId)+ .single(),+ getConfiguredSalePrice(client, companyId, itemId, configuration),+ buildCostEffects(client, quoteLineId, { refreshBuyCosts: false })+ ]);+ if (settingsResult.error)+ return { data: null, error: settingsResult.error };+ if (salePrice.error) return { data: null, error: salePrice.error };+ // No costed method yet: nothing to roll up, so nothing to compare against.+ if (!costEffects) return { data: rows.map(stored), error: null };++ const defaultMarkups: Record<string, number> = {};+ for (const [key, value] of Object.entries(+ (settingsResult.data.quoteLineCategoryMarkups as Record<+ string,+ number+ >) ?? {}+ )) {+ defaultMarkups[key] = value * 100;+ }+ const effectiveDefaults = getEffectiveDefaultMarkups(defaultMarkups);+ const { effects } = costEffects;++ basePriceFor = (row) => {+ const categoryMarkups = row.categoryMarkups as CategoryMarkups | null;+ const decision = decideRecalcPricing(+ { priceSource: row.priceSource, categoryMarkups },+ effectiveDefaults+ );+ const markups = decision.mode === "reprice" ? decision.markups : {};+ const qty = row.quantity;+ const rollupPrice = costCategoryKeys.reduce((sum, key) => {+ const total = effects[key].reduce((acc, fn) => acc + fn(qty), 0);+ const cost = qty > 0 ? total / qty : 0;+ return sum + cost * (1 + (markups[key] ?? 0) / 100);+ }, 0);+ const configuredPrice = configuredQuoteBasePrice({+ configuration,+ unitSalePrice: salePrice.data,+ categoryMarkups,+ defaultMarkups: effectiveDefaults+ });+ return configuredPrice === null+ ? { amount: rollupPrice, source: QUOTE_BASE_PRICE_SOURCES.costPlus }+ : { amount: configuredPrice, source: null };+ };+ } else if (methodType === "Purchase to Order") {+ const priceMap = await getSupplierPriceBreaksForItems(client, [itemId]);+ basePriceFor = (row) => ({+ amount: lookupBuyPriceFromMap(itemId, row.quantity, priceMap, 0),+ source: QUOTE_BASE_PRICE_SOURCES.supplier+ });+ }++ const data = await Promise.all(+ rows.map(async (row) => {+ if (row.priceSource === "manual") return stored(row);+ const base = basePriceFor(row);+ const { trace } = await resolvePrice(client, companyId, {+ itemId,+ quantity: row.quantity,+ customerId,+ existingBasePrice: base.amount,+ configuration+ });+ return {+ ...stored(row),+ currentTrace: withBasePriceSource(trace, base.source)+ };+ })+ );++ return { data, error: null };+}++export class QuoteLockedError extends Error {+ constructor() {+ super("Cannot modify a locked quote. Reopen it first.");+ }+}++// Reprices a quote line's system rows to what today's rules give — the+// `currentTrace` getQuoteLinePriceTraces shows — storing that trace with the+// price. Manual rows, and rows today's pipeline cannot price, are rewritten+// unchanged; one transaction either way. Draft quotes only (QuoteLockedError+// otherwise) — checked here, not in the route, because this is also an MCP+// tool.+export async function repriceQuoteLineFromRules(+ client: SupabaseClient<Database>,+ db: Kysely<KyselyDatabase>,+ companyId: string,+ quoteId: string,+ quoteLineId: string,+ userId: string+): Promise<{ data: null; error: PostgrestError | Error | null }> {+ const quote = await client+ .from("quote")+ .select("status")+ .eq("id", quoteId)+ .eq("companyId", companyId)+ .maybeSingle();+ if (quote.error) return { data: null, error: quote.error };+ if (!quote.data) return { data: null, error: new Error("Quote not found") };+ if (isQuoteLocked(quote.data.status)) {+ return { data: null, error: new QuoteLockedError() };+ }++ const traces = await getQuoteLinePriceTraces(+ client,+ companyId,+ quoteId,+ quoteLineId+ );+ if (traces.error) return { data: null, error: traces.error };+ if (!traces.data) {+ return { data: null, error: new Error("Quote line not found") };+ }++ const prices = traces.data.map((price) => {+ const finalPrice = price.currentTrace?.at(-1)?.amount;+ if (!price.currentTrace || finalPrice === undefined) {+ return {+ quoteLineId,+ quantity: price.quantity,+ unitPrice: price.unitPrice,+ priceTrace: price.trace,+ createdBy: userId+ };+ }+ return {+ quoteLineId,+ quantity: price.quantity,+ unitPrice: finalPrice,+ priceTrace: price.currentTrace,+ priceSource: "system" as const,+ createdBy: userId+ };+ });++ try {+ await upsertQuoteLinePrices(db, companyId, quoteId, quoteLineId, prices);+ } catch (error) {+ logger.error("Failed to reprice quote line from rules", {+ companyId,+ quoteId,+ quoteLineId,+ error+ });+ return { data: null, error: error as Error };+ }+ return { data: null, error: null };+}+export async function upsertQuoteLineMethod(client: SupabaseClient<Database>,lineMethod: {@@ -7744,6 +8005,7 @@ export async function createReplacementSalesOrder(itemId: line.itemId,saleQuantity: Number(line.quantity),unitPrice: price.finalPrice,+ priceTrace: price.trace,unitOfMeasureCode: line.unitOfMeasureCode,companyId,createdBy: userIddiff --git a/apps/erp/app/modules/sales/sales.utils.test.ts b/apps/erp/app/modules/sales/sales.utils.test.tsindex 09b0e33314..f554d6481b 100644--- a/apps/erp/app/modules/sales/sales.utils.test.ts+++ b/apps/erp/app/modules/sales/sales.utils.test.ts@@ -10,9 +10,11 @@ import {decideRecalcPricing,getEffectiveDefaultMarkups,reconcileQuantityBreaks,+ repricedUnitPrice,resolveJobConfiguration,resolvePreservedQuoteLinePriceFields,- toMatchedRule+ toMatchedRule,+ withBasePriceSource} from "./sales.utils";import type { MatchedRule } from "./types";@@ -511,3 +513,43 @@ describe("configuredQuoteBasePrice", () => {).toBeNull();});});++describe("withBasePriceSource", () => {+ const trace = [+ { step: "Base Price", source: "Item Unit Sale Price", amount: 100 },+ { step: "Markup", source: "Rule: A", amount: 110, adjustment: 10 },+ { step: "Final Price", source: "Resolved", amount: 110 }+ ];++ it("names the base the row really started from", () => {+ expect(withBasePriceSource(trace, "Cost + Markup")).toEqual([+ { step: "Base Price", source: "Cost + Markup", amount: 100 },+ trace[1],+ trace[2]+ ]);+ });++ it("keeps the trace as resolved when there is no other base", () => {+ expect(withBasePriceSource(trace, null)).toBe(trace);+ });+});++describe("repricedUnitPrice", () => {+ const current = (amount: number) => [+ { step: "Base Price", source: "Cost + Markup", amount: 100 },+ { step: "Final Price", source: "Resolved", amount }+ ];++ it("is null for a manual price, which has no current calculation", () => {+ expect(repricedUnitPrice(null, 110, 2)).toBeNull();+ });++ it("is null when today's price rounds to the stored one", () => {+ expect(repricedUnitPrice(current(110.004), 110, 2)).toBeNull();+ });++ it("is today's price at the line's precision when it differs", () => {+ expect(repricedUnitPrice(current(104.5678), 110, 2)).toBe(104.57);+ expect(repricedUnitPrice(current(104.5678), 110, 4)).toBe(104.5678);+ });+});diff --git a/apps/erp/app/modules/sales/sales.utils.ts b/apps/erp/app/modules/sales/sales.utils.tsindex c315eb52d2..fca69ae55b 100644--- a/apps/erp/app/modules/sales/sales.utils.ts+++ b/apps/erp/app/modules/sales/sales.utils.ts@@ -2,6 +2,7 @@// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,// including ports, remain AGPLv3; serving them over a network requires releasing their source.+import { equals, round } from "@carbon/utils";import { z } from "zod";import type {MatchedRule,@@ -29,6 +30,44 @@ export function getEffectiveDefaultMarkups(return enabled ? defaultMarkups : {};}+// What a quote line price starts from when it is not the item's sale price.+export const QUOTE_BASE_PRICE_SOURCES = {+ costPlus: "Cost + Markup",+ supplier: "Supplier Price"+} as const;++/**+ * resolvePrice names every base price "Item Unit Sale Price". A quote row that+ * starts from somewhere else — the cost-plus rollup, a supplier price break —+ * names its real base so the stored trace reads true. A null source keeps the+ * trace as resolved.+ */+export function withBasePriceSource(+ trace: PriceTraceStep[],+ source: string | null+): PriceTraceStep[] {+ if (!source) return trace;+ return trace.map((step) =>+ step.step === "Base Price" ? { ...step, source } : step+ );+}++/**+ * The unit price today's calculation gives, at the line's precision — null+ * when there is no calculation (a manual price) or it gives the stored price.+ * What the pricing trace's "repricing gives X" note and Reprice act on.+ */+export function repricedUnitPrice(+ currentTrace: PriceTraceStep[] | null,+ unitPrice: number,+ precision: number+): number | null {+ const finalPrice = currentTrace?.at(-1)?.amount;+ if (finalPrice === undefined) return null;+ const rounded = round(finalPrice, precision);+ return equals(rounded, unitPrice) ? null : rounded;+}+/*** The user-entered fields on a `quoteLinePrice` row that must survive a* delete-and-reinsert rewrite. An explicitly provided value wins; an omitted onediff --git a/apps/erp/app/modules/sales/types.ts b/apps/erp/app/modules/sales/types.tsindex 95fa651824..9bc60c241a 100644--- a/apps/erp/app/modules/sales/types.ts+++ b/apps/erp/app/modules/sales/types.ts@@ -36,7 +36,10 @@ import type {getSalesRFQs,priceSourceTypes} from "./sales.service";-import type { pricingRuleConfigurationPriceValidator } from "./sales.utils";+import type {+ pricingRuleConfigurationPriceValidator,+ QuoteLinePriceSource+} from "./sales.utils";// Pricing typesexport type MatchedRule = {@@ -125,6 +128,18 @@ export type PriceTraceStep = {label?: string;};+// One quantity break of a quote line: `trace` is how its price was reached+// (stored with the price; null for a manual price or one set before traces+// were recorded), `currentTrace` what today's rules would produce (null for a+// manual price).+export type QuoteLinePriceTrace = {+ quantity: number;+ unitPrice: number;+ priceSource: QuoteLinePriceSource;+ trace: PriceTraceStep[] | null;+ currentTrace: PriceTraceStep[] | null;+};+export type PricingRule = NonNullable<Awaited<ReturnType<typeof getPricingRules>>["data"]>[number];diff --git a/apps/erp/app/modules/sales/ui/Pricing/PriceOverridesTable.tsx b/apps/erp/app/modules/sales/ui/Pricing/PriceOverridesTable.tsxindex e8301dd697..9dadf5c08d 100644--- a/apps/erp/app/modules/sales/ui/Pricing/PriceOverridesTable.tsx+++ b/apps/erp/app/modules/sales/ui/Pricing/PriceOverridesTable.tsx@@ -50,7 +50,7 @@ import type { PriceListRow } from "~/modules/sales";import { path } from "~/utils/path";import { DuplicatePriceListModal } from "./DuplicatePriceListModal";import { PriceListScopeEmpty } from "./PriceListScopeEmpty";-import { PriceTracePopover } from "./PriceTracePopover";+import { PriceTraceModal } from "./PriceTraceModal";import { type ScopeOption, ScopePicker } from "./ScopePicker";type PriceListTableProps = {@@ -210,7 +210,7 @@ const PriceListTable = memo(<TooltipContent>This price is overridden.</TooltipContent></Tooltip>)}- <PriceTracePopover+ <PriceTraceModaltrace={row.original.trace}currencyCode={baseCurrency}/>diff --git a/apps/erp/app/modules/sales/ui/Pricing/PriceTraceModal.tsx b/apps/erp/app/modules/sales/ui/Pricing/PriceTraceModal.tsxnew file mode 100644index 0000000000..211074853d--- /dev/null+++ b/apps/erp/app/modules/sales/ui/Pricing/PriceTraceModal.tsx@@ -0,0 +1,222 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import {+ Badge,+ Modal,+ ModalBody,+ ModalContent,+ ModalDescription,+ ModalHeader,+ ModalTitle,+ ModalTrigger,+ Table,+ Tbody,+ Td,+ Th,+ Thead,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ Tr+} from "@carbon/react";+import { Trans, useLingui } from "@lingui/react/macro";+import type { ComponentProps } from "react";+import { useState } from "react";+import { LuCalculator, LuExternalLink } from "react-icons/lu";+import { Link } from "react-router";+import { useCurrencyFormatter } from "~/hooks/useCurrencyFormatter";+import { path } from "~/utils/path";+import type { PriceTraceStep } from "../../types";++type BadgeVariant = NonNullable<ComponentProps<typeof Badge>["variant"]>;++const STEP_BADGE: Record<+ string,+ { label: string; variant: BadgeVariant } | null+> = {+ "Base Price": { label: "Base", variant: "gray" },+ Override: { label: "Override", variant: "yellow" },+ "Type Override": { label: "Type Override", variant: "blue" },+ "All Override": { label: "All Override", variant: "gray" },+ Discount: { label: "Discount", variant: "red" },+ Markup: { label: "Markup", variant: "green" },+ // Labelled with the parameter's name (`step.label`) when it has one.+ Configuration: { label: "Configuration", variant: "purple" },+ "Final Price": null+};++const HEAD_CELL =+ "text-xs uppercase tracking-wide text-muted-foreground whitespace-nowrap";++// True when anything beyond the base price moved the price — an override,+// a pricing rule or a configuration price.+export function hasPriceAdjustments(+ trace: PriceTraceStep[] | null | undefined+) {+ return (+ Array.isArray(trace) &&+ trace.some(+ (step) => step.step !== "Base Price" && step.step !== "Final Price"+ )+ );+}++type PriceTraceModalProps = {+ trace: PriceTraceStep[] | null | undefined;+ currencyCode: string;+};++export function PriceTraceModal({ trace, currencyCode }: PriceTraceModalProps) {+ const { t } = useLingui();+ const [open, setOpen] = useState(false);++ const steps = Array.isArray(trace) ? trace : [];+ if (steps.length === 0) return null;++ // The button is the dialog's trigger so Radix returns focus to it on close.+ return (+ <Modal open={open} onOpenChange={setOpen}>+ <Tooltip>+ <TooltipTrigger asChild>+ <ModalTrigger asChild>+ <button+ type="button"+ aria-label={t`How this price was calculated`}+ className="text-xxs text-muted-foreground hover:text-foreground inline-flex items-center gap-0.5"+ >+ <LuCalculator className="size-3" />+ </button>+ </ModalTrigger>+ </TooltipTrigger>+ <TooltipContent>+ <Trans>How this price was calculated</Trans>+ </TooltipContent>+ </Tooltip>+ <ModalContent size="xxlarge">+ <ModalHeader>+ <ModalTitle>+ <Trans>Pricing Trace</Trans>+ </ModalTitle>+ <ModalDescription>+ <Trans>How the resolved price was calculated.</Trans>+ </ModalDescription>+ </ModalHeader>+ <ModalBody>+ <PriceTraceTable trace={steps} currencyCode={currencyCode} />+ </ModalBody>+ </ModalContent>+ </Modal>+ );+}++export function PriceTraceTable({+ trace,+ currencyCode+}: {+ trace: PriceTraceStep[];+ currencyCode: string;+}) {+ const currencyFormatter = useCurrencyFormatter({+ rate: true,+ currency: currencyCode+ });+ const format = (value: number) => currencyFormatter.format(value);++ return (+ <div className="overflow-x-auto rounded-lg border border-border">+ <Table>+ <Thead>+ <Tr>+ <Th className={HEAD_CELL}>+ <Trans>Step</Trans>+ </Th>+ <Th className={HEAD_CELL}>+ <Trans>Type</Trans>+ </Th>+ <Th className={HEAD_CELL}>+ <Trans>Description</Trans>+ </Th>+ <Th className={`${HEAD_CELL} text-right`}>+ <Trans>Change</Trans>+ </Th>+ <Th className={`${HEAD_CELL} text-right`}>+ <Trans>Running Total</Trans>+ </Th>+ </Tr>+ </Thead>+ <Tbody>+ {trace.map((step, i) => {+ const isFinal = step.step === "Final Price";+ return (+ <Tr+ key={i}+ className={+ isFinal ? "border-t border-border font-semibold" : undefined+ }+ >+ <Td className="text-sm whitespace-nowrap">{step.step}</Td>+ <Td className="text-sm whitespace-nowrap">+ <StepTypeBadge step={step} />+ </Td>+ <Td+ className="text-sm text-muted-foreground max-w-[320px]"+ title={step.source}+ >+ {step.ruleId ? (+ <Link+ to={path.to.pricingRule(step.ruleId)}+ target="_blank"+ rel="noreferrer"+ className="hover:text-foreground hover:underline decoration-dotted underline-offset-2 inline-flex items-center gap-1 max-w-full"+ >+ <span className="truncate">{step.source}</span>+ <LuExternalLink className="size-3 shrink-0" />+ </Link>+ ) : (+ <span className="block truncate">{step.source}</span>+ )}+ </Td>+ <Td className="text-right whitespace-nowrap">+ <DeltaPill value={step.adjustment} format={format} />+ </Td>+ <Td className="text-right text-sm whitespace-nowrap tabular-nums">+ {format(step.amount)}+ </Td>+ </Tr>+ );+ })}+ </Tbody>+ </Table>+ </div>+ );+}++function StepTypeBadge({ step }: { step: PriceTraceStep }) {+ const mapping = STEP_BADGE[step.step];+ if (mapping === null) return null;+ if (!mapping) return <Badge variant="gray">{step.step}</Badge>;+ return <Badge variant={mapping.variant}>{step.label ?? mapping.label}</Badge>;+}++export function DeltaPill({+ value,+ format+}: {+ value: number | undefined;+ format: (value: number) => string;+}) {+ if (value === undefined || value === 0) {+ return <span className="text-sm text-muted-foreground">—</span>;+ }+ const isNegative = value < 0;+ const variant = isNegative ? "red" : "green";+ const sign = isNegative ? "" : "+";+ return (+ <Badge variant={variant}>+ {sign}+ {format(value)}+ </Badge>+ );+}diff --git a/apps/erp/app/modules/sales/ui/Pricing/PriceTracePopover.tsx b/apps/erp/app/modules/sales/ui/Pricing/PriceTracePopover.tsxdeleted file mode 100644index 224b1dc77f..0000000000--- a/apps/erp/app/modules/sales/ui/Pricing/PriceTracePopover.tsx+++ /dev/null@@ -1,203 +0,0 @@-// SPDX-License-Identifier: AGPL-3.0-only-// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,-// including ports, remain AGPLv3; serving them over a network requires releasing their source.--import {- Badge,- Popover,- PopoverContent,- PopoverTrigger,- Table,- Tbody,- Td,- Th,- Thead,- Tooltip,- TooltipContent,- TooltipTrigger,- Tr-} from "@carbon/react";-import { Trans } from "@lingui/react/macro";-import type { ComponentProps, ReactNode } from "react";-import { LuCalculator, LuExternalLink } from "react-icons/lu";-import { Link } from "react-router";-import { useCurrencyFormatter } from "~/hooks/useCurrencyFormatter";-import { path } from "~/utils/path";-import type { PriceTraceStep } from "../../types";--type BadgeVariant = NonNullable<ComponentProps<typeof Badge>["variant"]>;--const STEP_BADGE: Record<- string,- { label: string; variant: BadgeVariant } | null-> = {- "Base Price": { label: "Base", variant: "gray" },- Override: { label: "Override", variant: "yellow" },- "Type Override": { label: "Type Override", variant: "blue" },- "All Override": { label: "All Override", variant: "gray" },- Discount: { label: "Discount", variant: "red" },- Markup: { label: "Markup", variant: "green" },- // Labelled with the parameter's name (`step.label`) when it has one.- Configuration: { label: "Configuration", variant: "purple" },- "Final Price": null-};--type PriceTracePopoverProps = {- trace: PriceTraceStep[] | null | undefined;- currencyCode: string;- /** Optional trigger content. If omitted, renders a "View calc" text button. */- children?: ReactNode;-};--export function PriceTracePopover({- trace,- currencyCode,- children-}: PriceTracePopoverProps) {- const currencyFormatter = useCurrencyFormatter({ currency: currencyCode });- const format = (value: number) => currencyFormatter.format(value);-- const steps = Array.isArray(trace) ? trace : [];- if (steps.length === 0) {- return children ? <>{children}</> : null;- }-- const trigger = children ? (- <button- type="button"- className="cursor-help decoration-dotted underline-offset-2 hover:underline"- >- {children}- </button>- ) : (- <button- type="button"- aria-label="How this price was calculated"- className="text-xxs text-muted-foreground hover:text-foreground inline-flex items-center gap-0.5"- >- <LuCalculator className="size-3" />- </button>- );-- return (- <Popover>- {children ? (- <PopoverTrigger asChild>{trigger}</PopoverTrigger>- ) : (- <Tooltip>- <TooltipTrigger asChild>- <PopoverTrigger asChild>{trigger}</PopoverTrigger>- </TooltipTrigger>- <TooltipContent>- <Trans>How this price was calculated</Trans>- </TooltipContent>- </Tooltip>- )}- <PopoverContent align="end" sideOffset={8} className="max-w-[800px] p-0">- <div className="px-4 py-3 border-b border-border">- <p className="text-sm font-semibold">- <Trans>Pricing Trace</Trans>- </p>- <p className="text-xs text-muted-foreground mt-0.5">- <Trans>How the resolved price was calculated.</Trans>- </p>- </div>- <div className="overflow-x-auto">- <Table>- <Thead>- <Tr>- <Th className="text-xs uppercase tracking-wide text-muted-foreground whitespace-nowrap">- <Trans>Step</Trans>- </Th>- <Th className="text-xs uppercase tracking-wide text-muted-foreground whitespace-nowrap">- <Trans>Type</Trans>- </Th>- <Th className="text-xs uppercase tracking-wide text-muted-foreground whitespace-nowrap">- <Trans>Description</Trans>- </Th>- <Th className="text-xs uppercase tracking-wide text-muted-foreground text-right whitespace-nowrap">- <Trans>Change</Trans>- </Th>- <Th className="text-xs uppercase tracking-wide text-muted-foreground text-right whitespace-nowrap">- <Trans>Running Total</Trans>- </Th>- </Tr>- </Thead>- <Tbody>- {steps.map((step, i) => {- const isFinal = step.step === "Final Price";- return (- <Tr- key={i}- className={- isFinal- ? "border-t border-border font-semibold"- : undefined- }- >- <Td className="text-sm whitespace-nowrap">{step.step}</Td>- <Td className="text-sm whitespace-nowrap">- <StepTypeBadge step={step} />- </Td>- <Td- className="text-sm text-muted-foreground max-w-[240px]"- title={step.source}- >- {step.ruleId ? (- <Link- to={path.to.pricingRule(step.ruleId)}- target="_blank"- rel="noreferrer"- className="hover:text-foreground hover:underline decoration-dotted underline-offset-2 inline-flex items-center gap-1 max-w-full"- >- <span className="truncate">{step.source}</span>- <LuExternalLink className="size-3 shrink-0" />- </Link>- ) : (- <span className="block truncate">{step.source}</span>- )}- </Td>- <Td className="text-right whitespace-nowrap">- <DeltaPill value={step.adjustment} format={format} />- </Td>- <Td className="text-right text-sm whitespace-nowrap">- {format(step.amount)}- </Td>- </Tr>- );- })}- </Tbody>- </Table>- </div>- </PopoverContent>- </Popover>- );-}--function StepTypeBadge({ step }: { step: PriceTraceStep }) {- const mapping = STEP_BADGE[step.step];- if (mapping === null) return null;- if (!mapping) return <Badge variant="gray">{step.step}</Badge>;- return <Badge variant={mapping.variant}>{step.label ?? mapping.label}</Badge>;-}--export function DeltaPill({- value,- format-}: {- value: number | undefined;- format: (value: number) => string;-}) {- if (value === undefined || value === 0) {- return <span className="text-sm text-muted-foreground">—</span>;- }- const isNegative = value < 0;- const variant = isNegative ? "red" : "green";- const sign = isNegative ? "" : "+";- return (- <Badge variant={variant}>- {sign}- {format(value)}- </Badge>- );-}diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePriceTraceModal.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePriceTraceModal.tsxnew file mode 100644index 0000000000..8c8e8cc90d--- /dev/null+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePriceTraceModal.tsx@@ -0,0 +1,203 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import {+ Badge,+ Button,+ Modal,+ ModalBody,+ ModalContent,+ ModalDescription,+ ModalFooter,+ ModalHeader,+ ModalTitle,+ Spinner+} from "@carbon/react";+import { Trans } from "@lingui/react/macro";+import { useState } from "react";+import { LuRefreshCcw } from "react-icons/lu";+import { useCurrencyFormatter } from "~/hooks/useCurrencyFormatter";+import { repricedUnitPrice } from "../../sales.utils";+import type { QuoteLinePriceTrace } from "../../types";+import { PriceTraceTable } from "../Pricing/PriceTraceModal";++function repricedTo(price: QuoteLinePriceTrace, precision: number) {+ return repricedUnitPrice(price.currentTrace, price.unitPrice, precision);+}++type QuoteLinePriceTraceModalProps = {+ traces: QuoteLinePriceTrace[];+ isLoading: boolean;+ currencyCode: string;+ unitPricePrecision: number;+ isEditable: boolean;+ isRepricing: boolean;+ onReprice: () => void;+ onClose: () => void;+};++const QuoteLinePriceTraceModal = ({+ traces,+ isLoading,+ currencyCode,+ unitPricePrecision,+ isEditable,+ isRepricing,+ onReprice,+ onClose+}: QuoteLinePriceTraceModalProps) => {+ const unitPriceFormatter = useCurrencyFormatter({+ rate: true,+ currency: currencyCode,+ decimalPlaces: unitPricePrecision+ });++ const canReprice = traces.some(+ (price) => repricedTo(price, unitPricePrecision) !== null+ );++ return (+ <Modal+ open+ onOpenChange={(open) => {+ if (!open) onClose();+ }}+ >+ <ModalContent size="xxlarge">+ <ModalHeader>+ <ModalTitle>+ <Trans>Pricing Trace</Trans>+ </ModalTitle>+ <ModalDescription>+ <Trans>How the unit price of each quantity was calculated.</Trans>+ </ModalDescription>+ </ModalHeader>+ <ModalBody>+ {isLoading ? (+ <div className="flex items-center justify-center py-16">+ <Spinner className="size-6" />+ </div>+ ) : (+ <div className="flex flex-col gap-6">+ {traces.map((price) => (+ <QuantityTrace+ key={price.quantity}+ price={price}+ repricedPrice={repricedTo(price, unitPricePrecision)}+ currencyCode={currencyCode}+ format={(value) => unitPriceFormatter.format(value)}+ />+ ))}+ </div>+ )}+ </ModalBody>+ {isEditable && canReprice && (+ <ModalFooter>+ <Button+ leftIcon={<LuRefreshCcw />}+ isLoading={isRepricing}+ isDisabled={isRepricing}+ onClick={onReprice}+ >+ <Trans>Reprice with current rules</Trans>+ </Button>+ </ModalFooter>+ )}+ </ModalContent>+ </Modal>+ );+};++function QuantityTrace({+ price,+ repricedPrice,+ currencyCode,+ format+}: {+ price: QuoteLinePriceTrace;+ repricedPrice: number | null;+ currencyCode: string;+ format: (value: number) => string;+}) {+ const [showCurrent, setShowCurrent] = useState(false);+ const isManual = price.priceSource === "manual";+ // A system price with no stored trace was set before traces were recorded:+ // today's calculation is the only explanation there is.+ const trace = price.trace ?? (isManual ? null : price.currentTrace);++ return (+ <section className="flex flex-col gap-2">+ <div className="flex items-baseline justify-between gap-4">+ <h3 className="text-sm font-semibold tabular-nums">+ <Trans>Quantity {price.quantity}</Trans>+ </h3>+ <span className="flex items-center gap-2 text-sm tabular-nums">+ {isManual && (+ <Badge variant="gray">+ <Trans>Manual</Trans>+ </Badge>+ )}+ {format(price.unitPrice)}+ </span>+ </div>+ {!isManual && !price.trace && price.currentTrace && (+ <p className="text-sm text-muted-foreground">+ <Trans>+ Priced before pricing traces were recorded — this is today's+ calculation.+ </Trans>+ </p>+ )}+ {trace ? (+ <PriceTraceTable trace={trace} currencyCode={currencyCode} />+ ) : (+ <p className="rounded-lg border border-border px-4 py-3 text-sm text-muted-foreground">+ {isManual ? (+ <Trans>+ This price was entered manually, so no pricing rules were applied.+ </Trans>+ ) : (+ <Trans>No pricing rules apply to this quantity.</Trans>+ )}+ </p>+ )}+ {repricedPrice !== null && (+ <div className="flex flex-col gap-2 rounded-lg bg-muted/60 px-4 py-3">+ <div className="flex items-center justify-between gap-4 text-sm">+ <span>+ <Trans>+ Repricing with today's rules and costs gives{" "}+ <span className="font-medium tabular-nums">+ {format(repricedPrice)}+ </span>+ .+ </Trans>+ </span>+ {price.trace && (+ <Button+ variant="link"+ size="sm"+ onClick={() => setShowCurrent((show) => !show)}+ >+ {showCurrent ? (+ <Trans>Hide calculation</Trans>+ ) : (+ <Trans>Show calculation</Trans>+ )}+ </Button>+ )}+ </div>+ {showCurrent && price.trace && price.currentTrace && (+ <PriceTraceTable+ trace={price.currentTrace}+ currencyCode={currencyCode}+ />+ )}+ </div>+ )}+ </section>+ );+}++export default QuoteLinePriceTraceModal;diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsxindex 2f618e43aa..d1a39d4597 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteLinePricing.tsx@@ -41,6 +41,7 @@ import { getLocalTimeZone, today } from "@internationalized/date";import { Trans, useLingui } from "@lingui/react/macro";import { useCallback, useEffect, useMemo, useState } from "react";import {+ LuCalculator,LuCalendarClock,LuChevronDown,LuChevronRight,@@ -60,6 +61,10 @@ import {useSettings,useUser} from "~/hooks";+import type {+ action as priceTraceAction,+ loader as priceTraceLoader+} from "~/routes/x+/quote+/$quoteId.$lineId.price-trace";import { path } from "~/utils/path";import {type CostCategoryKey,@@ -67,15 +72,23 @@ import {quoteLineAdditionalChargesValidator,quoteLineCategoryMarkupsValidator} from "../../sales.models";-import { asConfiguration } from "../../sales.utils";+import {+ asConfiguration,+ QUOTE_BASE_PRICE_SOURCES,+ withBasePriceSource+} from "../../sales.utils";import type {Costs,+ PriceResolutionResult,+ PriceTraceStep,Quotation,QuotationLine,QuotationPrice} from "../../types";+import { hasPriceAdjustments } from "../Pricing/PriceTraceModal";import { CostRowLabel, costRowLabelCellClass } from "./CostRowLabel";import QuoteLeadTimeModal from "./QuoteLeadTimeModal";+import QuoteLinePriceTraceModal from "./QuoteLinePriceTraceModal";const logger = getLogger("erp", "sales", "quote-line-pricing");@@ -377,13 +390,25 @@ const QuoteLinePricing = ({// A cost-plus rollup is only the starting price: the line's pricing rules,// including its configuration prices, apply on top — the same pipeline as- // recalculateQuoteLinePrices on the server. Null when the rules could not- // be applied.+ // recalculateQuoteLinePrices on the server. Returns the price with the trace+ // that explains it (stored alongside); null when the rules could not be+ // applied.const customerId = routeData?.quote?.customerId;const [isRepricing, setIsRepricing] = useState(false);const resolveRollupPrice = useCallback(- async (quantity: number, rollupPrice: number): Promise<number | null> => {- if (!line.itemId) return round(rollupPrice, unitPricePrecision);+ async (+ quantity: number,+ rollupPrice: number+ ): Promise<{+ unitPrice: number;+ priceTrace: PriceTraceStep[] | null;+ } | null> => {+ if (!line.itemId) {+ return {+ unitPrice: round(rollupPrice, unitPricePrecision),+ priceTrace: null+ };+ }const configuration = asConfiguration(line.configuration);try {const response = await fetch(path.to.api.salesResolvePrice, {@@ -405,8 +430,14 @@ const QuoteLinePricing = ({});return null;}- const result = await response.json();- return round(result.finalPrice, unitPricePrecision);+ const result: PriceResolutionResult = await response.json();+ return {+ unitPrice: round(result.finalPrice, unitPricePrecision),+ priceTrace: withBasePriceSource(+ result.trace,+ QUOTE_BASE_PRICE_SOURCES.costPlus+ )+ };} catch (error) {logger.error("Failed to resolve quote line price", {lineId,@@ -434,7 +465,7 @@ const QuoteLinePricing = ({}setIsRepricing(true);- const unitPricesByQuantity = await Promise.all(+ const resolvedByQuantity = await Promise.all(costsByQuantity.map((costs, index) =>resolveRollupPrice(quantities[index],@@ -444,7 +475,7 @@ const QuoteLinePricing = ({);setIsRepricing(false);- if (unitPricesByQuantity.some((price) => price === null)) {+ if (resolvedByQuantity.some((resolved) => resolved === null)) {toast.error(t`Failed to apply pricing rules`);return;}@@ -452,7 +483,11 @@ const QuoteLinePricing = ({const formData = new FormData();formData.append("unitPricesByQuantity",- JSON.stringify(unitPricesByQuantity)+ JSON.stringify(resolvedByQuantity.map((resolved) => resolved!.unitPrice))+ );+ formData.append(+ "priceTracesByQuantity",+ JSON.stringify(resolvedByQuantity.map((resolved) => resolved!.priceTrace)));formData.append("quantities", JSON.stringify(quantities));formData.append(@@ -513,14 +548,15 @@ const QuoteLinePricing = ({const quantityIndex = quantities.indexOf(quantity);const categoryCosts = costsByQuantity[quantityIndex];- const unitPrice = await resolveRollupPrice(+ const resolved = await resolveRollupPrice(quantity,computeUnitPriceFromMarkups(categoryCosts, newMarkups));- if (unitPrice === null) {+ if (resolved === null) {toast.error(t`Failed to apply pricing rules`);return;}+ const { unitPrice, priceTrace } = resolved;setEditableFields((prev) => ({...prev,@@ -530,7 +566,8 @@ const QuoteLinePricing = ({...prev.prices[quantity],categoryMarkups: newMarkups,priceSource: "system",- unitPrice+ unitPrice,+ priceTrace}}}));@@ -543,10 +580,12 @@ const QuoteLinePricing = ({.update({categoryMarkups: newMarkups,priceSource: "system",- unitPrice+ unitPrice,+ priceTrace}).eq("quoteLineId", lineId)- .eq("quantity", quantity);+ .eq("quantity", quantity)+ .eq("companyId", company.id);if (priceUpdate?.error) {logger.error("Failed to update quote line pricing", {@@ -558,6 +597,7 @@ const QuoteLinePricing = ({[categoryMarkupsByQuantity,carbon,+ company.id,lineId,costsByQuantity,quantities,@@ -600,10 +640,11 @@ const QuoteLinePricing = ({...newPrices[quantity],[key]: roundedValue,// A direct price / virtual-markup edit makes this a manual price:- // priceSource 'manual' tells every recalc to preserve it, and clearing- // the stored per-category markups keeps the display consistent.+ // priceSource 'manual' tells every recalc to preserve it, clearing+ // the stored per-category markups keeps the display consistent, and no+ // rule explains it any more....(key === "unitPrice"- ? { categoryMarkups: {}, priceSource: "manual" }+ ? { categoryMarkups: {}, priceSource: "manual", priceTrace: null }: {})};@@ -618,13 +659,14 @@ const QuoteLinePricing = ({.update({[key]: roundedValue,...(key === "unitPrice"- ? { categoryMarkups: {}, priceSource: "manual" }+ ? { categoryMarkups: {}, priceSource: "manual", priceTrace: null }: {}),quoteLineId: lineId,quantity}).eq("quoteLineId", lineId)- .eq("quantity", quantity);+ .eq("quantity", quantity)+ .eq("companyId", company.id);if (update?.error) {logger.error("Failed to update quote line pricing", {error: update.error@@ -654,12 +696,57 @@ const QuoteLinePricing = ({exchangeRate,userId,carbon,+ company.id,t]);const [leadTimeModalOpen, setLeadTimeModalOpen] = useState(false);+ // How each quantity's price was resolved. The stored traces arrive with the+ // prices, so showing the button costs no request; today's calculation (the+ // price-trace route) is loaded when the modal opens and after a reprice —+ // and once on mount when no stored trace shows a rule, since only today's+ // calculation can tell whether one applies now.+ const [priceTraceModalOpen, setPriceTraceModalOpen] = useState(false);+ const priceTraceFetcher = useFetcher<typeof priceTraceLoader>();+ const repriceFetcher = useFetcher<typeof priceTraceAction>();+ const priceTraceLoad = priceTraceFetcher.load;+ const priceTraceUrl = path.to.quoteLinePriceTrace(quoteId, lineId);+ useEffect(() => {+ if (repriceFetcher.state !== "idle" || !repriceFetcher.data) return;+ if (repriceFetcher.data.error) toast.error(repriceFetcher.data.error);+ else priceTraceLoad(priceTraceUrl);+ }, [+ repriceFetcher.state,+ repriceFetcher.data,+ priceTraceLoad,+ priceTraceUrl+ ]);++ const storedPrices = Object.values(editableFields.prices);+ const hasStoredAdjustments = storedPrices.some((price) =>+ hasPriceAdjustments(price.priceTrace as PriceTraceStep[] | null)+ );+ // No stored trace shows a rule, but a rule may have been added since (or+ // the price predates traces): only today's calculation can tell, and it is+ // what reveals the trace button.+ const needsCurrentTrace =+ !hasStoredAdjustments &&+ storedPrices.some((price) => price.priceSource !== "manual");+ useEffect(() => {+ if (isEmployee && needsCurrentTrace) priceTraceLoad(priceTraceUrl);+ }, [isEmployee, needsCurrentTrace, priceTraceLoad, priceTraceUrl]);++ const priceTraces = priceTraceFetcher.data?.traces ?? [];+ const hasPricingRules =+ hasStoredAdjustments ||+ priceTraces.some(+ (price) =>+ hasPriceAdjustments(price.trace) ||+ hasPriceAdjustments(price.currentTrace)+ );+// Applies one predicted lead time per quantity break in ONE state update:// onUpdatePrice snapshots editableFields.prices per call and replaces the// whole map, so looping it would keep only the last quantity's value.@@ -1091,7 +1178,24 @@ const QuoteLinePricing = ({)}<Tr><Td className={costRowLabelCellClass}>- <CostRowLabel label={<Trans>Unit Price</Trans>} />+ <CostRowLabel+ label={<Trans>Unit Price</Trans>}+ badge={+ isEmployee &&+ hasPricingRules && (+ <IconButton+ aria-label={t`How this price was calculated`}+ icon={<LuCalculator />}+ variant="ghost"+ size="sm"+ onClick={() => {+ priceTraceLoad(priceTraceUrl);+ setPriceTraceModalOpen(true);+ }}+ />+ )+ }+ /></Td>{quantities.map((quantity) => {const price = editableFields.prices[quantity]?.unitPrice;@@ -1514,6 +1618,23 @@ const QuoteLinePricing = ({onClose={() => setLeadTimeModalOpen(false)}/>)}+ {priceTraceModalOpen && (+ <QuoteLinePriceTraceModal+ traces={priceTraces}+ isLoading={priceTraceFetcher.state !== "idle"}+ currencyCode={baseCurrency}+ unitPricePrecision={unitPricePrecision}+ isEditable={isEditable}+ isRepricing={repriceFetcher.state !== "idle"}+ onReprice={() =>+ repriceFetcher.submit(null, {+ method: "post",+ action: priceTraceUrl+ })+ }+ onClose={() => setPriceTraceModalOpen(false)}+ />+ )}</Card>);};diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsxindex 3eacd86a9b..f65934eddb 100644--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderLineForm.tsx@@ -39,7 +39,13 @@ import {useMount,VStack} from "@carbon/react";-import { getItemReadableId, INPUT_FORMAT, INPUT_STEP } from "@carbon/utils";+import {+ equals,+ getItemReadableId,+ INPUT_FORMAT,+ INPUT_STEP,+ round+} from "@carbon/utils";import { Trans, useLingui } from "@lingui/react/macro";import { useCallback, useEffect, useState } from "react";import {@@ -91,7 +97,7 @@ import type {SalesOrder,SalesOrderLineType} from "../../types";-import { PriceTracePopover } from "../Pricing/PriceTracePopover";+import { PriceTraceModal } from "../Pricing/PriceTraceModal";type SalesOrderLineFormProps = {initialValues: z.infer<typeof salesOrderLineValidator> & {@@ -167,9 +173,7 @@ const SalesOrderLineForm = ({priceListId:(initialValues as { priceListId?: string | null }).priceListId ?? null,priceListName: null,- priceTrace:- (initialValues as { priceTrace?: PriceTraceStep[] | null }).priceTrace ??- null+ priceTrace: initialValues.priceTrace ?? null});const configurator = useItemConfiguration({@@ -611,13 +615,11 @@ const SalesOrderLineForm = ({name="priceListId"value={itemData?.priceListId ?? undefined}/>+ {/* Always posted: "null" clears a stored trace once the+ price is typed rather than resolved. */}<Hiddenname="priceTrace"- value={- itemData?.priceTrace- ? JSON.stringify(itemData.priceTrace)- : undefined- }+ value={JSON.stringify(itemData?.priceTrace ?? null)}/><Hidden name="unitOfMeasureCode" value={itemData.uom} /><Hidden@@ -705,7 +707,7 @@ const SalesOrderLineForm = ({<Trans>Unit Price</Trans></LabelWithHelp></span>- <PriceTracePopover+ <PriceTraceModaltrace={itemData.priceTrace}currencyCode={baseCurrency}/>@@ -718,10 +720,20 @@ const SalesOrderLineForm = ({currencyDecimals)}onChange={(value) =>- setItemData((d) => ({- ...d,- unitPrice: value- }))+ setItemData((d) =>+ // The field commits at the storage scale,+ // so a resolved price with more digits+ // comes back rounded on blur — not a typed+ // price.+ equals(round(value), round(d.unitPrice))+ ? d+ : {+ ...d,+ unitPrice: value,+ // A typed price is not the resolved one.+ priceTrace: null+ }+ )}/></div>diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.jsonindex aba24fb3a4..e3ecba59b9 100644--- a/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-manifest.digest.json@@ -1,5 +1,5 @@{- "totalTools": 1559,+ "totalTools": 1561,"modules": 15,"tools": [{"name":"account_deleteUserAttributeValue","classification":"DESTRUCTIVE","paramCount":2,"schema":"0d38e12233b4","response":"bcde375ebd4c","injectAuth":"companyId+userId","permission":"none","paginates":false},@@ -1199,9 +1199,9 @@{"name":"resources_upsertTrainingAssignment","classification":"WRITE","paramCount":3,"schema":"9f8996544bb7","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"resources:create+update","paginates":false},{"name":"resources_upsertTrainingQuestion","classification":"WRITE","paramCount":12,"schema":"f27342252292","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"resources:create+update","paginates":false},{"name":"resources_upsertWorkCenter","classification":"DESTRUCTIVE","paramCount":15,"schema":"cc81867b6509","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"resources:create+update","paginates":false},- {"name":"sales_buildMakeToOrderPriceRows","classification":"WRITE","paramCount":4,"schema":"9ca94f5219fe","response":"89e850aef11d","injectAuth":"companyId","permission":"sales:update","paginates":false},- {"name":"sales_buildPullFromInventoryPriceRows","classification":"WRITE","paramCount":4,"schema":"9ca94f5219fe","response":"89e850aef11d","injectAuth":"companyId","permission":"sales:update","paginates":false},- {"name":"sales_buildPurchaseToOrderPriceRows","classification":"WRITE","paramCount":4,"schema":"9ca94f5219fe","response":"89e850aef11d","injectAuth":"companyId","permission":"sales:update","paginates":false},+ {"name":"sales_buildMakeToOrderPriceRows","classification":"WRITE","paramCount":4,"schema":"9ca94f5219fe","response":"10ba10c1ac60","injectAuth":"companyId","permission":"sales:update","paginates":false},+ {"name":"sales_buildPullFromInventoryPriceRows","classification":"WRITE","paramCount":4,"schema":"9ca94f5219fe","response":"10ba10c1ac60","injectAuth":"companyId","permission":"sales:update","paginates":false},+ {"name":"sales_buildPurchaseToOrderPriceRows","classification":"WRITE","paramCount":4,"schema":"9ca94f5219fe","response":"10ba10c1ac60","injectAuth":"companyId","permission":"sales:update","paginates":false},{"name":"sales_calculatePricesForQuantities","classification":"WRITE","paramCount":3,"schema":"160e0d2cf116","response":"af602e7b257e","injectAuth":"companyId","permission":"sales:update","paginates":false},{"name":"sales_cancelSalesOrder","classification":"WRITE","paramCount":2,"schema":"745d2b9e6ebc","response":"903bb804a4ff","injectAuth":"companyId+userId","permission":"sales:update","paginates":false},{"name":"sales_cancelSalesReturnOrder","classification":"WRITE","paramCount":1,"schema":"3797626bd17e","response":"3797626bd17e","injectAuth":"companyId+userId","permission":"sales:update","paginates":false},@@ -1284,10 +1284,11 @@{"name":"sales_getQuoteByExternalId","classification":"READ","paramCount":1,"schema":"21801463053a","response":"22f48d816de0","injectAuth":"companyId","permission":"sales:view","paginates":false},{"name":"sales_getQuoteCustomerDetails","classification":"READ","paramCount":1,"schema":"c726ae407913","response":"7656953707c3","injectAuth":"companyId","permission":"sales:view","paginates":false},{"name":"sales_getQuoteLine","classification":"READ","paramCount":1,"schema":"e0050938a2c8","response":"2e0476c17730","injectAuth":"companyId","permission":"sales:view","paginates":false},- {"name":"sales_getQuoteLinePrices","classification":"READ","paramCount":1,"schema":"e0050938a2c8","response":"902defd23e04","injectAuth":"companyId","permission":"sales:view","paginates":false},+ {"name":"sales_getQuoteLinePrices","classification":"READ","paramCount":1,"schema":"e0050938a2c8","response":"b380070f2ac3","injectAuth":"companyId","permission":"sales:view","paginates":false},{"name":"sales_getQuoteLinePricesByItemId","classification":"READ","paramCount":2,"schema":"17311e00ca6f","response":"2d479ad29d1f","injectAuth":"companyId","permission":"sales:view","paginates":false},{"name":"sales_getQuoteLinePricesByItemIds","classification":"READ","paramCount":2,"schema":"64b602e1a6e4","response":"2d479ad29d1f","injectAuth":"companyId","permission":"sales:view","paginates":false},- {"name":"sales_getQuoteLinePricesByQuoteId","classification":"READ","paramCount":1,"schema":"c726ae407913","response":"902defd23e04","injectAuth":"companyId","permission":"sales:view","paginates":false},+ {"name":"sales_getQuoteLinePricesByQuoteId","classification":"READ","paramCount":1,"schema":"c726ae407913","response":"b380070f2ac3","injectAuth":"companyId","permission":"sales:view","paginates":false},+ {"name":"sales_getQuoteLinePriceTraces","classification":"READ","paramCount":2,"schema":"55ee981d3d94","response":"898c52004ae5","injectAuth":"companyId","permission":"sales:view","paginates":false},{"name":"sales_getQuoteLines","classification":"READ","paramCount":1,"schema":"c726ae407913","response":"31ca07c6139c","injectAuth":"companyId","permission":"sales:view","paginates":false},{"name":"sales_getQuoteLinesList","classification":"READ","paramCount":1,"schema":"c726ae407913","response":"5ebff9af923d","injectAuth":"companyId","permission":"sales:view","paginates":false},{"name":"sales_getQuoteMakeMethod","classification":"READ","paramCount":1,"schema":"899e2f637661","response":"9bc4f5e58344","injectAuth":"companyId","permission":"sales:view","paginates":false},@@ -1353,6 +1354,7 @@{"name":"sales_recalculateQuoteLinePrices","classification":"WRITE","paramCount":2,"schema":"55ee981d3d94","response":"6db20595d1b7","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},{"name":"sales_releaseSalesOrder","classification":"WRITE","paramCount":1,"schema":"d160a49d6787","response":"bcde375ebd4c","injectAuth":"companyId+updatedBy","permission":"sales:update","paginates":false},{"name":"sales_reopenSalesReturnOrder","classification":"WRITE","paramCount":1,"schema":"3797626bd17e","response":"none","injectAuth":"companyId+userId","permission":"sales:update","paginates":false},+ {"name":"sales_repriceQuoteLineFromRules","classification":"WRITE","paramCount":2,"schema":"55ee981d3d94","response":"bcde375ebd4c","injectAuth":"companyId","permission":"sales:update","paginates":false},{"name":"sales_resolvePrice","classification":"WRITE","paramCount":1,"schema":"e21d9e9b3005","response":"eb12029769da","injectAuth":"companyId","permission":"sales:update","paginates":false},{"name":"sales_resolvePriceList","classification":"WRITE","paramCount":6,"schema":"2ee3c5668f0c","response":"7da40016b67c","injectAuth":"companyId","permission":"sales:update","paginates":true},{"name":"sales_resolvePurchaseToOrderPrices","classification":"WRITE","paramCount":3,"schema":"160e0d2cf116","response":"af602e7b257e","injectAuth":"companyId","permission":"sales:update","paginates":false},@@ -1393,7 +1395,7 @@{"name":"sales_upsertQuoteLine","classification":"WRITE","paramCount":19,"schema":"d3c525861e1c","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertQuoteLineAdditionalCharges","classification":"WRITE","paramCount":2,"schema":"483aa73b0c32","response":"bcde375ebd4c","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertQuoteLineMethod","classification":"WRITE","paramCount":5,"schema":"5f94e8a4cbf6","response":"none","injectAuth":"companyId+createdBy+updatedBy+userId","permission":"sales:create+update","paginates":false},- {"name":"sales_upsertQuoteLinePrices","classification":"DESTRUCTIVE","paramCount":3,"schema":"25f3f3e7401f","response":"none","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},+ {"name":"sales_upsertQuoteLinePrices","classification":"DESTRUCTIVE","paramCount":3,"schema":"03bc74906afb","response":"none","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertQuoteMaterial","classification":"WRITE","paramCount":17,"schema":"196337e8929e","response":"af9af3838934","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertQuoteMaterialMakeMethod","classification":"WRITE","paramCount":4,"schema":"06f97e90fc79","response":"bcde375ebd4c","injectAuth":"companyId+createdBy+updatedBy+userId","permission":"sales:create+update","paginates":false},{"name":"sales_upsertQuoteOperation","classification":"WRITE","paramCount":27,"schema":"3babae40d38f","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},@@ -1404,7 +1406,7 @@{"name":"sales_upsertQuoteShipment","classification":"WRITE","paramCount":7,"schema":"b67f297e5398","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertReturnReason","classification":"WRITE","paramCount":4,"schema":"765854e5447a","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertSalesOrder","classification":"WRITE","paramCount":19,"schema":"c7fa1aa49c04","response":"5cc20a44d4fe","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},- {"name":"sales_upsertSalesOrderLine","classification":"WRITE","paramCount":24,"schema":"df82fcdde982","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},+ {"name":"sales_upsertSalesOrderLine","classification":"WRITE","paramCount":25,"schema":"f36171418dd8","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertSalesOrderPayment","classification":"WRITE","paramCount":8,"schema":"310037cea6c3","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertSalesOrderShipment","classification":"WRITE","paramCount":17,"schema":"a1ab551afe2a","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},{"name":"sales_upsertSalesReturnOrderLine","classification":"WRITE","paramCount":12,"schema":"f4a19f25c389","response":"3797626bd17e","injectAuth":"companyId+createdBy+updatedBy","permission":"sales:create+update","paginates":false},diff --git a/apps/erp/app/routes/x+/assembly+/$id.tsx b/apps/erp/app/routes/x+/assembly+/$id.tsxindex 361419cf31..67e5b1a893 100644--- a/apps/erp/app/routes/x+/assembly+/$id.tsx+++ b/apps/erp/app/routes/x+/assembly+/$id.tsx@@ -632,7 +632,7 @@ export default function AssemblyInstructionRoute() {/>}content={- <div className="relative bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] w-full">+ <div className="relative bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] w-full">{glbPath && graphPath && isPlanning && (<div className="absolute left-1/2 top-3 z-10 flex -translate-x-1/2 items-center gap-2 rounded-full border border-border bg-card px-3 py-1.5 shadow-lg"><Spinner className="h-3.5 w-3.5" />diff --git a/apps/erp/app/routes/x+/consumable+/$itemId.tsx b/apps/erp/app/routes/x+/consumable+/$itemId.tsxindex 4abe827b8c..57bdd2f8e9 100644--- a/apps/erp/app/routes/x+/consumable+/$itemId.tsx+++ b/apps/erp/app/routes/x+/consumable+/$itemId.tsx@@ -245,7 +245,7 @@ export default function ConsumableRoute() {</div>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><Outlet /></div>}diff --git a/apps/erp/app/routes/x+/issue+/$id.tsx b/apps/erp/app/routes/x+/issue+/$id.tsxindex c651d6b4c4..9093ecd75f 100644--- a/apps/erp/app/routes/x+/issue+/$id.tsx+++ b/apps/erp/app/routes/x+/issue+/$id.tsx@@ -252,7 +252,7 @@ export default function IssueRoute() {</Suspense>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/items+/change-notice+/$id.tsx b/apps/erp/app/routes/x+/items+/change-notice+/$id.tsxindex e3067bf7de..5fb5ce6615 100644--- a/apps/erp/app/routes/x+/items+/change-notice+/$id.tsx+++ b/apps/erp/app/routes/x+/items+/change-notice+/$id.tsx@@ -339,7 +339,7 @@ export default function ChangeNoticeIdRoute() {<ResizablePanelsexplorer={<ChangeNoticeExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><Outlet /></div>}diff --git a/apps/erp/app/routes/x+/job+/$jobId.tsx b/apps/erp/app/routes/x+/job+/$jobId.tsxindex a1fc63f5c5..422a97b1d6 100644--- a/apps/erp/app/routes/x+/job+/$jobId.tsx+++ b/apps/erp/app/routes/x+/job+/$jobId.tsx@@ -193,7 +193,7 @@ export default function JobRoute() {</div>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-hidden w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-hidden w-full"><Outlet /></div>}diff --git a/apps/erp/app/routes/x+/maintenance+/$dispatchId.tsx b/apps/erp/app/routes/x+/maintenance+/$dispatchId.tsxindex d21bd4bc86..029699c46d 100644--- a/apps/erp/app/routes/x+/maintenance+/$dispatchId.tsx+++ b/apps/erp/app/routes/x+/maintenance+/$dispatchId.tsx@@ -113,7 +113,7 @@ export default function MaintenanceDispatchRoute() {<MaintenanceDispatchExplorer items={items} events={events} />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><MaintenanceDispatchNotesid={dispatchId}diff --git a/apps/erp/app/routes/x+/material+/$itemId.tsx b/apps/erp/app/routes/x+/material+/$itemId.tsxindex 1d6ef308e4..19a40d603a 100644--- a/apps/erp/app/routes/x+/material+/$itemId.tsx+++ b/apps/erp/app/routes/x+/material+/$itemId.tsx@@ -247,7 +247,7 @@ export default function MaterialRoute() {</div>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><Outlet /></div>}diff --git a/apps/erp/app/routes/x+/part+/$itemId.tsx b/apps/erp/app/routes/x+/part+/$itemId.tsxindex d11ebc6358..d1c3e6523d 100644--- a/apps/erp/app/routes/x+/part+/$itemId.tsx+++ b/apps/erp/app/routes/x+/part+/$itemId.tsx@@ -622,7 +622,7 @@ export default function PartRoute() {</div>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full"><Outlet /></div>}diff --git a/apps/erp/app/routes/x+/procedure+/$id.tsx b/apps/erp/app/routes/x+/procedure+/$id.tsxindex cbeec1f163..0c88561148 100644--- a/apps/erp/app/routes/x+/procedure+/$id.tsx+++ b/apps/erp/app/routes/x+/procedure+/$id.tsx@@ -110,7 +110,7 @@ export default function ProcedureRoute() {/>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><ProcedureEditor /><Outlet /></div>diff --git a/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.tsx b/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.tsxindex 425be0ed33..2c0ed83188 100644--- a/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.tsx+++ b/apps/erp/app/routes/x+/purchase-invoice+/$invoiceId.tsx@@ -141,7 +141,7 @@ export default function PurchaseInvoiceRoute() {<ResizablePanelsexplorer={<PurchaseInvoiceExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsxindex 76d4fb51c9..463a666d02 100644--- a/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx+++ b/apps/erp/app/routes/x+/purchase-order+/$orderId.tsx@@ -585,7 +585,7 @@ export default function PurchaseOrderRoute() {<ResizablePanelsexplorer={<PurchaseOrderExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/purchase-return-order+/$id.tsx b/apps/erp/app/routes/x+/purchase-return-order+/$id.tsxindex 7eecff5275..43fbc1b1b3 100644--- a/apps/erp/app/routes/x+/purchase-return-order+/$id.tsx+++ b/apps/erp/app/routes/x+/purchase-return-order+/$id.tsx@@ -94,7 +94,7 @@ export default function PurchaseReturnOrderRoute() {<ResizablePanelsexplorer={<PurchaseReturnOrderExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.tsx b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.tsxindex 4ab177bb4b..441fbd9d49 100644--- a/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.tsx+++ b/apps/erp/app/routes/x+/purchasing-rfq+/$rfqId.tsx@@ -145,7 +145,7 @@ export default function PurchasingRFQRoute() {<ResizablePanelsexplorer={<PurchasingRFQExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/quality-document+/$id.tsx b/apps/erp/app/routes/x+/quality-document+/$id.tsxindex 68460ed4bf..644f288ab3 100644--- a/apps/erp/app/routes/x+/quality-document+/$id.tsx+++ b/apps/erp/app/routes/x+/quality-document+/$id.tsx@@ -297,7 +297,7 @@ export default function QualityDocumentRoute() {<div className="flex flex-grow overflow-hidden"><ResizablePanelscontent={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><QualityDocumentEditor /><Outlet /></div>diff --git a/apps/erp/app/routes/x+/quote+/$quoteId.$lineId.price-trace.tsx b/apps/erp/app/routes/x+/quote+/$quoteId.$lineId.price-trace.tsxnew file mode 100644index 0000000000..0f6fbaf5aa--- /dev/null+++ b/apps/erp/app/routes/x+/quote+/$quoteId.$lineId.price-trace.tsx@@ -0,0 +1,96 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import { assertIsPost } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { getLogger } from "@carbon/logger";+import type {+ ActionFunctionArgs,+ LoaderFunctionArgs,+ ShouldRevalidateFunction+} from "react-router";+import { data } from "react-router";+import {+ getQuoteLinePriceTraces,+ QuoteLockedError,+ repriceQuoteLineFromRules+} from "~/modules/sales";+import { getDatabaseClient } from "~/services/database.server";++const logger = getLogger("erp", "quoteid-lineid-price-trace");++// Today's calculation is expensive (a cost rollup and a price resolution per+// quantity); the pricing grid loads it when it needs it rather than after+// every action on the page.+export const shouldRevalidate: ShouldRevalidateFunction = () => false;++export async function loader({ request, params }: LoaderFunctionArgs) {+ // Read-only: explains the stored prices, writes nothing.+ const { client, companyId } = await requirePermissions(request, {+ view: "sales",+ role: "employee"+ });++ const { quoteId, lineId } = params;+ if (!quoteId) throw new Error("Could not find quoteId");+ if (!lineId) throw new Error("Could not find lineId");++ const traces = await getQuoteLinePriceTraces(+ client,+ companyId,+ quoteId,+ lineId+ );+ if (traces.error) {+ logger.error("Failed to load quote line price traces", {+ companyId,+ quoteId,+ lineId,+ error: traces.error+ });+ return data(+ { traces: [], error: "Failed to load pricing trace" },+ { status: 500 }+ );+ }+ if (!traces.data) throw new Response(null, { status: 404 });++ return data({ traces: traces.data, error: null });+}++// Reprice: store what today's rules give, with the trace that explains it.+export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ update: "sales",+ role: "employee"+ });++ const { quoteId, lineId } = params;+ if (!quoteId) throw new Error("Could not find quoteId");+ if (!lineId) throw new Error("Could not find lineId");++ const repriced = await repriceQuoteLineFromRules(+ client,+ getDatabaseClient(),+ companyId,+ quoteId,+ lineId,+ userId+ );+ if (repriced.error instanceof QuoteLockedError) {+ return data({ error: repriced.error.message }, { status: 400 });+ }+ if (repriced.error) {+ logger.error("Failed to reprice quote line", {+ companyId,+ quoteId,+ lineId,+ error: repriced.error+ });+ return data({ error: "Failed to reprice quote line" }, { status: 500 });+ }++ return data({ error: null });+}diff --git a/apps/erp/app/routes/x+/quote+/$quoteId.$lineId.recalculate-price.tsx b/apps/erp/app/routes/x+/quote+/$quoteId.$lineId.recalculate-price.tsxindex e1e9c47680..8929bf7c3e 100644--- a/apps/erp/app/routes/x+/quote+/$quoteId.$lineId.recalculate-price.tsx+++ b/apps/erp/app/routes/x+/quote+/$quoteId.$lineId.recalculate-price.tsx@@ -8,7 +8,10 @@ import { getLogger } from "@carbon/logger";import type { ActionFunctionArgs } from "react-router";import { data } from "react-router";import { z } from "zod";-import { upsertQuoteLinePrices } from "~/modules/sales";+import {+ priceTraceStepValidator,+ upsertQuoteLinePrices+} from "~/modules/sales";import { getDatabaseClient } from "~/services/database.server";const logger = getLogger("erp", "quoteid-lineid-recalculate-price");@@ -45,6 +48,13 @@ export async function action({ request, params }: ActionFunctionArgs) {JSON.parse((formData.get("categoryMarkupsByQuantity") as string) ?? "{}"));+ // The trace each price was resolved with, index-aligned with the prices.+ const priceTracesByQuantity = z+ .array(z.array(priceTraceStepValidator).nullable())+ .safeParse(+ JSON.parse((formData.get("priceTracesByQuantity") as string) ?? "[]")+ );+if (unitPricesByQuantity.success === false) {return data({ data: null, errors: unitPricesByQuantity.error.issues?.[0].message },@@ -66,6 +76,13 @@ export async function action({ request, params }: ActionFunctionArgs) {);}+ if (priceTracesByQuantity.success === false) {+ return data(+ { data: null, errors: "Invalid price traces" },+ { status: 400 }+ );+ }+if (unitPricesByQuantity.data.length !== quantities.data.length) {return data({ data: null, errors: "Prices and quantities must have the same length" },@@ -80,6 +97,7 @@ export async function action({ request, params }: ActionFunctionArgs) {quoteLineId: lineId,quantity,unitPrice,+ priceTrace: priceTracesByQuantity.data[index] ?? null,createdBy: userId,// discountPercent / leadTime / shippingCost are intentionally omitted so// upsertQuoteLinePrices preserves the user-entered values for each quantitydiff --git a/apps/erp/app/routes/x+/quote+/$quoteId.tsx b/apps/erp/app/routes/x+/quote+/$quoteId.tsxindex 30359ae68f..65a4588ff0 100644--- a/apps/erp/app/routes/x+/quote+/$quoteId.tsx+++ b/apps/erp/app/routes/x+/quote+/$quoteId.tsx@@ -278,7 +278,7 @@ export default function QuoteRoute() {<ResizablePanelsexplorer={<QuoteExplorer methods={methods} />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.tsx b/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.tsxindex 35d80d07d9..5739a9a347 100644--- a/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.tsx+++ b/apps/erp/app/routes/x+/sales-invoice+/$invoiceId.tsx@@ -157,7 +157,7 @@ export default function SalesInvoiceRoute() {<ResizablePanelsexplorer={<SalesInvoiceExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx b/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.details.tsxindex 4446d70cf0..a4ad80587a 100644--- a/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx+++ b/apps/erp/app/routes/x+/sales-order+/$orderId.$lineId.details.tsx@@ -32,6 +32,7 @@ import { getItemReplenishment } from "~/modules/items";import { getJobsBySalesOrderLine } from "~/modules/production";import type {Opportunity,+ PriceTraceStep,SalesOrder,SalesOrderLineType} from "~/modules/sales";@@ -282,6 +283,7 @@ export default function EditSalesOrderLineRoute() {shippingCost: line?.shippingCost ?? 0,configuration:(line?.configuration as Record<string, unknown> | null) ?? null,+ priceTrace: (line?.priceTrace as PriceTraceStep[] | null) ?? null,assetReadableId: (line as any)?.assetReadableId ?? undefined,assetName: (line as any)?.assetName ?? undefined,...getCustomFields(line?.customFields)diff --git a/apps/erp/app/routes/x+/sales-order+/$orderId.tsx b/apps/erp/app/routes/x+/sales-order+/$orderId.tsxindex 82a1512b4c..a052fb36be 100644--- a/apps/erp/app/routes/x+/sales-order+/$orderId.tsx+++ b/apps/erp/app/routes/x+/sales-order+/$orderId.tsx@@ -238,7 +238,7 @@ export default function SalesOrderRoute() {<ResizablePanelsexplorer={<SalesOrderExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/sales-return-order+/$id.tsx b/apps/erp/app/routes/x+/sales-return-order+/$id.tsxindex 94cb960d7e..9730804cb9 100644--- a/apps/erp/app/routes/x+/sales-return-order+/$id.tsx+++ b/apps/erp/app/routes/x+/sales-return-order+/$id.tsx@@ -83,7 +83,7 @@ export default function SalesReturnOrderRoute() {<ResizablePanelsexplorer={<SalesReturnOrderExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/sales-rfq+/$rfqId.tsx b/apps/erp/app/routes/x+/sales-rfq+/$rfqId.tsxindex 2f35c61026..166328915d 100644--- a/apps/erp/app/routes/x+/sales-rfq+/$rfqId.tsx+++ b/apps/erp/app/routes/x+/sales-rfq+/$rfqId.tsx@@ -199,7 +199,7 @@ export default function SalesRFQRoute() {<ResizablePanelsexplorer={<SalesRFQExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/service+/$itemId.tsx b/apps/erp/app/routes/x+/service+/$itemId.tsxindex adc2b0f561..5e5534b1b2 100644--- a/apps/erp/app/routes/x+/service+/$itemId.tsx+++ b/apps/erp/app/routes/x+/service+/$itemId.tsx@@ -336,7 +336,7 @@ export default function ServiceRoute() {</div>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full"><Outlet /></div>}diff --git a/apps/erp/app/routes/x+/supplier-quote+/$id.tsx b/apps/erp/app/routes/x+/supplier-quote+/$id.tsxindex 03062c574f..203a6fc53e 100644--- a/apps/erp/app/routes/x+/supplier-quote+/$id.tsx+++ b/apps/erp/app/routes/x+/supplier-quote+/$id.tsx@@ -169,7 +169,7 @@ export default function SupplierQuoteRoute() {<ResizablePanelsexplorer={<SupplierQuoteExplorer />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><VStack spacing={4} className="p-4"><Outlet /></VStack>diff --git a/apps/erp/app/routes/x+/tool+/$itemId.tsx b/apps/erp/app/routes/x+/tool+/$itemId.tsxindex c447455e23..58f26f742e 100644--- a/apps/erp/app/routes/x+/tool+/$itemId.tsx+++ b/apps/erp/app/routes/x+/tool+/$itemId.tsx@@ -585,7 +585,7 @@ export default function ToolRoute() {</div>}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-hide w-full"><Outlet /></div>}diff --git a/apps/erp/app/routes/x+/training+/$id.tsx b/apps/erp/app/routes/x+/training+/$id.tsxindex 9b37739376..14ed4db280 100644--- a/apps/erp/app/routes/x+/training+/$id.tsx+++ b/apps/erp/app/routes/x+/training+/$id.tsx@@ -7,12 +7,13 @@ import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import { getLogger } from "@carbon/logger";import type { JSONContent } from "@carbon/react";-import { generateHTML, Input, useDebounce } from "@carbon/react";+import { generateHTML, useDebounce } from "@carbon/react";import { Editor } from "@carbon/react/Editor";import { isUnaffectedByNavigation } from "@carbon/utils";import { getLocalTimeZone, today } from "@internationalized/date";import { msg } from "@lingui/core/macro";-import { useState } from "react";+import { useLingui } from "@lingui/react/macro";+import { useEffect, useState } from "react";import type {LoaderFunctionArgs,ShouldRevalidateFunction@@ -34,6 +35,7 @@ import {} from "~/modules/resources";import { getTagsList } from "~/modules/shared";import type { action } from "~/routes/x+/training+/update";+import { useDocumentStore } from "~/stores";import { detailBreadcrumb, type Handle } from "~/utils/handle";import { path } from "~/utils/path";@@ -102,7 +104,7 @@ export default function TrainingRoute() {<ResizablePanelsexplorer={<TrainingExplorer key={`explorer-${id}`} />}content={- <div className="bg-muted dark:bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full">+ <div className="bg-card h-[calc(100dvh-var(--topbar-height)-var(--header-height)-var(--content-inset))] overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent w-full"><TrainingEditor /><Outlet /></div>@@ -120,6 +122,7 @@ function TrainingEditor() {const { id } = useParams();if (!id) throw new Error("Could not find id");+ const { t } = useLingui();const permissions = usePermissions();const loaderData = useLoaderData<typeof loader>();@@ -151,44 +154,53 @@ function TrainingEditor() {);const fetcher = useFetcher<typeof action>();+ const setLiveTitle = useDocumentStore((s) => s.setLiveTitle);- const updateTrainingName = async (name: string) => {- const formData = new FormData();+ const updateTrainingName = useDebounce(+ async (name: string) => {+ const formData = new FormData();- formData.append("ids", id);- formData.append("field", "name");- formData.append("value", name);+ formData.append("ids", id);+ formData.append("field", "name");+ formData.append("value", name);- fetcher.submit(formData, {- method: "post",- action: path.to.bulkUpdateTraining- });- };+ fetcher.submit(formData, {+ method: "post",+ action: path.to.bulkUpdateTraining+ });+ },+ 500,+ true+ );const onUploadImage = useImageUpload("training");+ const canEdit =+ permissions.can("update", "people") &&+ loaderData?.training?.status === "Draft";++ // Mirror the live title only while editing; clear it when editing ends (e.g.+ // a Draft→Active transition that doesn't remount the route) or on unmount, so+ // the header title bar can never show a stale edited title.+ useEffect(() => {+ if (!canEdit) setLiveTitle(null);+ return () => setLiveTitle(null);+ }, [canEdit, setLiveTitle]);+return (- <div className="flex flex-col gap-6 w-full h-full p-6">- <Input- className="md:text-3xl text-2xl font-semibold leading-none tracking-tight text-foreground"- value={trainingName}- borderless- onChange={- loaderData?.training?.status === "Draft"- ? (e) => setTrainingName(e.target.value)- : undefined- }- onBlur={- loaderData?.training?.status === "Draft"- ? (e) => updateTrainingName(e.target.value)- : undefined- }- />-- {permissions.can("update", "people") &&- loaderData?.training?.status === "Draft" ? (+ <div className="flex flex-col w-full h-full">+ {canEdit ? (<Editortoolbar+ title={{+ value: trainingName,+ placeholder: t`Untitled`,+ onChange: (name) => {+ setTrainingName(name);+ setLiveTitle(name);+ updateTrainingName(name);+ }+ }}initialValue={content}onUpload={onUploadImage}onChange={(value) => {@@ -197,12 +209,17 @@ function TrainingEditor() {}}/>) : (- <div- className="prose dark:prose-invert"- dangerouslySetInnerHTML={{- __html: generateHTML(content)- }}- />+ <div className="flex flex-col gap-6 w-full h-full p-8">+ <h1 className="md:text-3xl text-2xl font-semibold leading-tight tracking-tight text-foreground">+ {trainingName}+ </h1>+ <div+ className="prose dark:prose-invert"+ dangerouslySetInnerHTML={{+ __html: generateHTML(content)+ }}+ />+ </div>)}</div>);diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.tsindex 2211250179..2cd3d51139 100644--- a/apps/erp/app/utils/path.ts+++ b/apps/erp/app/utils/path.ts@@ -1991,6 +1991,8 @@ export const path = {generatePath(`${x}/quote/${quoteId}/${quoteLineId}/method/${methodId}`),quoteLineOrder: (quoteId: string) =>generatePath(`${x}/quote/${quoteId}/line-order`),+ quoteLinePriceTrace: (quoteId: string, lineId: string) =>+ generatePath(`${x}/quote/${quoteId}/${lineId}/price-trace`),quoteLineRecalculatePrice: (quoteId: string, lineId: string) =>generatePath(`${x}/quote/${quoteId}/${lineId}/recalculate-price`),quoteLineUpdatePrecision: (quoteId: string, lineId: string) =>diff --git a/packages/database/src/datasets/data/satellite/items.ts b/packages/database/src/datasets/data/satellite/items.tsindex 71ec768729..764cc77871 100644--- a/packages/database/src/datasets/data/satellite/items.ts+++ b/packages/database/src/datasets/data/satellite/items.ts@@ -876,6 +876,13 @@ export const CONFIGURATION: ConfigurationSpec = {field: "laborTime",code: 'return params.orbit_regime === "GTO" ? 96 : 72;'}+ ],+ prices: [+ { key: "payload_mass_kg", amount: 100 },+ { key: "orbit_regime", value: "LEO", amount: 2000 },+ { key: "orbit_regime", value: "SSO", amount: 3000 },+ { key: "orbit_regime", value: "GTO", amount: 4000 },+ { key: "propulsion_module", value: "true", amount: 1000 }]};diff --git a/packages/database/src/datasets/tiers/02-items.ts b/packages/database/src/datasets/tiers/02-items.tsindex 523d45df46..3f34762966 100644--- a/packages/database/src/datasets/tiers/02-items.ts+++ b/packages/database/src/datasets/tiers/02-items.ts@@ -395,7 +395,11 @@ export async function runTier2(ctx: Ctx): Promise<void> {name: spec.name,ruleType: spec.ruleType,amountType: spec.amountType,- amount: spec.amount,+ // The dataset states a percentage in points (5 = 5%); the pricing+ // engine multiplies by a fraction (price × amount), as the rule form+ // stores it.+ amount:+ spec.amountType === "Percentage" ? spec.amount / 100 : spec.amount,priority: spec.priority,customerIds: spec.customer? [need(ctx.refs.customers, spec.customer, "customer")]@@ -462,6 +466,28 @@ export async function runTier2(ctx: Ctx): Promise<void> {updatedBy: ctx.userId});}+ // The shape normalizePricingRule (sales.service.ts) gives a Configuration+ // rule: one item, Fixed 0, the prices carrying the parameter's label so the+ // price trace can name it.+ if (cfg.prices?.length) {+ const labelByKey = new Map(cfg.parameters.map((p) => [p.key, p.label]));+ await insertRow(ctx, "pricingRule", {+ name: `${cfg.item} Configuration`,+ ruleType: "Configuration",+ amountType: "Fixed",+ amount: 0,+ priority: 0,+ itemIds: [cfgItem.id],+ configurationPrices: JSON.stringify(+ cfg.prices.map((price) => ({+ key: price.key,+ value: price.value ?? null,+ amount: price.amount,+ label: labelByKey.get(price.key)+ }))+ )+ });+ }ctx.log("enforcement rules");for (const spec of data.enforcementRules) {diff --git a/packages/database/src/datasets/types.ts b/packages/database/src/datasets/types.tsindex 1b9481f9d9..ca4424e77a 100644--- a/packages/database/src/datasets/types.ts+++ b/packages/database/src/datasets/types.ts@@ -382,7 +382,8 @@ export type PricingRuleSpec = {name: string;ruleType: "Discount" | "Markup";amountType: "Percentage" | "Fixed";- /** Percent (0–100] for Percentage; a per-unit amount for Fixed. */+ /** Percent (0–100] for Percentage — tier 02 stores it as the fraction the+ * pricing engine expects; a per-unit amount for Fixed. */amount: number;customer?: string;customerType?: string;@@ -408,11 +409,23 @@ export type ConfigurationRuleSpec = {code: string;};+/** A surcharge one parameter adds to the configured item's price. `value` is+ * the list option, or "true" for a boolean; omitted, the amount is per unit+ * of a numeric parameter's value. */+export type ConfigurationPriceSpec = {+ key: string;+ value?: string;+ amount: number;+};+export type ConfigurationSpec = {item: string;group: string;parameters: ConfigurationParameterSpec[];rules: ConfigurationRuleSpec[];+ /** Seeded as the item's Configuration pricing rule ("<item> Configuration"),+ * so quotes and orders of a configured line price the chosen options. */+ prices?: ConfigurationPriceSpec[];};export type RuleOperator =diff --git a/packages/database/src/datasets/validate.ts b/packages/database/src/datasets/validate.tsindex f7bb930375..df5e456a90 100644--- a/packages/database/src/datasets/validate.ts+++ b/packages/database/src/datasets/validate.ts@@ -1767,6 +1767,31 @@ export function items(ctx: ValidationCtx): void {fail(`${where}: list parameter "${parameter.key}" has no listOptions`);}}+ // Each price must name a value the configurator can produce, or it never+ // applies (configurationSurcharge in sales.utils.ts).+ const parameterByKey = new Map(cfg.parameters.map((p) => [p.key, p]));+ for (const price of cfg.prices ?? []) {+ const priceWhere = `${where} price "${price.key}${price.value === undefined ? "" : `=${price.value}`}"`;+ const parameter = parameterByKey.get(price.key);+ if (!parameter) {+ fail(`${priceWhere}: unknown parameter`);+ continue;+ }+ if (!Number.isFinite(price.amount) || price.amount === 0) {+ fail(`${priceWhere}: amount must be a non-zero number`);+ }+ const valueOk =+ parameter.dataType === "numeric"+ ? price.value === undefined+ : parameter.dataType === "boolean"+ ? price.value === "true"+ : (parameter.listOptions ?? []).includes(price.value ?? "");+ if (!valueOk) {+ fail(+ `${priceWhere}: not a value of ${parameter.dataType} parameter "${parameter.key}"`+ );+ }+ }}const revisionByItem = new Map(diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.tsindex 72b79d7547..fe52c33282 100644--- a/packages/database/src/swagger-docs-schema.ts+++ b/packages/database/src/swagger-docs-schema.ts@@ -67503,6 +67503,9 @@ export default {{$ref: "#/parameters/rowFilter.quoteLinePrice.convertedShippingCost"},+ {+ $ref: "#/parameters/rowFilter.quoteLinePrice.priceTrace"+ },{$ref: "#/parameters/select"},@@ -67625,6 +67628,9 @@ export default {{$ref: "#/parameters/rowFilter.quoteLinePrice.convertedShippingCost"},+ {+ $ref: "#/parameters/rowFilter.quoteLinePrice.priceTrace"+ },{$ref: "#/parameters/preferReturn"}@@ -67701,6 +67707,9 @@ export default {{$ref: "#/parameters/rowFilter.quoteLinePrice.convertedShippingCost"},+ {+ $ref: "#/parameters/rowFilter.quoteLinePrice.priceTrace"+ },{$ref: "#/parameters/body.quoteLinePrice"},@@ -138865,6 +138874,9 @@ export default {convertedShippingCost: {format: "numeric",type: "number"+ },+ priceTrace: {+ format: "jsonb"}},type: "object"@@ -187479,6 +187491,12 @@ export default {in: "query",type: "string"},+ "rowFilter.quoteLinePrice.priceTrace": {+ name: "priceTrace",+ required: false,+ in: "query",+ type: "string"+ },"body.attributeDataType": {name: "attributeDataType",description: "attributeDataType",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 4f7961d104..f9289ddf30 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -46712,6 +46712,7 @@ export type Database = {netExtendedPrice: number | nullnetUnitPrice: number | nullpriceSource: string+ priceTrace: Json | nullquantity: numberquoteId: stringquoteLineId: string@@ -46735,6 +46736,7 @@ export type Database = {netExtendedPrice?: number | nullnetUnitPrice?: number | nullpriceSource?: string+ priceTrace?: Json | nullquantity?: numberquoteId: stringquoteLineId: string@@ -46758,6 +46760,7 @@ export type Database = {netExtendedPrice?: number | nullnetUnitPrice?: number | nullpriceSource?: string+ priceTrace?: Json | nullquantity?: numberquoteId?: stringquoteLineId?: stringdiff --git a/packages/database/supabase/functions/convert/index.ts b/packages/database/supabase/functions/convert/index.tsindex 70f5c98fc4..6330917ede 100644--- a/packages/database/supabase/functions/convert/index.ts+++ b/packages/database/supabase/functions/convert/index.ts@@ -10,6 +10,7 @@ import { datetime, getCompanyTimeZone } from "../lib/datetime.ts";import { getFunctionLogger } from "../lib/logging.ts";import { toJson } from "../lib/json.ts";+import { quoteToOrderPriceTrace } from "../lib/price-trace.ts";import { RecordNotFoundError } from "../lib/company-records.ts";import { corsPreflight, errorResponse, jsonResponse } from "../lib/response.ts";import { requirePermissions } from "../lib/supabase.ts";@@ -727,6 +728,15 @@ serve(async (req: Request) => {status: "Ordered",unitOfMeasureCode: line.unitOfMeasureCode,unitPrice: price.netUnitPrice ?? 0,+ // How the quoted price was reached, carried onto the order.+ priceTrace: toJson(+ quoteToOrderPriceTrace(+ price.priceTrace,+ price.unitPrice ?? 0,+ price.netUnitPrice ?? 0,+ price.discountPercent ?? 0+ )+ ),promisedDate: todayDate.add({ days: price.leadTime ?? 0 }).toString(),diff --git a/packages/database/supabase/functions/get-method/index.ts b/packages/database/supabase/functions/get-method/index.tsindex 4bf8e54774..f93d9a83da 100644--- a/packages/database/supabase/functions/get-method/index.ts+++ b/packages/database/supabase/functions/get-method/index.ts@@ -7199,8 +7199,10 @@ serve(async (req: Request) => {l.exchangeRate ?? sourceQuote.data?.exchangeRate ?? 1,categoryMarkups: JSON.stringify(l.categoryMarkups ?? {}),// Copied prices keep their provenance so a manual price- // stays protected on the new quote/revision.+ // stays protected on the new quote/revision, and the+ // trace that explains it.priceSource: l.priceSource ?? "system",+ priceTrace: toJson(l.priceTrace),createdBy: userId,})))diff --git a/packages/database/supabase/functions/lib/price-trace.test.ts b/packages/database/supabase/functions/lib/price-trace.test.tsnew file mode 100644index 0000000000..0d5e61f0aa--- /dev/null+++ b/packages/database/supabase/functions/lib/price-trace.test.ts@@ -0,0 +1,45 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";+import { quoteToOrderPriceTrace } from "./price-trace.ts";++const quoteTrace = [+ { step: "Base Price", source: "Cost + Markup", amount: 100 },+ {+ step: "Markup",+ source: "Rule: Aerospace",+ amount: 110,+ adjustment: 10,+ ruleId: "pr1",+ },+ { step: "Final Price", source: "Resolved", amount: 110 },+];++Deno.test("a quote break with no trace gives the order line none", () => {+ assertEquals(quoteToOrderPriceTrace(null, 110, 110, 0), null);+ assertEquals(quoteToOrderPriceTrace([], 110, 110, 0), null);+});++Deno.test("an undiscounted break keeps its steps and ends at the price", () => {+ assertEquals(quoteToOrderPriceTrace(quoteTrace, 110, 110, 0), [+ quoteTrace[0],+ quoteTrace[1],+ { step: "Final Price", source: "Quote", amount: 110 },+ ]);+});++Deno.test("the quote line discount is a step down to the net price", () => {+ assertEquals(quoteToOrderPriceTrace(quoteTrace, 110, 99, 0.1), [+ quoteTrace[0],+ quoteTrace[1],+ {+ step: "Discount",+ source: "Quote Discount (10%)",+ amount: 99,+ adjustment: -11,+ },+ { step: "Final Price", source: "Quote", amount: 99 },+ ]);+});diff --git a/packages/database/supabase/functions/lib/price-trace.ts b/packages/database/supabase/functions/lib/price-trace.tsnew file mode 100644index 0000000000..8799b4fa3f--- /dev/null+++ b/packages/database/supabase/functions/lib/price-trace.ts@@ -0,0 +1,45 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,+// including ports, remain AGPLv3; serving them over a network requires releasing their source.++import { round } from "../shared/precision.ts";++// The PriceTraceStep shape (apps/erp/app/modules/sales/types.ts) — the edge+// runtime cannot import app code.+export type PriceTraceStep = {+ step: string;+ source: string;+ amount: number;+ adjustment?: number;+ ruleId?: string;+ label?: string;+};++/**+ * The trace a sales order line converted from a quote carries: the quote+ * break's own trace, then the quote line discount, ending at the net unit+ * price the order line is written with. Null when the break has no trace — a+ * manual price, or one priced before traces were recorded — since nothing+ * explains it.+ */+export function quoteToOrderPriceTrace(+ trace: unknown,+ unitPrice: number,+ netUnitPrice: number,+ discountPercent: number+): PriceTraceStep[] | null {+ if (!Array.isArray(trace) || trace.length === 0) return null;+ const steps = (trace as PriceTraceStep[]).filter(+ (step) => step.step !== "Final Price"+ );+ if (discountPercent > 0) {+ steps.push({+ step: "Discount",+ source: `Quote Discount (${round(discountPercent * 100)}%)`,+ amount: netUnitPrice,+ adjustment: netUnitPrice - unitPrice+ });+ }+ steps.push({ step: "Final Price", source: "Quote", amount: netUnitPrice });+ return steps;+}diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 4f7961d104..f9289ddf30 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -46712,6 +46712,7 @@ export type Database = {netExtendedPrice: number | nullnetUnitPrice: number | nullpriceSource: string+ priceTrace: Json | nullquantity: numberquoteId: stringquoteLineId: string@@ -46735,6 +46736,7 @@ export type Database = {netExtendedPrice?: number | nullnetUnitPrice?: number | nullpriceSource?: string+ priceTrace?: Json | nullquantity?: numberquoteId: stringquoteLineId: string@@ -46758,6 +46760,7 @@ export type Database = {netExtendedPrice?: number | nullnetUnitPrice?: number | nullpriceSource?: string+ priceTrace?: Json | nullquantity?: numberquoteId?: stringquoteLineId?: stringdiff --git a/packages/database/supabase/migrations/20261001125824_quote-line-price-trace.sql b/packages/database/supabase/migrations/20261001125824_quote-line-price-trace.sqlnew file mode 100644index 0000000000..f695403fab--- /dev/null+++ b/packages/database/supabase/migrations/20261001125824_quote-line-price-trace.sql@@ -0,0 +1,13 @@+-- Record how each quote line price was reached, per quantity break.+--+-- Pricing rules are edited in place, so re-running today's rules cannot+-- explain a price set under yesterday's. "priceTrace" is the PriceTraceStep[]+-- the pricing run produced (base → overrides → rules → final), written with+-- the price it explains. NULL means no rule produced the price: a manual+-- ('manual' priceSource) price, or a row priced before this column existed.+--+-- quoteLine."priceTrace" (20260413120001_pricing-rules.sql) is one trace per+-- line and cannot describe several quantity breaks; nothing fills it (quote+-- copies carry it over, always NULL).++ALTER TABLE "quoteLinePrice" ADD COLUMN IF NOT EXISTS "priceTrace" JSONB;diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.poindex 2097285071..7cc5350ba7 100644--- a/packages/locale/locales/de/erp.po+++ b/packages/locale/locales/de/erp.po@@ -8763,6 +8763,9 @@ msgstr "Kontonummer verbergen"msgid "Hide Again"msgstr "Erneut ausblenden"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Roh ausblenden"@@ -8934,6 +8937,9 @@ msgstr "Wie der aufgelöste Preis berechnet wurde."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Wie die Stichprobengröße entschieden wird — Alle inspizieren, Erste N inspizieren, Prozentsatz des Loses oder AQL (Z1.4 / ISO 2859-1). Jeder Modus zeigt seine eigenen Parameterfelder unten."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Wie dieses Prüfmittel verwendet wird — Normal (regelmäßige Überprüfungen) oder Referenz (kalibriert andere Prüfmittel)."@@ -11952,6 +11958,9 @@ msgstr "Keine Preisfindung für die ausgewählte Menge"msgid "No pricing options found"msgstr "Keine Preisfindungsoptionen gefunden"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Kein Drucker konfiguriert"@@ -13631,6 +13640,9 @@ msgstr "Preislisten"msgid "Price override"msgstr "Preisübersteuerung"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Preise"@@ -14158,6 +14170,10 @@ msgstr "Mengen"msgid "Quantity"msgstr "Menge"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Eintreffende Menge – aus offenen Bestellungen plus aus Produktionsaufträgen (Herstellen)."@@ -14942,6 +14958,13 @@ msgstr "Berichtsdimension"msgid "Reports"msgstr "Berichte"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Erneut drucken"@@ -16698,6 +16721,9 @@ msgstr "Verfügbare Losnummern anzeigen"msgid "Show available tracking numbers"msgstr "Verfügbare Verfolgungsnummern anzeigen"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Kundenkennung anzeigen"@@ -18902,6 +18928,9 @@ msgstr "Diese PIN wird nicht mehr angezeigt. Wenn Sie sie vergessen haben, setzemsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Diese PIN wird nicht mehr angezeigt. Sie benötigen sie, um den Konsolenmodus auf MES-Terminals zu beenden."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "diese Bestellung"diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.poindex 6e2c2b3897..2d984a4a79 100644--- a/packages/locale/locales/en/erp.po+++ b/packages/locale/locales/en/erp.po@@ -8763,6 +8763,9 @@ msgstr "Hide account number"msgid "Hide Again"msgstr "Hide Again"+msgid "Hide calculation"+msgstr "Hide calculation"+msgid "Hide raw"msgstr "Hide raw"@@ -8934,6 +8937,9 @@ msgstr "How the resolved price was calculated."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."+msgid "How the unit price of each quantity was calculated."+msgstr "How the unit price of each quantity was calculated."+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."@@ -11952,6 +11958,9 @@ msgstr "No pricing for selected quantity"msgid "No pricing options found"msgstr "No pricing options found"+msgid "No pricing rules apply to this quantity."+msgstr "No pricing rules apply to this quantity."+msgid "No printer configured"msgstr "No printer configured"@@ -13631,6 +13640,9 @@ msgstr "Price Lists"msgid "Price override"msgstr "Price override"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr "Priced before pricing traces were recorded — this is today's calculation."+msgid "Prices"msgstr "Prices"@@ -14158,6 +14170,10 @@ msgstr "Quantities"msgid "Quantity"msgstr "Quantity"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr "Quantity {0}"+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Quantity arriving — on open purchase orders plus on production (make) orders."@@ -14942,6 +14958,13 @@ msgstr "Reporting dimension"msgid "Reports"msgstr "Reports"+msgid "Reprice with current rules"+msgstr "Reprice with current rules"++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr "Repricing with today's rules and costs gives <0>{0}</0>."+msgid "Reprint"msgstr "Reprint"@@ -16698,6 +16721,9 @@ msgstr "Show available batch numbers"msgid "Show available tracking numbers"msgstr "Show available tracking numbers"+msgid "Show calculation"+msgstr "Show calculation"+msgid "Show Customer IDs"msgstr "Show Customer IDs"@@ -18902,6 +18928,9 @@ msgstr "This PIN will not be shown again. If it is lost, reset it from the operamsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "This PIN will not be shown again. You will need it to exit console mode on MES terminals."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr "This price was entered manually, so no pricing rules were applied."+msgid "this purchase order"msgstr "this purchase order"diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.poindex b691b7c3d4..144d512931 100644--- a/packages/locale/locales/es/erp.po+++ b/packages/locale/locales/es/erp.po@@ -8763,6 +8763,9 @@ msgstr "Ocultar número de cuenta"msgid "Hide Again"msgstr "Ocultar de nuevo"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Ocultar sin procesar"@@ -8934,6 +8937,9 @@ msgstr "Cómo se calculó el precio resuelto."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Cómo se decide el tamaño de la muestra — Inspeccionar Todo, Inspeccionar los Primeros N, Porcentaje del Lote o AQL (Z1.4 / ISO 2859-1). Cada modo revela sus propios campos de parámetros a continuación."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Cómo se utiliza este instrumento de medición — Estándar (verificaciones regulares) o Maestro (calibra otros instrumentos)."@@ -11952,6 +11958,9 @@ msgstr "Sin fijación de precios para la cantidad seleccionada"msgid "No pricing options found"msgstr "No se encontraron opciones de fijación de precios"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Sin impresora configurada"@@ -13631,6 +13640,9 @@ msgstr "Listas de Precios"msgid "Price override"msgstr "Sobrescritura de precio"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Precios"@@ -14158,6 +14170,10 @@ msgstr "Cantidades"msgid "Quantity"msgstr "Cantidad"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Cantidad por llegar: en órdenes de compra abiertas más en órdenes de producción (fabricación)."@@ -14942,6 +14958,13 @@ msgstr "Dimensión de informe"msgid "Reports"msgstr "Informes"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Reimprimir"@@ -16698,6 +16721,9 @@ msgstr "Muestra números de lote disponibles"msgid "Show available tracking numbers"msgstr "Mostrar números de seguimiento disponibles"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Mostrar IDs de Cliente"@@ -18902,6 +18928,9 @@ msgstr "Este PIN no se mostrará nuevamente. Si se pierde, restablézcalo desdemsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Este PIN no se mostrará nuevamente. Lo necesitará para salir del modo de consola en terminales MES."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "esta orden de compra"diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.poindex 08b9e7fe90..a96dcd9d62 100644--- a/packages/locale/locales/fr/erp.po+++ b/packages/locale/locales/fr/erp.po@@ -8763,6 +8763,9 @@ msgstr "Masquer le numéro de compte"msgid "Hide Again"msgstr "Masquer à nouveau"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Masquer le brut"@@ -8934,6 +8937,9 @@ msgstr "Comment le prix résolu a été calculé."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Comment la taille d'échantillon est décidée — Inspecter tout, Inspecter les N premiers, Pourcentage du lot ou AQL (Z1.4 / ISO 2859-1). Chaque mode affiche ses propres champs de paramètre ci-dessous."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Comment cet instrument de mesure est utilisé — Standard (contrôles réguliers) ou Maître (étalonner d'autres instruments)."@@ -11952,6 +11958,9 @@ msgstr "Aucune tarification pour la quantité sélectionnée"msgid "No pricing options found"msgstr "Aucune option de tarification trouvée"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Aucune imprimante configurée"@@ -13631,6 +13640,9 @@ msgstr "Listes de prix"msgid "Price override"msgstr "Substitution de prix"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Prix"@@ -14158,6 +14170,10 @@ msgstr "Quantités"msgid "Quantity"msgstr "Quantité"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Quantité à venir — sur les bons de commande ouverts plus sur les ordres de production (fabrication)."@@ -14942,6 +14958,13 @@ msgstr "Axe analytique"msgid "Reports"msgstr "Rapports"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Réimprimer"@@ -16698,6 +16721,9 @@ msgstr "Afficher les numéros de lot disponibles"msgid "Show available tracking numbers"msgstr "Afficher les numéros de suivi disponibles"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Afficher les ID clients"@@ -18902,6 +18928,9 @@ msgstr "Ce code PIN ne sera plus affiché. Si vous l'avez oublié, réinitialisemsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Ce code PIN ne sera plus affiché. Vous en aurez besoin pour quitter le mode console sur les terminaux MES."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "ce bon de commande"diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.poindex cbb63650c9..4feeff4a39 100644--- a/packages/locale/locales/hi/erp.po+++ b/packages/locale/locales/hi/erp.po@@ -8763,6 +8763,9 @@ msgstr "खाता संख्या छिपाएँ"msgid "Hide Again"msgstr "फिर से छिपाएँ"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "कच्चे को छुपाएं"@@ -8934,6 +8937,9 @@ msgstr "हल की गई कीमत की गणना कैसे कmsgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "नमूना आकार कैसे तय किया जाता है — सभी निरीक्षण करें, पहले N निरीक्षण करें, बहुत की प्रतिशत या AQL (Z1.4 / ISO 2859-1)। प्रत्येक मोड नीचे अपने स्वयं के पैरामीटर फ़ील्ड प्रकट करता है।"+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "यह गेज कैसे उपयोग किया जाता है — मानक (नियमित जांच) या मास्टर (अन्य गेज को कैलिब्रेट करता है)।"@@ -11952,6 +11958,9 @@ msgstr "चयनित मात्रा के लिए कोई मूलmsgid "No pricing options found"msgstr "कोई मूल्य निर्धारण विकल्प नहीं मिला"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "कोई प्रिंटर कॉन्फ़िगर नहीं किया गया"@@ -13631,6 +13640,9 @@ msgstr "मूल्य सूचियाँ"msgid "Price override"msgstr "मूल्य ओवरराइड"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "कीमतें"@@ -14158,6 +14170,10 @@ msgstr "मात्रा"msgid "Quantity"msgstr "मात्रा"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "आने वाली मात्रा — खुले क्रय आदेशों पर साथ ही उत्पादन (निर्माण) आदेशों पर।"@@ -14942,6 +14958,13 @@ msgstr "रिपोर्टिंग आयाम"msgid "Reports"msgstr "रिपोर्ट"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "दोबारा प्रिंट करें"@@ -16698,6 +16721,9 @@ msgstr "उपलब्ध बैच नंबर दिखाएं"msgid "Show available tracking numbers"msgstr "उपलब्ध ट्रैकिंग संख्याएँ दिखाएँ"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "ग्राहक आईडी दिखाएं"@@ -18902,6 +18928,9 @@ msgstr "यह PIN फिर से नहीं दिखाया जाएगmsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "यह PIN फिर से नहीं दिखाया जाएगा। MES टर्मिनल पर कंसोल मोड से बाहर निकलने के लिए आपको इसकी आवश्यकता होगी।"+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "यह क्रय आदेश"diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.poindex 9b6e9fcc29..158d3307b4 100644--- a/packages/locale/locales/it/erp.po+++ b/packages/locale/locales/it/erp.po@@ -8763,6 +8763,9 @@ msgstr "Nascondi il numero di conto"msgid "Hide Again"msgstr "Nascondi di nuovo"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Nascondi raw"@@ -8934,6 +8937,9 @@ msgstr "Come è stato calcolato il prezzo risolto."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Come viene decisa la dimensione del campione — Ispeziona Tutto, Ispeziona i Primi N, Percentuale del Lotto o AQL (Z1.4 / ISO 2859-1). Ogni modalità rivela i suoi campi di parametri di seguito."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Come viene utilizzato questo strumento di misurazione: Standard (controlli regolari) o Master (calibra altri strumenti)."@@ -11952,6 +11958,9 @@ msgstr "Nessun prezzo per la quantità selezionata"msgid "No pricing options found"msgstr "Nessuna opzione di prezzo trovata"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Nessuna stampante configurata"@@ -13631,6 +13640,9 @@ msgstr "Listini Prezzi"msgid "Price override"msgstr "Forzatura del prezzo"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Prezzi"@@ -14158,6 +14170,10 @@ msgstr "Quantità"msgid "Quantity"msgstr "Quantità"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Quantità in arrivo: su ordini d'acquisto aperti più su ordini di produzione (fabbricazione)."@@ -14942,6 +14958,13 @@ msgstr "Dimensione di reporting"msgid "Reports"msgstr "Rapporti"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Ristampa"@@ -16698,6 +16721,9 @@ msgstr "Mostra i numeri di lotto di produzione disponibili"msgid "Show available tracking numbers"msgstr "Mostra numeri di tracciamento disponibili"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Mostra ID Cliente"@@ -18902,6 +18928,9 @@ msgstr "Questo PIN non verrà più visualizzato. Se viene smarrito, reimpostalomsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Questo PIN non verrà più visualizzato. Ne avrai bisogno per uscire dalla modalità console sui terminali MES."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "questo ordine di acquisto"diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.poindex b3dbb527aa..c814594ed8 100644--- a/packages/locale/locales/ja/erp.po+++ b/packages/locale/locales/ja/erp.po@@ -8763,6 +8763,9 @@ msgstr "口座番号を隠す"msgid "Hide Again"msgstr "もう一度非表示"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "生データを非表示"@@ -8934,6 +8937,9 @@ msgstr "解決された価格がどのように計算されたかを示しますmsgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "サンプルサイズがどのように決定されるか—すべてを検査、最初のNを検査、ロットのパーセンテージまたはAQL(Z1.4 / ISO 2859-1)。各モードは下記の独自のパラメータフィールドを表示します。"+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "この測定器の使用方法 — なみ検査(通常のチェック)または標準器(他の測定器を校正)"@@ -11952,6 +11958,9 @@ msgstr "選択した数量の価格設定がありません"msgid "No pricing options found"msgstr "価格設定オプションが見つかりません"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "プリンターが設定されていません"@@ -13631,6 +13640,9 @@ msgstr "価格リスト"msgid "Price override"msgstr "価格上書き"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "価格"@@ -14158,6 +14170,10 @@ msgstr "数量"msgid "Quantity"msgstr "数量"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "入荷予定数量 — 未処理の発注書および生産(製造)注文の分。"@@ -14942,6 +14958,13 @@ msgstr "報告ディメンション"msgid "Reports"msgstr "レポート"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "再印刷"@@ -16698,6 +16721,9 @@ msgstr "利用可能なバッチ番号を表示"msgid "Show available tracking numbers"msgstr "利用可能な追跡番号を表示"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "得意先IDを表示"@@ -18902,6 +18928,9 @@ msgstr "このPINは再度表示されません。紛失した場合は、作業msgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "このPINは再度表示されません。MES 端末でコンソールモードを終了するときに必要です。"+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "この発注書"diff --git a/packages/locale/locales/ko/erp.po b/packages/locale/locales/ko/erp.poindex dff3bdd375..08091e1ad8 100644--- a/packages/locale/locales/ko/erp.po+++ b/packages/locale/locales/ko/erp.po@@ -8763,6 +8763,9 @@ msgstr "계좌 번호 숨기기"msgid "Hide Again"msgstr "다시 숨기기"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "원본 숨기기"@@ -8934,6 +8937,9 @@ msgstr "확정된 가격이 계산된 방식입니다."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "샘플 크기를 결정하는 방식 — 전수 검사, 처음 N개 검사, 로트 비율, 또는 AQL(Z1.4 / ISO 2859-1). 각 모드는 아래에 고유한 파라미터 필드를 표시합니다."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "이 계측기의 사용 방식 — 보통 검사(정기 점검) 또는 표준기(다른 계측기 교정)."@@ -11952,6 +11958,9 @@ msgstr "선택한 수량에 대한 가격 책정이 없습니다."msgid "No pricing options found"msgstr "가격 책정 옵션을 찾을 수 없습니다."+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "설정된 프린터가 없습니다"@@ -13631,6 +13640,9 @@ msgstr "가격표"msgid "Price override"msgstr "가격 재정의"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "가격"@@ -14158,6 +14170,10 @@ msgstr "수량"msgid "Quantity"msgstr "수량"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "도착 예정 수량 — 미결 발주서 및 생산(사내 생산) 작업 지시상의 수량입니다."@@ -14942,6 +14958,13 @@ msgstr "보고 차원"msgid "Reports"msgstr "보고서"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "재출력"@@ -16698,6 +16721,9 @@ msgstr "가용 배치 번호 표시"msgid "Show available tracking numbers"msgstr "가용 추적 번호 표시"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "고객 ID 표시"@@ -18902,6 +18928,9 @@ msgstr "이 PIN은 다시 표시되지 않습니다. 분실한 경우 작업자msgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "이 PIN은 다시 표시되지 않습니다. MES 터미널에서 콘솔 모드를 종료할 때 필요합니다."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "이 발주서"diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.poindex 005a27533d..f055596358 100644--- a/packages/locale/locales/pl/erp.po+++ b/packages/locale/locales/pl/erp.po@@ -8763,6 +8763,9 @@ msgstr "Ukryj numer konta"msgid "Hide Again"msgstr "Ukryj ponownie"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Ukryj surowe"@@ -8934,6 +8937,9 @@ msgstr "Jak została obliczona ostateczna cena."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Jak decyduje się o wielkości próbki — Sprawdzić Wszystko, Sprawdzić Pierwsze N, Procent Partii lub AQL (Z1.4 / ISO 2859-1). Każdy tryb ujawnia poniżej swoje własne pola parametrów."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Jak ten przyrząd pomiarowy jest używany — Normalna (regularne sprawdzenia) czy Wzorzec (wzorcuje inne przyrządy pomiarowe)."@@ -11952,6 +11958,9 @@ msgstr "Brak wyceny dla wybranej ilości"msgid "No pricing options found"msgstr "Nie znaleziono opcji ceny"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Brak skonfigurowanej drukarki"@@ -13631,6 +13640,9 @@ msgstr "Cenniki"msgid "Price override"msgstr "Nadpisanie ceny"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Ceny"@@ -14158,6 +14170,10 @@ msgstr "Ilości"msgid "Quantity"msgstr "Ilość"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Ilość przychodząca — z otwartych zamówień zakupu oraz ze zleceń produkcyjnych (produkcja)."@@ -14942,6 +14958,13 @@ msgstr "Wymiar raportowania"msgid "Reports"msgstr "Raporty"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Wydruk ponownie"@@ -16698,6 +16721,9 @@ msgstr "Pokaż dostępne numery partii produkcyjnej"msgid "Show available tracking numbers"msgstr "Pokaż dostępne numery śledzenia"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Pokaż identyfikatory klientów"@@ -18902,6 +18928,9 @@ msgstr "Ten PIN nie będzie już więcej wyświetlany. Jeśli zostanie utracony,msgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Ten PIN nie będzie już więcej wyświetlany. Będzie ci potrzebny do wyjścia z trybu konsoli na terminalach MES."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "to zamówienie zakupu"diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.poindex b576e979f2..f79eaeac70 100644--- a/packages/locale/locales/pt/erp.po+++ b/packages/locale/locales/pt/erp.po@@ -8763,6 +8763,9 @@ msgstr "Ocultar número da conta"msgid "Hide Again"msgstr "Ocultar Novamente"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Ocultar bruto"@@ -8934,6 +8937,9 @@ msgstr "Como o preço resolvido foi calculado."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Como o tamanho da amostra é decidido — Inspecionar Tudo, Inspecionar Primeiro N, Percentual do Lote ou AQL (Z1.4 / ISO 2859-1). Cada modo revela seus próprios campos de parâmetros abaixo."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Como este instrumento de medição é usado — Normal (verificações regulares) ou Padrão (calibra outros instrumentos de medição)."@@ -11952,6 +11958,9 @@ msgstr "Nenhuma precificação para a quantidade selecionada"msgid "No pricing options found"msgstr "Nenhuma opção de precificação encontrada"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Nenhuma impressora configurada"@@ -13631,6 +13640,9 @@ msgstr "Listas de Preços"msgid "Price override"msgstr "Sobrescrita de preço"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Preços"@@ -14158,6 +14170,10 @@ msgstr "Quantidades"msgid "Quantity"msgstr "Quantidade"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Quantidade a chegar — em pedidos de compra abertos mais em ordens de produção (fabricação)."@@ -14942,6 +14958,13 @@ msgstr "Dimensão de relatório"msgid "Reports"msgstr "Relatórios"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Reimprimir"@@ -16698,6 +16721,9 @@ msgstr "Mostrar números de lote de produção disponíveis"msgid "Show available tracking numbers"msgstr "Mostrar números de rastreamento disponíveis"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Mostrar IDs de Cliente"@@ -18902,6 +18928,9 @@ msgstr "Este PIN não será exibido novamente. Se você o perdeu, redefina-o namsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Este PIN não será exibido novamente. Você precisará dele para sair do modo de console em terminais MES."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "este pedido de compra"diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.poindex 79a5c71085..06f7901a78 100644--- a/packages/locale/locales/ru/erp.po+++ b/packages/locale/locales/ru/erp.po@@ -8763,6 +8763,9 @@ msgstr "Скрыть номер счёта"msgid "Hide Again"msgstr "Скрыть снова"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Скрыть исходное"@@ -8934,6 +8937,9 @@ msgstr "Как была рассчитана окончательная ценаmsgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Как определяется объем выборки — проверить все, проверить первые N, процент партии или AQL (Z1.4 / ISO 2859-1). Каждый режим показывает свои собственные поля параметров ниже."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Как используется это средство измерения — Нормальный (регулярные проверки) или Эталон (калибрует другие средства измерения)."@@ -11952,6 +11958,9 @@ msgstr "Нет ценообразования для выбранного колmsgid "No pricing options found"msgstr "Варианты ценообразования не найдены"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Принтер не настроен"@@ -13631,6 +13640,9 @@ msgstr "Прайс-листы"msgid "Price override"msgstr "Переопределение цены"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Цены"@@ -14158,6 +14170,10 @@ msgstr "Количества"msgid "Quantity"msgstr "Количество"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Поступающее количество — из открытых заказов поставщику и производственных заказов."@@ -14942,6 +14958,13 @@ msgstr "Измерение отчётности"msgid "Reports"msgstr "Отчеты"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Перепечать"@@ -16698,6 +16721,9 @@ msgstr "Показать доступные номера серии"msgid "Show available tracking numbers"msgstr "Показать доступные номера отслеживания"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Показывать ID Покупателей"@@ -18902,6 +18928,9 @@ msgstr "Этот PIN больше не будет показан. Если онmsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Этот PIN больше не будет показан. Он вам понадобится для выхода из режима консоли на терминалах MES."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "этот заказ поставщику"diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.poindex ccd60461ff..dd1be55e8b 100644--- a/packages/locale/locales/tr/erp.po+++ b/packages/locale/locales/tr/erp.po@@ -8763,6 +8763,9 @@ msgstr "Hesap numarasını gizle"msgid "Hide Again"msgstr "Tekrar Gizle"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "Ham verileri gizle"@@ -8934,6 +8937,9 @@ msgstr "Çözülen fiyatın nasıl hesaplandığı."msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "Örneklem büyüklüğünün nasıl belirlendiği — Tümünü İncele, İlk N'yi İncele, Lot'un Yüzdesi veya AQL (Z1.4 / ISO 2859-1). Her mod aşağıda kendi parametre alanlarını ortaya koymaktadır."+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "Bu ölçüm aletinin nasıl kullanıldığı — Normal (düzenli kontroller) veya Mastar (diğer ölçüm aletlerini kalibre eder)."@@ -11952,6 +11958,9 @@ msgstr "Seçilen miktar için fiyatlandırma yok"msgid "No pricing options found"msgstr "Fiyatlandırma seçeneği bulunamadı"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "Yazıcı yapılandırılmadı"@@ -13631,6 +13640,9 @@ msgstr "Fiyat Listeleri"msgid "Price override"msgstr "Fiyat geçersiz kılma"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "Fiyatlar"@@ -14158,6 +14170,10 @@ msgstr "Miktarlar"msgid "Quantity"msgstr "Miktar"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "Gelecek miktar — açık satın alma siparişlerinde ve üretim (üretme) siparişlerinde."@@ -14942,6 +14958,13 @@ msgstr "Raporlama boyutu"msgid "Reports"msgstr "Raporlar"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "Yeniden Yazdır"@@ -16698,6 +16721,9 @@ msgstr "Kullanılabilir parti numaralarını göster"msgid "Show available tracking numbers"msgstr "Kullanılabilir izleme numaralarını göster"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "Müşteri Kimliklerini Göster"@@ -18902,6 +18928,9 @@ msgstr "Bu PIN bir daha gösterilmeyecek. Kaybolduysa, operatörler listesindenmsgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "Bu PIN bir daha gösterilmeyecek. MES terminal'lerinde konsol modundan çıkmak için gerekli olacak."+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "bu satın alma siparişi"diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.poindex 49c166de03..00fae93d9e 100644--- a/packages/locale/locales/zh/erp.po+++ b/packages/locale/locales/zh/erp.po@@ -8763,6 +8763,9 @@ msgstr "隐藏账户号码"msgid "Hide Again"msgstr "再次隐藏"+msgid "Hide calculation"+msgstr ""+msgid "Hide raw"msgstr "隐藏原始内容"@@ -8934,6 +8937,9 @@ msgstr "已解决价格的计算方式。"msgid "How the sample size is decided — Inspect All, Inspect First N, Percentage of Lot, or AQL (Z1.4 / ISO 2859-1). Each mode reveals its own parameter fields below."msgstr "样本量如何确定——检验全部、检验前N个、批次百分比或AQL(Z1.4 / ISO 2859-1)。每种模式显示其自身的参数字段。"+msgid "How the unit price of each quantity was calculated."+msgstr ""+msgid "How this gauge is used — Standard (regular checks) or Master (calibrates other gauges)."msgstr "此量具的用途——正常检验(定期检查)或标准器(校准其他量具)。"@@ -11952,6 +11958,9 @@ msgstr "所选数量无定价"msgid "No pricing options found"msgstr "未找到定价选项"+msgid "No pricing rules apply to this quantity."+msgstr ""+msgid "No printer configured"msgstr "未配置打印机"@@ -13631,6 +13640,9 @@ msgstr "价格表"msgid "Price override"msgstr "价格覆盖"+msgid "Priced before pricing traces were recorded — this is today's calculation."+msgstr ""+msgid "Prices"msgstr "价格"@@ -14158,6 +14170,10 @@ msgstr "数量"msgid "Quantity"msgstr "数量"+#. placeholder {0}: price.quantity+msgid "Quantity {0}"+msgstr ""+msgid "Quantity arriving — on open purchase orders plus on production (make) orders."msgstr "即将到货的数量——来自未结采购订单以及生产(制造)订单。"@@ -14942,6 +14958,13 @@ msgstr "报告维度"msgid "Reports"msgstr "报告"+msgid "Reprice with current rules"+msgstr ""++#. placeholder {0}: format(repricedPrice)+msgid "Repricing with today's rules and costs gives <0>{0}</0>."+msgstr ""+msgid "Reprint"msgstr "重新打印"@@ -16698,6 +16721,9 @@ msgstr "显示可用的生产批次号"msgid "Show available tracking numbers"msgstr "显示可用的跟踪号码"+msgid "Show calculation"+msgstr ""+msgid "Show Customer IDs"msgstr "显示客户ID"@@ -18902,6 +18928,9 @@ msgstr "此PIN将不再显示。如果丢失,可从操作员列表中重置。msgid "This PIN will not be shown again. You will need it to exit console mode on MES terminals."msgstr "此PIN将不再显示。您需要它来在MES终端上退出控制台模式。"+msgid "This price was entered manually, so no pricing rules were applied."+msgstr ""+msgid "this purchase order"msgstr "此采购订单"