# `Sp_Cashier_GetMaterialsPrice` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sMaterialsGuid` | `varchar(100)` | | 2 | IN | `sSupplyGuid` | `varchar(100)` | | 3 | IN | `sBrId` | `varchar(100)` | | 4 | IN | `sSuId` | `varchar(100)` | | 5 | OUT | `dPrice` | `decimal(18,6)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Cashier_GetMaterialsPrice`'`._ ## Narrative **Business context:** 采购 / 财务 — material offer-price resolver. Returns the per-unit price the system should suggest for a given material when building a purchase/quotation row, branching on whether a supplier is specified and on the tenant's `CbxOfferMaterials` setting. **What it does:** If `sSupplyGuid` is supplied, walks `elematerialssupply` (checked rows only) in decreasing specificity — (supply + material + style) → (supply + material) → (material + style) → material — taking `dQuantityPrice` from the most recent match, then falls back to `EleMaterials.dRecentPurchasePrice` and finally `dPurchasePrice`. Without a supplier it reads `SysSystemSettings.CbxOfferMaterials` (`plannedpurchase` / `recentpurchase` / `designatedsales` / `recentcost`) and pulls the matching column from `EleMaterials`; the `recentcost` branch delegates to `Sp_Cashier_GetCostMaterialsPrice`. Always returns a non-null `dPrice` via `IfNull`. **Invocation:** Status: appears orphaned at the proc level — no form-master, gdsmodule hook, other-routine caller, or xly-src caller besides the install scripts (`script/标版/30100101/`) and a commented-out reference in `Sp_Manufacture_sWodPurchareMaterials.sql`. Live callers go through the scalar wrapper `Fun_Cashier_GetMaterialsPrice` (and its `_new`/`_Quo` variants), which quotation/work-order/gross-profit calculators invoke inline. Candidate for maintainer audit — likely superseded by the function family.