# `Sp_Receivables_AR_sd` (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` | `varchar(100)` |
| 4 | IN | `tEndDate` | `varchar(100)` |
| 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 PROCEDURE `Sp_Receivables_AR_sd`'`._

## Narrative

**Business context:** 财务管理 → 应收账款 — `_sd` customer/branch override of `Sp_Receivables_AR` (file naming convention: `_<二字简拼>` typically denotes a printer customer). The 结算方式 (settlement-method) annotation on `sStatistics` parameter suggests the variant pre-builds the report keyed on `EleCustomer.sSettleStyleId` rather than the standard customer dimensions.

**What it does:** Same AR roll-up pipeline as base `Sp_Receivables_AR` (opening balance + period sales + receipts + invoices + adjustments per customer, via `TmpAll` UNION → `Sp_Outstanding_Query`), with the variant's filter clauses adapted to that customer's chart-of-accounts/結算 conventions.

**Invocation:** No bindings found. Not referenced by `gdsconfigformmaster.sSqlStr`, no `gdsmodule` hook, no other routine calls it, no xly-src match. Status: appears orphaned — customer-specific variant retained without live binding. Candidate for maintainer audit.
