# `Sp_SalesOrder_Analysis` (procedure) > 销售订单分析报表 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sGroupType` | `varchar(100)` | | 2 | IN | `sSearchType` | `varchar(100)` | | 3 | IN | `sBillType` | `varchar(100)` | | 4 | IN | `tStartDate` | `varchar(100)` | | 5 | IN | `sLoginId` | `varchar(100)` | | 6 | IN | `sBrId` | `varchar(100)` | | 7 | IN | `sSuId` | `varchar(100)` | | 8 | IN | `bFilter` | `varchar(5000)` | | 9 | IN | `pageNum` | `int` | | 10 | IN | `pageSize` | `int` | | 11 | OUT | `totalCount` | `int` | | 12 | IN | `countCloumn` | `varchar(5000)` | | 13 | OUT | `countMapJson` | `longtext` | | 14 | IN | `sFilterOrderBy` | `varchar(5000)` | | 15 | IN | `sGroupby_select_sql` | `varchar(5000)` | | 16 | IN | `sGroupby_group_sql` | `varchar(5000)` | | 17 | OUT | `sColumnNameConfig` | `longtext` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_SalesOrder_Analysis`'`._ ## Narrative **Business context:** 销售管理 → 销售分析 — 销售订单分析报表 data-source. Pivot report keyed by configurable `sGroupType` (客户 / 业务员 / 产品 / 业务部门 / …), aggregating sales-order or 报价 bills across a date range. Returns one row per dimension+`sCurrency` combo with totals: `dProductMoney` (含税金额), `dProductNoTaxMoney` (不含税), `dProductTaxMoney` (税额), `dProductQty` (数量), `dProductForeignMoney` (外币). Also returns a dynamic `sColumnNameConfig` so the grid can render the show-hide column choices the user saved. **What it does:** Resolves the date range (`tStartDate` is the string `start,end`; default = last 12 months), sets `p_sDateType` / `p_sGroupType` / `p_sBillType` from the input flags. Creates temp table `p_SalesOrder_Analysis` and emits a `Fun_get_show_config` row per displayed column (编号 / 币别 / 名称 / 总计-金额 / 不含税 / 税额 / 总数量 / 外币金额, …) accumulating the JSON config in `p_sColumnNameConfig`. Then it branches on `sBillType` (`salsalesorder` / `salquotation` / etc.) and `sGroupType` to build the dynamic insert into the temp table, joining `viw_salsalesorder` (or equivalent) to dimension tables (`elecustomer`, `SisSalesMan`, `eleproduct`, …) filtered to the date range and `bInvalid=0`. Final SELECT runs through the standard pager (`Sp_Outstanding_Query` shape) with `bFilter` → WHERE translation and grouping driven by `sGroupby_select_sql` / `sGroupby_group_sql`. **Invocation:** Standard 报表 data-source signature (17 params ending in `sColumnNameConfig OUT`). Status: **appears orphaned in this snapshot** — no `gdsconfigformmaster.sSqlStr` matches in current DB, no `gdsmodule` ties it as a procName, no other proc references it, no install-script call beyond the self-defining `script/标版/30100101/Sp_SalesOrder_Analysis.sql`. The corresponding form is likely customer-seeded; if missing in your tenant, the report won't show. Candidate for maintainer audit to confirm whether a 销售订单分析 form-master row needs to be re-installed.