Sp_Sales_SalesAnalysiseOfSalesdepart (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_SalesAnalysiseOfSalesdepart'._
Narrative
Business context: 销售管理 → 销售分析(人员角度) → 销售分析表(销售部门) — paged sales analysis pivoted by 销售部门 (sisdepart), one row per department with that department's aggregate ordered / collected / outstanding totals.
What it does: Seeds SAS from sisdepart for the current 品牌/分公司, then UPDATE ... INNER JOINs in order counts, qty and money from viw_salSalesOrder joined to sissalesman (to lift each order's sSalesManId to a sDepartId) and grouped by EP.sDepartId — restricted to the seven 销售订单 sFormId whitelist with bCheck=1 AND bInvalid=0. Joins cahreceiptmaster through sissalesman the same way for 收款. Drops zero-money rows, computes dBalanceMoney, averages and 占比 columns from tempSAS, then hands SAS to Sp_Do_UpdateByPageSizeBefore.
Invocation: Bound as the data-source of the 销售分析表(销售部门) form gfm.sId=101251240115015848401639221 via gdsconfigformmaster.sSqlStr; module path 销售管理 → 销售分析(人员角度) → 销售分析表(销售部门). 优化版 ships at script/标版/optimize/Sp_Sales_SalesAnalysiseOfSalesdepart.sql; original at script/标版/30100101/Sp_Sales_SalesAnalysiseOfSalesdepart.sql.