# `Sp_InsertVoucher_salsalescheckingGW` (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_salsalescheckingGW`'`._ ## Narrative **Business context:** 财务 / 自动凭证 — GW (港外, "off-port"/overseas) variant of the 销售对账 voucher generator. Identical mechanics to `Sp_InsertVoucher_salsaleschecking` but covers the subset of sales-reconciliation rows that the parent skips, so that overseas sales post into their own subject set (typically the 5102.04 / foreign-currency branch). **What it does:** Parses date range from `$.changeValue[0].pChooseDate`. Reads `p_sSrcInvoiceNo` from already-posted `udfvoucherslave.sMemo` to dedup. Cursors `viw_salsaleschecking GROUP BY dCurrencyRate, sCustomerId, sMReserve1 WHERE bCheck=1 AND iVouchermark=0 AND `, tracking the previous customer (`p_sOldCustomerId`) to start a new voucher when it changes. Per group: allocates a voucher number via `SP_Sis_GetMaxNo`, inserts `udfvouchermaster` + `udfvoucherslave` debit/credit rows summing money, stamps `iVouchermark=1`. **Invocation:** Called by DB proc `Sp_InsertVoucher_salsaleschecking` at the end of its main loop (`call Sp_InsertVoucher_salsalescheckingGW(sProInParam, …)`). xly-src ships install scripts for both as siblings in `script/标版/30100101/`. No direct form-master/`gdsmodule`/workflow/Java caller — only reachable via the parent.