# `sp_salsalesorderdata` (procedure)


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 销售管理 → 销售订单 — paged data-source for the 销售订单 unmatched / pending list. Reads `salsalesordermaster` plus its slaves, computes the "remaining" buckets (`p_dProductQty`, `p_dWorkOrderQty`, `p_dRejectQty`, `p_dDeliverNotifyQty1`, `p_dDeliverQty1`, `p_dProductMoney`, `p_dProductTaxMoney`, ...) per line, and projects them to the form so users see how much of each order is still to be made / 送货 / 收款.

**What it does:** Builds two staging tables `TMP_Viw_SalSalesOrder_mVFp` (master) and `TMP_Viw_SalSalesOrder_mVFp_child` (slave) from `salsalesordermaster`; reads system settings (`bFilter` is auto-converted via `Fun_bFilter_toWhere(bFilter,'A')` when it is JSON); fills the staging tables with computed remaining qtys for product, work-order, reject, deliver-notify, deliver, money, tax-money, foreign-money; marks `已作废` rows; and finally hands the assembled `SELECT * FROM TMP_Viw_SalSalesOrder_mVFp_child ...` to `Sp_Outstanding_Query` for paging + count + `bFilter` splicing.

**Invocation:** Not bound to any `gdsconfigformmaster` row, no `gdsmodule` hook, no other-routine caller in the live DB, and no install script in `xly-src/script/`. Status: appears orphaned in this tenant — likely a working draft superseded by one of the `Sp_Sales_*` proc family (`Sp_Sales_SalesAnalysiseOfProduct`, etc.) that drives the current 销售订单 reports. Candidate for maintainer audit before removal.
