Sp_Calc_sRct.md 2.8 KB

Sp_Calc_sRct (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(100)
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_sRct'._

Narrative

Business context: KPI流程操作菜单 → 财务收付款 → 收款单 — audit / un-audit of a 收款单 (customer-receipt / AR receipt) on CahReceiptMaster/CahReceiptSlave. The most-touching audit in the family: a receipt may settle against sales orders, sales contracts, delivery notes, quality-deduction slaves, reject-goods slaves, sales-checking slaves, sales-invoices, trade orders and work-orders all in one bill. On approval it posts the receipt to the customer's AR ledger, allocates per-slave to the original source bill (back-writing dCheckMoney/dCheckMoneyForeign etc.), runs the chained re-audits, writes the wastebook, posts the operator KPI, and updates customer-init balances.

What it does: Body is ~81K chars. Validates sGuid, locks, refuses on bInvalid=1. On iFlag=1 cursors CahReceiptSlave, dispatches per-slave by source-bill type — back-writes SalSalesOrderMaster/Slave, SalSalesContractMaster/Slave, SalDeliverGoodsMaster/Slave, SalRejectGoodsSlave, SalQualityAbnormalSlave, SalSalesCheckingSlave, SalSalesInvoiceSlave, SalTradeOrderMaster, MftWorkOrderMaster/Slave, QuoQuotationMaster — calling the originating bill's own re-audit proc where needed (Sp_Calc_sDgd, Sp_Calc_sQtt, Sp_Calc_sSod, Sp_Calc_sWod); Insert Into CahWasteBook posts the financial wastebook entry; Update CahCustomerInit/CahFinancialAdjust/CahPaymentMaster to update the customer init / adjust / payment balances; INSERT INTO kpidetail when KPI logging is enabled for the operator; flips CahReceiptMaster.bCheck=1/sStatus=1. iFlag=0 delete from cahreceiptnewmaster/cahwastebook and reverses every back-write.

Invocation: Bound to gdsmodule.sProcName on 收款单 (sId 192116810113315231731646200) under KPI流程操作菜单 → 财务收付款. Dispatched by Java BusinessBaseServiceImpl.getPrcName(sFormGuid, …) on the audit/un-audit button. Install scripts: script/标版/30100101/Sp_Calc_sRct.sql, an upgrade patch script/标版/upgrade/20220104审核去除结账校验/Sp_Calc_sRct.sql, plus customer overrides at script/客户/扬州浩宇/ and script/客户/千彩/ — verify which is deployed per tenant.