# `Sp_Quotation_CalcDataPackProductStd` (procedure)


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 销售管理 → 销售单据 — per-product helper for the pack-quotation (`Sp_Quotation_CalcDataPack`) calculator. Drives the per-slave material/process roll-up for a *single product* inside a 包装 (packaging) quote, where one quote line groups multiple component products.

**What it does:** Iterates slaves in `quoquotationslave_tmp` and aggregates each product's element charges from `eleproduct` and the staging tables `QuoQuotationMaterials_Tmp`, `QuoQuotationProcess_Tmp`, `QuoQuotationParam_Tmp`. Resolves the percentage/rate fields (`p_dRate`, `p_dAdjustRate`, `p_sSumRate`), applies last-process / product-first-process flags, and writes per-product money into the temp tables `p_quoquotationslave_tmp` and `p_SlaveMoneyTable`. Also calls `Sp_Sis_GetConst` for localised constants and `DELETE FROM quoquotationcalc_tmp` to clear prior calc rows. Updates `quoquotationcontrol_tmp`, `quoquotationmaster_tmp`, `quoquotationprocess_tmp`.

**Invocation:** Called only from `Sp_Quotation_CalcDataPack` (the umbrella pack-quote calculator). Install: `script/标版/30100101/Sp_Quotation_CalcDataPackProductStd.sql`. A customer override exists at `script/客户/上海亚峰/报价单计算/Sp_Quotation_CalcDataPackProductStd.sql` — verify which version is deployed.
