# `Sp_Calc_sSample` (procedure)

> 样例


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iFlag` | `int` |
| 2 | IN | `iTmpCheck` | `int` |
| 3 | IN | `sFormGuid` | `varchar(100)` |
| 4 | IN | `sGuid` | `varchar(100)` |
| 5 | IN | `sLoginId` | `varchar(100)` |
| 6 | OUT | `sReturn` | `varchar(4000)` |
| 7 | IN | `sBrId` | `varchar(100)` |
| 8 | IN | `sSuId` | `varchar(100)` |
| 9 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** "样例" (sample / template) — boilerplate template for the `Sp_Calc_s<Code>` audit family. Operates against `SalSampleMaster` (a sample-bill table presumably used as a fixture for the template). Not a live business proc: it ships as a starting point for engineers cloning the audit/un-audit pattern into a new module.

**What it does:** Standard `Sp_Calc_s*` skeleton — IFNULL the params, `SysLocking` guard, `bInvalid` guard, on `iFlag=1` guard on already-checked then `UPDATE SalSampleMaster SET bCheck=1, sStatus=1, sCheckPerson, tCheckDate` for the matching `sId`/`sBrandsId`/`sSubsidiaryId`; `iFlag=0` reverses. The 作废 flag check is hard-coded `SET @bInvalid = 1` then immediately fails the "is-invalidated" guard — i.e. running this proc against any real row will always return the "cannot audit invalidated bill" error, by design (so the template never accidentally mutates production data).

**Invocation:** No `gdsmodule.sProcName='Sp_Calc_sSample'` binding, no callers in any channel, no xly-src grep hits. **Status: template — not expected to be invoked from production.** The hard-coded `@bInvalid=1` guard confirms intent: kept in the catalog as a copy-paste source for new audit procs, not as a live routine.
