# `fun_getreportId_bycus` (function)

> 根据客户ID获取报表ID


- **Type:** FUNCTION
- **Returns:** `varchar(255)`
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `p_sCustId` | `varchar(255)` |
| 2 | IN | `p_sSrcCustId` | `varchar(255)` |

## Body

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

## Narrative

**Business context:** Customer-specific print-report dispatch — maps a customer `sId` (or a "source-customer" `sId`, for re-billed orders) onto one of ~14 hard-coded `report.sId` GUIDs, falling back to a generic report. Functionally a per-tenant lookup table cooked into procedural form, naming customers like `嘉年实业(香港)`, `深圳烟草工业`, `国药集团致君`, `深圳市浩瀚卓越`, `金进精密科技`, `伟易达`, `美律电子`, etc.

**What it does:** sequence of `ELSEIF p_sCustId = '<guid>' THEN RETURN '<report-guid>'` clauses with a final `ELSE` for everyone else. Reads no tables.

**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. The hard-coded customer + report `sId`s are tenant-specific; would silently miss-route if copied to a different deployment.
