# `Sp_Calc_sPqa` (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_sPqa`'`._ ## Narrative **Business context:** 采购管理 → 采购单据 → 采购品质异常 — purchase quality-abnormal (PQA) audit on `purqualityabnormalmaster`. Records and approves a quality-issue ticket raised against an incoming purchase, freezing the master row once the QA process has agreed on disposition. **What it does:** Guards on `bInvalid` against `purqualityabnormalmaster`. On `iFlag=1` refuses if the row is already `bCheck=1`, then `Update purqualityabnormalmaster` to set `bCheck=1, sCheckPerson, tCheckDate=NOW(), sStatus=1`. `iFlag=0` symmetrically clears. No KPI write, no downstream propagation — this is a lightweight check/uncheck. **Invocation:** Bound to `gdsmodule.sProcName` on 采购品质异常 (sId `101251240115016111131581760`, parent 采购单据 → 采购管理) — dispatched by `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on the audit/un-audit button. `script/标版/30100101/Sp_Calc_sPqa.sql` is the install script. Caveat: the procedure's stored `COMMENT` clause reads `'商机跟进'` (sales-lead follow-up), inherited from a copied-template ancestor. The actual body targets `purqualityabnormalmaster` and matches the 采购品质异常 module — treat the stale comment as documentation drift, not a different intent.