# `Sp_InsertVoucher_salsaleschecking` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sProInParam` | `varchar(10000)` | | 2 | IN | `sMakePerson_s` | `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_InsertVoucher_salsaleschecking`'`._ ## Narrative **Business context:** 财务 / 自动凭证 — generates accounting vouchers for 销售对账 (sales-reconciliation) bills `salsalescheckingmaster` over a chosen date range. Sales counterpart to `Sp_InsertVoucher_purpurchaseinvoice`. Tail-calls `Sp_InsertVoucher_salsalescheckingGW` to cover the 港外 / 港外特殊 (overseas/special) branch. **What it does:** Parses date range from `$.changeValue[0].pChooseDate`. Reads `p_sSrcInvoiceNo` from already-posted `udfvoucherslave.sMemo` over the period for dedup. Cursors `viw_salsaleschecking GROUP BY dCurrencyRate, sCustomerId, sMReserve1 WHERE bCheck=1 AND iVouchermark=0` (subject is propagated from `sisproductclassify.sAccountNo` similarly to the purchase variant). Per group allocates a voucher number via `SP_Sis_GetMaxNo`, inserts `udfvouchermaster` + `udfvoucherslave` debit/credit rows summing money for the customer/rate/subject tuple, and stamps `iVouchermark=1`. After the main loop, `CALL Sp_InsertVoucher_salsalescheckingGW(sProInParam, …)` to handle the GW branch in the same run. **Invocation:** Status: appears orphaned at the dispatcher level. No form-master/`gdsmodule`/workflow reference and no xly-src match besides install script `script/标版/30100101/Sp_InsertVoucher_salsaleschecking.sql`. Signature matches the `GenericProcedureCallServiceImpl.doGenericProcedureCall()` voucher-button shape; likely superseded by `Sp_InsertVoucher_Universal*`. Candidate for maintainer audit.