# `Sp_Receivables_AgingSmallai` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `iType` | `int` | | 2 | IN | `sStatistics` | `varchar(100)` | | 3 | IN | `tStartDate` | `datetime` | | 4 | IN | `tEndDate` | `datetime` | | 5 | IN | `sZero` | `varchar(100)` | | 6 | IN | `sLoginId` | `varchar(100)` | | 7 | INOUT | `dNoReceiptMoney` | `decimal(18,6)` | | 8 | INOUT | `dDueReceiptMoney` | `decimal(18,6)` | | 9 | IN | `sBrId` | `varchar(100)` | | 10 | IN | `sSuId` | `varchar(100)` | | 11 | IN | `bFilter` | `varchar(5000)` | | 12 | IN | `pageNum` | `int` | | 13 | IN | `pageSize` | `int` | | 14 | OUT | `totalCount` | `int` | | 15 | IN | `countCloumn` | `varchar(5000)` | | 16 | OUT | `countMapJson` | `longtext` | | 17 | IN | `sFilterOrderBy` | `varchar(5000)` | | 18 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 19 | 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_AgingSmallai`'`._ ## Narrative **Business context:** 财务管理 → 应收账款 — 小ai保驾护航 (AI assistant) edition of the AR aging report. Tailored output shape for the scheduled WeChat/IM message that the 小ai bot pushes to finance — same bucketing as `Sp_Receivables_Aging` but trimmed to the column set the message-template consumes (`dDueLastBalanceMoney, dDueThisBalanceMoney, dDueSalesMoney, dDueSalesMoney60, …90, …120, …150, dNoCheckMoney`). **What it does:** Same `TmpAll` UNION pipeline over `salsalesorderslave`/`viw_salsalescheckingmaster`/`CahReceiptMaster`/`SalSalesInvoiceMaster`/`CahFinancialAdjust`/`CahPaymentMaster` as base AR aging, computing the same 当期/30/60/90/120/150 buckets. Result is paged via `Sp_Outstanding_Query`; `countMapJson` returns the summary used by the messaging layer. **Invocation:** Called by `Sp_Task_doAgingSmallai` — the Quartz scheduled task ("小ai保驾护航-超期应收") which composes the daily 应收帐款超期未收分析报告. Quartz dispatch lives in `xlyFlow/src/main/java/com/xly/quartz/task/QuartzTask.java` / `TaskServiceImpl`. Install: `script/标版/30100101/Sp_Receivables_AgingSmallai.sql`.