# `Sp_Calc_sYsTb` (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_sYsTb`'`._

## Narrative

**Business context:** Bears the `Sp_Calc_s*` audit/un-audit signature against `departmentalBudgetMaster` (部门预算填报主表 — departmental budget-entry master). COMMENT says 预算填报审批 — auditing approves the department's submitted budget for the period.

**What it does:** Validates `sGuid`. Reads `departmentalBudgetMaster.bInvalid`, refuses when invalidated. Checks `SysSystemSettings.CkxIntervalMonthModifyBill` (currently the period-frozen guard against `sysaccountperiod.bFrozen` is commented out in the body — see Caveat). With `iFlag=1` flips the master to bCheck/sStatus checked state; with `iFlag=0` reverses. Honours custom approval flow when configured.

**Invocation:** Status: appears orphaned. No `gdsmodule.sProcName` row binds this name; xly-src has no occurrence anywhere. No Java caller, no other-routine caller, no form-master reference. Candidate for maintainer audit.

Caveat: the period-frozen guard block (`sysaccountperiod.bFrozen` check) is commented out in the deployed body — a budget submission can be audited even when the accounting period is closed. Flag for finance maintainer.
