# `Sp_pur_purpurchaseorderOfSupply` (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` | `text` |
| 7 | IN | `pageNum` | `int` |
| 8 | IN | `pageSize` | `int` |
| 9 | OUT | `totalCount` | `int` |
| 10 | IN | `countCloumn` | `text` |
| 11 | OUT | `countMapJson` | `longtext` |
| 12 | IN | `sFilterOrderBy` | `text` |
| 13 | IN | `sGroupby_select_sql` | `text` |
| 14 | IN | `sGroupby_group_sql` | `text` |

## Body

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

## Narrative

**Business context:** 采购管理 — paged purchase-order report keyed by 供应商 (supplier). Despite the `COMMENT '现金日记帐'` (cash daybook) tag, the body is built off `viw_purpurchaseorder` rather than any cash table — the comment was copy-pasted from a daybook template and the proc is actually a per-supplier purchase summary.

**What it does:** Defaults `tStartDate` to one month ago and `tEndDate` to NOW+1day. Builds a temp table `SAS` of purchase-order rows in the window, then hands a dynamic SQL to `Sp_Outstanding_Query` for `bFilter`/paging/total-count/`countCloumn` aggregation. Signature matches the standard report-binding contract (`bFilter`, `pageNum`, `pageSize`, `totalCount`, `countMapJson`, `sFilterOrderBy`, `sGroupby_*`).

**Invocation:** Status: appears orphaned. No caller found in any channel (form-master sSqlStr/sConfigSqlStr, gdsmodule hooks, other routines, xly-src grep across all extensions). Install script ships at `script/标版/30100101/Sp_pur_purpurchaseorderOfSupply.sql` — candidate for maintainer audit; the misleading `COMMENT` suggests it may be legacy / pre-prod.
