# `Sp_Calc_sRgd_new` (procedure)

> 销售退货


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

## Parameters

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

## Body

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

## Narrative

**Business context:** Variant of [`Sp_Calc_sRgd`](Sp_Calc_sRgd.md) — audit / un-audit of a 销售退货 (sales return / reject-goods) bill on `SalRejectGoodsMaster`/`SalRejectGoodsSlave`. The `_new` suffix marks an in-progress rewrite staged alongside the live version.

**What it does:** Same skeleton as `Sp_Calc_sRgd` — cursor slave, `INSERT INTO MitMaterialsStore`/`PitProductStore`, `INSERT INTO EleMaterialsStock`, `UPDATE EleProductStock`, back-write `SalDeliverGoodsSlave`, post `CahReceivables` adjustment, `CALL Sp_Bill_Used`/`SP_Inventory_ProductCalcQty`/`Sp_System_AutoMaterialsPriceSingle`/`Sp_System_CheckFlow`, flip `SalRejectGoodsMaster.bCheck=1`/`sStatus=1`/`sCheckPerson`/`tCheckDate`. Body matches the `Sp_Calc_sRgd1` variant — also omits `Sp_calc_materialsstoreLimit` vs the live `Sp_Calc_sRgd`.

**Invocation:** No `gdsmodule.sProcName='Sp_Calc_sRgd_new'` binding, no callers in any channel, no xly-src grep hits. **Status: appears orphaned.** `_new` suffix is the conventional xly marker for a staged rewrite — per wiki convention, backup/variant objects are not narrated as production code. Verify against deployment scripts before relying on it; likely safe to drop once the rewrite cycle is closed.
