Sp_Receivables_Aging (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 PROCEDURESpReceivables_Aging'._
Narrative
Business context: 财务管理 → 应收账款 → 应收账款账龄分析 (AR aging analysis). Same data sources as Sp_Receivables_AR but bucketed by overdue interval: 当期未到期, 30日内, 30-60, 60-90, 90-120, 120-150, 150+ 天 — producing the classic accounting aging-summary table per customer.
What it does: Builds the TmpAll UNION over salsalesorderslave/viw_salsalescheckingmaster/SalSalesCheckingSlave/saldelivergoodsslave/CahReceiptMaster/SalSalesInvoiceMaster/CahFinancialAdjust/CahPaymentMaster like base AR. For each row, computes p_dDueLastBalanceMoney/p_dDueThisBalanceMoney plus per-bucket sums dDueSalesMoney, dDueSalesMoney60, …90, …120, …150 from tCheckDate vs tEndDate/tInitDate. Hands the dynamic SQL to Sp_Outstanding_Query for paging, total counts, bFilter/countMapJson splicing.
Invocation: Called by Sp_Task_doAgingSmallai (scheduled Quartz task for the 小ai overdue-AR daily report — installed at script/标版/30100101/Sp_Task_doAgingSmallai.sql). No direct gdsconfigformmaster binding found in the live db, but the procedure is otherwise the standard 账龄 engine; an aging report form usually wires it. Install: script/标版/30100101/Sp_Receivables_Aging.sql (with a customer override at script/客户/千彩/Sp_Receivables_Aging.sql).