Sp_Payables_AP.md 2.81 KB

Sp_Payables_AP (procedure)

应付账款 2025-12-30 新

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

Parameters

# Mode Name Type
1 IN tStartDate datetime
2 IN tEndDate datetime
3 IN sStatistics varchar(255)
4 IN sZero varchar(100)
5 IN sLoginId varchar(100)
6 INOUT dNoPayMoney decimal(18,6)
7 INOUT dDuePayMoney decimal(18,6)
8 IN sBrId varchar(100)
9 IN sSuId varchar(100)
10 IN bFilter varchar(5000)
11 IN pageNum int
12 IN pageSize int
13 OUT totalCount int
14 IN countCloumn varchar(5000)
15 OUT countMapJson longtext
16 IN sFilterOrderBy varchar(5000)
17 IN sGroupby_select_sql varchar(5000)
18 IN sGroupby_group_sql varchar(5000)

Body

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

Narrative

Business context: 财务管理 → 应付账款 → 应付账款 — paged AP-ledger report for a supplier window: per-supplier outstanding payable (dNoPayMoney) plus due-payable (dDuePayMoney) on top of the bill-by-bill 采购/外协/调整 transactions, with the optional sStatistics/sZero switches to control the summary vs. detail mode and zero-balance filtering. The COMMENT marks the body as a 2025-12-30 rewrite.

What it does: Builds the full AP working set by aggregating purchase-instore bills (p_iPayType='purchaseinstore'), outsourcing bills (p_iOutSidePayType='outsideprocess'), return/adjust/payment streams (p_sReturnType, p_sAdjustType, p_sPaymentType, p_sPaysType), and initial-balance carry-over (p_sInitType), all scoped to sBrId/sSuId and the supplier/date window. Computes per-supplier 已付 / 未付 / 到期 columns into the temp working table, writes the totals into the INOUT dNoPayMoney and dDuePayMoney outputs, and forwards the assembled SQL + paging / grouping inputs to Sp_Outstanding_Query for pagination, total-count and countMapJson totals.

Invocation: Bound as the data-source of the 应付账款 form gfm.sId=192116810113315319067607260 via gdsconfigformmaster.sSqlStr — module 应付账款 under 应付账款 → 财务管理. Also bound to several 订单-付款明细表 sub-forms (采购/付款/调整金额/调整票据/退款/开票) and 供应商流水账 under 常用模块 → 常用设置 and 财务管理 → 应付账款. Called as a delegate by sibling Sp_Payables_APAccount and read by Fun_getInitColumnByProName for column-init metadata. Install script: script/标版/30100101/Sp_Payables_AP.sql plus a customer override under script/客户/湛江新澳/.