# `Sp_CostAccount_WorkCenterToOperation_Event` (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(4000)` |
| 6 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 成本管理 → 印刷机台汇总达成统计 — "confirm" button-event sibling of `Sp_CostAccount_WorkCenterToOperation`. Promotes the period's confirmed `accordercostanalysis` rows into the persistent `accordercostanalysisoperation` table so the work-centre × operation totals are frozen and can be reported on later without re-running the full join.

**What it does:** Pulls `sCostPeriod` out of `sProInParam` (validates with `Sp_Sis_GetConst('paramsErro', ...)`), deletes any prior `accordercostanalysisoperation` rows for that period, then `INSERT INTO accordercostanalysisoperation` from `accordercostanalysis` filtered by brand/subsidiary, `sCostPeriod`, `bConfirm=1` and `iType=2` (work-centre level). Then cursors over `elecostframe` and runs per-frame updates that fan each cost frame's amount onto the matching column of the just-inserted rows.

**Invocation:** Status: appears orphaned. No `gdsmodule` hook, `gdsconfigformmaster` reference, other-routine caller, or xly-src hit. Signature matches the `sp_btn_action*` dispatcher contract — paired with the `_WorkCenterToOperation` report proc as its confirm/save button — but the binding row is absent. Candidate for maintainer audit.
