# `Sp_NotReceivables` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sCustomerGuid` | `varchar(100)` |
| 2 | OUT | `iOut` | `int` |
| 3 | IN | `sLoginId` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | IN | `bFilter` | `text` |
| 7 | IN | `sUnTaskFormId` | `varchar(100)` |
| 8 | IN | `pageNum` | `int` |
| 9 | IN | `pageSize` | `int` |
| 10 | OUT | `totalCount` | `int` |
| 11 | IN | `countCloumn` | `text` |
| 12 | OUT | `countMapJson` | `longtext` |
| 13 | IN | `sFilterOrderBy` | `text` |
| 14 | IN | `sGroupby_select_sql` | `text` |
| 15 | IN | `sGroupby_group_sql` | `text` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_NotReceivables`'`._

## Narrative

**Business context:** KPI流程操作菜单 → 财务收付款 → 1/1 销售对账->收款 — AR-side counterpart of `Sp_NotPayAbles`. Paged customer-receivables warning list: pulls every still-unreceived sales bill (delivery, advance, financial-adjust, payment, AR-init) into one window so the credit/collections desk can prioritise follow-ups.

**What it does:** Reads `SysAccountPeriod.tAPDate` as the AR cutoff, calls `Sp_Sis_GetConst` for `ReceiptInit/Advance/FinancialAdjust/Payment` language labels, builds `ReceivablesWarning` (customer, product, qty, money, currency, due-date, reserves) by UNION-ing across the AR source views filtered to `sBrId/sSuId` and `tCreateDate >= tAPDate`, then forwards the final SQL to `Sp_Outstanding_Query` for paging, `bFilter`/`sFilterOrderBy` splicing, `countCloumn` totals, and `sGroupby_*` rollups.

**Invocation:** Bound as the data-source of form `gfm.sId=19211681015115285266337740` (1/1 销售对账->收款) via `gdsconfigformmaster.sSqlStr`. Also referenced by the helper `Fun_getInitColumnByProName` (column-discovery for the dynamic-grid layer). Install script ships at `script/标版/30100101/Sp_NotReceivables.sql`.
