# `Sp_NotReceivables_HZ_new` (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_HZ_new`'`._

## Narrative

**Business context:** Newer (`_new`) rewrite of `Sp_NotReceivables_hz` — customer-receivables summary (汇总) under 1/1 销售对账->收款. Same per-customer rollup intent, refactored to assemble its data via explicit `p_sInsertSql/p_sSelectSql/p_sFromSql/p_sWhereSql` parts (plus pre-declared decimal accumulators for `dProductMoney/dReceiptMoney/dProductQty/dNoReceiptMoney/dProductForeignMoney`) instead of the older inline UNION.

**What it does:** Same overall flow as the rest of the family — `SysAccountPeriod.tAPDate` cutoff, `Sp_Sis_GetConst` constant resolution, `ReceivablesWarning` temp table — but materialises results through a single composed `INSERT … SELECT … FROM … WHERE …` joining delivery/advance/financial-adjust/payment/AR-init sources, grouped by `sCustomerId`, then paged via `Sp_Outstanding_Query`.

**Invocation:** Status: appears orphaned. Not bound to any `gdsconfigformmaster`, no `gdsmodule` hook, no other-routine reference, no xly-src caller — looks like a staged replacement for `Sp_NotReceivables_hz` that was never wired up. Candidate for maintainer audit.
