# `Sp_BtnEvent_DeliverGoodsFinance` (procedure)

> 送货单财务确认


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sProInParam` | `varchar(10000)` |
| 2 | IN | `sMakePerson` | `varchar(100)` |
| 3 | IN | `sUserId` | `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 PROCEDURE `Sp_BtnEvent_DeliverGoodsFinance`'`._

## Narrative

**Business context:** 销售 / 送货单 — button-click handler for finance to confirm an entire delivery-note (`saldelivergoodsmaster`) at the master level, after the warehouse-dispatch (储运) side has confirmed every line. Drives downstream invoicing/billing on the delivery note.

**What it does:** Parses `$.params[*].value[*].sId` from `sProInParam`. For each master id, first counts `saldelivergoodsslave` rows still at `bSingleReceipt=0`; if any remain the run aborts with `sCode=-1` and the localised `sDeliveryCyNotConfirm` ("该送货单储运未确认，禁止财务确认") message from `Fun_Sis_GetConst`. Otherwise sets `bFinance=1, sFinancePerson, tFinanceDate=NOW()` on both `saldelivergoodsmaster` and every matching `saldelivergoodsslave (sParentId=p_sId)`.

**Invocation:** Dispatched dynamically by `GenericProcedureCallServiceImpl.doGenericProcedureCall()` (POST `/procedureCall/doGenericProcedureCall`) — 送货单 grid's 财务确认 toolbar button names `Sp_BtnEvent_DeliverGoodsFinance` as the action. Inverse: `Sp_BtnEvent_DeliverGoodsFinanceReset`. Per-line variant: `Sp_BtnEvent_DeliverGoodsFinanceSlave`.
