# `Sp_Calc_sSdv` (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_sSdv`'`._

## Narrative

**Business context:** 销售机会 → 开发申请 (development application — `salsalesdevmaster`) audit / un-audit. The 开发申请 turns a 销售机会 product line into a tracked development task; on audit it locks the application and may write the linked-chance product back so that the chance is marked "in development".

**What it does:** Validates `sGuid`/`bInvalid`, then on `iFlag=1` sets `bCheck=1`, `sCheckPerson`, `tCheckDate` on `salsalesdevmaster`; updates `salsaleschanceproduct` on the linked 销售机会 to flag the product as under development. `iFlag=0` reverses both.

**Invocation:** Bound to `gdsmodule.sProcName` on:
- `开发申请` (sId `101251240115016044797781880`)
- `开发申请->开发计划` (sId `101251240115016052380061680`) — the convert/audit shortcut
- `工单变更申请` (sId `101251240115016117326536100`) — reused for the manufacturing-order change-request bill
- `项目评定` (sId `101251240115016126904308390`) — reused for the project-evaluation bill

Dispatched by `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on the 审核/反审核 button. Reuse across non-dev forms means the body's reads against `salsalesdevmaster` may silently no-op for those — verify per form.
