# `Sp_OpsOutside_Customer` (procedure)


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `tStartDate` | `datetime` |
| 2 | IN | `tEndDate` | `datetime` |
| 3 | IN | `sCustomerName` | `varchar(100)` |
| 4 | IN | `sBrId` | `varchar(100)` |
| 5 | IN | `sSuId` | `varchar(100)` |
| 6 | IN | `sLoginId` | `varchar(100)` |
| 7 | IN | `bFilter` | `text` |
| 8 | IN | `pageNum` | `int` |
| 9 | IN | `pageSize` | `int` |
| 10 | OUT | `totalCount` | `int` |
| 11 | IN | `countCloumn` | `varchar(5000)` |
| 12 | OUT | `countMapJson` | `longtext` |
| 13 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 14 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 15 | IN | `sGroupby_group_sql` | `varchar(5000)` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_OpsOutside_Customer`'`._

## Narrative

**Business context:** 外协管理 / 外发加工 — per-customer 外发加工 (`opsoutsideprocess*`) money summary for a date range. Pivots material-cost spending by `sCustomerId` so a report can rank customers by outsourced spend in the window.

**What it does:** Defaults `tStartDate` to the first of the current month and `tEndDate` to one month forward; populates a temp table from `opsoutsideprocessslave` joined to `opsoutsideprocessmaster` and `elecustomer`, filtered on `sCustomerName LIKE %sCustomerName%` and master `tCreateDate BETWEEN tStartDate AND tEndDate`. A second temp table aggregates per customer and prepares output rows for paging (`pageNum`/`pageSize`/`totalCount`).

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master, gdsmodule hooks, other routines, xly-src grep across all extensions, dynamic-dispatch search) — candidate for maintainer audit. Body shape matches the 外发-by-客户 reports under 外协管理 but no `gdsconfigformmaster` binding currently references it; likely a draft variant superseded by a sibling proc.
