# `Sp_Calc_sSfu` (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_sSfu`'`._

## Narrative

**Business context:** 销售管理 → 商机跟进单据 (sales lead follow-up — `salsalesFollowUpmaster`) audit / un-audit. The 商机跟进 records visit / call / progress notes against a 销售机会 (sales chance); auditing it freezes the follow-up and flags the parent chance / chance-product as touched.

**What it does:** Validates `sGuid`/`bInvalid`, then on `iFlag=1` sets `bCheck=1`, `sCheckPerson`, `tCheckDate` on `salsalesFollowUpmaster`; updates `salsaleschancemaster` and `salsaleschanceproduct` on the linked 销售机会 to record the latest follow-up state. `iFlag=0` reverses the flags and writeback.

**Invocation:** Bound to `gdsmodule.sProcName` on `商机跟进单据` (sId `101251240115016035948853880`) — 销售管理. Dispatched by `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on the 审核/反审核 button. xly-src also carries `script/标版/optimize/Sp_Calc_sSfu.sql` (perf patch) alongside the install script.
