# `Sp_Calc_sFtf` (procedure) > 财务转账 - **Type:** PROCEDURE - **Deterministic:** NO - **SQL data access:** CONTAINS SQL ## Parameters | # | Mode | Name | Type | |---|---|---|---| | 1 | IN | `iFlag` | `int` | | 2 | IN | `iTmpCheck` | `int` | | 3 | IN | `sFormGuid` | `varchar(100)` | | 4 | IN | `sGuid` | `varchar(100)` | | 5 | IN | `sLoginId` | `varchar(100)` | | 6 | OUT | `sReturn` | `varchar(100)` | | 7 | IN | `sBrId` | `varchar(100)` | | 8 | IN | `sSuId` | `varchar(100)` | | 9 | OUT | `sCode` | `int` | ## Body _Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Calc_sFtf`'`._ ## Narrative **Business context:** 财务管理 → 财务单据 → 财务转账单据 — financial-transfer check / uncheck on `CahFinancialTransfer` (COMMENT `'财务转账'`). Approves a 财务转账 (cash movement between bank accounts / cash boxes) so the offsetting ledger entries become permanent — and once approved, locks the affected accounts and writes the matched stock-invoice / wastebook (出纳流水) lines. **What it does:** Validates `sGuid`, refuses when `bInvalid=1`, checks `sysaccountperiod.bFrozen` per `SysSystemSettings.CkxIntervalMonthModifyBill` and `SysLocking` against the involved accounts. With `iFlag=1`: `Update CahFinancialTransfer` to set the audit flags, then `INSERT INTO CahStockInvoice` and `INSERT INTO CahWasteBook` to post the offsetting in/out lines for both ends of the transfer; `Update CahStockInvoice` re-totals the running balance. Uncheck deletes/zero-flags the posted rows. **Invocation:** Bound to `gdsmodule.sProcName` on `财务转账单据` (sId `192116810113315231655092270`), parent `财务单据` → 财务管理. Dispatched by Java `BusinessBaseServiceImpl.getPrcName(...)` on the audit/un-audit button. xly-src ships `script/标版/30100101/Sp_Calc_sFtf.sql` (install) and `script/标版/optimize/Sp_Calc_sFtf.sql` (patch).