# `Sp_Inventory_ProductInOutStoreCost` (procedure)


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sCustomerGuid` | `varchar(255)` |
| 2 | IN | `sProductGuid` | `varchar(255)` |
| 3 | IN | `sParentGuid` | `varchar(255)` |
| 4 | IN | `sWarehouseGuid` | `varchar(255)` |
| 5 | IN | `sDefineNoS` | `varchar(255)` |
| 6 | IN | `sDefineNoS2` | `varchar(255)` |
| 7 | IN | `tStartDate` | `datetime` |
| 8 | IN | `tEndDate` | `datetime` |
| 9 | IN | `iViewOperation` | `int` |
| 10 | IN | `sBrId` | `varchar(255)` |
| 11 | IN | `sSuId` | `varchar(255)` |
| 12 | IN | `bFilter` | `varchar(5000)` |
| 13 | IN | `pageNum` | `int` |
| 14 | IN | `pageSize` | `int` |
| 15 | OUT | `totalCount` | `int` |
| 16 | IN | `countCloumn` | `varchar(5000)` |
| 17 | OUT | `countMapJson` | `longtext` |
| 18 | IN | `sFilterOrderBy` | `varchar(5000)` |
| 19 | IN | `sGroupby_select_sql` | `varchar(5000)` |
| 20 | IN | `sGroupby_group_sql` | `varchar(5000)` |
| 21 | OUT | `sCode` | `int` |
| 22 | OUT | `sReturn` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** Cost-focused split of the finished-product 进销存 ledger family (`Sp_Inventory_ProductInOutStore*`) — surfaces unit costs and cost-money columns rather than qty/sales-money, intended for the 成本管理 → 产品存货分析 cost-only view. The trailing `sCode`/`sReturn` OUT params follow the standard error-channel convention.

**What it does:** Same temp-table pattern as `Sp_Inventory_ProductInOutStore`: aggregates `pitproductstore` rows into opening/in/out/closing across a date range per product / 自定义项 / warehouse / location, joins `eleproduct` etc. for display, but selects the `dCostPrice` / `dCostMoney` / `dProductPrice` columns. Delivered through `Sp_Outstanding_Query` for paging and count-JSON.

**Invocation:** Status: appears orphaned. No form-master binding, no `gdsmodule` hook, no other DB caller, only the two install / optimize SQL files in xly-src (`script/标版/30100101/cost/Sp_Inventory_ProductInOutStoreCost.sql`, `script/标版/optimize/Sp_Inventory_ProductInOutStoreCost.sql`). Kept as a sibling of `Sp_Inventory_ProductInOutStore` but appears not wired into a live form-master row — candidate for maintainer audit.
