# `Sp_Payables_APDetail` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `iSelect` | `int` | | 2 | IN | `iType` | `int` | | 3 | IN | `sStatistics` | `varchar(100)` | | 4 | IN | `tStartDate` | `datetime` | | 5 | IN | `tEndDate` | `datetime` | | 6 | IN | `sBrId` | `varchar(100)` | | 7 | IN | `sSuId` | `varchar(255)` | | 8 | IN | `bFilter` | `varchar(5000)` | | 9 | IN | `pageNum` | `int` | | 10 | IN | `pageSize` | `int` | | 11 | OUT | `totalCount` | `int` | | 12 | IN | `countCloumn` | `varchar(5000)` | | 13 | OUT | `countMapJson` | `longtext` | | 14 | IN | `sFilterOrderBy` | `varchar(5000)` | | 15 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 16 | 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_APDetail`'`._ ## Narrative **Business context:** 常用模块 → 常用设置 / 订单-付款明细表 — per-bill AP-by-purchase-order detail report. `iSelect`+`iType` select which payment-event variant to render (采购、付款、调整金额、调整票据、退款、开票); the same procedure backs each of the 订单-付款明细表 sub-forms by switching its `p_iPayType` / `p_sTable` / `p_iOutSide` family of locals. **What it does:** Defaults `tStartDate` to NOW()-1 month and `tEndDate` to NOW(), routes to one of the AP-event sources by `iSelect`/`iType`, builds the dynamic `p_sSql` for that source scoped to `sBrId`/`sSuId` plus the date window, joins to elesupplier / order tables to enrich the rows, and forwards the assembled SQL + paging / grouping inputs to `Sp_Outstanding_Query` for paging, total-count and `countMapJson` totals. **Invocation:** Bound as the data-source of six 订单-付款明细表 forms via `gdsconfigformmaster.sSqlStr` — 订单-付款明细表(采购) `gfm.sId=192116810113315319128813950`, (付款) `192116810113315319134212800`, (调整金额) `192116810113315319135996200`, (调整票据) `192116810113315319138829320`, (退款) `192116810113315319140301650`, (开票) `192116810113315319141949790` — all under 常用设置 → 常用模块. Also referenced by `Fun_getInitColumnByProName` for column-init metadata. Install script: `script/标版/30100101/Sp_Payables_APDetail.sql`.