# `Sp_Cost_CheckBusinessData` (procedure)

> @author:zhucx		     
		 @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_Cost_CheckBusinessData`'`._

## Narrative

**Business context:** 成本管理 → 期间账务 — pre-checks for the period-close cost flow. Refuses the selection (with localized errors via `Sp_Sis_GetConst`) when the chosen `sysaccountperiod` row is already frozen, when the param payload is malformed, or when the period window does not span "now" — and runs an `Sp_System_AccountSquareCheck` integrity probe when the period is closed but cost-square hasn't been run.

**What it does:** Counts `sysaccountperiod` rows whose `sId` appears inside `sProInParam`, returning `selectedRowKeysNo` if zero; rejects payloads shorter than 13 chars with `paramsErro`; reads the picked period's `bFrozen`, `tStartDate`, `tEndDate` and aborts with `AlreadySettleAccounts` if already settled; finally calls `Sp_System_AccountSquareCheck(0, ...)` when the period sits in the past, surfacing any imbalance into `sReturn`/`sCode`.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, `gdsconfigformmaster` reference, other-routine caller, or xly-src hit. Author tag (zhucx, 2021-05-21) and the standard `sp_btn_action*` signature suggest it was intended as a pre-flight button-event for the period-close screen but no current binding was found. Candidate for maintainer audit.
