# `Sp_financial_EasyCost` (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_EasyCost`'`._

## Narrative

**Business context:** Intended as the 简易成本 (easy-cost / quick-cost) report — same canonical paginated-report signature as the `Sp_financial_*GrossProfit` family, building order-level cost breakdowns (订单总金额, 直接材料, 生产补料, 发外加工) for a date window without the full 成本核算 month-end pipeline.

**What it does:** Materialises temp tables `p_TmpWorkOrder` and `p_TmpTb` summing per-`sOrderSlaveId` material/补料/发外 costs from the `mftworkorder*` family. Joins to customer/sales-man/product master tables and assembles dynamic SQL honoring caller-supplied `bFilter`, `sFilterOrderBy`, `sGroupby_*` clauses. Returns paginated rows plus `totalCount` and an aggregate `countMapJson`.

**Invocation:** Status: appears orphaned. No `gdsmodule.sProcName`, no `gdsconfigformmaster` data-source binding, no other-routine caller, and only the install script `script/标版/30100101/Sp_financial_EasyCost.sql` references it — candidate for maintainer audit (form-master binding appears to have been dropped).
