# `Fun_GetBillStatus` (function)

> 获取系统设定中  单据号设定 打印状态


- **Type:** FUNCTION
- **Returns:** `int`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sFormGuid` | `varchar(100)` |
| 2 | IN | `sBrId` | `varchar(100)` |
| 3 | IN | `sSuId` | `varchar(100)` |

## Body

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

## Narrative

**Business context:** Per-form bill-number print/status setting — header `获取系统设定中 单据号设定 打印状态`. The bill-number admin module (`SysBillNoSettings`) lets tenants configure, per form × brand × subsidiary, how the bill number behaves at print/save time (auto-generate, manual, audit-locked etc., encoded in `sStatusType`). This function pulls that flag.

**What it does:** if `sFormGuid` is non-empty, selects `sStatusType` from `SysBillNoSettings` where `sFormId/sBrandsId/sSubsidiaryId` match. Returns the value, or 0 if no row or no form.

**Invocation:** invoked by the material-shortage / pull-pending bill family — `Sp_BillOfApply` and `Sp_BillOfApplyLine` (material apply by work order, gdsmodule `根据工单领料申请`), `Sp_BillOfNoPicking`, `_Cljg`, `_copy1` (no-pull-yet pending lists) — to gate behavior on the tenant's bill-number policy for the calling form.
