# `Sp_financial_SaleManGrossProfit` (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` | `longtext` | | 7 | IN | `pageNum` | `int` | | 8 | IN | `pageSize` | `int` | | 9 | OUT | `totalCount` | `int` | | 10 | IN | `countCloumn` | `longtext` | | 11 | OUT | `countMapJson` | `longtext` | | 12 | IN | `sFilterOrderBy` | `longtext` | | 13 | IN | `sGroupby_select_sql` | `longtext` | | 14 | IN | `sGroupby_group_sql` | `longtext` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_financial_SaleManGrossProfit`'`._ ## Narrative **Business context:** Sales-rep-axis gross-profit report — aggregates 订单总金额 vs 直接材料 / 生产补料 / 发外加工 over a date window, grouped by 业务员 (`sSalesManId`/`sSalesManName`). Sibling of `Sp_financial_CustomerGrossProfit` and `Sp_financial_OrderGrossProfit`; shares the canonical paginated-report signature. **What it does:** Materialises `p_TmpWorkOrder` and `p_TmpTb` temp tables summing per-order cost components from `mftworkorder*`, joins to customer/sales-man/product master tables to populate grouping fields, then builds dynamic SQL honoring caller-supplied `bFilter`, `sFilterOrderBy`, `sGroupby_*` clauses. Returns paginated rows plus `totalCount` and `countMapJson` for the BACK report grid. **Invocation:** Status: appears orphaned. No `gdsmodule.sProcName`, no `gdsconfigformmaster` data-source binding, no other-routine caller, and only the install scripts at `script/标版/30100101/Sp_financial_SaleManGrossProfit.sql` and `script/标版/optimize/Sp_financial_SaleManGrossProfit.sql` reference it — candidate for maintainer audit (form-master binding appears to have been dropped).