# `Sp_InsertVoucher_opsoutsidechecking` (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_opsoutsidechecking`'`._

## Narrative

**Business context:** 财务 / 自动凭证 — generates accounting vouchers for 委外加工对账 (outsource-processing reconciliation) bills via `Viw_opsoutsidechecking`. Posts the period's outsourced-process settlements as `生产成本 / 应付账款` style entries grouped by (currency-rate × supplier × material-classify-subject).

**What it does:** Reads `p_sSrcInvoiceNo` from `udfvoucherslave.sMemo` over the period to skip already-posted bills (`INSTR(p_sSrcInvoiceNo, sInvoiceNo)<=0`). Refreshes `opsoutsidecheckingmaster.sMreserve1` from `sisproductclassify.sAccountNo` via the product → product-classify chain so each row carries the correct cost-account. Cursors `viw_opsoutsidechecking GROUP BY dCurrencyRate, sSupplyId, sMReserve1 WHERE bCheck=1 AND iVouchermark=0 AND sProcessId=''`. Per group: allocates `SP_Sis_GetMaxNo` voucher number, inserts master + debit/credit slave rows from the slave detail summing money, stamps `iVouchermark=1`.

**Invocation:** Status: appears orphaned. No form-master/`gdsmodule`/workflow/other-routine reference and no xly-src match besides install script `script/标版/30100101/Sp_InsertVoucher_opsoutsidechecking.sql`. Sibling: `Sp_InsertVoucher_opsoutsideinvoice` (委外发票 counterpart). Signature matches the `GenericProcedureCallServiceImpl.doGenericProcedureCall()` voucher-button shape; likely superseded by `Sp_InsertVoucher_Universal*`. Candidate for maintainer audit.
