# `Sp_beforeSave_sPmt` (procedure)

> 付款单保存前反写数量


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sGuid` | `varchar(2000)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |
| 4 | OUT | `sCode` | `int` |
| 5 | OUT | `sReturn` | `varchar(4000)` |

## Body

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

## Narrative

**Business context:** 财务收付款 / 付款单 — before-save dispatcher for the payment document. Delegates to `Sp_saveReturn_sPmt` to backwrite paid amounts onto upstream purchase / advance documents before the master save commits.

**What it does:** Declares unused `iPayType`, `iOutType` locals, then `CALL Sp_saveReturn_sPmt(sGuid, sBrId, sSuId, 1, @sCode, @sReturn)`. Unlike most other beforeSave wrappers, this one does **not** quote-wrap `sGuid` before calling — relies on `Sp_saveReturn_sPmt` to handle raw input.

**Invocation:** Hooked as `gdsmodule.sSaveProNameBefore` on `付款单` (sId `192116810113315233387186220`). Also called by dispatcher procs `Sp_Invalid_backwriting` and `Sp_delete_backwriting`; the dispatchers additionally route customer-prefix form-guid `1691254111217036638904730` into this same proc.
