# `Sp_Apply_Flow_Fybx` (procedure)

> 流程启动前调用-费用报销单


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | `sFormGuid` | `varchar(100)` |
| 2 | IN | `sGuid` | `varchar(100)` |
| 3 | IN | `sSrcNo` | `varchar(100)` |
| 4 | IN | `sLoginId` | `varchar(100)` |
| 5 | OUT | `sTableParams` | `longtext` |
| 6 | OUT | `sSrcReportData` | `longtext` |
| 7 | OUT | `sTableParamsValue` | `longtext` |
| 8 | OUT | `sReturn` | `varchar(4000)` |
| 9 | IN | `sBrId` | `varchar(100)` |
| 10 | IN | `sSuId` | `varchar(100)` |
| 11 | OUT | `sCode` | `int` |

## Body

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

## Narrative

**Business context:** 费用报销 / 付款申请 (catalog header: "流程启动前调用-费用报销单") — near-clone of [`Sp_Apply_Flow_Fksq`](./Sp_Apply_Flow_Fksq.md); the only structural difference is that the 烟包 flag (`iCigPack`) is read from `expensereimbursementmaster` rather than `advanceCostCheckMaster`. The duplicated proc presumably exists because 费用报销 (Fybx) and 付款申请 (Fksq) point at different source tables for the 烟包 flag.

**What it does:** Resolves seven approver tiers from `eleemployee` joined through `sisdepart`: 部门负责人 / 部门领导 (via `expensereimbursementmaster.sDepartId` + `sMasterDepartId`), 费用会计 (`sisposition.sName='税务费用核算专员'`), 财务负责人 / 国内事业副总 / 总经理 / 副董执行董事 (`iPosition` 11 / 34 / 1 / 38). Applies the same 李国哲 override when `iCigPack=2`. Branches `sTableParams` (column-label JSON) on `sFormGuid` ∈ {`1691254111217018313281950`, `1691254111217018313528400`} or falls through to the default 费用报销 label set. Builds `sTableParamsValue` (JSON of master values from `expensereimbursementmaster` + `sExpenseDetail`/`sMemo` from `expensereimbursementslave` + the seven approver name lists `OneFlow` / `TowFlow` / `ThreeFlow` / `FourFlow` / `SixFlow` / `SevenFlow` / `EightFlow` + `iCigPack`).

**Invocation:** Dispatched dynamically by Java `CheckExamineFlowDataServiceImpl.doSendCheckFolwData()` via `doProByNameFlow(..., sApplyProName, ...)` where `sApplyProName` is read from `gdsmoduleflow.sApplyProName` on the 费用报销 workflow config row. `gdsmoduleflow` is empty in this database — workflow configs are tenant-provisioned per deployment.

Flags: near-duplicate of `Sp_Apply_Flow_Fksq` (same approver-resolution block, same form-branch labels, same JSON shape); one variant probably superseded the other but both remain installed. Form GUIDs are tenant-specific (not present in this DB).
