# `Sp_Receivables_Warning` (procedure)

> 超期未收款


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `iType` | `int` |
| 2 | IN | `sCustomerId` | `varchar(100)` |
| 3 | OUT | `bOut` | `int` |
| 4 | IN | `sLoginId` | `varchar(100)` |
| 5 | IN | `sBrId` | `varchar(100)` |
| 6 | IN | `sSuId` | `varchar(100)` |
| 7 | IN | `bFilter` | `varchar(5000)` |
| 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_Receivables_Warning`'`._

## Narrative

**Business context:** 财务管理 → 应收账款 → 超期未收款 — customer-level overdue-receivables warning. Returns `bOut=1` when the given customer (`sCustomerId`) has receivables past the system 应收预警 threshold, supporting blocking new sales/delivery on the standard "客户应收预警" gate; also paged-listable as a report of all warned customers.

**What it does:** Reads `Fun_Sis_GetConst('iReceivableType')` / `Fun_Sis_GetConst('tCheckDate')` etc. for the configured warning thresholds, and `p_sLookCustomer` from `SysSystemSettings` for the per-tenant customer scope. Populates temp table `p_tmp_ReceivablesWarning` (`sCustomerNo`, `sCustomerName`, …) by joining receivable balances against the warning rule, then either flips `bOut=1` (when called with a single `sCustomerId`) or hands the result to `Sp_Outstanding_Query` for paging.

**Invocation:** No bindings found. Not referenced by `gdsconfigformmaster.sSqlStr`, no `gdsmodule` hook, no other routine calls it, only the install script at `script/标版/30100101/Sp_Receivables_Warning.sql`. Status: appears orphaned — the warning-gate proc that no live form/save-hook currently wires up. Candidate for maintainer audit (likely meant to be referenced from a save-hook on 销售订单/送货单).
