# `Sp_financialClosing_BtnEventCheckout` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sProInParam` | `varchar(10000)` | | 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_BtnEventCheckout`'`._ ## Narrative **Business context:** 系统设置 → 系统参数 → 财务结账 — 财务结帐 form's 结帐 (period-close) toolbar button. Closes the selected `sysaccountperiod` row, after running the per-period material-price calculation and posting estimate (暂估) inventory rows into the next period. **What it does:** Parses `$.params[0].value[0].sId` from `sProInParam` for the period sId. Reads `sysaccountperiod` to look up the chosen `sPeriodId` and the period covering NOW. Refuses to close the current month (`p_sPeriod = p_sNowPeriod` → `ThisNoSettleAccounts`) and refuses if the prior period isn't yet frozen (`PriorNoSettleAccounts`). Calls `Sp_financialClosing_BtnEventCalcMaterialPrice` to recompute material cost prices; if that returns `sCode<0` or `=2` the run aborts. On success sets `bFrozen=1, tForzenDate=NOW(), sMakePerson` on `sysaccountperiod` and calls `Sp_Insert_EstimateInstore(p_sPeriod, …)` to generate the estimate-instore (暂估入库) carry-over. **Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` from the 财务结帐 form's 结帐 button. Inverse is `Sp_financialClosing_BtnEventReCheckout`. Also called from DB by `Sp_Calc_sPdt` and by `Sp_financialClosing_BtnEventCheckoutCheckNew` / `Sp_financialClosing_BtnEventCheckout_Check` (pre-close validators). xly-src ships `script/标版/30100101/Sp_financialClosing_BtnEventCheckout.sql`.