Sp_financialClosing_BtnEventExpense.md 2.21 KB

Sp_financialClosing_BtnEventExpense (procedure)

自动提取凭证费用

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sProInParam longtext
2 IN sMakePerson varchar(100)
3 IN sBrId varchar(100)
4 IN sSuId varchar(100)
5 OUT sReturn varchar(1000)
6 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpfinancialClosing_BtnEventExpense'._

Narrative

Business context: 系统设置 → 系统参数 → 财务结账 — COMMENT '自动提取凭证费用'. Month-end driver that pulls departmental expense data straight from the general-ledger voucher (udfvouchermaster/udfvoucherslave) and rebuilds the per-department expense-entry forms used for cost allocation. Targets the 部门费用录入 form (sFormId='101801153119616595200652250').

What it does: Parses sCostPeriod from sProInParam. Reads sysaccountperiod for window dates. Guards on accdepart.bConfirm=0 (sSystemProductionDepartConfirm) and accworkcenter.bConfirm=0 (sSystemProductionWorkCenterConfirm) — both must be confirmed before pulling. Deletes any prior auto-generated rows (sMakePerson='系统插入') under elecostframe.sFrameType='default' from accexpenseentrydepartmentmaster, its accexpenseentrydepartmentslave and accexpenseentryworkcenterslave. Then cursors through every distinct sExpenseeId (cost frame) found via udfaccountno joined to voucher slaves where tVoucherDate matches the period, mints a new bill number with SP_Sis_GetMaxNo, inserts the master with the summed debit money, populates per-department slave rows grouped by sDepartId (filtered to sDepartType IN (1,2)), assigns iOrder, calls Sp_System_CheckSaveFlowCps to fire approval-flow hooks, then Sp_Calc_sCps to audit/post the bill.

Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() from the 财务结帐 form's 自动提取凭证费用 / 部门费用提取 toolbar button. No xly-src install script found — body lives only in the live DB.