Sp_QuoquotationOrderMonth.md 2.39 KB

Sp_QuoquotationOrderMonth (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 PROCEDURESpQuoquotationOrderMonth'._

Narrative

Business context: 销售管理 → 报价&估计管理 → 客户估价分析 — period-windowed customer-level quote-vs-order conversion report. One row per sCustomerId summarising 报价单数/报价金额/总数量 (counts and money of quotes filed) against 成单单数/成单金额 (the subset that linked to a sales order via quoquotation.sOrderId), with a 成单率 ratio.

What it does: Defaults tStartDate/tEndDate to the last month if null, then builds temp Tmp_QuoquotationOrder from viw_quoquotation filtered by sBrandsId/sSubsidiaryId/bInvalid=0/tCreateDate window, grouped by sCustomerId (counts, SUM(dProductQty), SUM(dProductMoney)). A second UPDATE JOIN over the same view restricted to IFNULL(sOrderId,'') <> '' fills dSucceedCount and dSucceedMoney. A join to elecustomer denormalises sCustomerName; a final SET dRate = ROUND(dSucceedCount/dCount*100, 2). The temp table is fed to Sp_Do_UpdateByPageSizeBefore for paging + bFilter splicing, then returned via dynamic SELECT * FROM Tmp_QuoquotationOrder.

Invocation: Bound as the data-source of the 客户估价分析 form gfm.sId=101801153119616739487098840 via gdsconfigformmaster.sSqlStr — under module 客户估价分析 (sId 101801153119616739487098580) inside 销售管理 → 报价&估计管理. Loaded when the user opens the report. xly-src/script/标版/optimize/Sp_QuoquotationOrderMonth.sql ships a performance/lock patch — verify which body is deployed.