# `Sp_OverdueNotReceivables` (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` | `varchar(5000)` |
| 7 | IN | `sUnTaskFormId` | `varchar(100)` |
| 8 | IN | `pageNum` | `int` |
| 9 | IN | `pageSize` | `int` |
| 10 | OUT | `totalCount` | `int` |
| 11 | IN | `countCloumn` | `varchar(5000)` |
| 12 | OUT | `countMapJson` | `longtext` |
| 13 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 14 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 15 | IN | `sGroupby_group_sql` | `varchar(5000)` |

## Body

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

## Narrative

**Business context:** 销售管理 → 开票&回款 → 超期未收款预警表 — overdue-uncollected AR early-warning report. Lists per-customer outstanding balances (未收款) along with their 应收/订单/单据 contexts, flagging the ones past the configured 收款期限 so AR can chase collection.

**What it does:** Builds the working set from receivable + advance-receipt + 票据 (invoice) sources scoped to `sBrId`/`sSuId` (and `sCustomerGuid` when provided), folds in `p_sLookCustomer` from the data-permission framework, computes `dNoReceiveMoney` per customer/bill, evaluates overdue by comparing today against the customer's 收款期限 set on `elecustomer` / system parameters, and forwards the assembled SQL plus paging / grouping / `countCloumn` inputs to the generic `Sp_Outstanding_Query` helper for paging, total-count and `countMapJson` totals.

**Invocation:** Bound as the data-source of the 超期未收款预警表 form `gfm.sId=101251240115015879457139790` via `gdsconfigformmaster.sSqlStr` — module 超期未收款预警表 under 开票&回款 → 销售管理. Loaded when the user opens the report. Install script: `script/标版/30100101/Sp_OverdueNotReceivables.sql`.
