# `Sp_InsertVoucher_Cahreceipt` (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_Cahreceipt`'`._ ## Narrative **Business context:** 财务 / 自动凭证 — generates accounting vouchers (`udfvouchermaster` + `udfvoucherslave`) for bank 收款单 (cash-receipt) bills `cahreceiptmaster` of `sSettlementId='bank'` over a chosen date range. Cash-receipt counterpart of `Sp_InsertVoucher_Cahpayment`. **What it does:** Up-front guard: if `udfvouchermaster` already has a same-day voucher with `bCheck=0`, refuses with the localised `sCahreceiptNeedCheck` message ("当日已生成凭证单据,请先审核再做此操作") from `Fun_Sis_GetConst`. Parses the date range from `$.changeValue[0].pChooseDate`. Cursors over `cahreceiptmaster GROUP BY sCustomerId, sBankId, dCurrencyRate WHERE bCheck=1 AND tCreateDate IN [start,end) AND sSettlementId='bank' AND iVouchermark=0`. Per group allocates a voucher number via `SP_Sis_GetMaxNo`, inserts master + debit/credit slave rows, sets `iVouchermark=1` on the consumed receipts. **Invocation:** Status: appears orphaned. Signature matches the `GenericProcedureCallServiceImpl.doGenericProcedureCall()` voucher-button shape but no form-master/`gdsmodule`/workflow/other-routine reference and no xly-src match besides install script `script/标版/30100101/Sp_InsertVoucher_Cahreceipt.sql`. Sibling: `Sp_InsertVoucher_Cahreceipt1` (variant). Likely superseded by `Sp_InsertVoucher_Universal*`; candidate for maintainer audit.