# `Sp_Check_sFybx` (procedure) > 费用报销保存之前数据校验 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `sTableName` | `varchar(100)` | | 2 | IN | `sGuid` | `varchar(100)` | | 3 | IN | `sFormGuid` | `varchar(100)` | | 4 | IN | `sLoginId` | `varchar(100)` | | 5 | IN | `sBrId` | `varchar(100)` | | 6 | IN | `sSuId` | `varchar(100)` | | 7 | IN | `iFlag` | `int` | | 8 | OUT | `sCode` | `int` | | 9 | OUT | `sReturn` | `varchar(4000)` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Check_sFybx`'`._ ## Narrative **Business context:** 财务管理 → 费用报销单 (sFybx = 费用报销, on `expensereimbursementmaster`/`expensereimbursementslave`) — post-save validator that guards the linkage between a 费用报销 and its source 预支费用单, totals the slave money back onto the master, recomputes the remaining 预支单 balance, and back-fills bank-account fields. **What it does:** Reads `sAdvanceOrderCodeId` from `expensereimbursementmaster` for `sId=sGuid`. Rejects when the referenced `advanceCostCheckMaster.bCheck=0` (`sAdvanceExpenseNotReview` — "预支费用单未审核请审核后再报销"). Verifies that every 费用细项 (`sExpenseDetailId`) used on the 报销单 also exists on the 预支单's slave (`sExpenseDetailNotExist`). Aborts when the 报销单's per-细项 `dAccountMoney` total exceeds the 预支单's per-细项 `dMaterialsMoney` (`sReimbursementUpAdvance`). On success, sums slave `dMaterialsMoney` back onto the master, updates `dAdvanceBalanceMoney` (= 预支总额 - 已用 - 当前报销), and writes `sAccountNo/sAccountId` onto the slave by joining `descriptionoffeesslave` on `(sExpenseDetailId, sDepartId)`. **Invocation:** Status: appears orphaned. No `gdsmodule.sSaveProName/sSaveProNameBefore` binding, no other routine references the name, no `xly-src` hit. The peer `Sp_Calc_sFybx` exists but is also not module-bound; both look like a half-wired feature for the 费用报销 form — candidate for maintainer audit.