Sp_DaysaleSalesMan.md 2.04 KB

Sp_DaysaleSalesMan (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(255)
4 IN sSuId varchar(255)
5 IN bFilter varchar(5000)
6 IN pageNum int
7 IN pageSize int
8 OUT totalCount int
9 IN countCloumn varchar(5000)
10 OUT countMapJson longtext
11 IN sFilterOrderBy varchar(5000)
12 IN sGroupby_select_sql varchar(5000)
13 IN sGroupby_group_sql varchar(5000)

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpDaysaleSalesMan'._

Narrative

Business context: 销售管理 → 销售分析(人员角度) — paged daily-sales pivot keyed by sales rep. Twin of Sp_Daysalecustomer but groups by sSalesManId instead of sCustomerId; returns one row per 销售员 with the monthly total dProductMoney plus 31 day-buckets d1..d31 for the month.

What it does: Formats the month-key %Y%m from tStartDate, builds a dynamic SQL that SELECT sId, sSlaveId, sCustomerId, sSalesManId, (SELECT sName FROM SisSalesMan WHERE sId=T.sSalesManId) AS sSalesManName, SUM(dProductMoney), COUNT(1), SUM(CASE WHEN DAY(tCreateDate)=N THEN dProductMoney ELSE 0 END) AS dN-style for N=1..31, from viw_salsalesorder filtered to the seven 销售订单 sFormIds and bInvalid=0, grouped by sSalesManId. The dynamic SQL is handed to Sp_Outstanding_Query for paging, total-count, and bFilter condition splicing.

Invocation: Bound as the data-source of the 销售人员日销售额统计 form gfm.sId=101801153119616636370835770 via gdsconfigformmaster.sSqlStr — under module 销售分析(人员角度) (sId 16342518750008161923333768442000) inside 销售管理. Loaded when the user opens the report. Not in xly-src 30100101 install scripts — DB-only.