# `Sp_Apply_Flow_SalSaleCheck` (procedure)

> 流程启动前调用-销售对账修改单价
					对账改了单价总价也会变，发票也涉及到改价格。
					这个到时候需要增加审批流程，比如说超过100元的，
					需要客服经理审核，营销部长审核，销售副总审核，财务审核，
					超过2万的总经理审核


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sFormGuid` | `varchar(100)` |
| 2 | IN | `sGuid` | `varchar(100)` |
| 3 | IN | `sSrcNo` | `varchar(100)` |
| 4 | IN | `sLoginId` | `varchar(100)` |
| 5 | OUT | `sTableParams` | `longtext` |
| 6 | OUT | `sSrcReportData` | `longtext` |
| 7 | OUT | `sTableParamsValue` | `longtext` |
| 8 | OUT | `sReturn` | `varchar(4000)` |
| 9 | IN | `sBrId` | `varchar(100)` |
| 10 | IN | `sSuId` | `varchar(100)` |
| 11 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 销售对账修改单价 (流程启动前调用-销售对账修改单价) — workflow-apply data builder for the sales-checking price-change approval flow on `salsalescheckingmaster`. Header documents intent: when 对账 changes line price the invoice price also changes; >100元 needs 客服经理/营销部长/销售副总/财务 review, >2万 needs 总经理. Builds a six-tier roster, price-variance line summary, and 烟包 indicator.

**What it does:** Resolves tiers from `eleemployee.iPosition`: 4=客服经理, 37=销售经理, 34=国内事业副总, 11=财务, 1=总经理, 38=副董执行董事. Computes `p_dChangeMoney = ROUND(SUM(B.dProductPrice*A.dProductQty),2) − ROUND(SUM(A.dProductMoney),2)` over `salsalescheckingslave A JOIN salsalesorderslave B ON A.sOrderSlaveId=B.sId` where the rounded prices differ and the new price is positive. Sets `p_iOut=1` (烟包) by joining the slave's order's customer's `SisCustomerProperty.sName='烟包'`. Emits per-line memo CONCAT-ing `产品名称➜数量➜现单价➜原单价` filtered to changed-price lines only.

**Invocation:** Dispatched dynamically by Java `CheckExamineFlowDataServiceImpl.doSendCheckFolwData()` via `doProByNameFlow(..., sApplyProName, ...)` from `gdsmoduleflow.sApplyProName` (empty in this DB — workflow configs tenant-provisioned per deployment).

Flag: header documents threshold gating (100元 / 2万 cutoffs) but proc emits only the roster — threshold gating is left to the consumer JSON-evaluator (no `p_iOut1`/`p_iOut2` cutoff flags).
