# `Sp_Sales_PurchaseAnalysiseOfSupplyYear` (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 PROCEDURE `Sp_Sales_PurchaseAnalysiseOfSupplyYear`'`._

## Narrative

**Business context:** 采购管理 → 采购分析报表 → 材料季度、年度均价表 — paged quarterly/annual material average-price report. Aggregates purchase qty and money per material across the window so procurement can track price drift.

**What it does:** Builds temp `SAS`/`tempSAS`, `INSERT INTO SAS` from `viw_purpurchaseorder` `JOIN elematerials`, grouping by material with `SUM(qty)`/`SUM(money)` and computing `avg_price = money/qty` per quarter/year bucket derived from `tCreateDate`. Final paging via `Sp_Do_UpdateByPageSizeBefore` returning `pageNum/pageSize` slice plus `countMapJson` from `countCloumn`.

**Invocation:** Status: appears orphaned in this snapshot. No `gdsconfigformmaster` binding and no xly-src reference at all. Likely intended for a 材料均价 dashboard whose form-master row was never persisted (or was pruned). Maintainer audit recommended.
