# `Sp_share_sRcts` (procedure) > 收款单(汇总)分摊 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sDropTableSql` | `longtext` | | 2 | IN | `sCreateTableSql` | `longtext` | | 3 | IN | `insertSql` | `longtext` | | 4 | IN | `selectSql` | `longtext` | | 5 | IN | `sFormGuid` | `varchar(100)` | | 6 | IN | `sLoginId` | `varchar(100)` | | 7 | IN | `sBrId` | `varchar(100)` | | 8 | IN | `sSuId` | `varchar(100)` | | 9 | OUT | `sCode` | `int` | | 10 | OUT | `sReturn` | `longtext` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_share_sRcts`'`._ ## Narrative **Business context:** 财务管理 → 收款单(汇总) — 收款单(汇总)分摊 (`COMMENT '收款单(汇总)分摊'`). Allocates a summary receipt header (`cahreceiptmaster` / `cahreceiptslave` / `cahreceiptsumslave`) across its detail rows so each slave and sum-slave line carries its share of the received money / foreign money / rounding. Used on the 收款汇总 form variant where multiple sub-bills are aggregated under one header. Per-receipt-row variant: `Sp_share_sRcts_One`. **What it does:** Executes the four dynamic-SQL strings handed in by the Java side (`sDropTableSql`, `sCreateTableSql`, `insertSql`, `selectSql`) to materialise `cahreceiptmaster_calc_tmp`, `cahreceiptslave_calc_tmp` and `cahreceiptsumslave_calc_tmp` temp tables seeded from the form's current data, runs the share/round arithmetic on the slave / sum-slave temps, then SELECTs the temps back for the front-end to refresh master and slave grids. **Invocation:** Dispatched dynamically by `CalcProcedureServiceImpl.calc()` (POST `/calcprocedure/calc`) — the 汇总分摊 button on the 收款单(汇总) form has `sProName='Sp_share_sRcts'` configured; Java builds the four temp-table SQLs from the form's current row data and forwards the call. xly-src ships `script/标版/30100101/Sp_share_sRcts.sql` (install).