# `Sp_Calc_sQtt` (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` | `text` | | 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_sQtt`'`._ ## Narrative **Business context:** 销售管理 → 报价&估计管理 / 销售单据 — audit / un-audit of a 报价单 (sales quotation) on `quoquotationmaster`/`quoquotationslave`. The most widely-bound `Sp_Calc_s*` in this snapshot — it serves the regular 报价单, the 卷筒 / 膜类 / 书刊 / 盒型 / 套装 product variants, the compatibility-suspended generic forms, the new 17/05 quote form, the self-service quote, and the quote-approval (报价审批) module. On approval it locks the quote, snapshots customer-product pricing, optionally posts KPI rows, and triggers the configured approval workflow. **What it does:** Validates `sGuid`/`bInvalid`, `CALL Sp_Bill_Used` to verify the quote is not consumed downstream; on `iFlag=1` flips `quoquotationmaster.bCheck=1`, `sStatus=1`, stamps `sCheckPerson`/`tCheckDate`; writes a price snapshot row to `eleproductcustomer` (per-customer-product pricing table) from each `quoquotationslave`; updates `salsaleschanceproduct` so the linked 销售机会 picks up the approved price; logs to `syslog`/`syslogdetail`; `CALL Sp_System_CheckFlow` per slave to launch the configured workflow when `CkxDefineCheck=1`. `iFlag=0` reverses the flags. **Invocation:** Bound to `gdsmodule.sProcName` on a large fleet of 报价单 modules — 卷筒/书刊/膜类/盒型/套装 variants, the 自助报价 self-service form, 报价审批, the new 17/05 form, 01/04 新增新报价单, plus several `兼容停用` (compatibility-suspended) rows. Dispatched by Java `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on the audit/un-audit button — the standard `Sp_Calc_s` slot. Install scripts: `script/标版/30100101/Sp_Calc_sQtt.sql`.