# `Fun_Cashier_GetMaterialsPrice_new` (function)

> 获取最近采购价(物料)


- **Type:** FUNCTION
- **Returns:** `varchar(100)`
- **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)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE FUNCTION `Fun_Cashier_GetMaterialsPrice_new`'`._

## Narrative

**Business context:** Newer revision of [`Fun_Cashier_GetMaterialsPrice`](Fun_Cashier_GetMaterialsPrice.md) — same "most recent purchase price" lookup for a material under the same fallback ladder. The two versions are bodies-identical in the section seen here; the diff (if any) sits in trailing logic this lookup didn't pull out.

**What it does:** reads `elematerialssupply.dQuantityPrice` filtered by material + (optional supplier, style), tenant-scoped, `bCheck = 1` only, latest by `tCreateDate`. Returns `'0'` if no match.

**Invocation:** called only by `Sp_Check_sMcd` — the material-check proc invoked from material-card save flows. Not referenced by any form-master, gdsmodule hook, or xly-src file. The stable variant `Fun_Cashier_GetMaterialsPrice` is the one used by the cost-calc family.
