# `Sp_Calc_sRbm` (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_sRbm`'`._

## Narrative

**Business context:** 财务管理 → 财务单据 → 报销申请 — audit / un-audit of a 报销申请 (expense-reimbursement application) on `reimbursementapplicationmaster`. On approval the request becomes payable; un-audit reopens it for editing.

**What it does:** Validates `sGuid`, refuses when `bInvalid=1`. On `iFlag=1` guards on already-checked, then `UPDATE reimbursementapplicationmaster` to set `bCheck=1`, stamp `sCheckPerson`/`tCheckDate`. `iFlag=0` un-checks symmetrically. No back-writing, no chain calls, no workflow hook beyond the master flag.

**Invocation:** Bound to `gdsmodule.sProcName` on `报销申请` (sId `101251240115016045695138900`) under 财务管理 → 财务单据. Dispatched by Java `BusinessBaseServiceImpl.getPrcName(sFormGuid, …)` on the audit/un-audit button. Install scripts: `script/标版/30100101/Sp_Calc_sRbm.sql`.

Caveat: `ROUTINE_COMMENT` is stale ('销售机会') — the body operates on the reimbursement table, not on `salsaleschancemaster`.
