# `Sp_sysaccountperiod` (procedure) - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sLoginId` | `varchar(100)` | | 2 | IN | `sBrId` | `varchar(100)` | | 3 | IN | `sSuId` | `varchar(100)` | | 4 | IN | `bFilter` | `longtext` | | 5 | IN | `pageNum` | `int` | | 6 | IN | `pageSize` | `int` | | 7 | OUT | `totalCount` | `int` | | 8 | IN | `countCloumn` | `longtext` | | 9 | OUT | `countMapJson` | `longtext` | | 10 | IN | `sFilterOrderBy` | `longtext` | | 11 | IN | `sGroupby_select_sql` | `longtext` | | 12 | IN | `sGroupby_group_sql` | `longtext` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_sysaccountperiod`'`._ ## Narrative **Business context:** 成本核算 / 财务月结 — paged report driver for a 会计期间(account period) overview grid: for each `sysaccountperiod` row up to the earliest unfrozen period (`bFrozen=0`), it derives 20+ per-period status flags showing whether each cost-accounting sub-step (库存月结、订单成本分析、工作中心、部门成本、产品库存、生产领料、费用录入、订单成本分析按类型 1/2/3/4/5/7…) has been confirmed/审核, so the user can see at a glance which steps still need attention before closing the period. **What it does:** Pulls the first `bFrozen=0` period into `p_sPeriodID`, then loads all `sysaccountperiod` rows up to that period into temp table `p_sp_sysaccountperiod` (constrained `sPeriodId >= 202401`). Initialises every status column `A0..A41` to a default localised string via `Fun_Sis_GetConstNew`, then runs ~20 UPDATEs that lookup `bConfirm`/`bCheck` rows in `accmaterialsstore`/`accordercostanalysis` (joined by `iType` 0/1/2/3/4/5/7 to pick the cost step)/`accworkcenter`/`accdepart`/`accproductstore`/`accproductionmaterialsslave`/`accexpenseentrydepartmentmaster`/`accexpenseentryworkcenterslave`, flipping each flag to the localised "已确认"/"未确认"/"sViewDetail"/"sUnAccount"/etc. constant. Splices `bFilter` (`Fun_bFilter_toWhere`) into the WHERE, paginates `pageSize`, returns the temp-table rows. **Invocation:** Status: appears orphaned. No `gdsmodule.sProcName` hook, no `gdsconfigformmaster` binding, no other-routine caller, no xly-src grep hit beyond the install script `script/标版/30100101/Sp_sysaccountperiod.sql`. Candidate for maintainer audit — likely the data source for an unwired 会计期间 dashboard (uses standard `bFilter`/paging/groupby contract of `Sp_Outstanding_Query`) or replaced by a newer report path.