Sp_Calc_sCio.md 1.86 KB

Sp_Calc_sCio (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(5000)
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_sCio'._

Narrative

Business context: 产品管理 → 客户档案管理 → 客户信息 — customer-master check / uncheck on elecustomer. Approving a customer record flips its bCheck=1 so it becomes selectable in sales/delivery documents, and back-fills the projected payment-receivable dates (tGetPayDate) on any open invoices using that customer's payment-term setup.

What it does: Validates sGuid. With iFlag=1: refuses if already checked; sets elecustomer.bCheck=1, sStatus=1, sCheckPerson=sLoginId, tCheckDate=NOW(). Then runs UPDATE SalSalesInvoiceMaster A JOIN salsalesinvoiceslave D ON A.sId=D.sParentId JOIN elecustomer B JOIN sispayment C ON B.sGetPayId=C.sId SET A.tGetPayDate = DATE_ADD(A.tInvoiceDate, INTERVAL C.iAfterDeliverDay DAY) for the just-checked customer where the invoice still has unreceived amount. Uncheck (iFlag=0) reverses the master flags only.

Invocation: Bound to gdsmodule.sProcName on:

  • 客户信息 (sId 192116810111915048607109671) — 产品管理 → 客户档案管理
  • 客户报备信息单据 (sId 101251240115015977193229000) — 销售管理 → 销售单据 (customer-registration / 客户报备 flow reuses this audit since it ultimately writes back into elecustomer)