# `Sp_financialClosing_BtnEventOutSideEstimation_new` (procedure)


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

## Narrative

**Business context:** Variant of `Sp_financialClosing_BtnEventOutSideEstimation` — 系统设置 → 系统参数 → 财务结账 / 发外暂估. `_new` suffix marks an in-progress rewrite kept alongside the live version; same `accordercostanalysis` (`iType=7`) + `accoutsideproductstore` rebuild against `sCostPeriod`. Body uses the same DELETE → temp-table → re-INSERT shape, with the same guard checks for prior-period 发外暂估 and 发外发票 confirmation.

**What it does:** Same as the base proc: parses `sCostPeriod`, validates `sysaccountperiod.bCost=0`, validates `accordercostanalysis` `iType=5` / `iType=3` are all `bConfirm=1`, deletes existing `iType=7` rows for the period, rebuilds them via temp tables `Sp_instore` / `Sp_instoreSum`, inserts the summed result into `accordercostanalysis` and `accoutsideproductstore`. The `_new` body differs in tab-indented formatting and may have updated source-view names — diff against the production variant before swapping.

**Invocation:** Status: appears orphaned. No caller found in any channel — no `gdsmodule` hook, no `gdsconfigformmaster` reference, no other proc CALLs it, no xly-src grep hit. Treat as a staging variant kept on the server for an incoming switch-over and audit before deletion. Sibling: `_test` is the test variant.
