# `Sp_Product_BtnEventCheck` (procedure)

> @author:杨恒林
							@date:20210521 封存
							@describe: 在库存商品价值表界面,计算当前库存价格


- **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_Product_BtnEventCheck`'`._

## Narrative

**Business context:** 成本管理 — legacy 在库存商品价值表 "calculate current inventory price" button. Header comment marks it `@date:20210521 封存` (sealed/deprecated 2021-05-21); modern flows use `Sp_System_CalcProductPrice` directly through the cost-period closing pages.

**What it does:** Looks up the current open `sysaccountperiod` row for `(sBrId, sSuId)` whose `tStartDate..tEndDate` window covers today, then `CALL Sp_System_CalcProductPrice(p_tStart, p_tEnd, 0, sMakePerson, sBrId, sSuId, @sReturn, @sCode)` to recompute moving-average product prices for that month. No JSON-row iteration — it ignores `sProInParam`.

**Invocation:** Standard `Sp_<Module>_BtnEvent*` slot — would have been dispatched by `GenericProcedureCallServiceImpl.doGenericProcedureCall()`. xly-src ships `script/标版/30100101/cost/Sp_Product_BtnEventCheck.sql`; no surviving form-master, gdsmodule hook, or other proc references the name today — effectively orphaned after the 2021-05 sealing. Maintainer audit candidate.
