# `Sp_Inventory_InOutStoreNew1` (procedure)


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

## Parameters

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

## Body

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

## Narrative

**Business context:** 材料库存 → 材料进销存 — abandoned/experimental variant of the material in-out-store (进销存) report driver. The naming (`*New1`) sits alongside `Sp_Inventory_InOutStoreNewTotal` and the production-side `Sp_Inventory_MaterialsInOutStoreDoing` as parallel iterations of the same opening-balance + movement + closing-balance computation against `mitmaterialsstore`, `elematerialsstockmonth`, `mitmaterialsinitmaster`.

**What it does:** Defaults the window to the last month, builds temp tables `p_Tmp_LastInitStore`, `p_Tmp_LastStore`, `p_TmpInOutStore`, and `TmpMitMaterialsStore` to gather initial stock, period-start stock, and per-period in/out movements per material/warehouse/location. Resolves the period via `sysaccountperiod`, fetches form-config constants via `Sp_Sis_GetMertialsInventoryFormGuid` + `Sp_Sis_GetConst`, and emits the paginated rowset through `CALL Sp_Outstanding_Query`.

**Invocation:** Status: appears orphaned. No caller found in any channel — no `gdsconfigformmaster` binding, no `gdsmodule` hook, no proc/function reference, and no `xly-src` grep hit. Looks like an in-progress fork of the live report (the `1` suffix suggests an iteration); candidate for maintainer audit before relying on it.
