# `Sp_beforeSave_sPrj` (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_sPrj`'`._

## Narrative

**Business context:** 采购退货 — would be the before-save dispatcher for a purchase-return (purchase-reject) document. Comment header: `采购退货保存前反写报价数量`. Targets `Sp_saveReturn_sPrj` (which exists).

**What it does:** If `sGuid` is non-empty, `CALL Sp_saveReturn_sPrj(sGuid, sBrId, sSuId, 1, @sCode, @sReturn)`. (No `sGuid` quote-wrapping — relies on inner proc.)

**Invocation:** Status: appears orphaned. No caller found in any channel — not in `gdsmodule.sSaveProName*`, not in `gdsconfigformmaster`, not in `Sp_Invalid_backwriting` / `Sp_delete_backwriting` / any other routine, not in xly-src. The 采购退货 doctype is not wired into the dispatcher pair (unlike its sibling 销售退货 → `Sp_beforeSave_sRgd`). Candidate for maintainer audit: either the dispatcher is missing the purchase-return branch, or the doctype is not yet rolled out.
