# `Sp_InsertVoucher_Cahreceipt1` (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_Cahreceipt1`'`._ ## Narrative **Business context:** 财务 / 自动凭证 — variant of `Sp_InsertVoucher_Cahreceipt` (note the `1` suffix). Same 收款单 → 凭证 (cash-receipt → voucher) shape but groups on `cahreceiptmaster.sBankId1` (the second bank-account column) instead of `sBankId`, and extends `tEndDate` by one day so receipts dated on the end-date itself are included. Likely a parallel branch for a customer running dual-bank-account receipts. **What it does:** Parses the date range from `$.changeValue[0].pChooseDate`, then `tEndDate = DATE_ADD(tEndDate, INTERVAL 1 DAY)`. Cursors over `cahreceiptmaster GROUP BY sCustomerId, sBankId1, 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 `udfvouchermaster` + per-debit/credit `udfvoucherslave` rows, stamps each consumed receipt with `iVouchermark=1`. **Invocation:** Status: appears orphaned. No form-master/`gdsmodule`/workflow/other-routine reference and no xly-src match at all (not even an install script — the only existing copy is in the live DB). Almost certainly a one-off branch for a specific customer that never got mainlined; candidate for maintainer audit / removal.