# `Sp_afterSave_sOiv` (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_sOiv`'`._ ## Narrative **Business context:** 发外发票 → 发外加工流程 → KPI流程操作菜单 — header says 发外发票保存后反写报价数量. Thin save-phase wrapper in the `Sp_afterSave_s` family that delegates the qty back-write to `Sp_saveReturn_sOiv`. Body comment 反写报价数量 indicates downstream effect is to refresh quoted-qty on upstream reconciliation/PO rows once an outsource-side invoice is booked. **What it does:** Wraps `sGuid` in double-quotes if not already quoted and, when `sGuid` is non-empty, calls `Sp_saveReturn_sOiv(sGuid, sBrId, sSuId, 2, @sCode, @sReturn)`. Does not propagate the inner `@sCode`/`@sReturn` to its own OUT params. A `-- set sCode = 1;` debug comment sits below the inner BEGIN. **Invocation:** Reached only through `Sp_Check_sOiv`, which is bound via `gdsmodule.sSaveProName` on 发外发票. Not present in the `Sp_Invalid_backwriting` form-id dispatch table — invalidate/un-invalidate of 发外发票 does not currently re-trigger the qty back-write.