# `Sp_financialClosing_BtnEventCheckoutCheckNew` (procedure)

> @author:杨恒林
		     @date:20210521 封存
				 @describe:月末结帐调用，计算材料与成品的库存与存货金额，并存入月结表，结帐之前检查未审核单据


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `longtext` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sBrId` | `varchar(100)` |
| 4 | IN | `sSuId` | `varchar(100)` |
| 5 | OUT | `sReturn` | `varchar(1000)` |
| 6 | OUT | `sCode` | `int` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_financialClosing_BtnEventCheckoutCheckNew`'`._

## Narrative

**Business context:** 系统设置 → 系统参数 → 财务结账 — month-end pre-close validator. Author note (`COMMENT`): "月末结帐调用，计算材料与成品的库存与存货金额，并存入月结表，结帐之前检查未审核单据" — drives the 异常核查 (anomaly-check) screen that the user runs before pressing 结帐.

**What it does:** Parses `$.params[0].value[0].sId` for the period sId. Reads `sysaccountperiod` for `sPeriodId, tStartDate, tEndDate, bFrozen`; if `bFrozen=1` refuses with localised `sAccountPeriodCantHc` ("该会计期间已结账，不能异常核查数据"). Otherwise delegates to `Sp_financialClosing_BtnEventCheckout_Check(0, p_tStart, p_tEnd, 0, '', p_sPeriod, sBrId, sSuId, 'admin', sCode, sReturn)` which sweeps every operational form for unaudited / 异常 rows. Normalises any `sCode = -1` returned by the validator back to `1` so the dialog displays the warning text without aborting the front-end action.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` from the 财务结帐 form's 异常核查 / 结帐前检查 toolbar button. Also called from DB by `Sp_financialClosing_BtnEventCheckout` as part of the close pipeline. No xly-src install script was found — body lives only in the live DB.
