Sp_InsertVoucher_Universals (procedure)
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sProInParam |
longtext |
| 2 | IN | sMakePerson |
varchar(100) |
| 3 | IN | sFormId |
varchar(100) |
| 4 | IN | sBrId |
varchar(100) |
| 5 | IN | sSuId |
varchar(100) |
| 6 | OUT | sReturn |
varchar(1000) |
| 7 | OUT | sCode |
int |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpInsertVoucher_Universals'._
Narrative
Business context: 财务管理 → 财务凭证 — generic per-bill voucher generator (legacy/v1). Earlier sibling of Sp_InsertVoucher_Universals_Pro with the same goal: turn user-selected source-bill ids plus a udfvouchertemplatemaster template into rows in udfvouchermaster/udfvoucherslave. Differs from the _Pro variant in its parameter shape (per-row {sId, sVoucherId, sMemo} only, no sSlaveId) and in its WHILE-loop driver instead of the _Pro set-based INSERT.
What it does: Reads $.params[0].value[*] JSON; for each entry validates sId and sVoucherId (returns chooseData / sInsertVoucherNoPzTemplate localised via Fun_Sis_GetConst if missing) then inserts into temp table p_voucherId_TableId. Builds p_voucherUniversal from the template-mapped source rows across accopsoutsideinstoremaster, accpurchaseinstoremaster, cahpaymentmaster, cahreceiptmaster, opsoutsideinstoremaster, purpurchaseinstoremaster, saldelivergoodsslave. CALL SP_Sis_GetMaxNo to issue a sVoucherNo, then Insert Into udfVoucherMaster/udfVoucherSlave and back-write the voucher number on the source rows.
Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() — same toolbar surface as Sp_InsertVoucher_Universals_Pro ("生成凭证" on the 应收/应付/出纳/成本相关转财务凭证 modules). Shipped twice in xly-src: script/标版/upgrade/20211115生成凭证/Sp_InsertVoucher_Universals.sql (initial) and script/标版/30100101/Sp_InsertVoucher_Universals.sql (current). Variants: _Pro (newer per-bill), _All (one voucher for everything), _ByMounth (monthly aggregate).