Sp_Calc_sSiv.md 2.11 KB

Sp_Calc_sSiv (procedure)

销售发票

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN iFlag int
2 IN iTmpCheck int
3 IN sFormGuid varchar(100)
4 IN sGuid varchar(100)
5 IN sLoginId varchar(100)
6 OUT sReturn varchar(4000)
7 IN sBrId varchar(100)
8 IN sSuId varchar(100)
9 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpCalc_sSiv'._

Narrative

Business context: 销售管理 → 销售发票 (sales invoice — salsalesinvoicemaster) audit / un-audit. Auditing a 销售发票 commits the AR (accounts-receivable) row, freezes the linked 对账单/送货单/退货 lines, and optionally posts an operator KPI.

What it does: Validates sGuid/bInvalid and reads viw_salsalesinvoice for context; on iFlag=1 sets bCheck=1, sCheckPerson, tCheckDate on SalSalesInvoiceMaster/SalSalesInvoiceSlave; writes-back Update salsalescheckingmaster/SalSalesCheckingSlave (对账 freeze), saldelivernotifyslave, salrejectgoodsslave; INSERT INTO CahReceivables to post the AR row and Update CahCustomerInit/CahFinancialAdjust to refresh customer balance; logs an optional kpidetail row; calls Sp_System_CheckFlow per slave when define-check is on. iFlag=0 reverses every step (Delete FROM CahReceivables, clear flags, undo writeback).

Invocation: Bound to gdsmodule.sProcName on:

  • 销售发票单据 (sId 15780358080007074056281633539000) — also sSaveProName=Sp_Check_sSiv, sSaveProNameBefore=Sp_beforeSave_sSiv, sDeleteProName=Sp_afterSave_sSiv
  • 销售发票明细 (sId 15777565190004256392637270378500)

Dispatched by BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the 审核/反审核 button — the standard Sp_Calc_s<Code> slot. xly-src has multiple patches (optimize/, upgrade/20220104审核去除结账校验/, customer-side Demo3.sql) — verify which is deployed.