# `Sp_Calc_sStl` (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(4000)` |
| 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_sStl`'`._

## Narrative

**Business context:** 财务管理 → 财务单据 → 财务调整单据 — audit/un-audit handler for the financial-adjustment voucher (`CahFinancialAdjust`). The 财务调整单据 lets finance post manual receivable/payable/inventory corrections; auditing the bill is the formal commitment step before downstream `Sp_Bill_Used` chains pick it up.

**What it does:** Validates `sGuid`; refuses when a `SysLocking` row exists for the bill (concurrent operation lock). Loads `tCreateDate`, `bInvalid` from `CahFinancialAdjust`; refuses when `bInvalid=1`. Reads `SysSystemSettings.CkxIntervalMonthModifyBill` and (when 0) checks `sysaccountperiod.bFrozen` to guard against modifying a closed period. With `iFlag=1` flips `bCheck=1`, stamps `sCheckPerson`/`tCheckDate` on the master; with `iFlag=0` reverses. May trigger `Sp_System_CheckFlow` when 自定义审批流 is enabled and `Sp_Bill_Used` for usage registration.

**Invocation:** Bound to `gdsmodule.sProcName` on 财务调整单据 (sId `192116810113315265349306830`) — 财务管理 → 财务单据. Dispatched by Java `BusinessBaseServiceImpl.getPrcName(sFormGuid, ...)` on the 审核/反审核 button. xly-src ships `script/标版/30100101/Sp_Calc_sStl.sql` (install) and `script/标版/optimize/Sp_Calc_sStl.sql` (patch).
