# `Sp_afterSave_sRct` (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_afterSave_sRct`'`._

## Narrative

**Business context:** 收款单 → 财务收付款 → KPI流程操作菜单 — header says 收款单保存后反写数量. Thin save-phase 反写 wrapper in the `Sp_afterSave_s<Code>` family that delegates the actual money back-write to `Sp_saveReturn_sRct`.

**What it does:** Declares unused locals `iReceivablesType`/`CbxAdvanceType`, wraps `sGuid` in double-quotes if not already quoted, then unconditionally calls `Sp_saveReturn_sRct(sGuid, sBrId, sSuId, 2, @sCode, @sReturn)` (iFlag=2 = "after save" phase). The body carries a very large commented-out block that would once have switched on `SysSystemSettings.CbxAdvanceType` / `CbxReceivablesType` and updated `dRealAdvanceMoney` / `dReceiptMoney` on the corresponding salesorder/workorder/delivergoods/saleschance master + slave — inert. Does not propagate the inner `@sCode`/`@sReturn` back to its own OUT params.

**Invocation:** Reached on three paths. (1) `Sp_Check_sRct` (the save-commit dispatch proc bound via `gdsmodule.sSaveProName` on 收款单) calls this proc near the tail of a successful save. (2) `Sp_Check_sRcts` and the backup `Sp_Check_sRct_copy1` also reference it. (3) `Sp_Invalid_backwriting` dispatches to this proc on 作废/取消作废 of form `192116810113315231731646200` (收款单).
