# `Fun_GetTestCount` (function)

> 获取字符串中数字


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

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `tCreateDate` | `datetime` |
| 2 | IN | `iType` | `int` |

## Body

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

## Narrative

**Business context:** Sample/打样 sales-order monthly counter — counts how many `salsalesorderslave` rows belong to orders of type `5` (打样 / sample order) created in the same calendar month as `tCreateDate`. `iType=1` adds an `iSucceed=1` filter to count only successful samples. Used for sample-volume KPI/打样次数 calculations. The header comment `获取字符串中数字` is wrong/copy-pasted from `Fun_GetNum` — body has nothing to do with digit extraction.

**What it does:** branches on `iType`. Joins `salsalesorderslave` to `salsalesordermaster`, filters `sOrderType=5` and the month-window `[YYYY-MM-01, next-month-01)`, counts `sId`. Returns the count.

**Invocation:** no form-master sSqlStr, gdsmodule hook, other routine, or xly-src reference uses this function. Status: appears orphaned. No caller found in any channel — candidate for maintainer audit (likely a KPI helper that was wired into a deprecated sample-order analysis form).
