# `Sp_Quotation_CalcDataStd` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sGuid` | `varchar(100)` |
| 2 | IN | `bChangeRate` | `int` |
| 3 | IN | `sLoginId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | OUT | `sCode` | `int` |
| 7 | OUT | `sReturn` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** 销售管理 → 销售单据 — standard quotation-form price calculator. Runs the full quote-cost pipeline against the temp staging tables (`QuoQuotationmaster_Tmp` / `_slave_tmp` / `_control_tmp` / `_material_tmp` / `_process_tmp` / `_param_tmp`) populated during the form's edit session. Used by the legacy 报价单单据(兼容停用), 卷筒产品报价单据, 报价单单据(膜类), 套装产品报价单据 forms.

**What it does:** Iterates per-slave (`QuoQuotationSlave_Tmp`) and walks materials/process/control cursors. Reads element rates from `EleMaterials`, `EleProcess`, `eleproduct`, plus form-level overrides in `sysformsetting` and global toggles in `SysSystemSettings`. Resolves dynamic field formulas via `Sp_System_ReplaceField` and consts via `Sp_Sis_GetConst`. Writes back per-row money/qty into `QuoQuotationMaterials_Tmp`, `QuoQuotationProcess_Tmp`, `QuoQuotationControl_Tmp`, `QuoQuotationSlave_Tmp`; finally rolls slave totals into `QuoQuotationmaster_tmp` (`dAllMoney`, etc.).

**Invocation:** Dispatched by `BusinessBaseServiceImpl` via the `CaclProNameEnum.SP_QUOTATION_CALCDATASTD` mapping — selected when the form's `gdsmodule.sCalcProName='Sp_Quotation_CalcDataStd'` (modules 报价单单据(兼容停用) `19211681019715780306452560`, 卷筒产品报价单据 `101251240115016002356125200`, 报价单单据(膜类) `101251240115016036175782700`, 套装产品报价单据 `12012615914116361104593880`). Install: `script/标版/30100101/Sp_Quotation_CalcDataStd.sql`.
