# `Sp_tmp` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_sVoucherNo` | `varchar(50)` |
| 2 | IN | `p_iVoucherMonth` | `varchar(50)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_tmp`'`._

## Narrative

**Business context:** One-off DBA utility — produces a 冲回 (reversal) voucher for an existing `udfVoucherMaster` entry. The intent is to copy a posted voucher and its slave entries into a new voucher dated to the first day of the following month with all amounts negated, mirroring the manual end-of-period reversal that finance does for accrual adjustments.

**What it does:** Generates a new `sId`, inserts a header row into `udfVoucherMaster` cloning the source voucher (matched by `sVoucherNo + iVoucherMonth`) with `sType=CONCAT(sType,'-冲回',sVoucherNo)`, `bMinus=1`, `sFormId='15928127560001382627511178461700'`. Computes `p_sCreateDate = first-of-next-month`, calls `SP_Sis_GetMaxNo('udfVoucherMaster', …)` to allocate a new `sVoucherNo`, updates the header with the new no/date, then copies every `udfVoucherSlave` row with `dCreditMoney/dDebitMoney` negated.

**Invocation:** No callers found in any channel — `gdsmodule`, form-master, other routines, and xly-src all empty. Status: appears orphaned. Name (`Sp_tmp`), lack of parameter defaults, and missing install script suggest a developer-shell scratch utility rather than a production hook. Candidate for maintainer audit / removal.
