Sp_InsertVoucher_purpurchaseinvoice (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 PROCEDURESpInsertVoucher_purpurchaseinvoice'._
Narrative
Business context: 财务 / 自动凭证 — generates accounting vouchers for 采购对账 (purchase-reconciliation) bills purpurchasecheckingmaster (the proc despite its name actually drives off purpurchasechecking*, not the invoice tables) over a chosen date range. Posts the period's purchase-receivable accounts grouped by (currency-rate × supplier × material-classify-subject).
What it does: Parses date range from $.changeValue[0].pChooseDate. Refreshes purpurchasecheckingmaster.sMreserve1 from sismaterialsclassify.sAccountNo via the materials → materials-classify chain so each row carries the correct subject. Cursors Viw_purpurchasechecking GROUP BY dCurrencyRate, sSupplyId, sMReserve1 WHERE bCheck=1 AND iVouchermark=0. Per group: allocates a voucher number via SP_Sis_GetMaxNo, inserts udfvouchermaster + udfvoucherslave debit/credit rows summing the slave detail money, stamps iVouchermark=1 on the consumed reconciliation rows.
Invocation: Status: appears orphaned. No form-master/gdsmodule/workflow/other-routine reference and no xly-src match besides install script script/标版/30100101/Sp_InsertVoucher_purpurchaseinvoice.sql. Signature matches the GenericProcedureCallServiceImpl.doGenericProcedureCall() voucher-button shape; likely superseded by Sp_InsertVoucher_Universal*. Candidate for maintainer audit.