Sp_Sales_SalesAnalysiseOfCustomerproperty (procedure)
客户属性销售分析表
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | tStartDate |
datetime |
| 2 | IN | tEndDate |
datetime |
| 3 | IN | sBrId |
varchar(100) |
| 4 | IN | sSuId |
varchar(100) |
| 5 | IN | sLoginId |
varchar(100) |
| 6 | IN | bFilter |
varchar(5000) |
| 7 | IN | pageNum |
int |
| 8 | IN | pageSize |
int |
| 9 | OUT | totalCount |
int |
| 10 | IN | countCloumn |
varchar(5000) |
| 11 | OUT | countMapJson |
longtext |
| 12 | IN | sFilterOrderBy |
varchar(5000) |
| 13 | IN | sGroupby_select_sql |
varchar(5000) |
| 14 | IN | sGroupby_group_sql |
varchar(5000) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpSales_SalesAnalysiseOfCustomerproperty'._
Narrative
Business context: 销售管理 → 销售分析(客户角度) → 销售分析表(客户属性) — paged sales analysis pivoted by 客户属性 (customer property — industry / distributor type), one row per siscustomerproperty entry.
What it does: Seeds SAS from siscustomerproperty for the current 品牌/分公司, then UPDATE ... INNER JOINs in order counts and money from viw_salSalesOrder joined to elecustomer and grouped by EP.sCustomerPropertyId (subject to the seven 销售订单 sFormId whitelist and bCheck=1 AND bInvalid=0). Joins cahreceiptmaster via the same customer→property mapping to bring in collected money, computes dBalanceMoney, averages and 占比 columns from tempSAS, drops zero-activity rows, then pages through Sp_Do_UpdateByPageSizeBefore. The receipts subquery's inner group by EP.sParentId rather than EP.sCustomerPropertyId is a known mismatch carried in this variant.
Invocation: Bound as the data-source of the 销售分析表(客户属性) form gfm.sId=101251240115015848399159370 via gdsconfigformmaster.sSqlStr; module path 销售管理 → 销售分析(客户角度) → 销售分析表(客户属性). Install ships at script/标版/30100101/Sp_Sales_SalesAnalysiseOfCustomerproperty.sql; 优化版 at script/标版/optimize/.