# `Sp_Calc_spurded` (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(5000)` |
| 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_spurded`'`._

## Narrative

**Business context:** 供应商扣款 — audit / un-audit of a 供应商扣款 (supplier deduction / charge-back) bill on `purpurchaseinstorededmaster`. Tied to the purchase-receipt deduction flow (e.g. supplier shipped short or off-spec, deduct from payable). Most of the post-audit recalculation logic in the body is commented out — current path is a minimal flag flip on master.

**What it does:** Validates `sGuid`, refuses when `bInvalid=1`. On `iFlag=1` `UPDATE purpurchaseinstorededmaster` to flip `bCheck=1`, `sStatus=1`, stamp `sCheckPerson`/`tCheckDate`; `iFlag=0` reverses. Several blocks that would recompute `purpurchaseinstorededslave.dMaterialsMoney`, `dMaterialsPrice`, tax-money breakdowns from `sistax`, etc., are present as comments — historical logic preserved but disabled.

**Invocation:** No `gdsmodule.sProcName` binding found in this snapshot, no `gdsconfigformmaster.sSqlStr` reference, no other proc/func calls it, and no xly-src grep hits. **Status: appears orphaned.** Either dispatched only from a customer overlay not in this snapshot, deactivated when its mainline logic was commented out, or stub left in place for legacy compatibility — candidate for maintainer audit.

Naming note: lowercase `spurded` (vs the family's `s<Code>` style) suggests the proper code is `sPurDed`; an inconsistent casing of `Sp_Calc_sPurDed`.
