# `Sp_Inventory_InOutStoreNewTotal` (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_InOutStoreNewTotal`'`._

## Narrative

**Business context:** 材料库存 → 材料进销存 — totals variant of the material in-out-store (进销存) report driver. Sibling of `Sp_Inventory_InOutStoreNew1`; both are detached forks of the live `Sp_Inventory_MaterialsInOutStoreDoing` that powers the 材料进销存报表 form.

**What it does:** Same opening-balance + period-movement + closing-balance computation as `Sp_Inventory_InOutStoreNew1` over `mitmaterialsstore`, `EleMaterialsStock`, `elematerialsstockmonth`, `mitmaterialsinitmaster`. Builds the same temp-table chain (`p_Tmp_LastInitStore` / `p_Tmp_LastStore` / `p_TmpInOutStore` / `TmpMitMaterialsStore`), pulls account period from `sysaccountperiod`, calls `Sp_Sis_GetMertialsInventoryFormGuid` + `Sp_Sis_GetConst` for form-config, and ships the paginated rowset via `Sp_Outstanding_Query`. The `Total` suffix collapses to per-material aggregates rather than per-warehouse/location detail.

**Invocation:** Status: appears orphaned. No caller in any channel — no form binding, no module hook, no proc/function reference, no `xly-src` reference. Looks like a detached experimental fork; candidate for maintainer audit.
