# `Sp_Check_sPmt` (procedure)

> 付款单保存之前数据校验


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 财务管理 → 财务收付款 → 付款单 — post-save validator on `cahpaymentmaster`. Thin wrapper that delegates the heavy lifting (write-back, source-bill update, etc.) to `Sp_afterSave_sPmt` and re-flags `sCode=-1` if that call sets a non-empty `sReturn`.

**What it does:** Sets `sCode=1`, defaults `iFlag` to 0, clears `sReturn`. After local-variable declarations (left-over scaffolding from the family template — billno/srcId/etc. are declared but unused), it short-circuits to `sCode=-1` if `sReturn` is already populated, then calls `Sp_afterSave_sPmt(sGuid, sBrId, sSuId, sCode, sReturn)` and flips `sCode=-1` again if that returns a message.

**Invocation:** Bound to `gdsmodule.sSaveProName` on `付款单` (`192116810113315233387186220`) — 财务管理 → 财务收付款 (KPI流程操作菜单). Dispatched by `BusinessBaseServiceImpl.checkUpdate(..., "sSaveProName")` after the save batch commits. Pre-save peer is `Sp_beforeSave_sPmt`. xly-src ships `script/标版/30100101/Sp_Check_sPmt.sql` as the install body.
