# `Sp_Inventory_ProductInOutStore_new` (procedure)


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

## Parameters

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

## Body

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

## Narrative

**Business context:** Newer-variant of `Sp_Inventory_ProductInOutStore` — finished-product 出入库流水账 / 进销存 report builder. The original is bound to the 成品进销存报表 (库存查询) and 产品存货核算 (成本管理) forms; this `_new` copy is a side-by-side replacement candidate retained for cutover.

**What it does:** Same parameter contract as `Sp_Inventory_ProductInOutStore` (customer / product / 自定义项 / warehouse / date-range / page / filter inputs, OUT rowset + `totalCount` + `countMapJson`) with an extra `sLoginId` parameter early in the signature. Builds a temp ledger from `pitproductstore`, joins `eleproduct` / `elecustomer` / `elewarehouse` for display fields, paginates via `Sp_Outstanding_Query` and emits column-aggregation JSON. Diverges from the original mainly in opening-balance window handling and column lineup.

**Invocation:** Status: appears orphaned. No form-master binding, no `gdsmodule` hook, no DB caller, no xly-src reference — kept as a parallel working copy of the production `Sp_Inventory_ProductInOutStore` while the rewrite was in flight. Candidate for maintainer audit before delete.
