# `Sp_Receivables_ARAccount` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sStatistics` | `varchar(255)` | | 2 | IN | `tStartDate` | `datetime` | | 3 | IN | `tEndDate` | `datetime` | | 4 | IN | `sLoginId` | `varchar(255)` | | 5 | IN | `iSum` | `int` | | 6 | IN | `iType` | `int` | | 7 | IN | `sBrId` | `varchar(100)` | | 8 | IN | `sSuId` | `varchar(255)` | | 9 | IN | `bFilter` | `varchar(5000)` | | 10 | IN | `pageNum` | `int` | | 11 | IN | `pageSize` | `int` | | 12 | OUT | `totalCount` | `int` | | 13 | IN | `countCloumn` | `varchar(5000)` | | 14 | OUT | `countMapJson` | `longtext` | | 15 | IN | `sFilterOrderBy` | `varchar(5000)` | | 16 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 17 | IN | `sGroupby_group_sql` | `varchar(5000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Receivables_ARAccount`'`._ ## Narrative **Business context:** 常用模块 → 常用设置 → 客户流水账 — paged per-customer "running account" ledger view. Lists every AR-affecting transaction (sales/送货/invoice/receipt/payment/adjustment) for a customer within a date range, in chronological order, with running balance. **What it does:** Builds an opening-balance row from `Sp_Receivables_AR` (called for `tStartDate` as cutoff to inherit the balance carried in) and then unions per-document detail rows from `viw_salsalescheckingmaster`/`SalSalesCheckingSlave`, `CahReceiptMaster`, `SalSalesInvoiceMaster`, `CahPaymentMaster`, `CahFinancialAdjust`. Groups by date and document id, computing running `d余额` per row. Hands the final dynamic SQL to `Sp_Outstanding_Query` for paging, total counts, and `bFilter`/`sGroupby_*_sql` splicing. **Invocation:** Bound as data-source of form 客户流水账 (`gfm.sId=192116810113315318251537560`, module 客户流水账 `192116810113315318250950380` under 常用模块 → 常用设置). Also referenced by `Fun_getInitColumnByProName` (column-introspection helper). Install: `script/标版/30100101/Sp_Receivables_ARAccount.sql`.