# `Sp_Payables_APAccount` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sStatistics` | `varchar(100)` | | 2 | IN | `tStartDate` | `datetime` | | 3 | IN | `tEndDate` | `datetime` | | 4 | IN | `iSum` | `int` | | 5 | IN | `sBrId` | `varchar(100)` | | 6 | IN | `sSuId` | `varchar(100)` | | 7 | IN | `bFilter` | `varchar(5000)` | | 8 | IN | `pageNum` | `int` | | 9 | IN | `pageSize` | `int` | | 10 | OUT | `totalCount` | `int` | | 11 | IN | `countCloumn` | `varchar(5000)` | | 12 | OUT | `countMapJson` | `longtext` | | 13 | IN | `sFilterOrderBy` | `varchar(5000)` | | 14 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 15 | IN | `sGroupby_group_sql` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Payables_APAccount`'`._ ## Narrative **Business context:** 财务管理 → 应付账款 → 供应商流水账 — supplier ledger / AP reconciliation report. For each supplier in the date window it lists every AP-affecting bill (purchase-in, outsourcing, adjustment, return, payment, invoice) plus the running 余额, switchable between detail (`iSum=0`) and per-supplier 汇总 mode (`iSum=1`). **What it does:** Sets the bill-type tag families (`p_iPayType='purchaseinstore'`, `p_iOutSidePayType='outsideprocess'`, plus return/payment/adjust/pays/init types) and assembles the streaming working set across the AP-relevant tables for `sBrId`/`sSuId` and the date window. Aggregates per supplier or per bill depending on `iSum`, derives 已付/未付 amounts, and forwards the dynamic SQL + paging/`countCloumn`/`sGroupby_*` to `Sp_Outstanding_Query` for pagination, total-count and `countMapJson` totals. Internally it also delegates to the new `Sp_Payables_AP` body for the unified AP working table. **Invocation:** Bound as the data-source of the 供应商流水账 form `gfm.sId=192116810113315319144212730` via `gdsconfigformmaster.sSqlStr` — module 供应商流水账 under 应付账款 → 财务管理. Also referenced by `Fun_getInitColumnByProName` for column-init metadata. Install script: `script/标版/30100101/Sp_Payables_APAccount.sql`.