# `sp_CalcWagebyReport` (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_CalcWagebyReport`'`._

## Narrative

**Business context:** 生产管理 / 上报 — wage-by-report calculator. Given a JSON list of selected 生产上报 master ids, evaluates each report-line's conversion formula (`eleprocess.sConversionFormulaId`) and writes the per-employee wage onto `mftproductionreportemployee`. Powers the "按上报计算工资" button on the production-report tooling so payroll can be tied to each operator's reported output.

**What it does:** Parses `$.params[0].value[*].sId` from `sProInParam`. For each report master id loops the slave rows, joins `mftproductionreportslave` to `eleprocess` to get `sConversionFormulaId`, and `CALL Sp_System_ReplaceField` to evaluate the formula against the slave-context tables — yielding `p_dAwardMoney` per employee on the slave. `UPDATE mftproductionreportemployee` to store the computed wage. Refuses when no rows are selected (returns localised `chooseData` / `sReportNeedUpOrder` messages via `Fun_Sis_GetConst`).

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` — the production-report list's "按上报计算工资" toolbar button names `sp_CalcWagebyReport` as the action. No `gdsmodule.sProcName` binding (BtnEvent procs are not on the audit slot). No form-master sSqlStr reference. Only operational entry point is the button.
