# `Sp_Calc_pruOrderBgd` (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_pruOrderBgd`'`._ ## Narrative **Business context:** 采购管理 → 采购单据 → 采购变更 — purchase-order change-document check: approves a `purpurchaseorderchangemaster` row, marks the underlying purchase order as changed, and re-runs the order's quantity-recalc (`Sp_Calc_sPod`) so order-level fulfilment math stays consistent with the change. **What it does:** Validates `sGuid`. Refuses if `salsalesorderchangemaster.bCheck=1` for the same `sId` (cross-document guard against a stale sales-order-change record). Reads `sChaseOrderId/sChaseOrderNo` from `purpurchaseorderchangemaster`; if there is a chased PO, sets `purpurchaseordermaster.bChange=1` and calls `Sp_Calc_sPod(0, 2, sFormId, sChaseOrderId, sLoginId, ...)` — if that returns `sCode<0`, propagates the failure prefixed with `purchase:`. Finally stamps `purpurchaseorderchangemaster.bCheck=1, sCheckPerson, tCheckDate=NOW()`. **Invocation:** Bound to `gdsmodule.sProcName` on module `采购变更` (sId `101251240115016233275096110`) under 采购管理 → 采购单据. Dispatched via the front-end's "审核" button on that module's master form. xly-src has deployment-bundle copies under `script/标版/`. Flag: only handles the check path (`iFlag` parameter is read but the body never branches on it) — uncheck is missing entirely.